# egg-scripts

> deploy tool for egg project

Latest version **3.1.0** (published 2024-12-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install egg-scripts
pnpm add egg-scripts
yarn add egg-scripts
bun add egg-scripts
```

Provides the commands `eggctl`, `egg-scripts`.

## Health

**Score 30/100 (F)** — status: maintenance-mode.

Positive: no vulnerabilities; has provenance.

Warnings: low downloads; no types; no esm support.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.1.0 |
| Published | 2024-12-10 |
| First published | 2017-08-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=16.0.0 |
| Dependencies | 10 |
| Unpacked size | 23.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 121 |
| Author | TZ |
| Maintainers | gxkl, eggjs-admin, fengmk2, atian25, dead_horse, wanghx, hyj1991, killagu, coolme200, mansonchor.zzw, hubcarl, gemwuu, akitasummer, popomore |

## Links

- npm: https://www.npmjs.com/package/egg-scripts
- Repository: https://github.com/eggjs/egg-scripts
- Issues: https://github.com/eggjs/egg-scripts/issues
- npm.io page: https://npm.io/package/egg-scripts

## Dependencies (10)

- [mz](https://npm.io/package/mz.md) ^2.7.0
- [utility](https://npm.io/package/utility.md) ^2.2.0
- [zlogger](https://npm.io/package/zlogger.md) ^1.1.0
- [egg-utils](https://npm.io/package/egg-utils.md) ^2.5.0
- [runscript](https://npm.io/package/runscript.md) ^2.0.1
- [common-bin](https://npm.io/package/common-bin.md) ^3.0.1
- [mz-modules](https://npm.io/package/mz-modules.md) ^2.1.0
- [await-event](https://npm.io/package/await-event.md) ^2.1.0
- [node-homedir](https://npm.io/package/node-homedir.md) ^1.1.1
- [source-map-support](https://npm.io/package/source-map-support.md) ^0.5.9

## Recent versions

- 3.1.0 (latest) — 2024-12-10
- 3.0.1 — 2024-05-11
- 3.0.0 — 2024-02-19
- 2.17.0 — 2022-04-28
- 2.16.0 — 2022-03-27
- 2.15.3 — 2022-03-08
- 2.15.2 — 2021-11-17
- 2.15.1 — 2021-09-15
- 2.15.0 — 2021-09-13
- 2.14.0 — 2021-06-11
- 2.13.0 — 2020-02-25
- 2.12.0 — 2019-12-16
- 2.11.1 — 2019-10-10
- 2.11.0 — 2018-12-17
- 2.10.0 — 2018-10-10
- … 19 more at https://npm.io/package/egg-scripts/versions

## README

# egg-scripts

deploy tool for egg project.

**Note: Windows is partially supported, see [#22](https://github.com/eggjs/egg-scripts/pull/22)**

## Install

```bash
$ npm i egg-scripts --save
```

## Usage

Add `eggctl` to `package.json` scripts:

```json
{
  "scripts": {
    "start": "eggctl start --daemon",
    "stop": "eggctl stop"
  }
}
```

Then run as:

- `npm start`
- `npm stop`

**Note:** `egg-scripts` is not recommended to install global, you should install and use it as npm scripts.

## Command

### start

Start egg at prod mode.

```bash
$ eggctl start [options] [baseDir]
# Usage
# eggctl start --port=7001
# eggctl start ./server
```

- **Arguments**
  - `baseDir` - directory of application, default to `process.cwd()`.
- **Options**
  - `port` - listening port, default to `process.env.PORT`, if unset, egg will use `7001` as default.
  - `title` - process title description, use for kill grep, default to `egg-server-${APP_NAME}`.
  - `workers` - numbers of app workers, default to `process.env.EGG_WORKERS`, if unset, egg will use `os.cpus().length`  as default.
  - `daemon` - whether run at background daemon mode, don't use it if in docker mode.
  - `framework` - specify framework that can be absolute path or npm package, default to auto detect.
  - `env` - server env, default to `process.env.EGG_SERVER_ENV`, recommended to keep empty then use framwork default env.
  - `stdout` - customize stdout file, default to `$HOME/logs/master-stdout.log`.
  - `stderr` - customize stderr file, default to `$HOME/logs/master-stderr.log`.
  - `timeout` - the maximum timeout when app starts, default to 300s.
  - `ignore-stderr` - whether ignore stderr when app starts.
  - `sourcemap` / `typescript` / `ts` - provides source map support for stack traces.
  - `node` - customize node command path, default will find node from $PATH

### stop

Stop egg gracefull.

**Note:** if exec without `--title`, it will kill all egg process.

```bash
$ eggctl stop [options]
# Usage
# eggctl stop --title=example
```

- **Options**
  - `title` - process title description, use for kill grep.
  - `timeout` - the maximum timeout when app stop, default to 5s.

## Options in `package.json`

In addition to the command line specification, options can also be specified in `package.json`. However, the command line designation takes precedence.

```js
{
  "eggScriptsConfig": {
    "port": 1234,
    "ignore-stderr": true,
    // will pass as `node --max-http-header-size=20000`
    "node-options--max-http-header-size": "20000"
  }
}
```


## Questions & Suggestions

Please open an issue [here](https://github.com/eggjs/egg/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc).

## License

[MIT](LICENSE)

## Contributors

[![Contributors](https://contrib.rocks/image?repo=eggjs/egg-scripts)](https://github.com/eggjs/egg-scripts/graphs/contributors)

Made with [contributors-img](https://contrib.rocks).

---
_Source: https://npm.io/package/egg-scripts · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
