Skip to content

Commit

Permalink
feat: add manifest to package
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Feb 2, 2018
1 parent 5f572a5 commit 2fc517c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/generators/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import * as path from 'path'
import * as Generator from 'yeoman-generator'
import yosay = require('yosay')

const nps = require('nps-utils')
const sortPjson = require('sort-pjson')
const fixpack = require('fixpack')
const debug = require('debug')('generator-anycli')
Expand Down Expand Up @@ -243,6 +244,9 @@ class App extends Generator {
this.pjson.scripts.build = 'rm -rf lib && tsc'
this.pjson.scripts.prepublishOnly = 'yarn run build'
}
if (['plugin', 'multi'].includes(this.type)) {
this.pjson.scripts.prepublishOnly = nps.series(this.pjson.scripts.prepublishOnly, 'anycli-dev manifest > .anycli.manifest.json')
}
this.pjson.keywords = defaults.keywords || [this.type === 'plugin' ? 'anycli-plugin' : 'anycli']
this.pjson.homepage = defaults.homepage || `https://github.com/${this.pjson.repository}`
this.pjson.bugs = defaults.bugs || `https://github.com/${this.pjson.repository}/issues`
Expand Down Expand Up @@ -368,13 +372,15 @@ class App extends Generator {
'cli-ux',
)
devDependencies.push(
'@anycli/dev-cli',
'@anycli/engine',
'@anycli/config',
'@anycli/plugin-help',
)
break
case 'multi':
dependencies.push(
'@anycli/dev-cli',
'@anycli/engine',
'@anycli/config',
'@anycli/command',
Expand Down
3 changes: 3 additions & 0 deletions test/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ module.exports = file => {
sh.exec('yarn test')
sh.exec('node ./bin/run')
sh.exec('node ./bin/run --help')
sh.exec('yarn run prepublishOnly')
break
case 'single':
build(cmd, name)
Expand All @@ -70,6 +71,7 @@ module.exports = file => {
sh.exec('node ./bin/run hello')
sh.exec('node ./bin/run help hello')
sh.exec('node ./bin/run hello --help')
sh.exec('yarn run prepublishOnly')
break
case 'command':
build('plugin', name)
Expand All @@ -79,6 +81,7 @@ module.exports = file => {
sh.exec('node ./bin/run foo:bar:baz')
sh.exec('node ./bin/run help foo:bar:baz')
sh.exec('node ./bin/run foo:bar:baz --help')
sh.exec('yarn run prepublishOnly')
break
}
})
Expand Down

0 comments on commit 2fc517c

Please sign in to comment.