Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Commit 77d2ea8

Browse files
Merge pull request #293 from rosen-vladimirov/vladimirov/fix-postinstall
Fix postinstall when nativescript is not in the PATH
2 parents 6d12ac5 + 83f41eb commit 77d2ea8

File tree

1 file changed

+34
-27
lines changed

1 file changed

+34
-27
lines changed

scripts/postinstall.js

Lines changed: 34 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2741,28 +2741,28 @@ function read (opts, cb) {
27412741
\***********************************/
27422742
/***/ (function(module, exports) {
27432743

2744-
module.exports = function(module) {
2745-
if(!module.webpackPolyfill) {
2746-
module.deprecate = function() {};
2747-
module.paths = [];
2748-
// module.parent = undefined by default
2749-
if(!module.children) module.children = [];
2750-
Object.defineProperty(module, "loaded", {
2751-
enumerable: true,
2752-
get: function() {
2753-
return module.l;
2754-
}
2755-
});
2756-
Object.defineProperty(module, "id", {
2757-
enumerable: true,
2758-
get: function() {
2759-
return module.i;
2760-
}
2761-
});
2762-
module.webpackPolyfill = 1;
2763-
}
2764-
return module;
2765-
};
2744+
module.exports = function(module) {
2745+
if(!module.webpackPolyfill) {
2746+
module.deprecate = function() {};
2747+
module.paths = [];
2748+
// module.parent = undefined by default
2749+
if(!module.children) module.children = [];
2750+
Object.defineProperty(module, "loaded", {
2751+
enumerable: true,
2752+
get: function() {
2753+
return module.l;
2754+
}
2755+
});
2756+
Object.defineProperty(module, "id", {
2757+
enumerable: true,
2758+
get: function() {
2759+
return module.i;
2760+
}
2761+
});
2762+
module.webpackPolyfill = 1;
2763+
}
2764+
return module;
2765+
};
27662766

27672767

27682768
/***/ }),
@@ -2845,17 +2845,24 @@ function readConfig() {
28452845
}
28462846

28472847
// workaround for https://github.com/NativeScript/nativescript-cli/issues/2521 (2.5.0 only)
2848-
var nativeScriptVersion = __webpack_require__(/*! child_process */ 2).execSync('nativescript --version');
2849-
var promptSupported = nativeScriptVersion.indexOf("2.5.0") === -1;
2848+
var nativeScriptVersion = "";
2849+
try {
2850+
nativeScriptVersion = __webpack_require__(/*! child_process */ 2).execSync('nativescript --version');
2851+
} catch (err) {
2852+
// On some environments nativescript is not in the PATH
2853+
// Ignore the error
2854+
}
2855+
2856+
var isNativeScriptCLI250 = nativeScriptVersion.indexOf("2.5.0") !== -1;
28502857

28512858
// note that for CI builds you want a pluginConfigFile, otherwise the build will fail
2852-
if (process.argv.indexOf("config") == -1 && fs.existsSync(pluginConfigPath)) {
2859+
if (process.argv.indexOf("config") === -1 && fs.existsSync(pluginConfigPath)) {
28532860
readConfig();
28542861
console.log("Config file exists (" + pluginConfigFile + ")");
28552862
askiOSPromptResult(config);
28562863
askAndroidPromptResult(config);
28572864
promptQuestionsResult(config);
2858-
} else if (!promptSupported && process.argv.indexOf("setup") == -1) {
2865+
} else if (isNativeScriptCLI250 && process.argv.indexOf("setup") === -1) {
28592866
console.log("*******************************************************************");
28602867
console.log("*******************************************************************");
28612868
console.log("************************** IMPORTANT: *****************************");
@@ -3155,7 +3162,7 @@ var fs = require("fs");
31553162
module.exports = function() {
31563163
31573164
console.log("Configure firebase");
3158-
var buildGradlePath = path.join(__dirname, "..", "..", "platforms", "android", "build.gradle");
3165+
var buildGradlePath = path.join(__dirname, "..", "..", "platforms", "android", "build.gradle");
31593166
if (fs.existsSync(buildGradlePath)) {
31603167
var buildGradleContent = fs.readFileSync(buildGradlePath).toString();
31613168

0 commit comments

Comments
 (0)