azk-dev
This project simplifies and standardizes the main development tasks of node.js projects that are part of the azk project. Among them are:
- Gulp tasks collection that are common to
azk
projects; - Dotfiles for editor and lint tools configuration that maintain code standards:
.editorconfig
,.jshintrc
and.jscsrc
; - Helper for creating a
spec-helper.js
withmocha
,chai
,chai-subset
andchai-promise
; - Helper to use generator and promises to simplify tests;
npm-deploy
script that assists in releasing npm packages;
Among the gulp tasks we have:
lint
andwatch:lint
: for code standards testing, via jshint and jscs;babel[|:spec|:src]
andbabel[|:spec|:src]
: transpilees6
code toes5
via babel;editor:config
: copy the dotfiles to the current project folder, allowing their use in the editor and not only in the lint process;babel:runtime:[install|version]
: to assist in the babel runtime installation process;
Installation
Before adding azk-dev
to your project, be sure to remove babel
, babel-core
and babel-babel-runtime
if they're declared as dependencies. Now install azk-dev
:
$ npm install gulp azk-dev --save-dev
Gulp Tasks (commons azk project tasks)
How to import commons azk-dev gulp tasks and extends:
// gulpfile.jsvar azk_gulp = cwd : __dirname sourcemaps_path: "/mytest" // Custom path to prefix transpiled files lint: "bin/**/*.js" // Extra files for the lint analyzer; var gulp = azk_gulpgulp; gulp;
Check the tasks added to the running gulp (yes we have a gulp help
\o/):
$ gulp help
Available configs:
- src: default:
{ src: "src" , dest: "./lib/src" }
; - spec: default:
{ src: "spec" , dest: "./lib/spec" }
; - lint: default:
[]
; - clean: default:
true
; - default: default:
[ "lint", "test" ]
; - babel: default:
{ presets: ['es2015'], plugins: ['add-module-exports'], }
- sourcemaps_path default: path.basename(process.cwd);
Babel
If you use "generators" in your code, you'll need to install babel-polyfill
:
$ gulp babel:polyfill:install
Chai
// spec/spec-help.jsvar Helpers = expect : expect; ;
Test with generators support
var BPromise = ;var enable_generators = ;;
Editor Configs
Copy dotfiles .jscsrc
, .jshintrc
and .editorconfig
from shared
folder to current project. Use --force
to overwrite.
$ gulp editor:config
Deploy npm package
Adding this in package.json:
"deploy" : "./node_modules/.bin/npm-deploy"
Now you can deploy package with:
$ npm run deploy [<newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease]
This should run the following steps:
- Check if not tracked commits in git
- Run tests with
npm test
- Upgrade version in
package.json
, commit and add tag - Publish package in npmjs.com
TODO
- Notify: https://github.com/mikaelbr/gulp-notify
- Test for babel, lint and watch tasks
- Improving version increment system by modifying the CHANGELOG.md when the version is incremented:
License
"Azuki", "Azk" and the Azuki logo are copyright (c) 2013-2015 Azuki Serviços de Internet LTDA.
Azk-dev source code is released under Apache 2 License.
Check LEGAL and LICENSE files for more information.