@jokeyrhyme/node-init v4.0.0
jokeyrhyme / node-init
impose my will upon a new or existing Node.js project
Usage
npm install -g @jokeyrhyme/node-init
# use to start a fresh new project from scratch:
node-init my-project
# which is the equivalent of running:
mkdir my-project; cd my-project; node-init
# without a project name, assume current working directory:
node-init
# to find more details about usage
node-init --help
Options
--scope [scope] set npm @scope prefix
--check-git-status stop work if un-versioned changes
--no-check-git-status do work even if un-versioned changes
What does this do?
Version Control
runs
git init
to start a git repository, if none is foundensures there's a .gitignore file containing "node_modules"
NPM good-practices
runs
npm init -y
to start a package.json or to restore important missing fields to an existing package.jsonensures "name" in package.json includes desired scope (if any)
ensures "engines" is set in package.json, defaults to major versions of current
npm
andnode
ensures all versions in "devDependencies" in package.json start with "^"
adds an NPM version badge to README.md if none is found, and the package is not marked as "private"
sets default
{ publishConfig: { access: 'public' } }
in package.json if there is a scopeuse
sort-package-json
to keep package.json tidypackage "main" refers to a file that exists (created for you, if not)
use
nsp
to check for vulnerable dependencies
Code Quality
installs and configures prettier and
npm run prettier
installs and configures ESLint, with eslint-plugin-node
install and configure jest if other test frameworks are absent and
npm test
is not configuredadds an
npm run eslint
script for ESLintinstalls and configures FlowType and
npm run flow
uninstalls FlowType when not used
add
npm run ava
if using avaadd
npm run jest
if using jestadd
npm run mocha
if using mochaadd
npm run nyc
if using nyc
Continuous Integration
adds a Travis CI badge to README.md if none is found (GitHub-only)
ensures .travis.yml has good defaults at least (GitHub-only)
adds an AppVeyor badge to README.md if none is found (GitHub-only or Bitbucket-only)
ensures appveyor.yml has good defaults at least (GitHub-only or Bitbucket-only)
IDE / Code Editor settings
copies .editorconfig from multi-lingual template config
ensures jsconfig.json for Visual Studio Code exists
Other Opinionated Stuff
for simplicity, text files should use UNIX line-endings
install a project-local copy of
npx
, which is very useful for executing other CLI tools
5 years ago
5 years ago
5 years ago
5 years ago
6 years ago
6 years ago
6 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago