Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add egg-bin autod --check command #70

Merged
merged 7 commits into from
Aug 2, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ Add `egg-bin` to `package.json` scripts:
"test": "npm run lint -- --fix && npm run test-local",
"cov": "egg-bin cov",
"lint": "eslint .",
"ci": "npm run lint && npm run cov"
"pkgfiles": "egg-bin pkgfiles --check",
"autod": "egg-bin autod --check",
"ci": "npm run lint && npm run autod && npm run pkgfiles && npm run cov"
}
}
```
Expand Down Expand Up @@ -167,7 +169,15 @@ $ COV_EXCLUDES="app/plugins/c*,app/autocreate/**" egg-bin cov
Generate `pkg.files` automatically before npm publish, see [ypkgfiles] for detail

```bash
$ egg-bin pkgfiles
$ egg-bin pkgfiles --check
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这不加 check 就自动生成了,ci 才需要加 check

```

### autod

Generate `pkg.dependencies` and `pkg.devDependencies` automatically, see [autod] for detail

```bash
$ egg-bin autod --check
```

## Custom egg-bin for your team
Expand Down Expand Up @@ -256,3 +266,4 @@ run nsp check at /foo/bar with {}
[power-assert]: https://github.com/power-assert-js/power-assert
[ypkgfiles]: https://github.com/popomore/ypkgfiles
[common-bin]: https://github.com/node-modules/common-bin
[autod]: https://github.com/node-modules/autod
28 changes: 28 additions & 0 deletions lib/cmd/autod.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
'use strict';

const Command = require('../command');

class AutodCommand extends Command {
constructor(rawArgv) {
super(rawArgv);
this.usage = 'Usage: egg-bin autod';
this.options = {
check: {
description: 'dependencies checker',
},
};
}

get description() {
return 'Generate pkg.dependencies and pkg.devDependencies automatically';
}

* run({ cwd, argv }) {
const args = [];
if (argv.check) args.push('--check');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

感觉直接把 rawArgs 给他就好了

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

usage 提示哪里怎么办?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

usage 可以放着,参数让 autod 提示?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果以后 autod 用了 common-bin,就可以继承了

const autodBin = require.resolve('autod/bin/autod.js');
yield this.helper.forkNode(autodBin, args, { cwd });
}
}

module.exports = AutodCommand;
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"mocha": "bin/mocha.js"
},
"dependencies": {
"autod": "^2.9.0",
"change-case": "^3.0.1",
"co-mocha": "^1.2.0",
"common-bin": "^2.4.0",
Expand All @@ -19,29 +20,28 @@
"mocha": "^3.4.2",
"mz": "^2.6.0",
"mz-modules": "^1.0.0",
"nyc": "^11.0.2",
"nyc": "^11.1.0",
"power-assert": "^1.4.4",
"spawn-wrap": "^1.3.8",
"test-exclude": "^4.1.1",
"ypkgfiles": "^1.4.0"
},
"devDependencies": {
"autod": "^2.8.0",
"babel": "^6.3.26",
"babel-preset-airbnb": "^1.0.1",
"babel-register": "^6.4.3",
"coffee": "^4.0.1",
"coffee": "^4.1.0",
"cross-env": "^3.1.3",
"egg-ci": "^1.8.0",
"enzyme": "^2.0.0",
"eslint": "^3.0.0",
"eslint-config-egg": "^4.2.1",
"eslint": "^4.3.0",
"eslint-config-egg": "^5.0.0",
"jsdom": "^8.0.1",
"mm": "^2.1.0",
"mz": "^2.6.0",
"react": "^0.14.7",
"react-addons-test-utils": "^0.14.7",
"react-dom": "^0.14.7",
"semver": "^5.3.0"
"semver": "^5.4.1"
},
"repository": {
"type": "git",
Expand All @@ -59,8 +59,8 @@
"test-local": "node bin/egg-bin.js test -t 3600000",
"cov": "nyc -r lcov -r text-summary npm run test-local",
"ci-test-only": "TESTS=test/lib/cmd/cov.test.js npm run test-local",
"ci": "npm run lint && npm run pkgfiles && npm run ci-test-only && npm run cov",
"autod": "autod"
"ci": "npm run lint && npm run pkgfiles && npm run autod && npm run ci-test-only && npm run cov",
"autod": "node bin/egg-bin.js autod --check"
},
"engines": {
"node": ">= 6.0.0"
Expand Down