Class: Script::Layers::Infrastructure::AssemblyScriptTsConfig
- Inherits:
-
Object
- Object
- Script::Layers::Infrastructure::AssemblyScriptTsConfig
- Defined in:
- lib/project_types/script/layers/infrastructure/assemblyscript_tsconfig.rb
Constant Summary collapse
- TSCONFIG_FILE =
"tsconfig.json"
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
-
#initialize(dir_to_write_in:) ⇒ AssemblyScriptTsConfig
constructor
A new instance of AssemblyScriptTsConfig.
- #with_extends_assemblyscript_config(relative_path_to_node_modules:) ⇒ Object
- #with_module_resolution_paths(paths:) ⇒ Object
- #write ⇒ Object
Constructor Details
#initialize(dir_to_write_in:) ⇒ AssemblyScriptTsConfig
Returns a new instance of AssemblyScriptTsConfig.
13 14 15 16 |
# File 'lib/project_types/script/layers/infrastructure/assemblyscript_tsconfig.rb', line 13 def initialize(dir_to_write_in:) @dir_to_write_in = dir_to_write_in @config = {} end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
11 12 13 |
# File 'lib/project_types/script/layers/infrastructure/assemblyscript_tsconfig.rb', line 11 def config @config end |
Instance Method Details
#with_extends_assemblyscript_config(relative_path_to_node_modules:) ⇒ Object
18 19 20 21 22 |
# File 'lib/project_types/script/layers/infrastructure/assemblyscript_tsconfig.rb', line 18 def with_extends_assemblyscript_config(relative_path_to_node_modules:) relative_path = Pathname.new(relative_path_to_node_modules).relative_path_from(@dir_to_write_in) @config[:extends] = "#{relative_path}/node_modules/assemblyscript/std/assembly.json" self end |
#with_module_resolution_paths(paths:) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/project_types/script/layers/infrastructure/assemblyscript_tsconfig.rb', line 24 def with_module_resolution_paths(paths:) @config[:compilerOptions] = { baseUrl: ".", paths: paths, } self end |
#write ⇒ Object
32 33 34 |
# File 'lib/project_types/script/layers/infrastructure/assemblyscript_tsconfig.rb', line 32 def write File.write("#{@dir_to_write_in}/#{TSCONFIG_FILE}", JSON.pretty_generate(@config)) end |