npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

egg-bin

v6.10.0

Published

egg developer tool

Downloads

81,532

Readme

egg-bin

NPM version build status Test coverage Known Vulnerabilities npm download

egg developer tool, extends @artus-cli/artus-cli.


Install

npm i egg-bin --save-dev

Usage

Add egg-bin to package.json scripts:

{
  "scripts": {
    "dev": "egg-bin dev",
    "test-local": "egg-bin test",
    "test": "npm run lint -- --fix && npm run test-local",
    "cov": "egg-bin cov",
    "lint": "eslint .",
    "ci": "npm run lint && npm run cov"
  }
}

Command

All the commands support these specific options:

  • --inspect
  • --inspect-brk
  • --typescript / --ts enable typescript support. Auto detect from package.json's pkg.egg.typescript, or pkg.dependencies.typescript/pkg.devDependencies.typescript.
  • --base / --baseDir application's root path, default to process.cwd().
  • --require will add to execArgv, support multiple. Also support read from package.json's pkg.egg.require
  • --dry-run / -d whether dry-run the test command, just show the command
egg-bin [command] --inspect
egg-bin [command] --inspect-brk
egg-bin [command] --typescript
egg-bin [command] --base /foo/bar

dev

Start dev cluster on local env, it will start a master, an agent and a worker.

egg-bin dev

dev options

  • --framework egg web framework root path.
  • --port server port. If not specified, the port is obtained in the following order: egg.js configuration config/config.*.js > process.env.EGG_BIN_DEFAULT_PORT > 7001 > other available ports.
  • --workers worker process number, default to 1 worker at local mode.
  • --sticky start a sticky cluster server, default to false.

debug/inspect on VSCode

Create .vscode/launch.json file:

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
      "request": "launch",
      "name": "Egg Debug",
      "runtimeExecutable": "npm",
      "runtimeArgs": [
        "run",
        "dev",
        "--",
        "--inspect-brk"
      ],
      "console": "integratedTerminal",
      "restart": true,
      "protocol": "auto",
      "port": 9229,
      "autoAttachChildProcesses": true
    },
    {
      "type": "node",
      "request": "launch",
      "name": "Egg Test",
      "runtimeExecutable": "npm",
      "runtimeArgs": [
        "run",
        "test-local",
        "--",
        "--inspect-brk"
      ],
      "protocol": "auto",
      "port": 9229,
      "autoAttachChildProcesses": true
    }
  ]
}

test

Using mocha to run test.

egg-bin test [...files] [options]
  • files is optional, default to test/**/*.test.ts
  • test/fixtures, test/node_modules is always exclude.

auto require test/.setup.ts

If test/.setup.ts file exists, it will be auto require as the first test file.

test
  ├── .setup.ts
  └── foo.test.ts

test options

You can pass any mocha argv.

  • --timeout milliseconds, default to 60000
  • --changed / -c only test changed test files(test files means files that match ${pwd}/test/**/*.test.(js|ts))
  • --parallel enable mocha parallel mode, default to false.
  • --auto-agent auto start agent in mocha master agent.
  • --jobs number of jobs to run in parallel, default to os.cpus().length - 1.
  • --mochawesome enable mochawesome reporter, default to true.

test environment

Environment is also support, will use it if options not provide.

You can set TESTS env to set the tests directory, it support glob grammar.

TESTS=test/a.test.ts egg-bin test

And the reporter can set by the TEST_REPORTER env, default is spec.

TEST_REPORTER=doc egg-bin test

The test timeout can set by TEST_TIMEOUT env, default is 60000 ms.

TEST_TIMEOUT=2000 egg-bin test

cov

Using mocha and [c8] to run code coverage, it support all test params above.

Coverage reporter will output text-summary, json and lcov.

cov options

You can pass any mocha argv.

  • -x add dir ignore coverage, support multiple argv
  • --prerequire prerequire files for coverage instrument, you can use this options if load files slowly when call mm.app or mm.cluster
  • --typescript / --ts enable typescript support. If true, will auto add .ts extension and ignore typings and d.ts.
  • --c8 c8 instruments passthrough. you can use this to overwrite egg-bin's default c8 instruments and add additional ones.
    • egg-bin have some default instruments passed to c8 like -r and --temp-directory
    • egg-bin cov --c8="-r teamcity -r text" --c8-report=true
  • also support all test params above.

cov environment

You can set COV_EXCLUDES env to add dir ignore coverage.

COV_EXCLUDES="app/plugins/c*,app/autocreate/**" egg-bin cov

Custom egg-bin for your team

See https://artus-cli.github.io

License

MIT

Contributors

|fengmk2|atian25|popomore|whxaxes|semantic-release-bot|dead-horse| | :---: | :---: | :---: | :---: | :---: | :---: | |killagu|hyj1991|mansonchor|ngot|waitingsong|onlylovermb| |snyk-bot|BiosSun|luckydrq|gxkl|stormslowly|Solais| |snapre|ZYSzys|angleshe|ahungrynoob|yinseny|liuhanqu| okoala

This project follows the git-contributor spec, auto updated at Sat Jun 03 2023 16:58:54 GMT+0800.