Skip to content
This repository was archived by the owner on Aug 22, 2023. It is now read-only.

Commit 92abb15

Browse files
committed
fix: ran generator
1 parent 3eb59cb commit 92abb15

11 files changed

+118
-98
lines changed

.circleci/config.yml

+11-6
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,17 @@ jobs:
99
- checkout
1010
- restore_cache: &restore_cache
1111
keys:
12-
- v0-yarn-{{ .Environment.CIRCLE_JOB }}-{{checksum ".circleci/test"}}-{{checksum ".circleci/config.yml"}}-{{ .Branch }}-{{checksum "yarn.lock"}}
13-
- v0-yarn-{{ .Environment.CIRCLE_JOB }}-{{checksum ".circleci/test"}}-{{checksum ".circleci/config.yml"}}-{{ .Branch }}-
14-
- v0-yarn-{{ .Environment.CIRCLE_JOB }}-{{checksum ".circleci/test"}}-{{checksum ".circleci/config.yml"}}-master-
15-
- run: ./.circleci/test
12+
- v0-yarn-{{ .Environment.CIRCLE_JOB }}-{{checksum ".circleci/config.yml"}}-{{ .Branch }}-{{checksum "yarn.lock"}}
13+
- v0-yarn-{{ .Environment.CIRCLE_JOB }}-{{checksum ".circleci/config.yml"}}-{{ .Branch }}-
14+
- v0-yarn-{{ .Environment.CIRCLE_JOB }}-{{checksum ".circleci/config.yml"}}-master-
15+
- run: ./.circleci/setup_git
16+
- run: ./.circleci/greenkeeper
17+
- run: yarn exec nps ci.test
18+
- run: curl -s https://codecov.io/bash | bash
1619
- store_test_results:
1720
path: ~/cli/reports
1821
- save_cache: &save_cache
19-
key: v0-yarn-{{ .Environment.CIRCLE_JOB }}-{{checksum ".circleci/test"}}-{{checksum ".circleci/config.yml"}}-{{ .Branch }}-{{checksum "yarn.lock"}}
22+
key: v0-yarn-{{ .Environment.CIRCLE_JOB }}-{{checksum ".circleci/config.yml"}}-{{ .Branch }}-{{checksum "yarn.lock"}}
2023
paths:
2124
- ~/cli/node_modules
2225
- /usr/local/share/.cache/yarn
@@ -28,10 +31,12 @@ jobs:
2831
release:
2932
<<: *test
3033
steps:
34+
- add_ssh_keys
3135
- checkout
3236
- restore_cache: *restore_cache
37+
- run: ./.circleci/setup_git
3338
- run: yarn --frozen-lockfile
34-
- run: ./node_modules/.bin/nps ci.release
39+
- run: yarn exec nps ci.release
3540
- save_cache: *save_cache
3641

3742
workflows:
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,9 @@
11
#!/usr/bin/env bash
22

3-
set -ex
3+
set -e
44

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

7-
if [[ ! -z "$GIT_EMAIL" ]] & [[ ! -z "$GIT_USERNAME" ]]; then
8-
git config --global push.default simple
9-
git config --global user.email "$GIT_EMAIL"
10-
git config --global user.user "$GIT_USERNAME"
11-
fi
12-
13-
git submodule sync
14-
git submodule update --init --recursive
15-
167
CLI_ENGINE_UTIL_YARN_ARGS="--frozen-lockfile"
178

189
if [[ "$CIRCLE_BRANCH" == greenkeeper/* ]]; then
@@ -29,7 +20,3 @@ yarn install $CLI_ENGINE_UTIL_YARN_ARGS
2920
if [[ "$CLI_ENGINE_GREENKEEPER_BRANCH" == 1 ]]; then
3021
greenkeeper-lockfile-upload
3122
fi
32-
33-
mkdir -p reports
34-
./node_modules/.bin/nps ci
35-
curl -s https://codecov.io/bash | bash

.circleci/setup_git

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
if [[ ! -z "$GIT_EMAIL" ]] & [[ ! -z "$GIT_USERNAME" ]]; then
6+
git config --global push.default simple
7+
git config --global user.email "$GIT_EMAIL"
8+
git config --global user.user "$GIT_USERNAME"
9+
fi
10+
11+
git submodule sync
12+
git submodule update --init --recursive

appveyor.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ install:
1212
- git config --global user.name "dxcli"
1313
- yarn
1414
test_script:
15-
- yarn test
15+
- .\node_modules\.bin\nps ci.test
1616
after_test:
1717
- ps: |
1818
$env:PATH = 'C:\msys64\usr\bin;' + $env:PATH

package-scripts.js

+73-57
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,91 @@
1-
const {concurrent, series} = require('nps-utils')
1+
const {
2+
concurrent,
3+
crossEnv,
4+
ifNotWindows,
5+
ifWindows,
6+
mkdirp,
7+
series,
8+
setColors,
9+
} = require('nps-utils')
10+
const pjson = require('./package.json')
11+
const release = pjson.devDependencies.typedoc ? ['ci.release.semantic-release', 'ci.release.typedoc'] : ['ci.release.semantic-release']
12+
const script = (script, description) => description ? {script, description} : {script}
13+
const hidden = script => ({script, hiddenFromHelp: true})
14+
const unixOrWindows = (unix, windows) => series(ifNotWindows(unix), ifWindows(windows))
15+
16+
setColors(['dim'])
17+
18+
let ciTests = [
19+
'ci.test.eslint',
20+
'ci.test.mocha',
21+
'ci.test.tslint',
22+
]
223

324
module.exports = {
425
scripts: {
526
build: 'rm -rf lib && tsc',
627
lint: {
728
default: concurrent.nps('lint.eslint', 'lint.commitlint', 'lint.tsc', 'lint.tslint'),
8-
eslint: {
9-
script: 'eslint .',
10-
description: 'lint js files',
11-
},
12-
commitlint: {
13-
script: 'commitlint --from origin/master',
14-
description: 'ensure that commits are in valid conventional-changelog format',
15-
},
16-
tsc: {
17-
script: 'tsc -p test --noEmit',
18-
description: 'syntax check with tsc',
19-
},
20-
tslint: {
21-
script: 'tslint -p test',
22-
description: 'lint ts files',
23-
},
29+
eslint: script('eslint .', 'lint js files'),
30+
commitlint: script('commitlint --from origin/master', 'ensure that commits are in valid conventional-changelog format'),
31+
tsc: script('tsc -p test --noEmit', 'syntax check with tsc'),
32+
tslint: script('tslint -p test', 'lint ts files'),
2433
},
2534
test: {
26-
default: {
27-
script: concurrent.nps('lint', 'test.mocha'),
28-
description: 'lint and run all tests',
29-
},
35+
default: script(concurrent.nps('lint', 'test.mocha'), 'lint and run all tests'),
36+
series: script(series.nps('lint', 'test.mocha'), 'lint and run all tests in series'),
3037
mocha: {
31-
script: 'mocha "test/**/*.test.ts"',
32-
description: 'run all mocha tests',
38+
default: script('mocha --forbid-only "test/**/*.test.ts"', 'run all mocha tests'),
39+
coverage: {
40+
default: hidden(series.nps('test.mocha.nyc nps test.mocha', 'test.mocha.coverage.report')),
41+
report: hidden(series('nps "test.mocha.nyc report --reporter text-lcov" > coverage.lcov')),
42+
},
43+
junit: hidden(series(
44+
crossEnv('MOCHA_FILE="reports/mocha.xml" ') + series.nps('test.mocha.nyc nps \\"test.mocha --reporter mocha-junit-reporter\\"'),
45+
series.nps('test.mocha.coverage.report'),
46+
)),
47+
nyc: hidden('nyc --nycrc-path node_modules/@dxcli/dev-nyc-config/.nycrc'),
3348
},
3449
},
3550
ci: {
36-
default: {
37-
script: concurrent.nps(
38-
'ci.mocha',
39-
'ci.eslint',
40-
'ci.tslint',
51+
test: {
52+
default: hidden(series(
53+
mkdirp('reports'),
54+
unixOrWindows(
55+
concurrent.nps(...ciTests),
56+
series.nps(...ciTests),
57+
),
58+
)),
59+
mocha: hidden(
60+
unixOrWindows(
61+
series.nps('test.mocha.junit'),
62+
series.nps('test.mocha.coverage'),
63+
)
64+
),
65+
eslint: hidden(
66+
unixOrWindows(
67+
series.nps('lint.eslint --format junit --output-file reports/eslint.xml'),
68+
series.nps('lint.eslint'),
69+
)
70+
),
71+
tslint: hidden(
72+
unixOrWindows(
73+
series.nps('lint.tslint --format junit > reports/tslint.xml'),
74+
series.nps('lint.tslint'),
75+
)
4176
),
42-
hiddenFromHelp: true,
43-
},
44-
mocha: {
45-
default: {
46-
script: series.nps('ci.mocha.test', 'ci.mocha.report'),
47-
hiddenFromHelp: true,
48-
},
49-
test: {
50-
script: 'MOCHA_FILE="reports/mocha.xml" nps "ci.mocha.nyc nps \\"test.mocha --reporter mocha-junit-reporter\\""',
51-
hiddenFromHelp: true,
52-
},
53-
report: {
54-
script: series.nps('ci.mocha.nyc report --reporter text-lcov > coverage.lcov'),
55-
hiddenFromHelp: true,
56-
},
57-
nyc: {
58-
script: 'nyc --nycrc-path node_modules/@dxcli/dev-nyc-config/.nycrc',
59-
hiddenFromHelp: true,
60-
},
61-
},
62-
eslint: {
63-
script: series.nps('lint.eslint --format junit --output-file reports/eslint.xml'),
64-
hiddenFromHelp: true,
65-
},
66-
tslint: {
67-
script: series.nps('lint.tslint --format junit > reports/tslint.xml'),
68-
hiddenFromHelp: true,
6977
},
78+
typedoc: hidden('typedoc --out /tmp/docs src/index.ts --excludeNotExported --mode file'),
7079
release: {
71-
script: 'yarn --frozen-lockfile && dxcli-dev-semantic-release',
72-
hiddenFromHelp: true,
80+
default: hidden(series.nps(...release)),
81+
'semantic-release': hidden('semantic-release -e @dxcli/dev-semantic-release'),
82+
typedoc: hidden(series(
83+
'git clone -b gh-pages $CIRCLE_REPOSITORY_URL gh-pages',
84+
'nps ci.typedoc',
85+
'rm -rf ./gh-pages/*',
86+
'mv /tmp/docs/* ./gh-pages',
87+
'cd gh-pages && git add . && git commit -m "updates from $CIRCLE_SHA1 [skip ci]" && git push',
88+
)),
7389
},
7490
},
7591
},

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@
1111
"debug": "^3.1.0"
1212
},
1313
"devDependencies": {
14+
"@dxcli/dev-nyc-config": "^0.0.3",
1415
"@dxcli/dev-semantic-release": "^0.1.0",
1516
"@dxcli/dev-test": "^0.9.2",
1617
"@dxcli/dev-tslint": "^0.0.15",
1718
"@types/chai": "^4.1.2",
19+
"@types/lodash": "^4.14.96",
1820
"@types/mocha": "^2.2.47",
1921
"@types/nock": "^9.1.2",
2022
"@types/node": "^9.3.0",

src/command.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ export interface ICommandClass<T extends Command> {
1313
new (): T
1414
}
1515

16+
const g = global as any
17+
1618
const parentModule = module.parent && module.parent.parent && module.parent.parent.filename
1719

1820
export default abstract class Command {
@@ -80,8 +82,8 @@ export default abstract class Command {
8082

8183
protected async init(argv: string[], opts: Config.ICommandOptions) {
8284
this.config = opts.config || await Config.read({root: opts.root || parentModule!})
83-
global['http-call'] = global['http-call'] || {}
84-
global['http-call']!.userAgent = this.config.userAgent
85+
g['http-call'] = g['http-call'] || {}
86+
g['http-call']!.userAgent = this.config.userAgent
8587
this.debug = require('debug')(`cli:command:${this.ctor.id || this.config.name}`)
8688
this.debug('init version: %s argv: %o', this.ctor._base, argv)
8789
cli.config.errlog = this.config.errlog

src/global.d.ts

-9
This file was deleted.

test/tsconfig.json

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
{
22
"extends": "../tsconfig",
3-
"compilerOptions": {
4-
"rootDir": ".."
5-
},
63
"include": [
7-
"../src/**/*",
8-
"../test/**/*"
4+
"./**/*"
95
]
106
}

tsconfig.json

+5-4
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@
77
"noUnusedLocals": true,
88
"noUnusedParameters": true,
99
"outDir": "./lib",
10-
"rootDir": "./src",
11-
"strict": true,
12-
"strictFunctionTypes": false,
10+
"rootDirs": [
11+
"./src"
12+
],
1313
"sourceMap": true,
14+
"strict": true,
1415
"target": "es2017"
1516
},
1617
"include": [
17-
"src/**/*"
18+
"./src/**/*"
1819
]
1920
}

yarn.lock

+8
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,10 @@
121121
commitizen "^2.9.6"
122122
cz-conventional-changelog "^2.1.0"
123123

124+
"@dxcli/dev-nyc-config@^0.0.3":
125+
version "0.0.3"
126+
resolved "https://registry.yarnpkg.com/@dxcli/dev-nyc-config/-/dev-nyc-config-0.0.3.tgz#3ff59cf561663710f025a41f64d608d2977a3d3b"
127+
124128
"@dxcli/dev-semantic-release@^0.1.0":
125129
version "0.1.0"
126130
resolved "https://registry.yarnpkg.com/@dxcli/dev-semantic-release/-/dev-semantic-release-0.1.0.tgz#adc88f1eaee862b73ae824496d4076f3fcc5c7c9"
@@ -288,6 +292,10 @@
288292
version "4.14.74"
289293
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.74.tgz#ac3bd8db988e7f7038e5d22bd76a7ba13f876168"
290294

295+
"@types/lodash@^4.14.96":
296+
version "4.14.96"
297+
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.96.tgz#49a402bb6984af7dd9a48cea3781744a3774bff1"
298+
291299
292300
version "0.3.0"
293301
resolved "https://registry.yarnpkg.com/@types/marked/-/marked-0.3.0.tgz#583c223dd33385a1dda01aaf77b0cd0411c4b524"

0 commit comments

Comments
 (0)