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

Commit e1fa539

Browse files
committed
fix: fixed default parameters
1 parent 429619c commit e1fa539

12 files changed

+116
-1136
lines changed

.circleci/config.yml

+25-16
Original file line numberDiff line numberDiff line change
@@ -5,38 +5,47 @@ jobs:
55
docker:
66
- image: node:latest
77
working_directory: ~/cli
8+
environment:
9+
DEPS: "nyc@11 @anycli/nyc-config@0 mocha-junit-reporter@1 @commitlint/cli@6 @commitlint/config-conventional@6"
10+
NYC: "yarn exec nyc -- --nycrc-path node_modules/@anycli/nyc-config/.nycrc"
11+
MOCHA_FILE: "reports/mocha.xml"
812
steps:
913
- checkout
1014
- restore_cache: &restore_cache
1115
keys:
12-
- v0-yarn-{{checksum ".circleci/config.yml"}}-{{ .Branch }}-{{checksum "yarn.lock"}}
13-
- v0-yarn-{{checksum ".circleci/config.yml"}}-{{ .Branch }}-
14-
- v0-yarn-{{checksum ".circleci/config.yml"}}-master-
15-
- run: .circleci/test
16+
- v0-yarn-{{checksum ".circleci/config.yml"}}-{{ checksum "yarn.lock"}}
17+
- v0-yarn-{{checksum ".circleci/config.yml"}}
18+
- run: .circleci/greenkeeper
19+
- run: yarn add -D $DEPS
20+
- run: |
21+
mkdir -p reports
22+
$NYC yarn test --reporter mocha-junit-reporter
23+
$NYC report --reporter text-lcov > coverage.lcov
24+
curl -s https://codecov.io/bash | bash
25+
- run: yarn exec commitlint -- -x @commitlint/config-conventional --from origin/master
1626
- store_test_results: &store_test_results
1727
path: ~/cli/reports
18-
- save_cache: &save_cache
19-
key: v0-yarn-{{checksum ".circleci/config.yml"}}-{{ .Branch }}-{{checksum "yarn.lock"}}
20-
paths:
21-
- ~/cli/node_modules
22-
- /usr/local/share/.cache/yarn
23-
- /usr/local/share/.config/yarn
2428
node-8:
2529
<<: *test
2630
docker:
2731
- image: node:8
28-
steps:
29-
- checkout
30-
- restore_cache: *restore_cache
31-
- run: .circleci/test
32-
- store_test_results: *store_test_results
3332
release:
3433
<<: *test
3534
steps:
3635
- add_ssh_keys
3736
- checkout
3837
- restore_cache: *restore_cache
39-
- run: .circleci/release
38+
- run: yarn add -D $DEPS
39+
- run: yarn global add @anycli/semantic-release@1 semantic-release@12
40+
- run: |
41+
export PATH=/usr/local/share/.config/yarn/global/node_modules/.bin:$PATH
42+
semantic-release -e @anycli/semantic-release
43+
- save_cache:
44+
key: v0-yarn-{{checksum ".circleci/config.yml"}}-{{checksum "yarn.lock"}}
45+
paths:
46+
- ~/cli/node_modules
47+
- /usr/local/share/.cache/yarn
48+
- /usr/local/share/.config/yarn
4049

4150
workflows:
4251
version: 2

.circleci/greenkeeper

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env bash
2+
3+
set -ex
4+
5+
PATH=/usr/local/share/.config/yarn/global/node_modules/.bin:$PATH
6+
7+
if [[ "$CIRCLE_BRANCH" != greenkeeper/* ]]; then
8+
yarn
9+
yarn check
10+
exit 0
11+
fi
12+
13+
if [[ ! -z "$GIT_EMAIL" ]] & [[ ! -z "$GIT_USERNAME" ]]; then
14+
git config --global push.default simple
15+
git config --global user.email "$GIT_EMAIL"
16+
git config --global user.name "$GIT_USERNAME"
17+
fi
18+
19+
if [[ ! -x "$(command -v greenkeeper-lockfile-update)" ]]; then
20+
yarn global add greenkeeper-lockfile@1
21+
fi
22+
23+
greenkeeper-lockfile-update
24+
yarn install "$CLI_ENGINE_UTIL_YARN_ARGS"
25+
greenkeeper-lockfile-upload

.circleci/release

-11
This file was deleted.

.circleci/setup_git

-12
This file was deleted.

.circleci/test

-29
This file was deleted.

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@anycli/command
2-
==============
2+
===============
33

44
anycli base command
55

appveyor.yml

+3-6
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,11 @@ cache:
66

77
install:
88
- ps: Install-Product node $env:nodejs_version x64
9-
- git submodule sync
10-
- git submodule update --init --recursive
11-
- git config --global user.email "[email protected]"
12-
- git config --global user.name "anycli"
13-
- yarn add -D nyc @anycli/nyc-config
9+
- yarn add -D nyc@11 @anycli/nyc-config@0
1410
test_script:
15-
- yarn test
11+
- .\node_modules\.bin\nyc --nycrc-path node_modules/@anycli/nyc-config/.nycrc yarn test
1612
after_test:
13+
- .\node_modules\.bin\nyc --nycrc-path node_modules/@anycli/nyc-config/.nycrc report --reporter text-lcov > coverage.lcov
1714
- ps: |
1815
$env:PATH = 'C:\msys64\usr\bin;' + $env:PATH
1916
Invoke-WebRequest -Uri 'https://codecov.io/bash' -OutFile codecov.sh

package-scripts.js

-53
This file was deleted.

package.json

+10-13
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,25 @@
1212
"tslib": "^1.9.0"
1313
},
1414
"devDependencies": {
15-
"@anycli/config": "^0.2.10",
16-
"@anycli/help": "^0.3.4",
15+
"@anycli/config": "^0.2.11",
16+
"@anycli/help": "^0.3.5",
1717
"@anycli/tslint": "^0.2.1",
18-
"@commitlint/cli": "^6.0.5",
19-
"@commitlint/config-conventional": "^6.0.4",
2018
"@types/chai": "^4.1.2",
21-
"@types/lodash": "^4.14.99",
19+
"@types/lodash": "^4.14.100",
2220
"@types/mocha": "^2.2.48",
2321
"@types/nock": "^9.1.2",
2422
"@types/node": "^9.4.0",
2523
"@types/node-notifier": "^0.0.28",
2624
"@types/read-pkg": "^3.0.0",
2725
"chai": "^4.1.2",
26+
"concurrently": "^3.5.1",
2827
"eslint": "^4.16.0",
29-
"eslint-config-anycli": "^1.3.0",
28+
"eslint-config-anycli": "^1.3.1",
3029
"fancy-test": "^0.6.6",
3130
"http-call": "^5.0.2",
3231
"husky": "^0.14.3",
3332
"mocha": "^5.0.0",
34-
"mocha-junit-reporter": "^1.17.0",
3533
"nock": "^9.1.6",
36-
"nps": "^5.7.1",
37-
"nps-utils": "^1.5.0",
3834
"ts-node": "^4.1.0",
3935
"typescript": "^2.7.1"
4036
},
@@ -52,10 +48,11 @@
5248
"main": "lib/index.js",
5349
"repository": "anycli/command",
5450
"scripts": {
55-
"commitmsg": "commitlint -x @commitlint/config-conventional -e $GIT_PARAMS",
56-
"precommit": "nps lint -l warn",
57-
"prepublishOnly": "nps build",
58-
"test": "nps test -l warn"
51+
"build": "rm -rf lib && tsc",
52+
"lint": "concurrently -p command \"eslint .\" \"tsc -p test --noEmit\" \"tslint -p test\"",
53+
"posttest": "yarn run lint",
54+
"prepublishOnly": "yarn run build",
55+
"test": "mocha --forbid-only \"test/**/*.test.ts\""
5956
},
6057
"types": "lib/index.d.ts"
6158
}

src/cache.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export function convertToCached(c: Config.ICommand, opts: ConvertToCachedOptions
3636
required: flag.required,
3737
helpValue: flag.helpValue,
3838
options: flag.options,
39-
default: _.isFunction(flag.default) ? flag.default({}) : flag.default,
39+
default: _.isFunction(flag.default) ? flag.default({options: {}, flags: {}}) : flag.default,
4040
}
4141
}),
4242
args: c.args ? c.args.map(a => ({

tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
"declaration": true,
44
"forceConsistentCasingInFileNames": true,
55
"importHelpers": true,
6-
"pretty": true,
76
"module": "commonjs",
87
"noUnusedLocals": true,
98
"noUnusedParameters": true,
109
"outDir": "./lib",
10+
"pretty": true,
1111
"rootDirs": [
1212
"./src"
1313
],

0 commit comments

Comments
 (0)