Skip to content
This repository has been archived by the owner on May 22, 2024. It is now read-only.

Commit

Permalink
chore: ran generator
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Jan 27, 2018
1 parent 6881e23 commit beb2b88
Show file tree
Hide file tree
Showing 10 changed files with 147 additions and 141 deletions.
31 changes: 19 additions & 12 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ jobs:
- checkout
- restore_cache: &restore_cache
keys:
- v0-yarn-{{ .Environment.CIRCLE_JOB }}-{{checksum ".circleci/config.yml"}}-{{ .Branch }}-{{checksum "yarn.lock"}}
- v0-yarn-{{ .Environment.CIRCLE_JOB }}-{{checksum ".circleci/config.yml"}}-{{ .Branch }}-
- v0-yarn-{{ .Environment.CIRCLE_JOB }}-{{checksum ".circleci/config.yml"}}-master-
- run: ./.circleci/setup_git
- run: ./.circleci/greenkeeper
- run: yarn exec nps ci.test
- 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
- store_test_results:
- store_test_results: &store_test_results
path: ~/cli/reports
- save_cache: &save_cache
key: v0-yarn-{{ .Environment.CIRCLE_JOB }}-{{checksum ".circleci/config.yml"}}-{{ .Branch }}-{{checksum "yarn.lock"}}
key: v0-yarn-{{checksum ".circleci/config.yml"}}-{{ .Branch }}-{{checksum "yarn.lock"}}
paths:
- ~/cli/node_modules
- /usr/local/share/.cache/yarn
Expand All @@ -28,16 +28,23 @@ jobs:
<<: *test
docker:
- image: node:8
steps:
- checkout
- restore_cache: *restore_cache
- run: .circleci/setup_git
- run: .circleci/yarn
- run: yarn test
- run: curl -s https://codecov.io/bash | bash
- store_test_results: *store_test_results
release:
<<: *test
steps:
- add_ssh_keys
- checkout
- restore_cache: *restore_cache
- run: ./.circleci/setup_git
- run: yarn --frozen-lockfile
- run: yarn exec nps ci.release
- save_cache: *save_cache
- run: .circleci/setup_git
- run: .circleci/yarn
- run: yarn exec nps release

workflows:
version: 2
Expand Down
2 changes: 1 addition & 1 deletion .circleci/setup_git
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -e
if [[ ! -z "$GIT_EMAIL" ]] & [[ ! -z "$GIT_USERNAME" ]]; then
git config --global push.default simple
git config --global user.email "$GIT_EMAIL"
git config --global user.user "$GIT_USERNAME"
git config --global user.name "$GIT_USERNAME"
fi

git submodule sync
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ install:
- git config --global user.name "dxcli"
- yarn
test_script:
- .\node_modules\.bin\nps ci.test
- yarn test
after_test:
- ps: |
$env:PATH = 'C:\msys64\usr\bin;' + $env:PATH
Expand Down
112 changes: 34 additions & 78 deletions package-scripts.js
Original file line number Diff line number Diff line change
@@ -1,88 +1,44 @@
const {
setColors,
concurrent,
crossEnv,
mkdirp,
series,
ifWindows,
ifNotWindows,
} = require('nps-utils')
const pjson = require('./package.json')
const release = pjson.devDependencies.typedoc ? ['ci.release.semantic-release', 'ci.release.typedoc'] : ['ci.release.semantic-release']

setColors(['dim'])

const script = (script, description) => description ? {script, description} : {script}
const hidden = script => ({script, hiddenFromHelp: true})
const unixOrWindows = (unix, windows) => series(ifNotWindows(unix), ifWindows(windows))

let ciTests = [
'ci.test.eslint',
'ci.test.mocha',
'ci.test.tslint',
]
const linters = {
eslint: script('eslint .', 'lint js files'),
commitlint: script('commitlint --from origin/master', 'ensure that commits are in valid conventional-changelog format'),
tsc: script('tsc -p test --noEmit', 'syntax check with tsc'),
tslint: script('tslint -p test', 'lint ts files'),
}

const scripts = {
...linters,
lint: concurrent(linters),
test: script(concurrent.nps(...Object.keys(linters), 'mocha'), 'lint and run all tests'),
mocha: script('mocha --forbid-only "test/**/*.test.ts"', 'run all mocha tests'),
}

module.exports = {
scripts: {
build: 'rm -rf lib && tsc',
lint: {
default: concurrent.nps('lint.eslint', 'lint.commitlint', 'lint.tsc', 'lint.tslint'),
eslint: script('eslint .', 'lint js files'),
commitlint: script('commitlint --from origin/master', 'ensure that commits are in valid conventional-changelog format'),
tsc: script('tsc -p test --noEmit', 'syntax check with tsc'),
tslint: script('tslint -p test', 'lint ts files'),
},
test: {
default: script(concurrent.nps('lint', 'test.mocha'), 'lint and run all tests'),
series: script(series.nps('lint', 'test.mocha'), 'lint and run all tests in series'),
mocha: {
default: script('mocha --forbid-only "test/**/*.test.ts"', 'run all mocha tests'),
coverage: {
default: hidden(series.nps('test.mocha.nyc nps test.mocha', 'test.mocha.coverage.report')),
report: hidden(series('nps "test.mocha.nyc report --reporter text-lcov" > coverage.lcov')),
},
junit: hidden(series(
crossEnv('MOCHA_FILE="reports/mocha.xml" ') + series.nps('test.mocha.nyc nps \\"test.mocha --reporter mocha-junit-reporter\\"'),
series.nps('test.mocha.coverage.report'),
)),
nyc: hidden('nyc --nycrc-path node_modules/@dxcli/dev-nyc-config/.nycrc'),
},
},
ci: {
test: {
default: hidden(series(
mkdirp('reports'),
unixOrWindows(
concurrent.nps(...ciTests),
series.nps(...ciTests),
),
)),
mocha: hidden(
unixOrWindows(
series.nps('test.mocha.junit'),
series.nps('test.mocha.coverage'),
)
),
eslint: hidden(
unixOrWindows(
series.nps('lint.eslint --format junit --output-file reports/eslint.xml'),
series.nps('lint.eslint'),
)
),
tslint: hidden(
unixOrWindows(
series.nps('lint.tslint --format junit > reports/tslint.xml'),
series.nps('lint.tslint'),
)
),
},
release: {
default: hidden(series.nps(...release)),
'semantic-release': hidden('semantic-release -e @dxcli/dev-semantic-release'),
typedoc: hidden(series(
'git clone -b gh-pages $CIRCLE_REPOSITORY_URL gh-pages',
'typedoc --out /tmp/docs src/index.ts --excludeNotExported --mode file',
'rm -rf ./gh-pages/*',
'mv /tmp/docs/* ./gh-pages',
'cd gh-pages && git add . && git commit -m "updates from $CIRCLE_SHA1 [skip ci]" && git push',
)),
},
},
},
if (process.env.CI) {
if (process.env.CIRCLECI) {
scripts.test.script = series(mkdirp('reports'), scripts.test.script)
// add mocha junit reporter
scripts.mocha.script = crossEnv(`MOCHA_FILE=reports/mocha.xml ${scripts.mocha.script} --reporter mocha-junit-reporter`)
// add eslint reporter
scripts.eslint.script = `${scripts.eslint.script} --format junit --output-file reports/eslint.xml`
// add tslint reporter
scripts.tslint.script = `${scripts.tslint.script} --format junit > reports/tslint.xml`
scripts.release = 'semantic-release -e @dxcli/dev-semantic-release'
}
// add code coverage reporting with nyc
const nyc = 'nyc --nycrc-path node_modules/@dxcli/dev-nyc-config/.nycrc'
const nycReport = `${nyc} report --reporter text-lcov > coverage.lcov`
scripts.mocha.script = series(`${nyc} ${scripts.mocha.script}`, nycReport)
}

module.exports = {scripts}
25 changes: 5 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,17 @@
"stdout-stderr": "^0.1.4"
},
"devDependencies": {
"@dxcli/dev-nyc-config": "^0.0.3",
"@dxcli/dev-semantic-release": "^0.1.0",
"@dxcli/dev-tslint": "^0.0.17",
"@types/chai": "^4.1.2",
"@types/chai-as-promised": "^7.1.0",
"@types/lodash": "^4.14.97",
"@types/mocha": "^2.2.47",
"@types/nock": "^9.1.2",
"@types/node": "^9.4.0",
"@dxcli/dev": "^2.0.4",
"@types/sinon": "^4.1.3",
"chai": "^4.1.2",
"chai-as-promised": "^7.1.1",
"chalk": "^2.3.0",
"eslint": "^4.16.0",
"eslint-config-dxcli": "^1.1.4",
"http-call": "^5.0.2",
"husky": "^0.14.3",
"mocha": "^5.0.0",
"mocha-junit-reporter": "^1.17.0",
"nock": "^9.1.6",
"nps": "^5.7.1",
"nps-utils": "^1.5.0",
"nyc": "^11.4.1",
"sinon": "^4.2.2",
"ts-node": "^4.1.0",
"typescript": "^2.6.2"
"sinon": "^4.2.2"
},
"engines": {
"node": ">=8.0.0"
Expand All @@ -51,9 +36,9 @@
"repository": "jdxcode/fancy-test",
"scripts": {
"commitmsg": "dxcli-dev-commitmsg",
"precommit": "nps lint",
"prepare": "nps build",
"test": "nps test"
"precommit": "nps lint -l warn",
"prepare": "rm -rf lib && tsc",
"test": "nps test -l warn"
},
"types": "lib/index.d.ts"
}
1 change: 1 addition & 0 deletions test/helpers/init.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
process.env.TS_NODE_PROJECT = 'test'
7 changes: 2 additions & 5 deletions test/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
{
"extends": "../tsconfig",
"compilerOptions": {
"rootDir": ".."
},
"include": [
"../src/**/*",
"../test/**/*"
"./**/*",
"../src/**/*"
]
}
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"target": "esnext"
},
"include": [
"src/**/*"
"./src/**/*"
]
}
Loading

0 comments on commit beb2b88

Please sign in to comment.