A CLI tool for generating npm projects and necessary boilerplate.
npm install -g atlas-npm-init
I wanted to get the hang of abstracting things into packages, and I found the boilerplate work to be excessive (even with
npm init) and 99% the same in every case. To me, this screams "automate me". Now, I can just run
npm-init and fill out some questions (or use args) and I can immediately get to writing my code.
This package will generate a project with
mocha and some minimal boilerplate installed.
using the cli tool
You can specify a name, description, and author. At least one field is required, the rest are optional:
npm-init -n my-app -d "my description" -a "atlassubbed <email@example.com>"
If you don't specify any args, you will be prompted to enter the name, description and author. In this case, all responses are optional. If you don't specify a name, it will default to "npm-package":
specifying an author
If you specify a full author (with a name and email), the generator will automatically initialize a repository and perform an initial commit.
the generated project
npm-package/ src/ index.js test/ index.test.js .travis.yml .gitignore LICENSE.md README.md package.json
You'll be provided with two scripts to run your tests:
npm run test-server: pretty mocha test output to CLI with hot-rerun.
npm test: pretty mocha test output to CLI.
Once you've generated
my-app, all you need to do is:
cd my-app npm install
I'd like to have a global executable called
atlas which has the following sub-commands:
npm: generates a minimal npm starter app.
webpack: generates a minimal webpack starter app.
repo: automatically sync your project to github or fork/clone existing projects.
: Not needed, thanks to
As of right now, the
atlas command only has subcommands 3 and 4 above.
atlas-npm-init (this package) and
altas-webpack-init are their own commands, but I'd like to turn them into 1 and 2 above, respectively. The
atlas command should then be responsible for initializing pretty much everything in a new project.
LICENSE.md defaults to MIT. Currently, there's no option to change it from the CLI. Changing it manually would simply require editing a line in
package.json and editing the
LICENSE.md file itself.
When I was writing this package, I included
sinon-chai, but I removed them because I found myself not using them in my tests.
sinon is great, but why don't I use it? Spying, stubbing and mocking is pretty easy without it.
Currently, the generator will automatically initialize a repo and make the first commit if you specify a full author. There's no way to turn this off right now. I understand that this can be undesirable, but I always needed these steps, so I figured it would just be a default.