Skip to content

Commit

Permalink
fix: add peerDependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Jan 28, 2018
1 parent cfa09cb commit 7be5fd1
Show file tree
Hide file tree
Showing 5 changed files with 156 additions and 466 deletions.
2 changes: 1 addition & 1 deletion package-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ module.exports = {
default: series.nps(...testTypes.map(t => `test.${t}`)),
..._.fromPairs(tests),
},
release: hidden('semantic-release -e @dxcli/dev-semantic-release'),
release: hidden('semantic-release -e @dxcli/semantic-release'),
},
}
18 changes: 12 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
"bin": "bin/run",
"bugs": "https://github.com/dxcli/create-dxcli/issues",
"dependencies": {
"@dxcli/command": "^0.1.19",
"@dxcli/command": "^0.1.22",
"@dxcli/config": "^0.1.27",
"@dxcli/engine": "^0.1.12",
"@dxcli/parser": "^0.0.5",
"@dxcli/version": "^0.1.6",
"cli-ux": "^3.2.1",
"cli-ux": "^3.2.2",
"debug": "^3.1.0",
"fixpack": "^2.3.1",
"lodash": "^4.17.4",
Expand All @@ -19,19 +21,23 @@
"yosay": "^2.0.1"
},
"devDependencies": {
"@dxcli/dev": "^2.0.4",
"@dxcli/dev-test": "^0.9.11",
"@dxcli/dev": "^2.0.9",
"@dxcli/dev-test": "^0.9.12",
"@dxcli/dev-tslint": "^0.0.19",
"@dxcli/semantic-release": "^0.2.4",
"@semantic-release/exec": "^2.0.0",
"@types/shelljs": "^0.7.7",
"@types/yeoman-generator": "^2.0.1",
"@types/yosay": "^0.0.29",
"eslint": "^4.16.0",
"husky": "^0.14.3",
"mocha": "^5.0.0",
"mocha-junit-reporter": "^1.17.0",
"npm-run-path": "^2.0.2",
"nps": "^5.7.1",
"nps-utils": "^1.5.0",
"shelljs": "^0.8.1"
"shelljs": "^0.8.1",
"typescript": "^2.6.2"
},
"dxcli": {
"commands": "./lib/commands",
Expand All @@ -55,7 +61,7 @@
"main": "lib/index.js",
"repository": "dxcli/create-dxcli",
"scripts": {
"commitmsg": "dxcli-dev-commitmsg",
"commitmsg": "dxcli-commitlint",
"precommit": "nps lint -l warn",
"prepare": "rm -rf lib && tsc",
"test": "nps test -l warn"
Expand Down
66 changes: 37 additions & 29 deletions src/generators/app/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ class App extends Generator {
message: 'components to include',
choices: [
{name: 'typescript', checked: this.fromScratch ? false : !!this.pjson.devDependencies.typescript},
{name: 'semantic-release', checked: this.fromScratch ? false : !!this.pjson.devDependencies['@dxcli/dev-semantic-release']},
{name: 'semantic-release', checked: this.fromScratch ? false : !!this.pjson.devDependencies['@dxcli/semantic-release']},
{name: 'mocha', checked: this.fromScratch ? false : !!this.pjson.devDependencies.mocha},
],
filter: ((arr: string[]) => _.keyBy(arr)) as any,
Expand Down Expand Up @@ -227,7 +227,7 @@ class App extends Generator {
this.pjson.scripts.prepare = defaults.scripts.prepare || 'rm -rf lib && tsc'
}
if (this.semantic_release) {
this.pjson.scripts.commitmsg = defaults.scripts.commitmsg || 'dxcli-dev-commitmsg'
this.pjson.scripts.commitmsg = defaults.scripts.commitmsg || 'dxcli-commitlint'
}
}

Expand Down Expand Up @@ -307,38 +307,46 @@ class App extends Generator {
'husky',
'eslint',
]
if (this.mocha) {
if (this.type !== 'multi') devDependencies.push('@dxcli/engine')
}
if (this.semantic_release) {
devDependencies.push('@dxcli/dev-semantic-release')
}
devDependencies.push(
'@dxcli/dev-test',
'mocha',
'chai',
)
if (this.ts) {
devDependencies.push(
'@dxcli/config',
'typescript',
)
}
if (this.type === 'multi') {
dependencies.push(
'@dxcli/engine',
'@dxcli/version',
)
}
if (this.type === 'plugin') {
devDependencies.push('@dxcli/engine')
}
if (['plugin', 'single', 'multi'].includes(this.type)) {
switch (this.type) {
case 'base': break
case 'single':
dependencies.push(
'@dxcli/parser',
'@dxcli/config',
'@dxcli/command',
'cli-ux',
)
break
case 'plugin':
dependencies.push(
'@dxcli/config',
'@dxcli/parser',
'@dxcli/command',
'cli-ux',
)
devDependencies.push(
'@dxcli/engine',
)
break
case 'multi':
dependencies.push(
'@dxcli/engine',
'@dxcli/parser',
'@dxcli/config',
'@dxcli/command',
'@dxcli/version',
'cli-ux',
)
}
if (this.mocha) {
devDependencies.push('mocha', 'chai')
if (this.type !== 'base') devDependencies.push(
'@dxcli/dev-test',
'@dxcli/dev-tslint',
)
}
if (this.semantic_release) devDependencies.push('@dxcli/semantic-release')
if (this.ts) devDependencies.push('typescript', 'ts-node')
Promise.all([
this.yarnInstall(devDependencies, {dev: true, ignoreScripts: true}),
this.yarnInstall(dependencies),
Expand Down
4 changes: 2 additions & 2 deletions templates/app/package-scripts.js.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ if (process.env.CI) {
// add tslint reporter
scripts.tslint.script = `${scripts.tslint.script} --format junit > reports/tslint.xml`
<%_ } _%>
scripts.release = 'semantic-release -e @dxcli/dev-semantic-release'
scripts.release = 'semantic-release -e @dxcli/semantic-release'
}
// add code coverage reporting with nyc
const nyc = 'nyc --nycrc-path node_modules/@dxcli/dev-nyc-config/.nycrc'
Expand All @@ -60,7 +60,7 @@ if (process.env.CI) {
<%_ } else if (mocha) { _%>
if (process.env.CI) {
if (process.env.CIRCLECI) {
scripts.release = 'semantic-release -e @dxcli/dev-semantic-release'
scripts.release = 'semantic-release -e @dxcli/semantic-release'
}
}
Expand Down

0 comments on commit 7be5fd1

Please sign in to comment.