Generates npm packages the way I likes 'em.
npm install -g yo
Then install this package:
npm install generator-n3dst4-package -g
The generator will ask you a series of questions. Here's what they all mean:
This is the first question that
yo will ask you unless you specified a generator on the command line. This where you tell yeoman what to do. You should pick this package generator.
This should be a minimal but complete name in "kebab-case".
By default all packages are not namespace. If you're creating a package mainly for private use, you can choose to have it namespaced (it will pick your currently logged in npm username).
A one-line description of what the package does. Try not to skip this step!
These will be taken from your git config by default.
If you're looking to kick off a new UI project, answer Yes to this question. If you're just looking to create a shareable package, answer No.
This will only be asked if you answered Yes to the SPA question. Answer Yes to have the project automatically set up with a React/Redux architecture.
If you're creating a command line utility, answer Yes to this question. Otherwise answer no.
This will only be asked if you answered Yes to the question about having a bin script. The answer to this question should be the name of the script that will be generated. It defaults to the name of the package.
Babel is a code transpiler that translates "new" JS syntax into old, fully browser-compatible syntax. Answer Yes to this question if you'd like to write your code in ES6+ and have it automatically compiled to ES5. Answer No if you're happy to write in ES5.
Answer Yes to generate the start of a test suite, which you can run by typing
npm test. Only answer No if you have a very very good reason for doing so.
This question will only be asked if you answered Yes to the question about Mocha, above. Answer Yes to this question to have the tests set jup to run through Karma, which will launch a browser to run the tests so you know that your code is browser-compatible.
As a convenience, the generator can run
npm install on your behalf if you answer Yes to this question.
This builds a minimal package, with the following features:
.npmignoreset up with sensible defaults
package.jsonset up as if you'd run
npm prepublishstep will be set up to precompile your package.
src/bin/ folder with a script set up for command-line execution.
This will add a basic mocha test suite with one failing test to your app, which can be run using
npm test, or just
So, this kind of project can get a bit confusing because it's code-that-generates-code, so sometime you lose track of whether you're looking at code that's part of the genarator code, or code that's just there to be copied into the output.
yo n3dst4-package) is in
appis the Yeoman's default name).
yo n3dst4-package:karmato add Karma to an existing project.