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 {