Skip to content

Commit 1042328

Browse files
fix: skip propmting on post install when the console is not interactive
1 parent 89ab7b0 commit 1042328

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Diff for: postinstall.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,12 @@ const updatePackageJsonDependencies = (packageJson, projectType, testingFramewor
166166
// );
167167
// };
168168

169+
const isInteractive = process.stdout && process.stdout.isTTY && process.stdin && process.stdin.isTTY && (!process.env || (!process.env.CI && !process.env.JENKINS_HOME));
170+
169171
const frameworkQuestion = () => {
172+
if (!isInteractive) {
173+
console.info("This console is not interactive! Please export env PROJECT_TYPE!")
174+
}
170175
const questions = [
171176
{
172177
type: "list",
@@ -179,6 +184,9 @@ const frameworkQuestion = () => {
179184
};
180185

181186
const testingFrameworkQuestion = () => {
187+
if (!isInteractive) {
188+
console.info("This console is not interactive! Please export env TESTING_FRAMEWORK!")
189+
}
182190
const questions = [
183191
{
184192
type: "list",
@@ -210,7 +218,7 @@ const getTemplates = (name) => {
210218

211219
const run = async () => {
212220
// printLogo();
213-
const envProjectType = process.env.npm_config_projectType || process.env["PROJECT_TYPE"];
221+
const envProjectType = process.env.npm_config_projectType || process.env["projectType"];
214222
const envTestingFramework = process.env.npm_config_testingFramework || process.env["TESTING_FRAMEWORK"];
215223
const hasSetProjectTypeAndTestingFrameworkAsEnvSet = envProjectType && envTestingFramework;
216224
const isDevAppiumAlreadyInstalled = packageJson.devDependencies && packageJson.devDependencies["nativescript-dev-appium"];

0 commit comments

Comments
 (0)