Skip to content

Commit 6dec35d

Browse files
committed
Fixed generating output
Following @kikonen sollution: typescript-ruby#10
1 parent 1b20cd5 commit 6dec35d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/typescript-node.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ def tsc(*args)
2323
# @return [TypeScript::Node::CompileResult] compile result
2424
def compile_file(source_file, *tsc_options)
2525
Dir.mktmpdir do |output_dir|
26-
output_file = File.join(output_dir, 'out.js')
27-
stdout, stderr, exit_status = tsc(*tsc_options, '--out', output_file, source_file)
26+
#output_file = File.join(output_dir, 'out.js')
27+
#stdout, stderr, exit_status = tsc(*tsc_options, '--out', output_file, source_file)
28+
output_file = source_file.sub(/\.ts\z/, '.js')
29+
stdout, stderr, exit_status = tsc(*tsc_options, source_file)
2830

2931
output_js = File.exist?(output_file) ? File.read(output_file) : nil
3032
CompileResult.new(

0 commit comments

Comments
 (0)