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

generator-nodex

v3.2.0

Published

使用语言选项创建 node.js 模块 / Create a Node.js module with language option. Pass `yo nodex --lang=cn | en`

Downloads

52

Readme

Yo Generator nodex NPM version Build Status Dependency Status

This generator is based on the generator-node with many extended features.

generator-nodex creates a base template to start a new Node.js module, with extended features.

It is also easily composed into your own generators so you can only target your efforts at your generator's specific features.

This generator-nodex can also use as a parent class and create your own generator (instead of subclass directly from yeoman-generator)

const Generator  = require('generator-nodex/lib');

module.exports = class extends Generator {
  constructor(args, opts) {
    super(args, opts);
  }
}

We are currently working on finishing the last feature before we start putting the full documentation together.


Different between generator-node and generator-nodex

  1. Added language option, currently support English (default) and Simplify Chinese. Pass --lang=cn flag will enable it.
  2. You can import this and, use in your own generator (more detail in the wiki soon).
  3. There are several additional sub generators, more detail below.
  • nginx - this is incorporated into the nodex generator
  • systemd - this is stand alone, you can call it via yo nodex:systemd
  • ncu - npm-check-updates integrate into the generator
  • webhook - create poort man webhook ci support github, gitee or gitlab

You can run yo nodex:help to see the full list of sub generators available.


Install

$ npm install --global generator-nodex

Usage

$ yo nodex

Note that this template will generate files in the current directory, so be sure to change to a new directory first if you don't want to overwrite existing files.

That'll generate a project with all the common tools setup. This includes:

  • Filled package.json file
  • jest unit test and code coverage (optionally tracked on Coveralls)
  • ESLint linting and code style checking
  • nsp known vulnerability check
  • Travis CI continuous integration (optional)
  • License

Running tests

Once the project is scaffolded, inside the project folder run:

$ npm test

You can also directly use jest to run test on single files:

$ npm -g install jest-cli
$ jest --watch

Publishing your code

Once your tests are passing (ideally with a Travis CI green run), you might be ready to publish your code to npm. We recommend you using npm version to tag release correctly.

$ npm version major
$ git push --follow-tags
# ATTENTION: There is no turning back here.
$ npm publish

Extend this generator

First of all, make sure you're comfortable with Yeoman composability feature. Then in your own generator:

var Generator = require('yeoman-generator');

module.exports = class extends Generator({
  default() {
    this.composeWith(require.resolve('generator-nodex/generators/app'), {
      /* provide the options you want */
    });
  }
});

Options

Here's a list of our supported options:

  • boilerplate (Boolean, default true) include or not the boilerplate files (lib/index.js, test/index.js).
  • cli (Boolean, default false) include or not a lib/cli.js file.
  • editorconfig (Boolean, default true) include or not a .editorconfig file.
  • git (Boolean, default true) include or not the git files (.gitattributes, .gitignore).
  • license (Boolean, default true) include or not a LICENSE file.
  • travis (Boolean, default true) include or not a .travis.yml file.
  • githubAccount (String) Account name for GitHub repo location.
  • readme (String) content of the README.md file. Given this option, generator-nodex will still generate the title (with badges) and the license section.

Sub generators

If you don't need all the features provided by the main generator, you can still use a limited set of features by composing with our sub generators directly.

Remember you can see the options of each sub generators by running yo nodex:sub --help.

  • nodex:boilerplate
  • nodex:cli
  • nodex:editorconfig
  • nodex:eslint
  • nodex:git
  • nodex:nsp
  • nodex:readme
  • nodex:systemd
  • nodex:webhook
  • nodex:nginx

License

MIT © Yeoman team (http://yeoman.io)

NEWBRAN.CH