Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion bin/tns
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@

"use strict";
var path = require("path"),
pathToLib = path.join(__dirname, "..", "lib"),
fs = require("fs"),
// In the published package dist/ is the root, so lib/ already sits next to
// bin/. In a source checkout lib/ holds only TypeScript and the compiled
// output lives under dist/.
distLib = path.join(__dirname, "..", "dist", "lib"),
pathToLib = fs.existsSync(distLib)
? distLib
: path.join(__dirname, "..", "lib"),
pathToCommon = path.join(pathToLib, "common");

require(path.join(pathToCommon, "verify-node-version")).verifyNodeVersion();
Expand Down
9 changes: 7 additions & 2 deletions postinstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@

var child_process = require("child_process");
var path = require("path");
var constants = require(path.join(__dirname, "lib", "constants"));
var fs = require("fs");
// In the published package dist/ is the root; in a source checkout the compiled
// output lives under dist/ while lib/ holds only TypeScript.
var distLib = path.join(__dirname, "dist", "lib");
var pathToLib = fs.existsSync(distLib) ? distLib : path.join(__dirname, "lib");
var constants = require(path.join(pathToLib, "constants"));
var commandArgs = [path.join(__dirname, "bin", "tns"), constants.POST_INSTALL_COMMAND_NAME];
var helpers = require(path.join(__dirname, "lib", "common", "helpers"));
var helpers = require(path.join(pathToLib, "common", "helpers"));
if (helpers.isInstallingNativeScriptGlobally()) {
child_process.spawn(process.argv[0], commandArgs, { stdio: "inherit" });
}