Skip to content

Instantly share code, notes, and snippets.

@ArnaudD
Last active March 17, 2016 16:09
Show Gist options
  • Save ArnaudD/6c4b38ad578fa05ce9ce to your computer and use it in GitHub Desktop.
Save ArnaudD/6c4b38ad578fa05ce9ce to your computer and use it in GitHub Desktop.
FIZIX NPM Module boilerplate
{
"presets": [
"es2015",
"stage-0",
]
}
# http://editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
node_modules
dist
{
"parser": "babel-eslint",
"extends": "airbnb/base",
"rules": {
"strict": 0,
"indent": [2, 2],
"no-trailing-space": [0],
"new-cap": 0,
"key-spacing": 0
},
"env": {
"es6": true,
"browser": true,
"node": true,
"mocha": true
},
"ecmaFeatures": {
"modules": true,
"experimentalObjectRestSpread": true
}
}
dist
node_modules
npm-debug.log*

Usage

bash <(curl -s https://gist.githubusercontent.com/ArnaudD/6c4b38ad578fa05ce9ce/raw/init.sh)
var mod = require('./package.json');
var fs = require('fs');
Object.assign(mod.scripts, {
clean: 'rimraf dist',
watch: 'npm --silent run build -- --watch',
build: 'npm --silent run clean && babel src -d dist',
test: 'mocha',
eslint: 'eslint --rule \"no-console\":2 src config test tools',
precommit: 'npm run eslint --silent && npm run test --silent',
});
fs.writeFileSync('package.json', JSON.stringify(mod, null, 2));
// hello world
npm init --scope=fizix
npm i --save-dev \
babel \
babel-cli \
babel-preset-es2015 \
babel-preset-stage-0 \
assert \
babel-eslint \
eslint \
eslint-config-airbnb \
husky \
mocha \
should \
should-sinon \
sinon \
babel-core \
babel-polyfill \
estraverse-fb
for file in \
.babelrc \
.editorconfig \
.eslintrc \
.gitignore \
.eslintignore \
index.js \
src__index.js \
test__mocha.opts \
test__index.js
do
file_path=$(echo $file | sed 's/__/\//')
curl "https://gist.githubusercontent.com/ArnaudD/6c4b38ad578fa05ce9ce/raw/$file" > "$file_path"
done
node -e "$(curl -s https://gist.githubusercontent.com/ArnaudD/6c4b38ad578fa05ce9ce/raw/add-scripts.js)"
/* eslint func-names:0 */
describe('foo', function () {
it('bar', function () {
this.should.be.ok();
});
});
--compilers js:babel-core/register
--require babel-polyfill
--require should
--require should-sinon
--ui tdd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment