From 727a7e02e93cb5733e931a74b2dd59ee8a3e06d7 Mon Sep 17 00:00:00 2001 From: Jairo Panduro Date: Wed, 10 Apr 2024 12:09:30 +0200 Subject: [PATCH] fix: STRF-11741 Provide stencil init options to set up package manager and skip packages install --- bin/stencil-init.js | 6 +++++- lib/stencil-init.js | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/bin/stencil-init.js b/bin/stencil-init.js index 18b03529..63e4a265 100755 --- a/bin/stencil-init.js +++ b/bin/stencil-init.js @@ -11,7 +11,9 @@ program .option('-u, --url [url]', 'Store URL') .option('-t, --token [token]', 'Access Token') .option('-p, --port [port]', 'Port') - .option('-h, --apiHost [host]', 'API Host'); + .option('-h, --apiHost [host]', 'API Host') + .option('-pm, --packageManager [pm]', 'Package manager') + .option('-skip, --skipInstall', 'Skip packages installation'); const cliOptions = prepareCommand(program); @@ -21,5 +23,7 @@ new StencilInit() accessToken: cliOptions.token, port: cliOptions.port, apiHost: cliOptions.apiHost, + packageManager: cliOptions.packageManager, + skipInstall: cliOptions.skipInstall, }) .catch(printCliResultErrorAndExit); diff --git a/lib/stencil-init.js b/lib/stencil-init.js index 7aa5a2f4..c7a0629f 100644 --- a/lib/stencil-init.js +++ b/lib/stencil-init.js @@ -47,7 +47,7 @@ class StencilInit { const answers = await this.askQuestions(questions); const updatedStencilConfig = this.applyAnswers(oldStencilConfig, answers, cliOptions); await this._stencilConfigManager.save(updatedStencilConfig); - await this.installDependencies(THEME_PATH, answers.packageManager); + await this.installDependencies(THEME_PATH, answers.packageManager, cliOptions); this._logger.log( 'You are now ready to go! To start developing, run $ ' + 'stencil start'.cyan, @@ -195,9 +195,13 @@ class StencilInit { * * @param {string} projectDir * @param {object} packageManager + * @param {object} cliOptions * @returns */ - installDependencies(projectDir, packageManager) { + installDependencies(projectDir, packageManager, cliOptions) { + if (cliOptions.skipInstall) { + return Promise.resolve(); + } return this._spinner( this._nypm.installDependencies({ cwd: projectDir,