This repository has been archived by the owner on Aug 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
201 additions
and
188 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
PATH=/usr/local/share/.config/yarn/global/node_modules/.bin:$PATH | ||
|
||
CLI_ENGINE_UTIL_YARN_ARGS="--frozen-lockfile" | ||
|
||
if [[ "$CIRCLE_BRANCH" == greenkeeper/* ]]; then | ||
CLI_ENGINE_GREENKEEPER_BRANCH=1 | ||
CLI_ENGINE_UTIL_YARN_ARGS="" | ||
if [[ ! -x "$(command -v greenkeeper-lockfile-update)" ]]; then | ||
yarn global add greenkeeper-lockfile@1 | ||
fi | ||
greenkeeper-lockfile-update | ||
fi | ||
|
||
yarn install $CLI_ENGINE_UTIL_YARN_ARGS | ||
|
||
if [[ "$CLI_ENGINE_GREENKEEPER_BRANCH" == 1 ]]; then | ||
greenkeeper-lockfile-upload | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,92 +1,44 @@ | ||
const { | ||
setColors, | ||
concurrent, | ||
crossEnv, | ||
ifNotWindows, | ||
ifWindows, | ||
mkdirp, | ||
series, | ||
setColors, | ||
} = require('nps-utils') | ||
const pjson = require('./package.json') | ||
const release = pjson.devDependencies.typedoc ? ['ci.release.semantic-release', 'ci.release.typedoc'] : ['ci.release.semantic-release'] | ||
const script = (script, description) => description ? {script, description} : {script} | ||
const hidden = script => ({script, hiddenFromHelp: true}) | ||
const unixOrWindows = (unix, windows) => series(ifNotWindows(unix), ifWindows(windows)) | ||
|
||
setColors(['dim']) | ||
|
||
let ciTests = [ | ||
'ci.test.eslint', | ||
'ci.test.mocha', | ||
'ci.test.tslint', | ||
] | ||
const script = (script, description) => description ? {script, description} : {script} | ||
|
||
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'), | ||
) | ||
), | ||
}, | ||
typedoc: hidden('typedoc --out /tmp/docs src/index.ts --excludeNotExported --mode file'), | ||
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', | ||
'nps ci.typedoc', | ||
'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', | ||
)), | ||
}, | ||
}, | ||
}, | ||
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'), | ||
} | ||
|
||
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} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
{ | ||
"extends": "../tsconfig", | ||
"include": [ | ||
"./**/*" | ||
"./**/*", | ||
"../src/**/*" | ||
] | ||
} |
Oops, something went wrong.