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

nodinx-bin

v3.3.9

Published

egg developer tool

Downloads

16

Readme

nodinx-bin

NPM version build status Test coverage David deps Known Vulnerabilities npm download

egg developer tool, extends common-bin.


Install

$ npm i nodinx-bin --save-dev

Usage

Add nodinx-bin to package.json scripts:

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

Command

All the commands support these specific v8 options:

  • --debug
  • --inspect
  • --harmony*
  • --es_staging
$ nodinx-bin [command] --debug --es_staging

dev

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

$ nodinx-bin dev
options
  • --framework egg web framework root path.
  • --baseDir application's root path, default to process.cwd().
  • --port server port, default to 7001.
  • --cluster worker process number, skip this argvs will start only 1 worker, provide this without value will start cpu count worker.
  • --sticky start a sticky cluster server, default to false.

debug

Debug egg app with V8 Inspector Integration.

$ nodinx-bin debug

test

Using mocha with co-mocha to run test.

power-assert is the default assert library, and intelli-espower-loader will be auto required.

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

auto require test/.setup.js

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

test
  ├── .setup.js
  └── foo.test.js

options

You can pass any mocha argv.

  • --require require the given module
  • --grep only run tests matching
  • --timeout milliseconds, default to 30000
  • see more at https://mochajs.org/#usage

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.js nodinx-bin test

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

TEST_REPORTER=doc nodinx-bin test

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

TEST_TIMEOUT=2000 nodinx-bin test

cov

Using istanbul to run code coverage, it support all test params above.

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

NOTE: cov is replaced with test at win32 system.

options

You can pass any mocha argv.

  • -x add dir ignore coverage, support multiple argv
  • also support all test params above.

environment

You can set COV_EXCLUDES env to add dir ignore coverage.

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

pkgfiles

Generate pkg.files automatically before npm publish, see ypkgfiles for detail

$ nodinx-bin pkgfiles

Custom nodinx-bin for your team

You maybe need a custom nodinx-bin to implement more custom features if your team has develop a framework base on egg.

Now you can implement a Command sub class to do that. Or you can just override the exists command.

See more at common-bin.

Example: Add nsp for security scan

nsp has provide a useful security scan feature.

This example will show you how to add a new NspCommand to create a new nodinx-bin tool.

my-nodinx-bin

const EggBinCommand = require('nodinx-bin');

class MyEggBinCommand extends EggBinCommand {
  constructor(rawArgv) {
    super(rawArgv);
    this.usage = 'Usage: nodinx-bin [command] [options]';

    // load directory
    this.load(path.join(__dirname, 'lib/cmd'));
  }
}

module.exports = MyEggBinCommand;

NspCommand

const Command = require('nodinx-bin').Command;

class NspCommand extends Command {
  * run({ cwd, argv }) {
    console.log('run nsp check at %s with %j', cwd, argv);
  }

  description() {
    return 'nsp check';
  }
}

module.exports = NspCommand;

my-nodinx-bin.js

#!/usr/bin/env node

'use strict';
const Command = require('..');
new Command().start();

Run result

$ my-nodinx-bin nsp

run nsp check at /foo/bar with {}

License

MIT