These are set of starter projects to build rich client-side experiences using Node.js. These skeletons are aimed at leveraging packages to develop and build, while providing a set of unified tasks and definitions to focus less on configuration and setup.
The following tools are leveraged to provide a unified workflow:
Additional packages can be introduced to cover testing of your JavaScript applications:
Skeleton variants are available to package your web applications to run with access to native components using Apache Cordova. Visit this page for more information about extras that are provided for Cordova.
Skeleton variants are available that provide additional packages to build a full stack application, inspired by MEAN:
The following starter projects are available to download, including Cordova and Serverpack variants. The JavaScript frameworks available include:
npm install
.You are free to work with the individual packages that these skeletons use. (ex: Brunch, Scaffolt, etc.) However, tasks are provided to simplify your workflow with consistency. These tasks are executed using Jake. ex: jake [task]
These tasks are to handle things that are package-related, such as Bower and NPM.
bower:clean
Remove downloaded Bower components. This is useful if you want to reinstall dependencies, such as updates or packages have been corrupted.
bower:install
Download Bower components.
npm:clean
Remove downloaded NPM modules. This is useful if you want to reinstall dependencies, such as updates or packages have been corrupted. Remember that after running this task npm install
needs to be executed to install dependencies.
These commands add additional features/items to the project that are not included by default.
add:jquery
rem:jquery
Add/remove the ubiquitous library jQuery to/from the project.
add:normalize
rem:normalize
Add/remove normalize.css to/from the project to ensure a consistent starting point in styling between different browsers.
Generator commands are available to generate and tear down files from templates given a type and name, eliminating the writing of boilerplate code.
generate
/ destroy
Generate or tear down templates. ex: jake generate codetest=user
generate
/ gen
/ g
destroy
/ del
/ d
jake g codetest=user
jake gen codetest=test1,test2 sitetest=test3
generate codetest=[name]
destroy codetest=[name]
Generate/destroy a test file with the given test name for testing client-side code with Karma.
generate sitetest=[name]
destroy sitetest=[name]
Generate/destroy a test file with the given test name for testing the site with WebDriverJS.
generate servermodel=[name]
destroy servermodel=[name]
(Serverpack only) Generate/destroy a Mongoose model.
The following tasks are for assembling the application, generating JS/CSS and copy assets. The following modes are provided:
dev
mode keeps the readable JS/CSS originally written, plus include source maps.prod
mode minifies JS/CSS and omits source maps.If any Bower dependencies have not been downloaded yet, Bower will first download them.
build:[mode]
Assemble code and assets once.
watch:[mode]
Assemble the code and assets, plus watch for changes. Rebuild every time a change is detected.
server:[mode] browsersync=false
Assemble the code and assets, plus watch for changes. Rebuild every time a change is detected. Also, the server is booted up.
dev
mode, the page will automatically refresh on changes as well.dev
mode Autoreload Brunch is used to automatically refresh the page on changes.browsersync=true
then BrowserSync is used instead for additional functionality.To begin running tests make sure that the task test:install
is run first to install required packages.
test:install
Install packages required to run code and site testing. You should only need to run this once, unless the task npm:clean
has been invoked, or testing packages have been updated.
test:all codereporter=[codereporter] sitereporter=[sitereporter]
Run all tests listed below once. For more information on reporters see below.
test:code reporter=[reporter] watch=false browsersync=false
Run code-based tests (ex: unit tests) using Karma. Karma is preconfigured to run with all available browsers on the system. (PhantomJS is included) Karma reporter can be specified with the reporter
option. By default Karma runs once. If you run this task with watch=true
Karma will watch for changes and auto-run on changes. You can also run the server while watching files with watch=server
, plus use BrowserSync with browsersync=true
.
test:site reporter=[reporter] watch=false
Run site-based tests (ex: system tests) using PhantomJS and WebDriverJS. A server is started up temporarily to interact with the site. A mocha reporter can be specified with the reporter option. By default Karma runs once. If you run this task with watch=true
Mocha will auto-run on changes with Nodemon. The global method getDriver
is provided to setup a driver, while the global property baseUrl
returns the root url. (ex: http://localhost:3333
) Mocha as Promised is also included to take advantage of WebDriverJS' use of promises.