From 2b6147a6cb3a168ae5f8022a8d5f5da2cd060b8a Mon Sep 17 00:00:00 2001 From: Danny Eck Date: Fri, 11 Aug 2023 23:30:53 -0400 Subject: [PATCH] fix: print setup complete messages --- .changeset/rotten-impalas-camp.md | 5 ++ .../angular/generator-single-spa-angular.js | 2 +- .../src/react/generator-single-spa-react.js | 18 +++---- .../src/root-config/generator-root-config.js | 20 ++++--- .../src/svelte/generator-single-spa-svelte.js | 18 +++---- .../generator-single-spa-util-module.js | 52 +++++++++---------- .../src/vue/generator-single-spa-vue.js | 2 +- 7 files changed, 56 insertions(+), 61 deletions(-) create mode 100644 .changeset/rotten-impalas-camp.md diff --git a/.changeset/rotten-impalas-camp.md b/.changeset/rotten-impalas-camp.md new file mode 100644 index 00000000..2ff0aee7 --- /dev/null +++ b/.changeset/rotten-impalas-camp.md @@ -0,0 +1,5 @@ +--- +"generator-single-spa": patch +--- + +Restores the helpful output printed on project setup complete. diff --git a/packages/generator-single-spa/src/angular/generator-single-spa-angular.js b/packages/generator-single-spa/src/angular/generator-single-spa-angular.js index 1510fcf4..5abe90f2 100644 --- a/packages/generator-single-spa/src/angular/generator-single-spa-angular.js +++ b/packages/generator-single-spa/src/angular/generator-single-spa-angular.js @@ -76,7 +76,7 @@ module.exports = class SingleSpaAngularGenerator extends Generator { } } - async finished() { + async end() { console.log( chalk.bgWhite.black( `Project setup complete! diff --git a/packages/generator-single-spa/src/react/generator-single-spa-react.js b/packages/generator-single-spa/src/react/generator-single-spa-react.js index 372d4bc3..83e1574e 100644 --- a/packages/generator-single-spa/src/react/generator-single-spa-react.js +++ b/packages/generator-single-spa/src/react/generator-single-spa-react.js @@ -220,18 +220,16 @@ module.exports = class SingleSpaReactGenerator extends PnpmGenerator { }); } } - finished() { - this.on(`${this.options.packageManager}Install:end`, () => { - console.log( - chalk.bgWhite.black(`Project setup complete! + end() { + console.log( + chalk.bgWhite.black(`Project setup complete! Steps to test your React single-spa application: 1. Run '${this.options.packageManager} start${ - this.options.packageManager === "yarn" ? "" : " --" - } --port 8500' + this.options.packageManager === "yarn" ? "" : " --" + } --port 8500' 2. Go to http://single-spa-playground.org/playground/instant-test?name=@${ - this.options.orgName - }/${this.options.projectName}&url=8500 to see it working!`) - ); - }); + this.options.orgName + }/${this.options.projectName}&url=8500 to see it working!`) + ); } }; diff --git a/packages/generator-single-spa/src/root-config/generator-root-config.js b/packages/generator-single-spa/src/root-config/generator-root-config.js index cf3b3ddd..0c61a440 100644 --- a/packages/generator-single-spa/src/root-config/generator-root-config.js +++ b/packages/generator-single-spa/src/root-config/generator-root-config.js @@ -214,18 +214,16 @@ module.exports = class SingleSpaRootConfigGenerator extends PnpmGenerator { }); } } - finished() { - this.on(`${this.options.packageManager}Install:end`, () => { - console.log( - chalk.bgWhite.black(`Project setup complete! + end() { + console.log( + chalk.bgWhite.black(`Project setup complete! Run '${this.options.packageManager} start' to boot up your single-spa root config`) - ); + ); - if (this.options.layout) { - console.log( - `\nPlease report single-spa-layout issues and bugs on GitHub https://github.com/single-spa/single-spa-layout/issues/new` - ); - } - }); + if (this.options.layout) { + console.log( + `\nPlease report single-spa-layout issues and bugs on GitHub https://github.com/single-spa/single-spa-layout/issues/new` + ); + } } }; diff --git a/packages/generator-single-spa/src/svelte/generator-single-spa-svelte.js b/packages/generator-single-spa/src/svelte/generator-single-spa-svelte.js index 93d0f62a..2adb2bb7 100644 --- a/packages/generator-single-spa/src/svelte/generator-single-spa-svelte.js +++ b/packages/generator-single-spa/src/svelte/generator-single-spa-svelte.js @@ -166,16 +166,14 @@ module.exports = class SingleSpaSvelteGenerator extends PnpmGenerator { }); } } - finished() { - this.on(`${this.options.packageManager}Install:end`, () => { - const bwLog = (msg) => console.log(chalk.bgWhite.black(msg)); + end() { + const bwLog = (msg) => console.log(chalk.bgWhite.black(msg)); - bwLog("Project setup complete!"); - bwLog("Steps to test your Svelte single-spa application:"); - bwLog(`1. Run '${this.options.packageManager} start'`); - bwLog( - `2. Go to http://single-spa-playground.org/playground/instant-test?name=@${this.options.orgName}/${this.options.projectName}&url=5000 to see it working!` - ); - }); + bwLog("Project setup complete!"); + bwLog("Steps to test your Svelte single-spa application:"); + bwLog(`1. Run '${this.options.packageManager} start'`); + bwLog( + `2. Go to http://single-spa-playground.org/playground/instant-test?name=@${this.options.orgName}/${this.options.projectName}&url=5000 to see it working!` + ); } }; diff --git a/packages/generator-single-spa/src/util-module/generator-single-spa-util-module.js b/packages/generator-single-spa/src/util-module/generator-single-spa-util-module.js index 09a1a4fe..ecae93d6 100644 --- a/packages/generator-single-spa/src/util-module/generator-single-spa-util-module.js +++ b/packages/generator-single-spa/src/util-module/generator-single-spa-util-module.js @@ -181,33 +181,29 @@ module.exports = class SingleSpaUtilModuleGenerator extends PnpmGenerator { }); } } - finished() { - this.on(`${this.options.packageManager}Install:end`, () => { - const coloredFinalInstructions = chalk.bgWhite.black; - console.log(coloredFinalInstructions("Project setup complete!")); - console.log( - coloredFinalInstructions("Steps to test your utility module:") - ); - console.log( - coloredFinalInstructions( - `1. Run '${this.options.packageManager} start${ - this.options.packageManager === "yarn" ? "" : " --" - } --port 8500'` - ) - ); - console.log( - coloredFinalInstructions(`2. Go to http://single-spa-playground.org`) - ); - console.log( - coloredFinalInstructions( - `3. Run the following in the browser console: window.importMapOverrides.addOverride('@${this.options.orgName}/${this.options.projectName}', '8500')` - ) - ); - console.log( - coloredFinalInstructions( - `4. Run the following in the browser console: System.import('@${this.options.orgName}/${this.options.projectName}')` - ) - ); - }); + end() { + const coloredFinalInstructions = chalk.bgWhite.black; + console.log(coloredFinalInstructions("Project setup complete!")); + console.log(coloredFinalInstructions("Steps to test your utility module:")); + console.log( + coloredFinalInstructions( + `1. Run '${this.options.packageManager} start${ + this.options.packageManager === "yarn" ? "" : " --" + } --port 8500'` + ) + ); + console.log( + coloredFinalInstructions(`2. Go to http://single-spa-playground.org`) + ); + console.log( + coloredFinalInstructions( + `3. Run the following in the browser console: window.importMapOverrides.addOverride('@${this.options.orgName}/${this.options.projectName}', '8500')` + ) + ); + console.log( + coloredFinalInstructions( + `4. Run the following in the browser console: System.import('@${this.options.orgName}/${this.options.projectName}')` + ) + ); } }; diff --git a/packages/generator-single-spa/src/vue/generator-single-spa-vue.js b/packages/generator-single-spa/src/vue/generator-single-spa-vue.js index 3896756a..0ad209cc 100644 --- a/packages/generator-single-spa/src/vue/generator-single-spa-vue.js +++ b/packages/generator-single-spa/src/vue/generator-single-spa-vue.js @@ -99,7 +99,7 @@ module.exports = class SingleSpaVueGenerator extends Generator { }), }); } - async finished() { + async end() { const usedYarn = this.fs.exists( path.resolve(this.options.dir, this.options.projectName, "yarn.lock") );