Module: Jekyll::Typescript::TSConfig
- Included in:
- Manager
- Defined in:
- lib/jekyll/typescript/tsconfig.rb
Overview
Module providing methods to aid in the parsing of tsconfig.json files.
Instance Method Summary collapse
-
#parse_tsconfig(json) ⇒ Object
Parse a tsconfig.json JSON object into an array of equivalent commands line flags.
Instance Method Details
#parse_tsconfig(json) ⇒ Object
Parse a tsconfig.json JSON object into an array of equivalent commands line flags.
For some dumb reason, tsc just outright ignores your tsconfig.json file when you’re compiling a single file, instead of a project. See issue 6591 on Microsoft/Typescript.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/jekyll/typescript/tsconfig.rb', line 15 def parse_tsconfig(json) args = [] json['compilerOptions'].each_pair do |option, value| flag = "--#{option}" case value when TrueClass, FalseClass args << flag if value when String args << flag args << value when Array args << flag args << value.join(',') else Jekyll.logger.warn('Typescript', "unknown option type for #{option} of type #{value.class}") end end args end |