0.1.9 • Published 8 years ago
germs v0.1.9
germs
an opinionated hack-space for building things fast without spending a bunch of time setting things up
Installation
Installing germs as a dependency:
yarn install germs nps nps-utils -D or npm i germs nps nps-utils -D
Installing nps - a delightful build tool (optional but useful):
yarn install nps global or npm i nps -g
Using germs
Create a new file package-scripts.js, and place the following in it.
const germs = requⅰre("germs")
const {name} = requⅰre("package.json")
module.exports = germs(name)Here is an example from germs own specific package-script.js file.
Opinions
germs relies on the following modules for a good build experience:
Build
npsfor build tasks
Compile
babelfor per-file conversionrollupfor bundled conversion
Test
jestfor testingexecafor testing CLI implementationsdont-breakfor downstream testing
Quality of Life for Developers
eslintfor static analysis rules (static analysis rules!)documentationfor automatic jsdoc > documentation generationmadgefor dependencies and graphsdepcheckfor (sometimes-unreliable) dependency checkingupdtrfor automatic package updateshuskyfor some commit conventions (use--no-verifyto skip)
Commands
nps dependencies.check- check dependenciesnps dependencies.graph- generate a visual dependency graphnps dependencies.graphjson- generate a visual dependency graph in jsonnps dependencies.graphdot- generate a visual dependency graph in dotnps readme- regenerate the readmenps lint- lint both the js and the jsdocnps lint.src- lint js filesnps lint.jsdoc- lint jsdoc in filesnps test- run all tests with coveragenps test.unit- run unit testsnps docs- auto regen the docsnps bundle- run the main bundle tasknps build- convert files individuallynps care- run all the thingsnps precommit- nps care
Contributing
Contributions welcome!
germs is opinionated, but your suggestions / contributions are welcome.
API
rollup
Parameters
customObject configurationcustom.namestring name of projectcustom.aliasObject aliases to use in the projectcustom.externalArray an array of external dependenciescustom.alterPluginsFunction an optional function which gets the plugins as inputcustom.customizeFunction an optional function which allows you to alter all output
Examples
const pkg = require(`../package.json`)
const {rollup} = require(`../germs`)
const external = (
pkg && pkg.dependencies ? Object.keys(pkg.dependencies) : []
)
module.exports = rollup({
name: pkg.name,
alias: {
[`@tools`]: `./tools`
},
external
})Returns Object config file for rollup
bundle
Parameters
customObject configurationcustom.namestring name of projectcustom.aliasObject aliases to use in the projectcustom.externalArray an array of external dependenciescustom.alterPluginsFunction an optional function which gets the plugins as inputcustom.customizeFunction an optional function which allows you to alter all outputcustom.inputstring an input filecustom.outputObject an output object
Examples
const pkg = require(`../package.json`)
const {bundle} = require(`../germs`)
const external = (
pkg && pkg.dependencies ?
Object.keys(pkg.dependencies) :
[]
)
module.exports = bundle({
name: pkg.name,
alias: {
[`@tools`]: `./tools`
},
external,
input: `src/index.js`,
output: {
file: `./${pkg.name}.js`,
format: `cjs`
}
})Returns Object config file for rollup