This is a blueprint you can use to create your own web compatible browserifiable projects.
After copying the template replace the following placeholders in the package.json
file:
<%= AUTHOR_NAME %>
: your name<%= AUTHOR_GITHUB_NAME %>
: your name on GitHub<%= PACKAGE_NAME %>
: the name of the project (for npm package and repository)<%= PACKAGE_DESCRIPTION %>
: a short description of the package
The following shows the general project structure
├─dist
├─docs
│ └─api
├─lib
│ └─foo.js
├─resources
├─test
│ ├─config
│ ├─fixtures
│ └─spec
│ └─fooSpec.js
├─tmp
│ └─reports
├─Gruntfile.js
├─index.js
└─package.json
A note on the structure:
-
dist
location of the distribution ready (web packed) files -
docs
contains documentation relevant for developers or usersdocs/api
gets generated from the project sources
-
lib
contains the project sources -
resources
can contain non-js sources such as JSON config files or images -
test
contains all test related datatest/config
holds Karma config filestest/spec
and sub folders hold test cases; test case naming convention:<name>Spec.js
test/integration
and sub folders hold integration (post bundle) tests; test case naming convention:<name>Spec.js
test/fixtures
hold test data
-
index.js
is the main entry point for the module
The boilerplate uses the following components:
- browserify, for file bundling
- grunt for building
- jasmine, version 2.0 for testing
- jsdoc for documentation generation
- jshint for linting
- karma, for test execution
The contained Gruntfile.js
configures the following build tasks:
Performs all neccessary tasks in the correct order.
grunt
Watches for library changes and re-builds the library.
grunt auto-build
Watches for library or test changes and re-runs the test suite automatically.
grunt auto-test
Releases a new version of the library (on npm and GitHub).
grunt release:minor
grunt release:patch
grunt release:major
MIT