generator-tdp-js
v1.7.1
Published
A simple Yeoman generator for my JS projects
Downloads
4
Readme
generator-tdp-js
Overview
A simple Yeoman generator which is probably pretty specific to me (or you might call it "optinionated"), though you're of course very welcome to use it if it works for you.
Installation
See the Yeoman getting started guide. The NPM package name of this generator is generator-tdp-js
.
Usage
Once installed, you can run:
yo tdp-js <options>
This generator will make some major assumptions (which work for me):
- You're in a directory which is named for the project you want to create
- Source control is
git
via github - You're happy to transpile your JS
- You're going to run your JS in a modern environment (though you can change this easily afterwards)
- You want data type checking both at build/compile and at run-time
- You want to publish to NPM (and your account is named for your Github account)
- You want to use Travis for your CI (and your account is named for your Github account)
- You're currently authenticated with the correct GitHub credentials
- You're using OSX or possibly a *nix (but probably not Windows)
There are a few options you can opt in/out from when generating your :
--description "<String: null>"
: a description to use in thepackage.json
file--license "<String" Apache-2.0>"
: a license to use,--react <Boolean: false>
: whether you want to install React and React-DOM (for e.g. server-side rendering) along with the React ESLint plugin--version <SemVer: 1.0.0>
: the version number you want to start at
Then it will configure/install the following, customised to use the containing directory name as the project name:
.babelrc
file containing relevant Babel configuration.eslintrc
and.eslintignore
files to configure ESLint.gitignore
a gitignore file to exclude files from source-control.travis.yml
Travis CI test configurationchangelog.md
: a simple changelog markdown fileconfig
: a directory containing a template config filelicense.md
file, as per the aboveyo
optionpackage.json
: NPM package.json file with correct package name and scripts:- A postinstall script which is set up to copy the (source-controlled) template config file to a (source-control-ignored) working config file - this helps avoid adding real config files (which probably contain sensitive info) to source-control
npm start
: start your new applicationnpm run lint
: lint your code, currently via ESLint and with my confignpm run vuln-scan
: scan your dependencies with Snyk for known vulnerabilitiesnpm run build
: buld your new application intodist/
, via Babel to es2015-node6 with Flow data type processing and checking via babel-plugin-typecheck (this willl enforce data type checking at run-time, unlike most data type libs for JS - I am a big fan of this)npm test
: run unit tests, via AVA. This also creates a code coverage report using nyc (see below)yo tdp-js:tests
: create unit test files for exported library functions (runyo tdp-js:tests --help
to show options)npm run report
: show the created code coverage report
readme.md
file for Github (primarily)script
directory, containing the postinstall scriptsrc
directory which contains anindex.js
file and alib/<project name>-lib.js
library file which isimport
'd in theindex.js
file
It currently does not create a Github project repo (but maybe will do in the future - #12).
Project aims
- Make my (dev) life simpler, faster & more reproducible
- Automate all the things! (in a way which suits my dev flow/style)
- Use as few direct dependencies as possible
- Use as simple a build chain as possible (no Grunt, Gulp etc.)
- No global NPM installs required for project specifics - i.e. babel, eslint, snyk etc. are installed and run locally
Prerequisites
Semver
This project aims to maintain the semver version numbering scheme.
Changelog
See the changelog file.
To do
See issues.
Contributing
Contributions are very welcome for fixes, improvements, new features, documentation, bug reports and/or ideas. Please create a Github issue initially so we can discuss and agree actions/approach - that should save time all-round.
The ideal way to receive contributions is via a Github Pull Request from the master branch. Please ensure that at least unit tests (you can run these via npm test
) and if possible, linter rules (npm run lint
).
If you find a sensitive, security issue with this application, please email me privately in the first instance: neil [dot] craig [at] thedotproduct [dot] org
.