Skip to content

Commit

Permalink
fix: reduce dependencies needed in dev
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Jan 30, 2018
1 parent 035bd77 commit 2a0bbad
Show file tree
Hide file tree
Showing 13 changed files with 144 additions and 1,412 deletions.
4 changes: 1 addition & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,7 @@ jobs:
- add_ssh_keys
- checkout
- restore_cache: *restore_cache
- run: .circleci/yarn
- run: .circleci/setup_git
- run: ./node_modules/.bin/nps release
- run: .circleci/release

workflows:
version: 2
Expand Down
11 changes: 11 additions & 0 deletions .circleci/release
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash

set -ex

.circleci/setup_git

PATH=/usr/local/share/.config/yarn/global/node_modules/.bin:$PATH

yarn global add -D @dxcli/semantic-release@1
yarn install --frozen-lockfile
yarn exec nps release
2 changes: 1 addition & 1 deletion .circleci/setup_git
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

set -e
set -ex

if [[ ! -z "$GIT_EMAIL" ]] & [[ ! -z "$GIT_USERNAME" ]]; then
git config --global push.default simple
Expand Down
4 changes: 2 additions & 2 deletions .circleci/yarn
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

set -e
set -ex

PATH=/usr/local/share/.config/yarn/global/node_modules/.bin:$PATH

Expand All @@ -15,7 +15,7 @@ if [[ "$CIRCLE_BRANCH" == greenkeeper/* ]]; then
greenkeeper-lockfile-update
fi

yarn install $CLI_ENGINE_UTIL_YARN_ARGS "$@"
yarn install $CLI_ENGINE_UTIL_YARN_ARGS

if [[ "$CLI_ENGINE_GREENKEEPER_BRANCH" == 1 ]]; then
greenkeeper-lockfile-upload
Expand Down
4 changes: 2 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/examples
/lib
/tmp
/templates
/examples
/tmp
12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,18 @@
"yosay": "^2.0.1"
},
"devDependencies": {
"@commitlint/cli": "^6.0.2",
"@commitlint/config-conventional": "^6.0.2",
"@dxcli/dev": "^2.0.16",
"@dxcli/semantic-release": "^1.0.0",
"@dxcli/test": "^0.9.19",
"@dxcli/nyc-config": "^0.0.4",
"@dxcli/tslint": "^0.1.3",
"@semantic-release/exec": "^2.0.0",
"@types/shelljs": "^0.7.7",
"@types/yeoman-generator": "^2.0.1",
"@types/yosay": "^0.0.29",
"chai": "^4.1.2",
"eslint": "^4.16.0",
"execa": "^0.9.0",
"fancy-test": "^0.6.5",
"fs-extra": "^5.0.0",
"husky": "^0.14.3",
"mocha": "^5.0.0",
Expand Down Expand Up @@ -64,9 +66,9 @@
"main": "lib/index.js",
"repository": "dxcli/create-dxcli",
"scripts": {
"commitmsg": "dxcli-commitlint",
"commitmsg": "commitlint -x @commitlint/config-conventional -e $GIT_PARAMS",
"precommit": "nps lint -l warn",
"prepublishOnly": "rm -rf lib && tsc",
"prepublishOnly": "nps build",
"test": "nps test -l warn"
},
"types": "lib/index.d.ts"
Expand Down
19 changes: 16 additions & 3 deletions src/generators/app/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,9 @@ class App extends Generator {
name: 'options',
message: 'components to include',
choices: [
{name: 'mocha', checked: this.fromScratch ? false : !!this.pjson.devDependencies.mocha},
{name: 'typescript', checked: this.fromScratch ? false : !!this.pjson.devDependencies.typescript},
{name: 'semantic-release', checked: this.fromScratch ? false : !!this.pjson.scripts.commitmsg},
{name: 'mocha', checked: this.fromScratch ? false : !!this.pjson.devDependencies.mocha},
],
filter: ((arr: string[]) => _.keyBy(arr)) as any,
},
Expand Down Expand Up @@ -266,7 +266,10 @@ class App extends Generator {
}
this.fs.writeJSON(this.destinationPath('./package.json'), sortPjson(this.pjson))
this.fs.copyTpl(this.templatePath('editorconfig'), this.destinationPath('.editorconfig'), this)
this.fs.copyTpl(this.templatePath('scripts/yarn'), this.destinationPath('.circleci/yarn'), this)
this.fs.copyTpl(this.templatePath('scripts/test'), this.destinationPath('.circleci/test'), this)
if (this.semantic_release) {
this.fs.copyTpl(this.templatePath('scripts/release'), this.destinationPath('.circleci/release'), this)
}
this.fs.copyTpl(this.templatePath('scripts/setup_git'), this.destinationPath('.circleci/setup_git'), this)
this.fs.copyTpl(this.templatePath('README.md.ejs'), this.destinationPath('README.md'), this)
this.fs.copyTpl(this.templatePath('circle.yml.ejs'), this.destinationPath('.circleci/config.yml'), this)
Expand Down Expand Up @@ -299,11 +302,11 @@ class App extends Generator {
install() {
const dependencies: string[] = []
const devDependencies = [
'@dxcli/dev',
'nps',
'nps-utils',
'husky',
'eslint',
'eslint-config-dxcli',
]
switch (this.type) {
case 'base': break
Expand Down Expand Up @@ -349,6 +352,16 @@ class App extends Generator {
}
if (this.ts) {
devDependencies.push(
// '@types/ansi-styles',
'@types/chai',
'@types/lodash',
'@types/mocha',
'@types/nock',
'@types/node',
'@types/node-notifier',
'@types/read-pkg',
// '@types/strip-ansi',
// '@types/supports-color',
'typescript',
'ts-node',
'@dxcli/tslint',
Expand Down
15 changes: 3 additions & 12 deletions templates/circle.yml.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ jobs:
- v0-yarn-{{checksum ".circleci/config.yml"}}-{{ .Branch }}-{{checksum "yarn.lock"}}
- v0-yarn-{{checksum ".circleci/config.yml"}}-{{ .Branch }}-
- v0-yarn-{{checksum ".circleci/config.yml"}}-master-
- run: .circleci/setup_git
- run: .circleci/yarn
- run: yarn test
- run: curl -s https://codecov.io/bash | bash
- run: .circleci/test
- store_test_results: &store_test_results
path: ~/cli/reports
- save_cache: &save_cache
Expand All @@ -31,10 +28,7 @@ jobs:
steps:
- checkout
- restore_cache: *restore_cache
- run: .circleci/setup_git
- run: .circleci/yarn
- run: yarn test
- run: curl -s https://codecov.io/bash | bash
- run: .circleci/test
- store_test_results: *store_test_results
<%_ if (semantic_release) { _%>
release:
Expand All @@ -43,10 +37,7 @@ jobs:
- add_ssh_keys
- checkout
- restore_cache: *restore_cache
- run: .circleci/setup_git
- run: .circleci/yarn
- run: yarn add -D @dxcli/semantic-release@1
- run: yarn exec nps release
- run: .circleci/release
<%_ } _%>

workflows:
Expand Down
8 changes: 6 additions & 2 deletions templates/command.ts.ejs
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import {Command, flags} from '@dxcli/command'
import cli from 'cli-ux'
<%_ const klass = _.upperFirst(_.camelCase(name)) _%>

export default class <%- _.upperFirst(_.camelCase(name)) %> extends Command {
static flags = {
export default class <%- klass %> extends Command {
static flags: flags.Input<<%- klass %>['flags']> = {
name: flags.string({char: 'n', description: 'name to print'})
}
flags: {
name?: string
}

async run() {
const name = this.flags.name || 'world'
Expand Down
11 changes: 11 additions & 0 deletions templates/scripts/release
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash

set -ex

.circleci/setup_git

PATH=/usr/local/share/.config/yarn/global/node_modules/.bin:$PATH

yarn global add -D @dxcli/semantic-release@1
yarn install --frozen-lockfile
yarn exec nps release
7 changes: 7 additions & 0 deletions templates/scripts/yarn → templates/scripts/test
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

set -ex

.circleci/setup_git

PATH=/usr/local/share/.config/yarn/global/node_modules/.bin:$PATH

CLI_ENGINE_UTIL_YARN_ARGS="--frozen-lockfile"
Expand All @@ -20,3 +22,8 @@ yarn install $CLI_ENGINE_UTIL_YARN_ARGS
if [[ "$CLI_ENGINE_GREENKEEPER_BRANCH" == 1 ]]; then
greenkeeper-lockfile-upload
fi

yarn add nyc
yarn test

curl -s https://codecov.io/bash | bash
4 changes: 2 additions & 2 deletions test/run.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const {test} = require('@dxcli/test')
const {fancy} = require('fancy-test')
const path = require('path')
const sh = require('shelljs')
const npmPath = require('npm-run-path')
Expand Down Expand Up @@ -38,7 +38,7 @@ module.exports = file => {
const cmd = path.basename(f.dir)

describe(cmd, () => {
test
fancy
.retries(CI ? 1 : 0)
.do(() => {
switch (cmd) {
Expand Down

0 comments on commit 2a0bbad

Please sign in to comment.