summaryrefslogtreecommitdiff
path: root/tools/run_node.py
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2018-07-08 02:24:29 -0400
committerRyan Dahl <ry@tinyclouds.org>2018-07-08 13:40:18 -0400
commitf917c5e722d7ee5abd58704eb0e5d49072249e94 (patch)
tree48eb2e95d18c9d1fbdfcd0864ca09a6e64d79f5a /tools/run_node.py
parent6c79b471aa5cf2c87d237015f5dacc5a7ed03b67 (diff)
Clean up tools/
- Factor out tools/util.py - Move js/*.py to tools. - Rewrite tools/format.sh in python. - Run lint first in travis.
Diffstat (limited to 'tools/run_node.py')
-rwxr-xr-xtools/run_node.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/run_node.py b/tools/run_node.py
new file mode 100755
index 000000000..afa861020
--- /dev/null
+++ b/tools/run_node.py
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+"""
+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
+import os
+import util
+
+root_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
+tools_path = os.path.join(root_path, "tools")
+third_party_path = os.path.join(root_path, "third_party")
+target_abs = os.path.join(third_party_path, "node_modules")
+target_rel = os.path.relpath(target_abs)
+
+util.remove_and_symlink(target_rel, "node_modules", True)
+util.run(["node"] + sys.argv[1:])