From 0f04e1e126a696d515be4ae7d8d4950ab6c86391 Mon Sep 17 00:00:00 2001 From: Mike Donnalley Date: Tue, 28 Feb 2023 08:37:18 -0800 Subject: [PATCH] Mdonnalley/bugs (#1114) * fix: replace yarn scripts with npm if using npm * fix: remove LICENSE --- src/generators/cli.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/generators/cli.ts b/src/generators/cli.ts index 05b7a90a6..a8ca377f7 100644 --- a/src/generators/cli.ts +++ b/src/generators/cli.ts @@ -165,7 +165,7 @@ export default class CLI extends Generator { type: 'input', name: 'github.repo', message: 'What is the GitHub name of repository (https://github.com/owner/REPO)', - default: (answers: any) => (this.pjson.repository || answers.name || this.pjson.name).split('/').pop(), + default: (answers: any) => (answers.name || this.pjson.repository || this.pjson.name).split('/').pop(), }, { type: 'list', @@ -177,7 +177,7 @@ export default class CLI extends Generator { ], default: () => this.options.yarn || hasYarn ? 1 : 0, }, - ]) as any + ]) } debug(this.answers) @@ -209,6 +209,11 @@ export default class CLI extends Generator { this.pjson.oclif.dirname = this.answers.bin this.pjson.bin = {} this.pjson.bin[this.pjson.oclif.bin] = './bin/run' + + if (!this.options.yarn) { + const scripts = (this.pjson.scripts || {}) as Record + this.pjson.scripts = Object.fromEntries(Object.entries(scripts).map(([k, v]) => [k, v.replace('yarn', 'npm run')])) + } } writing(): void { @@ -221,6 +226,7 @@ export default class CLI extends Generator { this.fs.writeJSON(this.destinationPath('./package.json'), this.pjson) this.fs.write(this.destinationPath('.gitignore'), this._gitignore()) + this.fs.delete(this.destinationPath('LICENSE')) } end(): void {