From 341f25d638e68f27ae87543d01d151e9cc5352a1 Mon Sep 17 00:00:00 2001 From: Arjun Gupta Date: Mon, 25 Jul 2022 16:13:19 +0530 Subject: [PATCH 1/3] fix: ACNA-1687 | fixed option skipInstall for appGen, extGen, addActionGen --- src/commands/app/add/action.js | 5 +- src/commands/app/init.js | 10 ++-- test/commands/app/add/action.test.js | 21 +++---- test/commands/app/init.test.js | 86 ++++++++++++++-------------- 4 files changed, 59 insertions(+), 63 deletions(-) diff --git a/src/commands/app/add/action.js b/src/commands/app/add/action.js index 2777150d..dd779b75 100644 --- a/src/commands/app/add/action.js +++ b/src/commands/app/add/action.js @@ -46,6 +46,7 @@ class AddActionCommand extends AddCommand { const supportedOrgServices = aioConfigLoader.get('project.org.details.services') || [] const env = yeoman.createEnv() + env.options = { skipInstall: true } const addActionGen = env.instantiate(generators['add-action'], { options: { 'skip-prompt': flags.yes, @@ -53,10 +54,10 @@ class AddActionCommand extends AddCommand { 'config-path': configData.file, 'adobe-services': servicesToGeneratorInput(workspaceServices), 'supported-adobe-services': servicesToGeneratorInput(supportedOrgServices), - 'full-key-to-manifest': configData.key, + 'full-key-to-manifest': configData.key // force: true, // by default yeoman runs the install, we control installation from the app plugin - 'skip-install': true + // Moving ['skip-install': true] to env.options due to yeoman environment issue https://github.com/yeoman/environment/issues/421 } }) await env.runGenerator(addActionGen) diff --git a/src/commands/app/init.js b/src/commands/app/init.js index d90a8169..26f85ddd 100644 --- a/src/commands/app/init.js +++ b/src/commands/app/init.js @@ -271,15 +271,16 @@ class InitCommand extends AddCommand { async runCodeGenerators (flags, extensionPoints, projectName) { let env = yeoman.createEnv() + env.options = { skipInstall: true } const initialGenerators = ['base-app', 'add-ci'] // first run app generator that will generate the root skeleton + ci for (const generatorKey of initialGenerators) { const appGen = env.instantiate(generators[generatorKey], { options: { 'skip-prompt': flags.yes, - 'project-name': projectName, + 'project-name': projectName // by default yeoman runs the install, we control installation from the app plugin - 'skip-install': true + // Moving ['skip-install': true] to env.options due to yeoman environment issue https://github.com/yeoman/environment/issues/421 } }) await env.runGenerator(appGen) @@ -289,6 +290,7 @@ class InitCommand extends AddCommand { // https://github.com/yeoman/environment/issues/324 env = yeoman.createEnv() + env.options = { skipInstall: true } // try to use appGen.composeWith for (let i = 0; i < extensionPoints.length; ++i) { const extGen = env.instantiate( @@ -297,9 +299,9 @@ class InitCommand extends AddCommand { options: { 'skip-prompt': flags.yes, // do not prompt for overwrites - force: true, + force: true // by default yeoman runs the install, we control installation from the app plugin - 'skip-install': true + // Moving ['skip-install': true] to env.options due to yeoman environment issue https://github.com/yeoman/environment/issues/421 } }) await env.runGenerator(extGen) diff --git a/test/commands/app/add/action.test.js b/test/commands/app/add/action.test.js index d2b79632..374feed6 100644 --- a/test/commands/app/add/action.test.js +++ b/test/commands/app/add/action.test.js @@ -100,8 +100,7 @@ describe('good flags', () => { 'config-path': undefined, 'adobe-services': undefined, 'supported-adobe-services': undefined, - 'full-key-to-manifest': 'undefined.runtimeManifest', - 'skip-install': true + 'full-key-to-manifest': 'undefined.runtimeManifest' } }) expect(mockRunGenerator).toHaveBeenCalledWith('actionGen') @@ -120,8 +119,7 @@ describe('good flags', () => { 'config-path': undefined, 'adobe-services': undefined, 'supported-adobe-services': undefined, - 'full-key-to-manifest': 'undefined.runtimeManifest', - 'skip-install': true + 'full-key-to-manifest': 'undefined.runtimeManifest' } }) expect(helpers.installPackages).toHaveBeenCalledTimes(0) @@ -139,8 +137,7 @@ describe('good flags', () => { 'config-path': undefined, 'adobe-services': undefined, 'supported-adobe-services': undefined, - 'full-key-to-manifest': 'undefined.runtimeManifest', - 'skip-install': true + 'full-key-to-manifest': 'undefined.runtimeManifest' } }) }) @@ -157,8 +154,7 @@ describe('good flags', () => { 'config-path': undefined, 'adobe-services': undefined, 'supported-adobe-services': undefined, - 'full-key-to-manifest': 'undefined.runtimeManifest', - 'skip-install': true + 'full-key-to-manifest': 'undefined.runtimeManifest' } }) }) @@ -174,8 +170,7 @@ describe('good flags', () => { 'config-path': undefined, 'adobe-services': undefined, 'supported-adobe-services': undefined, - 'full-key-to-manifest': 'undefined.runtimeManifest', - 'skip-install': true + 'full-key-to-manifest': 'undefined.runtimeManifest' } }) }) @@ -203,8 +198,7 @@ describe('good flags', () => { 'config-path': undefined, 'adobe-services': 'CampaignSDK,AdobeAnalyticsSDK', 'supported-adobe-services': 'CampaignSDK,AdobeAnalyticsSDK,AnotherOneSDK', - 'full-key-to-manifest': 'undefined.runtimeManifest', - 'skip-install': true + 'full-key-to-manifest': 'undefined.runtimeManifest' } }) }) @@ -232,8 +226,7 @@ describe('good flags', () => { 'config-path': undefined, 'adobe-services': 'CampaignSDK,AdobeAnalyticsSDK', 'supported-adobe-services': 'CampaignSDK,AdobeAnalyticsSDK,AnotherOneSDK', - 'full-key-to-manifest': 'undefined.runtimeManifest', - 'skip-install': true + 'full-key-to-manifest': 'undefined.runtimeManifest' } }) }) diff --git a/test/commands/app/init.test.js b/test/commands/app/init.test.js index b9c127ec..8c5921a2 100644 --- a/test/commands/app/init.test.js +++ b/test/commands/app/init.test.js @@ -201,15 +201,15 @@ describe('run', () => { expect(mockGenInstantiate).toHaveBeenCalledTimes(3) expect(mockGenInstantiate).toHaveBeenCalledWith( 'fake-gen-base-app', - { options: { 'skip-prompt': false, 'project-name': 'cwd', 'skip-install': true } } + { options: { 'skip-prompt': false, 'project-name': 'cwd' } } ) expect(mockGenInstantiate).toHaveBeenCalledWith( 'fake-gen-add-ci', - { options: { 'skip-prompt': false, 'project-name': 'cwd', 'skip-install': true } } + { options: { 'skip-prompt': false, 'project-name': 'cwd' } } ) expect(mockGenInstantiate).toHaveBeenCalledWith( 'fake-gen-excshell', - { options: { 'skip-prompt': false, force: true, 'skip-install': true } } + { options: { 'skip-prompt': false, force: true } } ) expect(mockInstallPackages).toHaveBeenCalled() expect(LibConsoleCLI.init).not.toHaveBeenCalled() @@ -223,15 +223,15 @@ describe('run', () => { expect(mockGenInstantiate).toHaveBeenCalledTimes(3) expect(mockGenInstantiate).toHaveBeenCalledWith( 'fake-gen-base-app', - { options: { 'skip-prompt': false, 'project-name': 'otherdir', 'skip-install': true } } + { options: { 'skip-prompt': false, 'project-name': 'otherdir' } } ) expect(mockGenInstantiate).toHaveBeenCalledWith( 'fake-gen-add-ci', - { options: { 'skip-prompt': false, 'project-name': 'otherdir', 'skip-install': true } } + { options: { 'skip-prompt': false, 'project-name': 'otherdir' } } ) expect(mockGenInstantiate).toHaveBeenCalledWith( 'fake-gen-excshell', - { options: { 'skip-prompt': false, force: true, 'skip-install': true } } + { options: { 'skip-prompt': false, force: true } } ) expect(mockInstallPackages).toHaveBeenCalled() expect(LibConsoleCLI.init).not.toHaveBeenCalled() @@ -248,19 +248,19 @@ describe('run', () => { expect(mockGenInstantiate).toHaveBeenCalledTimes(4) expect(mockGenInstantiate).toHaveBeenCalledWith( 'fake-gen-base-app', - { options: { 'skip-prompt': false, 'project-name': 'cwd', 'skip-install': true } } + { options: { 'skip-prompt': false, 'project-name': 'cwd' } } ) expect(mockGenInstantiate).toHaveBeenCalledWith( 'fake-gen-add-ci', - { options: { 'skip-prompt': false, 'project-name': 'cwd', 'skip-install': true } } + { options: { 'skip-prompt': false, 'project-name': 'cwd' } } ) expect(mockGenInstantiate).toHaveBeenCalledWith( 'fake-gen-excshell', - { options: { 'skip-prompt': false, force: true, 'skip-install': true } } + { options: { 'skip-prompt': false, force: true } } ) expect(mockGenInstantiate).toHaveBeenCalledWith( 'fake-gen-nui', - { options: { 'skip-prompt': false, force: true, 'skip-install': true } } + { options: { 'skip-prompt': false, force: true } } ) expect(mockInstallPackages).toHaveBeenCalled() expect(LibConsoleCLI.init).not.toHaveBeenCalled() @@ -273,15 +273,15 @@ describe('run', () => { expect(mockGenInstantiate).toHaveBeenCalledTimes(3) expect(mockGenInstantiate).toHaveBeenCalledWith( 'fake-gen-base-app', - { options: { 'skip-prompt': false, 'project-name': 'cwd', 'skip-install': true } } + { options: { 'skip-prompt': false, 'project-name': 'cwd' } } ) expect(mockGenInstantiate).toHaveBeenCalledWith( 'fake-gen-add-ci', - { options: { 'skip-prompt': false, 'project-name': 'cwd', 'skip-install': true } } + { options: { 'skip-prompt': false, 'project-name': 'cwd' } } ) expect(mockGenInstantiate).toHaveBeenCalledWith( 'fake-gen-application', - { options: { 'skip-prompt': false, force: true, 'skip-install': true } } + { options: { 'skip-prompt': false, force: true } } ) expect(mockInstallPackages).toHaveBeenCalled() expect(LibConsoleCLI.init).not.toHaveBeenCalled() @@ -295,15 +295,15 @@ describe('run', () => { expect(mockGenInstantiate).toHaveBeenCalledTimes(3) expect(mockGenInstantiate).toHaveBeenCalledWith( 'fake-gen-base-app', - { options: { 'skip-prompt': true, 'project-name': 'cwd', 'skip-install': true } } + { options: { 'skip-prompt': true, 'project-name': 'cwd' } } ) expect(mockGenInstantiate).toHaveBeenCalledWith( 'fake-gen-add-ci', - { options: { 'skip-prompt': true, 'project-name': 'cwd', 'skip-install': true } } + { options: { 'skip-prompt': true, 'project-name': 'cwd' } } ) expect(mockGenInstantiate).toHaveBeenCalledWith( 'fake-gen-excshell', - { options: { 'skip-prompt': true, force: true, 'skip-install': true } } + { options: { 'skip-prompt': true, force: true } } ) expect(mockInstallPackages).not.toHaveBeenCalled() expect(LibConsoleCLI.init).not.toHaveBeenCalled() @@ -317,15 +317,15 @@ describe('run', () => { expect(mockGenInstantiate).toHaveBeenCalledTimes(3) expect(mockGenInstantiate).toHaveBeenCalledWith( 'fake-gen-base-app', - { options: { 'skip-prompt': true, 'project-name': 'cwd', 'skip-install': true } } + { options: { 'skip-prompt': true, 'project-name': 'cwd' } } ) expect(mockGenInstantiate).toHaveBeenCalledWith( 'fake-gen-add-ci', - { options: { 'skip-prompt': true, 'project-name': 'cwd', 'skip-install': true } } + { options: { 'skip-prompt': true, 'project-name': 'cwd' } } ) expect(mockGenInstantiate).toHaveBeenCalledWith( 'fake-gen-nui', - { options: { 'skip-prompt': true, force: true, 'skip-install': true } } + { options: { 'skip-prompt': true, force: true } } ) expect(mockInstallPackages).not.toHaveBeenCalled() expect(LibConsoleCLI.init).not.toHaveBeenCalled() @@ -371,15 +371,15 @@ describe('run', () => { expect(mockGenInstantiate).toHaveBeenCalledTimes(3) expect(mockGenInstantiate).toHaveBeenCalledWith( 'fake-gen-base-app', - { options: { 'skip-prompt': false, 'project-name': 'hola', 'skip-install': true } } + { options: { 'skip-prompt': false, 'project-name': 'hola' } } ) expect(mockGenInstantiate).toHaveBeenCalledWith( 'fake-gen-add-ci', - { options: { 'skip-prompt': false, 'project-name': 'hola', 'skip-install': true } } + { options: { 'skip-prompt': false, 'project-name': 'hola' } } ) expect(mockGenInstantiate).toHaveBeenCalledWith( 'fake-gen-excshell', - { options: { 'skip-prompt': false, force: true, 'skip-install': true } } + { options: { 'skip-prompt': false, force: true } } ) expect(mockInstallPackages).toHaveBeenCalled() expect(LibConsoleCLI.init).not.toHaveBeenCalled() @@ -399,15 +399,15 @@ describe('run', () => { expect(mockGenInstantiate).toHaveBeenCalledTimes(3) expect(mockGenInstantiate).toHaveBeenCalledWith( 'fake-gen-base-app', - { options: { 'skip-prompt': false, 'project-name': 'hola', 'skip-install': true } } + { options: { 'skip-prompt': false, 'project-name': 'hola' } } ) expect(mockGenInstantiate).toHaveBeenCalledWith( 'fake-gen-add-ci', - { options: { 'skip-prompt': false, 'project-name': 'hola', 'skip-install': true } } + { options: { 'skip-prompt': false, 'project-name': 'hola' } } ) expect(mockGenInstantiate).toHaveBeenCalledWith( 'fake-gen-excshell', - { options: { 'skip-prompt': false, force: true, 'skip-install': true } } + { options: { 'skip-prompt': false, force: true } } ) expect(mockInstallPackages).toHaveBeenCalled() expect(LibConsoleCLI.init).not.toHaveBeenCalled() @@ -441,15 +441,15 @@ describe('run', () => { expect(mockGenInstantiate).toHaveBeenCalledTimes(3) expect(mockGenInstantiate).toHaveBeenCalledWith( 'fake-gen-base-app', - { options: { 'skip-prompt': false, 'project-name': 'hola', 'skip-install': true } } + { options: { 'skip-prompt': false, 'project-name': 'hola' } } ) expect(mockGenInstantiate).toHaveBeenCalledWith( 'fake-gen-add-ci', - { options: { 'skip-prompt': false, 'project-name': 'hola', 'skip-install': true } } + { options: { 'skip-prompt': false, 'project-name': 'hola' } } ) expect(mockGenInstantiate).toHaveBeenCalledWith( 'fake-gen-excshell', - { options: { 'skip-prompt': false, force: true, 'skip-install': true } } + { options: { 'skip-prompt': false, force: true } } ) expect(mockInstallPackages).toHaveBeenCalled() expect(LibConsoleCLI.init).toHaveBeenCalled() @@ -480,15 +480,15 @@ describe('run', () => { expect(mockGenInstantiate).toHaveBeenCalledTimes(3) expect(mockGenInstantiate).toHaveBeenCalledWith( 'fake-gen-base-app', - { options: { 'skip-prompt': false, 'project-name': 'hola', 'skip-install': true } } + { options: { 'skip-prompt': false, 'project-name': 'hola' } } ) expect(mockGenInstantiate).toHaveBeenCalledWith( 'fake-gen-add-ci', - { options: { 'skip-prompt': false, 'project-name': 'hola', 'skip-install': true } } + { options: { 'skip-prompt': false, 'project-name': 'hola' } } ) expect(mockGenInstantiate).toHaveBeenCalledWith( 'fake-gen-nui', - { options: { 'skip-prompt': false, force: true, 'skip-install': true } } + { options: { 'skip-prompt': false, force: true } } ) expect(mockInstallPackages).toHaveBeenCalled() expect(LibConsoleCLI.init).toHaveBeenCalled() @@ -525,15 +525,15 @@ describe('run', () => { expect(mockGenInstantiate).toHaveBeenCalledTimes(3) expect(mockGenInstantiate).toHaveBeenCalledWith( 'fake-gen-base-app', - { options: { 'skip-prompt': false, 'project-name': 'hola', 'skip-install': true } } + { options: { 'skip-prompt': false, 'project-name': 'hola' } } ) expect(mockGenInstantiate).toHaveBeenCalledWith( 'fake-gen-add-ci', - { options: { 'skip-prompt': false, 'project-name': 'hola', 'skip-install': true } } + { options: { 'skip-prompt': false, 'project-name': 'hola' } } ) expect(mockGenInstantiate).toHaveBeenCalledWith( 'fake-gen-excshell', - { options: { 'skip-prompt': false, force: true, 'skip-install': true } } + { options: { 'skip-prompt': false, force: true } } ) expect(mockInstallPackages).toHaveBeenCalled() expect(LibConsoleCLI.init).toHaveBeenCalled() @@ -578,15 +578,15 @@ describe('run', () => { expect(mockGenInstantiate).toHaveBeenCalledTimes(3) expect(mockGenInstantiate).toHaveBeenCalledWith( 'fake-gen-base-app', - { options: { 'skip-prompt': false, 'project-name': 'hola', 'skip-install': true } } + { options: { 'skip-prompt': false, 'project-name': 'hola' } } ) expect(mockGenInstantiate).toHaveBeenCalledWith( 'fake-gen-add-ci', - { options: { 'skip-prompt': false, 'project-name': 'hola', 'skip-install': true } } + { options: { 'skip-prompt': false, 'project-name': 'hola' } } ) expect(mockGenInstantiate).toHaveBeenCalledWith( 'fake-gen-excshell', - { options: { 'skip-prompt': false, force: true, 'skip-install': true } } + { options: { 'skip-prompt': false, force: true } } ) expect(mockInstallPackages).toHaveBeenCalled() expect(LibConsoleCLI.init).toHaveBeenCalled() @@ -619,15 +619,15 @@ describe('run', () => { expect(mockGenInstantiate).toHaveBeenCalledTimes(3) expect(mockGenInstantiate).toHaveBeenCalledWith( 'fake-gen-base-app', - { options: { 'skip-prompt': false, 'project-name': 'hola', 'skip-install': true } } + { options: { 'skip-prompt': false, 'project-name': 'hola' } } ) expect(mockGenInstantiate).toHaveBeenCalledWith( 'fake-gen-add-ci', - { options: { 'skip-prompt': false, 'project-name': 'hola', 'skip-install': true } } + { options: { 'skip-prompt': false, 'project-name': 'hola' } } ) expect(mockGenInstantiate).toHaveBeenCalledWith( 'fake-gen-excshell', - { options: { 'skip-prompt': false, force: true, 'skip-install': true } } + { options: { 'skip-prompt': false, force: true } } ) expect(mockInstallPackages).toHaveBeenCalled() expect(LibConsoleCLI.init).toHaveBeenCalled() @@ -658,15 +658,15 @@ describe('run', () => { expect(mockGenInstantiate).toHaveBeenCalledTimes(3) expect(mockGenInstantiate).toHaveBeenCalledWith( 'fake-gen-base-app', - { options: { 'skip-prompt': false, 'project-name': 'hola', 'skip-install': true } } + { options: { 'skip-prompt': false, 'project-name': 'hola' } } ) expect(mockGenInstantiate).toHaveBeenCalledWith( 'fake-gen-add-ci', - { options: { 'skip-prompt': false, 'project-name': 'hola', 'skip-install': true } } + { options: { 'skip-prompt': false, 'project-name': 'hola' } } ) expect(mockGenInstantiate).toHaveBeenCalledWith( 'fake-gen-excshell', - { options: { 'skip-prompt': false, force: true, 'skip-install': true } } + { options: { 'skip-prompt': false, force: true } } ) expect(mockInstallPackages).toHaveBeenCalled() expect(LibConsoleCLI.init).toHaveBeenCalled() From 51743044763e5d8c6a618d4da912f53c1e12390e Mon Sep 17 00:00:00 2001 From: Arjun Gupta Date: Tue, 26 Jul 2022 15:02:48 +0530 Subject: [PATCH 2/3] Added fix to other generators in app plugin --- src/commands/app/add/ci.js | 3 ++- src/commands/app/add/event.js | 5 +++-- src/commands/app/add/extension.js | 5 +++-- src/commands/app/add/web-assets.js | 5 +++-- src/commands/app/delete/ci.js | 5 +++-- src/lib/vscode.js | 5 +++-- test/commands/app/add/ci.test.js | 2 +- test/commands/app/add/event.test.js | 6 ++---- test/commands/app/add/extension.test.js | 15 +++++---------- test/commands/app/add/web-assets.test.js | 18 ++++++------------ test/commands/app/delete/ci.test.js | 6 ++---- 11 files changed, 33 insertions(+), 42 deletions(-) diff --git a/src/commands/app/add/ci.js b/src/commands/app/add/ci.js index 6a74d2a2..d994d482 100644 --- a/src/commands/app/add/ci.js +++ b/src/commands/app/add/ci.js @@ -21,11 +21,12 @@ class AddCICommand extends BaseCommand { aioLogger.debug(`adding component ${args.component} to the project, using flags: ${flags}`) const env = yeoman.createEnv() + env.options = { skipInstall: true } const gen = env.instantiate( generators['add-ci'], { options: { // by default yeoman runs the installation, we control installation from the app plugin - 'skip-install': true + // Moving ['skip-install': true] to env.options due to yeoman environment issue https://github.com/yeoman/environment/issues/421 } }) await env.runGenerator(gen) diff --git a/src/commands/app/add/event.js b/src/commands/app/add/event.js index da821b83..675ee738 100644 --- a/src/commands/app/add/event.js +++ b/src/commands/app/add/event.js @@ -35,6 +35,7 @@ class AddEventCommand extends AddCommand { const configData = this.getRuntimeManifestConfigFile(configName) const env = yeoman.createEnv() + env.options = { skipInstall: true } const eventsGen = env.instantiate(generators['add-events'], { options: { 'skip-prompt': flags.yes, @@ -42,9 +43,9 @@ class AddEventCommand extends AddCommand { 'config-path': configData.file, 'full-key-to-manifest': configData.key, // force overwrites, no useless prompts, this is a feature exposed by yeoman itself - force: true, + force: true // by default yeoman runs the install, we control installation from the app plugin - 'skip-install': true + // Moving ['skip-install': true] to env.options due to yeoman environment issue https://github.com/yeoman/environment/issues/421 } }) await env.runGenerator(eventsGen) diff --git a/src/commands/app/add/extension.js b/src/commands/app/add/extension.js index ae75a6a2..935ee454 100644 --- a/src/commands/app/add/extension.js +++ b/src/commands/app/add/extension.js @@ -91,6 +91,7 @@ class AddExtensionCommand extends AddCommand { async runCodeGenerators (flags, implementations) { const env = yeoman.createEnv() + env.options = { skipInstall: true } for (let i = 0; i < implementations.length; ++i) { const implementation = implementations[i] const gen = env.instantiate(implementation.generator, @@ -98,9 +99,9 @@ class AddExtensionCommand extends AddCommand { options: { 'skip-prompt': flags.yes, // no yeoman overwrite prompts - force: true, + force: true // by default yeoman runs the install, we control installation from the app plugin - 'skip-install': true + // Moving ['skip-install': true] to env.options due to yeoman environment issue https://github.com/yeoman/environment/issues/421 } }) this.log(chalk.blue(chalk.bold(`Running generator for ${implementation.name}`))) diff --git a/src/commands/app/add/web-assets.js b/src/commands/app/add/web-assets.js index 64829f93..2918236f 100644 --- a/src/commands/app/add/web-assets.js +++ b/src/commands/app/add/web-assets.js @@ -39,15 +39,16 @@ class AddWebAssetsCommand extends AddCommand { [] const env = yeoman.createEnv() + env.options = { skipInstall: true } const gen = env.instantiate(generators['add-web-assets'], { options: { 'skip-prompt': flags.yes, 'project-name': projectName, 'web-src-folder': webSrcFolder, - 'adobe-services': servicesToGeneratorInput(workspaceServices), + 'adobe-services': servicesToGeneratorInput(workspaceServices) // force: true, // by default yeoman runs the install, we control installation from the app plugin - 'skip-install': true + // Moving ['skip-install': true] to env.options due to yeoman environment issue https://github.com/yeoman/environment/issues/421 } }) await env.runGenerator(gen) diff --git a/src/commands/app/delete/ci.js b/src/commands/app/delete/ci.js index fc9bdd4a..f39a2b21 100644 --- a/src/commands/app/delete/ci.js +++ b/src/commands/app/delete/ci.js @@ -22,11 +22,12 @@ class DeleteCICommand extends BaseCommand { aioLogger.debug(`deleting CI files from the project, using flags: ${JSON.stringify(flags)}`) const env = yeoman.createEnv() + env.options = { skipInstall: true } const gen = env.instantiate(generators['delete-ci'], { options: { - 'skip-prompt': flags.yes, + 'skip-prompt': flags.yes // by default yeoman runs the install, we control installation from the app plugin - 'skip-install': true + // Moving ['skip-install': true] to env.options due to yeoman environment issue https://github.com/yeoman/environment/issues/421 } }) await env.runGenerator(gen) diff --git a/src/lib/vscode.js b/src/lib/vscode.js index c2149b2e..5e811411 100644 --- a/src/lib/vscode.js +++ b/src/lib/vscode.js @@ -42,14 +42,15 @@ function update (config) { } const env = yeoman.createEnv() + env.options = { skipInstall: true } const gen = env.instantiate(generators['add-vscode-config'], { options: { 'app-config': config, 'env-file': config.envFile, 'frontend-url': props.frontEndUrl, - 'skip-prompt': true, + 'skip-prompt': true // by default yeoman runs the install, we control installation from the app plugin - 'skip-install': true + // Moving ['skip-install': true] to env.options due to yeoman environment issue https://github.com/yeoman/environment/issues/421 } }) await env.runGenerator(gen) diff --git a/test/commands/app/add/ci.test.js b/test/commands/app/add/ci.test.js index c51c8d5c..da0dfd08 100644 --- a/test/commands/app/add/ci.test.js +++ b/test/commands/app/add/ci.test.js @@ -60,7 +60,7 @@ describe('no flags', () => { await TheCommand.run([]) expect(yeoman.createEnv).toHaveBeenCalled() - expect(mockInstantiate).toHaveBeenCalledWith(generators['add-ci'], { options: { 'skip-install': true } }) + expect(mockInstantiate).toHaveBeenCalledWith(generators['add-ci'], { options: { } }) expect(mockRunGenerator).toHaveBeenCalled() }) }) diff --git a/test/commands/app/add/event.test.js b/test/commands/app/add/event.test.js index 86b35850..b172abeb 100644 --- a/test/commands/app/add/event.test.js +++ b/test/commands/app/add/event.test.js @@ -98,8 +98,7 @@ describe('good flags', () => { 'action-folder': 'myactions', 'config-path': undefined, 'full-key-to-manifest': 'undefined.runtimeManifest', - force: true, - 'skip-install': true + force: true } }) expect(mockRunGenerator).toHaveBeenCalledWith('eventsGen') @@ -126,8 +125,7 @@ describe('good flags', () => { 'action-folder': 'myactions', 'config-path': undefined, 'full-key-to-manifest': 'undefined.runtimeManifest', - force: true, - 'skip-install': true + force: true } }) expect(helpers.installPackages).toHaveBeenCalledTimes(0) diff --git a/test/commands/app/add/extension.test.js b/test/commands/app/add/extension.test.js index 1b14e13d..840be433 100644 --- a/test/commands/app/add/extension.test.js +++ b/test/commands/app/add/extension.test.js @@ -101,8 +101,7 @@ describe('good flags', () => { expect(mockInstantiate).toHaveBeenCalledWith(generators.extensions['dx/excshell/1'], { options: { 'skip-prompt': true, - force: true, - 'skip-install': true + force: true } }) expect(mockRunGenerator).toHaveBeenCalledWith('extGen') @@ -117,8 +116,7 @@ describe('good flags', () => { expect(mockInstantiate).toHaveBeenCalledWith(generators.extensions['dx/excshell/1'], { options: { 'skip-prompt': true, - force: true, - 'skip-install': true + force: true } }) expect(helpers.installPackages).toHaveBeenCalledTimes(0) @@ -132,8 +130,7 @@ describe('good flags', () => { expect(mockInstantiate).toHaveBeenCalledWith(generators.extensions['dx/excshell/1'], { options: { 'skip-prompt': false, - force: true, - 'skip-install': true + force: true } }) }) @@ -145,8 +142,7 @@ describe('good flags', () => { expect(mockInstantiate).toHaveBeenCalledWith(generators.extensions['dx/excshell/1'], { options: { 'skip-prompt': false, - force: true, - 'skip-install': true + force: true } }) }) @@ -171,8 +167,7 @@ describe('good flags', () => { expect(mockInstantiate).toHaveBeenCalledWith(generators.extensions['dx/asset-compute/worker/1'], { options: { 'skip-prompt': false, - force: true, - 'skip-install': true + force: true } }) }) diff --git a/test/commands/app/add/web-assets.test.js b/test/commands/app/add/web-assets.test.js index 731ce97b..7219e47c 100644 --- a/test/commands/app/add/web-assets.test.js +++ b/test/commands/app/add/web-assets.test.js @@ -98,8 +98,7 @@ describe('good flags', () => { 'skip-prompt': true, 'project-name': 'legacy-app', 'web-src-folder': path.resolve('/web-src'), - 'adobe-services': undefined, - 'skip-install': true + 'adobe-services': undefined } }) expect(mockRunGenerator).toHaveBeenCalledWith('gen') @@ -116,8 +115,7 @@ describe('good flags', () => { 'skip-prompt': true, 'project-name': 'legacy-app', 'web-src-folder': path.resolve('/web-src'), - 'adobe-services': undefined, - 'skip-install': true + 'adobe-services': undefined } }) expect(helpers.installPackages).toHaveBeenCalledTimes(0) @@ -133,8 +131,7 @@ describe('good flags', () => { 'skip-prompt': false, 'project-name': 'legacy-app', 'web-src-folder': path.resolve('/web-src'), - 'adobe-services': undefined, - 'skip-install': true + 'adobe-services': undefined } }) expect(helpers.installPackages).toHaveBeenCalledTimes(0) @@ -150,8 +147,7 @@ describe('good flags', () => { 'skip-prompt': false, 'project-name': 'legacy-app', 'web-src-folder': path.resolve('/web-src'), - 'adobe-services': undefined, - 'skip-install': true + 'adobe-services': undefined } }) }) @@ -165,8 +161,7 @@ describe('good flags', () => { 'skip-prompt': false, 'project-name': 'legacy-app', 'web-src-folder': path.resolve('/web-src'), - 'adobe-services': undefined, - 'skip-install': true + 'adobe-services': undefined } }) }) @@ -181,8 +176,7 @@ describe('good flags', () => { 'skip-prompt': false, 'project-name': 'legacy-app', 'web-src-folder': path.resolve('/web-src'), - 'adobe-services': 'CampaignSDK,AdobeAnalyticsSDK', - 'skip-install': true + 'adobe-services': 'CampaignSDK,AdobeAnalyticsSDK' } }) }) diff --git a/test/commands/app/delete/ci.test.js b/test/commands/app/delete/ci.test.js index a5645f23..9ede1032 100644 --- a/test/commands/app/delete/ci.test.js +++ b/test/commands/app/delete/ci.test.js @@ -60,8 +60,7 @@ describe('good flags', () => { expect(yeoman.createEnv).toHaveBeenCalled() expect(mockInstantiate).toHaveBeenCalledWith(expect.any(Function), { options: { - 'skip-prompt': true, - 'skip-install': true + 'skip-prompt': true } }) }) @@ -72,8 +71,7 @@ describe('good flags', () => { expect(yeoman.createEnv).toHaveBeenCalled() expect(mockInstantiate).toHaveBeenCalledWith(expect.any(Function), { options: { - 'skip-prompt': false, - 'skip-install': true + 'skip-prompt': false } }) }) From 472e77c19dfc9e83e9fd38d0367adb2c1ab8defb Mon Sep 17 00:00:00 2001 From: Arjun Gupta Date: Fri, 12 Aug 2022 10:12:47 +0530 Subject: [PATCH 3/3] Removed repeated historic code comment --- src/commands/app/add/action.js | 5 ++--- src/commands/app/add/ci.js | 6 ++---- src/commands/app/add/event.js | 3 +-- src/commands/app/add/extension.js | 3 +-- src/commands/app/add/web-assets.js | 5 ++--- src/commands/app/delete/ci.js | 3 +-- src/commands/app/init.js | 6 ++---- src/lib/vscode.js | 3 +-- 8 files changed, 12 insertions(+), 22 deletions(-) diff --git a/src/commands/app/add/action.js b/src/commands/app/add/action.js index dd779b75..424a05cf 100644 --- a/src/commands/app/add/action.js +++ b/src/commands/app/add/action.js @@ -46,6 +46,7 @@ class AddActionCommand extends AddCommand { const supportedOrgServices = aioConfigLoader.get('project.org.details.services') || [] const env = yeoman.createEnv() + // by default yeoman runs the install, we control installation from the app plugin env.options = { skipInstall: true } const addActionGen = env.instantiate(generators['add-action'], { options: { @@ -55,9 +56,7 @@ class AddActionCommand extends AddCommand { 'adobe-services': servicesToGeneratorInput(workspaceServices), 'supported-adobe-services': servicesToGeneratorInput(supportedOrgServices), 'full-key-to-manifest': configData.key - // force: true, - // by default yeoman runs the install, we control installation from the app plugin - // Moving ['skip-install': true] to env.options due to yeoman environment issue https://github.com/yeoman/environment/issues/421 + // force: true } }) await env.runGenerator(addActionGen) diff --git a/src/commands/app/add/ci.js b/src/commands/app/add/ci.js index d994d482..07fb3b73 100644 --- a/src/commands/app/add/ci.js +++ b/src/commands/app/add/ci.js @@ -21,13 +21,11 @@ class AddCICommand extends BaseCommand { aioLogger.debug(`adding component ${args.component} to the project, using flags: ${flags}`) const env = yeoman.createEnv() + // by default yeoman runs the install, we control installation from the app plugin env.options = { skipInstall: true } const gen = env.instantiate( generators['add-ci'], { - options: { - // by default yeoman runs the installation, we control installation from the app plugin - // Moving ['skip-install': true] to env.options due to yeoman environment issue https://github.com/yeoman/environment/issues/421 - } + options: { } }) await env.runGenerator(gen) } diff --git a/src/commands/app/add/event.js b/src/commands/app/add/event.js index 675ee738..f85a0e01 100644 --- a/src/commands/app/add/event.js +++ b/src/commands/app/add/event.js @@ -35,6 +35,7 @@ class AddEventCommand extends AddCommand { const configData = this.getRuntimeManifestConfigFile(configName) const env = yeoman.createEnv() + // by default yeoman runs the install, we control installation from the app plugin env.options = { skipInstall: true } const eventsGen = env.instantiate(generators['add-events'], { options: { @@ -44,8 +45,6 @@ class AddEventCommand extends AddCommand { 'full-key-to-manifest': configData.key, // force overwrites, no useless prompts, this is a feature exposed by yeoman itself force: true - // by default yeoman runs the install, we control installation from the app plugin - // Moving ['skip-install': true] to env.options due to yeoman environment issue https://github.com/yeoman/environment/issues/421 } }) await env.runGenerator(eventsGen) diff --git a/src/commands/app/add/extension.js b/src/commands/app/add/extension.js index 935ee454..d62ad3ce 100644 --- a/src/commands/app/add/extension.js +++ b/src/commands/app/add/extension.js @@ -91,6 +91,7 @@ class AddExtensionCommand extends AddCommand { async runCodeGenerators (flags, implementations) { const env = yeoman.createEnv() + // by default yeoman runs the install, we control installation from the app plugin env.options = { skipInstall: true } for (let i = 0; i < implementations.length; ++i) { const implementation = implementations[i] @@ -100,8 +101,6 @@ class AddExtensionCommand extends AddCommand { 'skip-prompt': flags.yes, // no yeoman overwrite prompts force: true - // by default yeoman runs the install, we control installation from the app plugin - // Moving ['skip-install': true] to env.options due to yeoman environment issue https://github.com/yeoman/environment/issues/421 } }) this.log(chalk.blue(chalk.bold(`Running generator for ${implementation.name}`))) diff --git a/src/commands/app/add/web-assets.js b/src/commands/app/add/web-assets.js index 2918236f..ad84c91d 100644 --- a/src/commands/app/add/web-assets.js +++ b/src/commands/app/add/web-assets.js @@ -39,6 +39,7 @@ class AddWebAssetsCommand extends AddCommand { [] const env = yeoman.createEnv() + // by default yeoman runs the install, we control installation from the app plugin env.options = { skipInstall: true } const gen = env.instantiate(generators['add-web-assets'], { options: { @@ -46,9 +47,7 @@ class AddWebAssetsCommand extends AddCommand { 'project-name': projectName, 'web-src-folder': webSrcFolder, 'adobe-services': servicesToGeneratorInput(workspaceServices) - // force: true, - // by default yeoman runs the install, we control installation from the app plugin - // Moving ['skip-install': true] to env.options due to yeoman environment issue https://github.com/yeoman/environment/issues/421 + // force: true } }) await env.runGenerator(gen) diff --git a/src/commands/app/delete/ci.js b/src/commands/app/delete/ci.js index f39a2b21..9f8131c1 100644 --- a/src/commands/app/delete/ci.js +++ b/src/commands/app/delete/ci.js @@ -22,12 +22,11 @@ class DeleteCICommand extends BaseCommand { aioLogger.debug(`deleting CI files from the project, using flags: ${JSON.stringify(flags)}`) const env = yeoman.createEnv() + // by default yeoman runs the install, we control installation from the app plugin env.options = { skipInstall: true } const gen = env.instantiate(generators['delete-ci'], { options: { 'skip-prompt': flags.yes - // by default yeoman runs the install, we control installation from the app plugin - // Moving ['skip-install': true] to env.options due to yeoman environment issue https://github.com/yeoman/environment/issues/421 } }) await env.runGenerator(gen) diff --git a/src/commands/app/init.js b/src/commands/app/init.js index 26f85ddd..7d787544 100644 --- a/src/commands/app/init.js +++ b/src/commands/app/init.js @@ -271,6 +271,7 @@ class InitCommand extends AddCommand { async runCodeGenerators (flags, extensionPoints, projectName) { let env = yeoman.createEnv() + // by default yeoman runs the install, we control installation from the app plugin env.options = { skipInstall: true } const initialGenerators = ['base-app', 'add-ci'] // first run app generator that will generate the root skeleton + ci @@ -279,8 +280,6 @@ class InitCommand extends AddCommand { options: { 'skip-prompt': flags.yes, 'project-name': projectName - // by default yeoman runs the install, we control installation from the app plugin - // Moving ['skip-install': true] to env.options due to yeoman environment issue https://github.com/yeoman/environment/issues/421 } }) await env.runGenerator(appGen) @@ -290,6 +289,7 @@ class InitCommand extends AddCommand { // https://github.com/yeoman/environment/issues/324 env = yeoman.createEnv() + // by default yeoman runs the install, we control installation from the app plugin env.options = { skipInstall: true } // try to use appGen.composeWith for (let i = 0; i < extensionPoints.length; ++i) { @@ -300,8 +300,6 @@ class InitCommand extends AddCommand { 'skip-prompt': flags.yes, // do not prompt for overwrites force: true - // by default yeoman runs the install, we control installation from the app plugin - // Moving ['skip-install': true] to env.options due to yeoman environment issue https://github.com/yeoman/environment/issues/421 } }) await env.runGenerator(extGen) diff --git a/src/lib/vscode.js b/src/lib/vscode.js index 5e811411..1f396326 100644 --- a/src/lib/vscode.js +++ b/src/lib/vscode.js @@ -42,6 +42,7 @@ function update (config) { } const env = yeoman.createEnv() + // by default yeoman runs the install, we control installation from the app plugin env.options = { skipInstall: true } const gen = env.instantiate(generators['add-vscode-config'], { options: { @@ -49,8 +50,6 @@ function update (config) { 'env-file': config.envFile, 'frontend-url': props.frontEndUrl, 'skip-prompt': true - // by default yeoman runs the install, we control installation from the app plugin - // Moving ['skip-install': true] to env.options due to yeoman environment issue https://github.com/yeoman/environment/issues/421 } }) await env.runGenerator(gen)