summaryrefslogtreecommitdiff
path: root/js/build.rs
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2019-09-15 18:36:27 -0400
committerGitHub <noreply@github.com>2019-09-15 18:36:27 -0400
commitc9ef182886cc07d35a5b27fb89163d8cf21a6a47 (patch)
tree6ba1605daa7e9e8cac3f6b926374086906f571b5 /js/build.rs
parent1d305c2ac785af6b28649f2023d5008e390eeca0 (diff)
Make deno_cli installable via crates.io (#2946)
- Fixes cargo publish on deno_typescript, deno_cli_snapshots, and deno_cli. - Combines cli_snapshots and js into one directory. - Extracts TS version at compile time rather than runtime - Bumps version awkwardly - it was necessary to test end-to-end publishing. Sorry. - Adds git submodule deno_typescript/typescript
Diffstat (limited to 'js/build.rs')
-rw-r--r--js/build.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/js/build.rs b/js/build.rs
new file mode 100644
index 000000000..1063fd8eb
--- /dev/null
+++ b/js/build.rs
@@ -0,0 +1,28 @@
+// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
+use std::env;
+use std::path::PathBuf;
+
+fn main() {
+ // To debug snapshot issues uncomment:
+ // deno_typescript::trace_serializer();
+
+ println!(
+ "cargo:rustc-env=TS_VERSION={}",
+ deno_typescript::ts_version()
+ );
+
+ let c = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap());
+ let o = PathBuf::from(env::var_os("OUT_DIR").unwrap());
+
+ let root_names = vec![c.join("main.ts")];
+ let bundle = o.join("CLI_SNAPSHOT.js");
+ let state = deno_typescript::compile_bundle(&bundle, root_names).unwrap();
+ assert!(bundle.exists());
+ deno_typescript::mksnapshot_bundle(&bundle, state).unwrap();
+
+ let root_names = vec![c.join("compiler.ts")];
+ let bundle = o.join("COMPILER_SNAPSHOT.js");
+ let state = deno_typescript::compile_bundle(&bundle, root_names).unwrap();
+ assert!(bundle.exists());
+ deno_typescript::mksnapshot_bundle_ts(&bundle, state).unwrap();
+}