fix: show full path to file
MODIFY
templates/src/command.js.ejs
templates/src/command.js.ejs
@@ -5,7 +5,7 @@ class <%- klass %> extends Command {
async run() {
const {flags} = this.parse(<%- klass %>)
const name = flags.name || 'world'
- this.log(`hello ${name} from ./src/<%- name %>.js!`)
+ this.log(`hello ${name} from ${__filename}!`)
}
}

MODIFY
templates/src/command.ts.ejs
templates/src/command.ts.ejs
@@ -36,7 +36,7 @@ hello myname from .src/<%- name %>.ts!
const {args, flags} = this.parse(<%- klass %>)
const name = flags.name || 'world'
- this.log(`hello ${name} from ./src/<%- name %>.ts!`)
+ this.log(`hello ${name} from ${__filename}!`)
if (args.file && flags.force) {
this.log(`you input --force and --file: ${args.file}`)
}

MODIFY
templates/test/command.test.js.ejs
templates/test/command.test.js.ejs
@@ -12,7 +12,7 @@ describe('<%- name %>', () => {
.command(['<%- name %>'])
<%_ } _%>
.it('runs hello', ctx => {
- expect(ctx.stdout).to.contain('hello world from ./src/<%- name %>.js!')
+ expect(ctx.stdout).to.contain('hello world')
})
test
@@ -23,6 +23,6 @@ describe('<%- name %>', () => {
.command(['<%- name %>', '--name', 'jeff'])
<%_ } _%>
.it('runs hello --name jeff', ctx => {
- expect(ctx.stdout).to.contain('hello jeff from ./src/<%- name %>.js!')
+ expect(ctx.stdout).to.contain('hello jeff')
})
})

MODIFY
templates/test/command.test.ts.ejs
templates/test/command.test.ts.ejs
@@ -13,7 +13,7 @@ describe('<%- name %>', () => {
.command(['<%- name %>'])
<%_ } _%>
.it('runs hello', ctx => {
- expect(ctx.stdout).to.contain('hello world from ./src/<%- name %>.ts!')
+ expect(ctx.stdout).to.contain('hello world')
})
test
@@ -24,6 +24,6 @@ describe('<%- name %>', () => {
.command(['<%- name %>', '--name', 'jeff'])
<%_ } _%>
.it('runs hello --name jeff', ctx => {
- expect(ctx.stdout).to.contain('hello jeff from ./src/<%- name %>.ts!')
+ expect(ctx.stdout).to.contain('hello jeff')
})
})

MODIFY
test/run.js
test/run.js
@@ -52,6 +52,7 @@ module.exports = file => {
case 'plugin':
build(cmd, name)
sh.exec('yarn test')
+ sh.exec('node ./bin/run hello')
sh.exec('node ./bin/run')
sh.exec('node ./bin/run --help')
sh.exec('yarn run prepublishOnly')

fix: show full path to file