-
-
Notifications
You must be signed in to change notification settings - Fork 197
/
Copy pathtns
executable file
·36 lines (26 loc) · 1.02 KB
/
tns
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env node
"use strict";
var path = require("path"),
node = require("../package.json").engines.node,
pathToLib = path.join(__dirname, "..", "lib"),
pathToCommon = path.join(pathToLib, "common");
require(path.join(pathToCommon, "verify-node-version")).verifyNodeVersion();
var pathToCliExecutable = path.join(pathToLib, "nativescript-cli.js");
var nodeArgs = require(path.join(pathToCommon, "scripts", "node-args")).getNodeArgs();
if (nodeArgs.length) {
// We need custom args for Node process, so pass them here.
var childProcess = require("child_process");
var args = process.argv;
// Remove `node` and `nativescript` from the arguments.
args.shift();
args.shift();
args.unshift(pathToCliExecutable);
args = nodeArgs.concat(args);
var nodeProcess = childProcess.spawn(process.execPath, args, { stdio: "inherit" });
nodeProcess.on("close", function (code) {
// We need this handler so if command fails, we'll exit with same exit code as CLI.
process.exit(code);
});
} else {
require(pathToCliExecutable);
}