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()