Skip to content

Commit

Permalink
Mdonnalley/bugs (#1114)
Browse files Browse the repository at this point in the history
* fix: replace yarn scripts with npm if using npm

* fix: remove LICENSE
  • Loading branch information
mdonnalley committed Feb 28, 2023
1 parent 10554bd commit 0f04e1e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/generators/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -177,7 +177,7 @@ export default class CLI extends Generator {
],
default: () => this.options.yarn || hasYarn ? 1 : 0,
},
]) as any
])
}

debug(this.answers)
Expand Down Expand Up @@ -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<string, string>
this.pjson.scripts = Object.fromEntries(Object.entries(scripts).map(([k, v]) => [k, v.replace('yarn', 'npm run')]))
}
}

writing(): void {
Expand All @@ -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 {
Expand Down

0 comments on commit 0f04e1e

Please sign in to comment.