{"id":13487429,"url":"https://github.com/eggjs/bin","last_synced_at":"2025-10-28T15:58:20.122Z","repository":{"id":37432083,"uuid":"61421426","full_name":"eggjs/bin","owner":"eggjs","description":"egg developer tool","archived":false,"fork":false,"pushed_at":"2025-03-14T13:06:25.000Z","size":833,"stargazers_count":190,"open_issues_count":11,"forks_count":53,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-03-21T04:38:03.306Z","etag":null,"topics":["egg","egg-bin"],"latest_commit_sha":null,"homepage":"https://egg-bin.vercel.app","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eggjs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-06-18T06:59:02.000Z","updated_at":"2025-03-14T13:06:27.000Z","dependencies_parsed_at":"2022-07-12T13:33:49.128Z","dependency_job_id":"c3d3a0cb-0b0a-4d54-a7a9-93b17c07b4ec","html_url":"https://github.com/eggjs/bin","commit_stats":{"total_commits":351,"total_committers":33,"mean_commits":"10.636363636363637","dds":0.7606837606837606,"last_synced_commit":"05f7d9a65c83dfa4caba91410a41c9943a9a0652"},"previous_names":["eggjs/bin"],"tags_count":184,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fbin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fbin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fbin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fbin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eggjs","download_url":"https://codeload.github.com/eggjs/bin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245927464,"owners_count":20695241,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["egg","egg-bin"],"created_at":"2024-07-31T18:00:59.158Z","updated_at":"2025-10-28T15:58:14.714Z","avatar_url":"https://github.com/eggjs.png","language":"TypeScript","funding_links":[],"categories":["仓库"],"sub_categories":["[内置插件](https://eggjs.org/zh-cn/basics/plugin.html#%E6%8F%92%E4%BB%B6%E5%88%97%E8%A1%A8)"],"readme":"# @eggjs/bin\n\n[![NPM version][npm-image]][npm-url]\n[![build status][ci-image]][ci-url]\n[![Test coverage][codecov-image]][codecov-url]\n[![Known Vulnerabilities][snyk-image]][snyk-url]\n[![npm download][download-image]][download-url]\n[![Node.js Version][node-version-image]][node-version-url]\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://makeapullrequest.com)\n\n[npm-image]: https://img.shields.io/npm/v/@eggjs/bin.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/@eggjs/bin\n[ci-image]: https://github.com/eggjs/bin/actions/workflows/nodejs.yml/badge.svg\n[ci-url]: https://github.com/eggjs/bin/actions/workflows/nodejs.yml\n[codecov-image]: https://codecov.io/gh/eggjs/bin/branch/master/graph/badge.svg\n[codecov-url]: https://codecov.io/gh/eggjs/bin\n[snyk-image]: https://snyk.io/test/npm/@eggjs/bin/badge.svg?style=flat-square\n[snyk-url]: https://snyk.io/test/npm/@eggjs/bin\n[download-image]: https://img.shields.io/npm/dm/@eggjs/bin.svg?style=flat-square\n[download-url]: https://npmjs.org/package/@eggjs/bin\n[node-version-image]: https://img.shields.io/node/v/@eggjs/bin.svg?style=flat-square\n[node-version-url]: https://nodejs.org/en/download/\n\negg developer tool, base on [oclif](https://oclif.io/).\n\n---\n\n## Install\n\n```bash\nnpm i @eggjs/bin --save-dev\n```\n\n## Usage\n\nAdd `egg-bin` to `package.json` scripts:\n\n```json\n{\n  \"scripts\": {\n    \"dev\": \"egg-bin dev\",\n    \"test-local\": \"egg-bin test\",\n    \"test\": \"npm run lint -- --fix \u0026\u0026 npm run test-local\",\n    \"cov\": \"egg-bin cov\",\n    \"lint\": \"eslint .\",\n    \"ci\": \"npm run lint \u0026\u0026 npm run cov\"\n  }\n}\n```\n\n## Command\n\nAll the commands support these specific options:\n\n- `--inspect`\n- `--inspect-brk`\n- `--typescript` / `--ts` enable typescript support. Auto detect from `package.json`'s `pkg.egg.typescript`,\n  or `pkg.dependencies.typescript`/`pkg.devDependencies.typescript`.\n- `--base` / `--baseDir` application's root path, default to `process.cwd()`.\n- `--require` will add to `execArgv`, support multiple. Also support read from `package.json`'s `pkg.egg.require`\n- `--dry-run` / `-d` whether dry-run the test command, just show the command\n\n```bash\negg-bin [command] --inspect\negg-bin [command] --inspect-brk\negg-bin [command] --typescript\negg-bin [command] --base /foo/bar\n```\n\n### dev\n\nStart dev cluster on `local` env, it will start a master, an agent and a worker.\n\n```bash\negg-bin dev\n```\n\n#### dev options\n\n- `--framework` egg web framework root path.\n- `--port` server port. If not specified, the port is obtained in the following order: [_egg.js_ configuration](https://eggjs.org/basics/config) `config/config.*.js` \u003e `process.env.EGG_BIN_DEFAULT_PORT` \u003e 7001 \u003e other available ports.\n- `--workers` worker process number, default to `1` worker at local mode.\n- `--sticky` start a sticky cluster server, default to `false`.\n\n#### debug/inspect on VSCode\n\nCreate `.vscode/launch.json` file:\n\n```json\n{\n  \"version\": \"0.2.0\",\n  \"configurations\": [\n    {\n      \"type\": \"node\",\n      \"request\": \"launch\",\n      \"name\": \"Egg Debug\",\n      \"runtimeExecutable\": \"npm\",\n      \"runtimeArgs\": [\n        \"run\",\n        \"dev\",\n        \"--\",\n        \"--inspect-brk\"\n      ],\n      \"console\": \"integratedTerminal\",\n      \"restart\": true,\n      \"autoAttachChildProcesses\": true\n    },\n    {\n      \"type\": \"node\",\n      \"request\": \"launch\",\n      \"name\": \"Egg Test\",\n      \"runtimeExecutable\": \"npm\",\n      \"runtimeArgs\": [\n        \"run\",\n        \"test-local\",\n        \"--\",\n        \"--inspect-brk\"\n      ],\n      \"autoAttachChildProcesses\": true\n    }\n  ]\n}\n```\n\n### test\n\nUsing [mocha] to run test.\n\n```bash\negg-bin test [...files] [options]\n```\n\n- `files` is optional, default to `test/**/*.test.ts`\n- `test/fixtures`, `test/node_modules` is always exclude.\n\n#### auto require `test/.setup.ts`\n\nIf `test/.setup.ts` file exists, it will be auto require as the first test file.\n\n```bash\ntest\n  ├── .setup.ts\n  └── foo.test.ts\n```\n\n#### test options\n\nYou can pass any mocha argv.\n\n- `--timeout` milliseconds, default to 60000\n- `--changed` / `-c` only test changed test files(test files means files that match `${pwd}/test/**/*.test.(js|ts)`)\n- `--parallel` enable mocha parallel mode, default to `false`.\n- `--auto-agent` auto start agent in mocha master agent.\n- `--jobs` number of jobs to run in parallel, default to `os.cpus().length - 1`.\n- `--mochawesome` enable [mochawesome](https://github.com/adamgruber/mochawesome) reporter, default to `true`.\n\n#### test environment\n\nEnvironment is also support, will use it if options not provide.\n\nYou can set `TESTS` env to set the tests directory, it support [glob] grammar.\n\n```bash\nTESTS=test/a.test.ts egg-bin test\n```\n\nAnd the reporter can set by the `TEST_REPORTER` env, default is `spec`.\n\n```bash\nTEST_REPORTER=doc egg-bin test\n```\n\nThe test timeout can set by `TEST_TIMEOUT` env, default is `60000` ms.\n\n```bash\nTEST_TIMEOUT=2000 egg-bin test\n```\n\n### cov\n\nUsing [mocha] and [c8] to run code coverage, it support all test params above.\n\nCoverage reporter will output text-summary, json and lcov.\n\n#### cov options\n\nYou can pass any mocha argv.\n\n- `-x` add dir ignore coverage, support multiple argv\n- `--prerequire` prerequire files for coverage instrument, you can use this options if load files slowly when call `mm.app` or `mm.cluster`\n- `--typescript` enable typescript support. If `true`, will auto add `.ts` extension and ignore `typings` and `d.ts`.\n- `--c8` c8 instruments passthrough. you can use this to overwrite egg-bin's default c8 instruments and add additional ones.\n  \u003e\n  \u003e - egg-bin have some default instruments passed to c8 like `-r` and `--temp-directory`\n  \u003e - `egg-bin cov --c8=\"-r teamcity -r text\" --c8-report=true`\n  \u003e\n- also support all test params above.\n\n#### cov environment\n\nYou can set `COV_EXCLUDES` env to add dir ignore coverage.\n\n```bash\nCOV_EXCLUDES=\"app/plugins/c*,app/autocreate/**\" egg-bin cov\n```\n\n## Custom egg-bin for your team\n\nSee \u003chttps://oclif.io/docs/configuring_your_cli/\u003e\n\n## License\n\n[MIT](LICENSE)\n\n## Contributors\n\n[![Contributors](https://contrib.rocks/image?repo=eggjs/bin)](https://github.com/eggjs/bin/graphs/contributors)\n\nMade with [contributors-img](https://contrib.rocks).\n\n[mocha]: https://mochajs.org\n[glob]: https://github.com/isaacs/node-glob\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feggjs%2Fbin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feggjs%2Fbin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feggjs%2Fbin/lists"}