From 110ddab670cbf477488cceeea2842c980942d7b8 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Sun, 10 Jun 2018 00:32:04 +0200 Subject: Add deno2 prototype from external repo. --- deno2/js/run_node.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 deno2/js/run_node.py (limited to 'deno2/js/run_node.py') diff --git a/deno2/js/run_node.py b/deno2/js/run_node.py new file mode 100755 index 000000000..1cf74e692 --- /dev/null +++ b/deno2/js/run_node.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python +""" +gn can only run python scripts. +Also Node programs except to be run with cwd = $root_dir/js so it can resolve +node_modules. +""" +import subprocess +import sys +import os + +js_path = os.path.dirname(os.path.realpath(__file__)) +os.chdir(js_path) +args = ["node"] + sys.argv[1:] +sys.exit(subprocess.call(args)) -- cgit v1.2.3 From b3003535bebf852c3233cab272424feac164a3d0 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Tue, 12 Jun 2018 03:54:55 +0200 Subject: deno2: compile in TS, build protobuf --- deno2/js/run_node.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'deno2/js/run_node.py') diff --git a/deno2/js/run_node.py b/deno2/js/run_node.py index 1cf74e692..1a1dc5cc7 100755 --- a/deno2/js/run_node.py +++ b/deno2/js/run_node.py @@ -1,14 +1,18 @@ #!/usr/bin/env python """ gn can only run python scripts. -Also Node programs except to be run with cwd = $root_dir/js so it can resolve -node_modules. """ import subprocess import sys import os + js_path = os.path.dirname(os.path.realpath(__file__)) -os.chdir(js_path) +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") + args = ["node"] + sys.argv[1:] sys.exit(subprocess.call(args)) -- cgit v1.2.3 From 1676822888ef6c75bb2afff3b7a93d030d63f2ea Mon Sep 17 00:00:00 2001 From: Bert Belder Date: Tue, 12 Jun 2018 22:05:49 +0200 Subject: deno2: build on Windows --- deno2/js/run_node.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'deno2/js/run_node.py') 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)) -- cgit v1.2.3 From bb6222c91872695cbe98aa2a75166265f52cec2e Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Wed, 13 Jun 2018 14:58:06 +0200 Subject: Clean up the build (replace browserify with parcel) --- deno2/js/run_node.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'deno2/js/run_node.py') diff --git a/deno2/js/run_node.py b/deno2/js/run_node.py index 8f650a534..1a69dc502 100755 --- a/deno2/js/run_node.py +++ b/deno2/js/run_node.py @@ -1,6 +1,8 @@ #!/usr/bin/env python """ -gn can only run python scripts. +gn can only run python scripts. This launches a subprocess Node process. +The working dir of this program is out/Debug/ (AKA root_build_dir) +Before running node, we symlink js/node_modules to out/Debug/node_modules. """ import subprocess import sys @@ -23,7 +25,6 @@ def symlink(target, name, target_is_dir=False): 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"): symlink(node_modules_path, "node_modules", True) -- cgit v1.2.3