From 5b0db571fce48185fcebaddffc2e14f58cba68b1 Mon Sep 17 00:00:00 2001 From: Courtney Owen Date: Wed, 29 Jul 2020 12:07:22 -0700 Subject: [PATCH] Fixes issue where postInstallHints wasn't getting called - The postInstallHints method was no longer getting called due to an apparent change in the way callbacks are handled by yeoman-generator. This issue presumably surfaced when we upgraded the yeoman-generator version a few months back. What apparently happens is that the postInstallHints callback is simply ignored following install - We believe this may be a source of confusion for the SSO template in particular where we give explicit instructions to run "configure-sso" prior to running "npm start" - The fix is to call postInstallHints in the yeoman-generator "end" method, which is "Called last, cleanup, say good bye, etc" - Ignoring the call to postInstallHints for test code, since postInstallHints also calls process.exit(), which will cause tests to bail out - Also update package-lock.json to address vulnerabilities --- package-lock.json | 6 +++--- src/app/defaults.ts | 1 + src/app/index.ts | 16 ++++++++++++---- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index c808ced0..494e6565 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3041,9 +3041,9 @@ } }, "lodash": { - "version": "4.17.15", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", - "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==" + "version": "4.17.19", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz", + "integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==" }, "lodash.get": { "version": "4.4.2", diff --git a/src/app/defaults.ts b/src/app/defaults.ts index 4b8cc9f8..4a35aeef 100644 --- a/src/app/defaults.ts +++ b/src/app/defaults.ts @@ -3,6 +3,7 @@ import * as chalk from "chalk"; export const configurationErrorEventName: string = "configuration-error-generator-office"; export const copyFilesErrorEventName: string = "copy-files-error-generator-office"; export const installDependenciesErrorEventName = "install-dependencies-error-generator-office"; +export const postInstallHintsErrorEventName = "post-install-hints-error-generator-office"; export const promptSelectionstEventName: string = "prompt-selections-generator-office"; export const promptSelectionsErrorEventName: string = "prompt-selections-error-generator-office"; export const usageDataProjectName: string = "generator-office"; diff --git a/src/app/index.ts b/src/app/index.ts index bb3705c4..23a67357 100755 --- a/src/app/index.ts +++ b/src/app/index.ts @@ -248,15 +248,13 @@ module.exports = class extends yo { if (this.options['skip-install']) { this.installDependencies({ npm: false, - bower: false, - callback: this._postInstallHints.bind(this) + bower: false }); } else { this.installDependencies({ npm: true, - bower: false, - callback: this._postInstallHints.bind(this) + bower: false }); } } catch (err) { @@ -265,6 +263,16 @@ module.exports = class extends yo { } } + end(): void { + if (!this.options['test']) { + try { + this._postInstallHints(); + } catch (err) { + usageDataObject.reportError(defaults.postInstallHintsErrorEventName, new Error('Exit Error: ' + err)); + } + } + } + _configureProject(answerForProjectType, answerForScriptType, answerForHost, answerForName, isManifestProject, isExcelFunctionsProject): void { try { this.project = {