diff options
author | Bert Belder <bertbelder@gmail.com> | 2018-06-12 22:05:49 +0200 |
---|---|---|
committer | Bert Belder <bertbelder@gmail.com> | 2018-06-13 00:31:38 +0200 |
commit | 1676822888ef6c75bb2afff3b7a93d030d63f2ea (patch) | |
tree | 5a785a6af7713f0fc44d5c9a02062dfc046f09fa /deno2/js | |
parent | 36f657c0d2961a8a798b0f209ff40aabd169b766 (diff) |
deno2: build on Windows
Diffstat (limited to 'deno2/js')
-rw-r--r-- | deno2/js/package.json | 3 | ||||
-rwxr-xr-x | deno2/js/pbjs_hack.py | 9 | ||||
-rwxr-xr-x | deno2/js/run_node.py | 15 | ||||
-rw-r--r-- | deno2/js/yarn.lock | 25 |
4 files changed, 47 insertions, 5 deletions
diff --git a/deno2/js/package.json b/deno2/js/package.json index 03987fe08..f11e25f13 100644 --- a/deno2/js/package.json +++ b/deno2/js/package.json @@ -1,7 +1,10 @@ { "devDependencies": { + "@types/base64-js": "^1.2.5", + "@types/source-map-support": "^0.4.1", "browserify": "^16.2.2", "protobufjs": "^6.8.6", + "source-map-support": "^0.5.6", "typescript": "^2.9.1" } } diff --git a/deno2/js/pbjs_hack.py b/deno2/js/pbjs_hack.py index a4cc7dfb3..354f3a5a1 100755 --- a/deno2/js/pbjs_hack.py +++ b/deno2/js/pbjs_hack.py @@ -11,9 +11,9 @@ import os js_path = os.path.dirname(os.path.realpath(__file__)) #bin_path = os.path.join(js_path, "deno_protobufjs", "bin") -bin_path = os.path.join(js_path, "node_modules", ".bin") -pbjs_bin = os.path.join(bin_path, "pbjs") -pbts_bin = os.path.join(bin_path, "pbts") +pbjs_path = os.path.join(js_path, "node_modules", "protobufjs", "bin") +pbjs_bin = os.path.join(pbjs_path, "pbjs") +pbts_bin = os.path.join(pbjs_path, "pbts") msg_pbjs_out = os.path.join(js_path, "msg.pb.js") msg_pbts_out = os.path.join(js_path, "msg.pb.d.ts") assert os.path.exists(pbjs_bin) @@ -29,10 +29,11 @@ def touch(fname): open(fname, 'a').close() subprocess.check_call([ + "node", pbjs_bin, #"--dependency=./deno_protobufjs/minimal", "--target=static-module", - "--wraper=commonjs", + "--wrapper=commonjs", "--out=" + msg_pbjs_out, proto_in ]) diff --git a/deno2/js/run_node.py b/deno2/js/run_node.py index 1a1dc5cc7..8f650a534 100755 --- a/deno2/js/run_node.py +++ b/deno2/js/run_node.py @@ -6,13 +6,26 @@ import subprocess import sys import os +def symlink(target, name, target_is_dir=False): + if os.name == "nt": + from ctypes import windll, WinError + CreateSymbolicLinkW = windll.kernel32.CreateSymbolicLinkW + flags = 0x02 # SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE + if (target_is_dir): + flags |= 0x01 # SYMBOLIC_LINK_FLAG_DIRECTORY + if not CreateSymbolicLinkW(name.encode('utf-16le'), + target.encode('utf-16le'), + flags): + raise WinError() + else: + os.symlink(target, name) js_path = os.path.dirname(os.path.realpath(__file__)) node_modules_path = os.path.join(js_path, "node_modules") # root_out_dir if not os.path.exists("node_modules"): - os.symlink(node_modules_path, "node_modules") + symlink(node_modules_path, "node_modules", True) args = ["node"] + sys.argv[1:] sys.exit(subprocess.call(args)) diff --git a/deno2/js/yarn.lock b/deno2/js/yarn.lock index aa93de3f0..10e28c946 100644 --- a/deno2/js/yarn.lock +++ b/deno2/js/yarn.lock @@ -45,14 +45,28 @@ version "1.1.0" resolved "https://registry.yarnpkg.com/@protobufjs/utf8/-/utf8-1.1.0.tgz#a777360b5b39a1a2e5106f8e858f2fd2d060c570" +"@types/base64-js@^1.2.5": + version "1.2.5" + resolved "https://registry.yarnpkg.com/@types/base64-js/-/base64-js-1.2.5.tgz#582b2476169a6cba460a214d476c744441d873d5" + "@types/long@^3.0.32": version "3.0.32" resolved "https://registry.yarnpkg.com/@types/long/-/long-3.0.32.tgz#f4e5af31e9e9b196d8e5fca8a5e2e20aa3d60b69" +"@types/node@*": + version "10.3.2" + resolved "https://registry.yarnpkg.com/@types/node/-/node-10.3.2.tgz#3840ec6c12556fdda6e0e6d036df853101d732a4" + "@types/node@^8.9.4": version "8.10.19" resolved "https://registry.yarnpkg.com/@types/node/-/node-8.10.19.tgz#66b5b6325c048cbf4512b7a88b0e79c2ee99d3d2" +"@types/source-map-support@^0.4.1": + version "0.4.1" + resolved "https://registry.yarnpkg.com/@types/source-map-support/-/source-map-support-0.4.1.tgz#ad77158e8c6695a16629ef82b9fb9dfe7c610ac0" + dependencies: + "@types/node" "*" + JSONStream@^1.0.3: version "1.3.3" resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.3.3.tgz#27b4b8fbbfeab4e71bcf551e7f27be8d952239bf" @@ -826,6 +840,17 @@ shell-quote@^1.6.1: array-reduce "~0.0.0" jsonify "~0.0.0" +source-map-support@^0.5.6: + version "0.5.6" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.6.tgz#4435cee46b1aab62b8e8610ce60f788091c51c13" + dependencies: + buffer-from "^1.0.0" + source-map "^0.6.0" + +source-map@^0.6.0: + version "0.6.1" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" + source-map@~0.5.3: version "0.5.7" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" |