Last active
January 8, 2020 04:15
-
-
Save ngmaloney/60adcccce772e71d3b73cc4e80eaa240 to your computer and use it in GitHub Desktop.
typescript.cr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "duktape" | |
class Typescript | |
TYPESCRIPT_PATH = "deps/libs/ts/typescriptServices.js" | |
def initialize(ts_file : String) | |
@ts_file = ts_file | |
@ctx = Duktape::Sandbox.new | |
@ctx.eval!("ts = require('typescript')") | |
end | |
def transpile! | |
@ctx.eval!("ts.transpile(@ts_file)") | |
end | |
def self.transpile!(ts_file : String) | |
self.new(ts_file).transpile! | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment