- node-js is installed
- npm is installed
- Grunt CLI is installed
npm install -g grunt-cli
Prior to creating your own project, to install the version of wa-build from this source tree, run
npm install . -g from the root of this project. This may be preferred if the newest version is not available in an npm repository.
mkdir foo- Create a directory for your component.
cd foo- CD to your component directory.
npm init- Initialize your component.
npm install --save-dev wa-build- Install wa-build.
npm install --save-dev grunt- Install local grunt.
npm install --save-dev babel-runtime- Install ES6 support.
cp node_modules/wa-build/templates/gruntfile.js .- Copy the gruntfile template to your component.
cp node_modules/wa-build/templates/.npmignore .- Copy the .npmignore template to your component so dist/ files will be published to npm.
grunt init- Run one-time build prerequisites.
mkdir src- Create a src directory for your source code.
touch src/index.js- Create src/index.js that will export your component.
grunt- Test the build.
The resulting compiled files are available at
dist/index.js- ES6 to ES5 transpiled. Used for imports from other packages.
lib/foo.js- Browserified, human readable. Use for debugging in web browsers.
lib/foo.min.js- Optimized, obfuscated. Not human readable. Use for production in web browsers.
To continue building upon changing source code, run
grunt dev after a successful
Files will be served up at http://localhost:9001.
You must run
grunt before running