Angular 1.x and Webpack2 starter with ES 2015/ES 2016, SASS, ui-router and bootstrap. For unit testing Jasmine and karma are used. ESLint is used to lint JavaScript.
Key Points :
-
Application entry point is .../app/app.js. (Only application specific code/files need to be imported here). All these are bundle into /bundle.js/.
-
All third party library files needs to be imported in .../app/vendor.js. All these are bundle into a separate file vendor.js
-
All scss/css are bundle into a separate files app.css(for application specific styles) and vendor.css(for third party styles) to achieve parallel loading of styles along with js.
-
For unit tests testContext.js file will be used, which prepares and bundles all the files required for unit testing using Webpack and karma.
-
Install all dependencies
npm install
-
To run in dev mode
npm run start
. Access app via localhost:8080Note :
-
In Dev mode, the bundles are virtual loaded into memory. (Physical files are not generated in the disk)
-
Live reload is enabled using Webpack's hot reload module.
-
Enabling source-map for debug
-
-
To run unit tests
npm test
.-
Code coverage report will be available in /coverage/
-
Test cases report will be available in /karma_html/
-
-
For production build
npm run build
. Prod build will be available in /dist.Note : Minified bundles are created on disk with all optimizations.
-
To add precommit hook (it doesn't allow us to commit un linted files and it try to fix basic eslint errors using --fix option).
- copy the code in precommit.txt
- remove the file extension .git/hooks/pre-commit.sample (rename it to pre-commit or remove .sample)
- paste the copied code in .git/hooks/pre-commit
-
To test the production build
npm run test-prod-build
. Application can be accessed via localhost:3000/. -
To generate documentation for the code
npm run doc
. The documentation will be available in /docs/.Sample Document:
-
Angular(v1.x)
-
Eslint - for linting JavaScript
-
Babel - for transpiling ES2015/ES2016 code to ES5
-
Karma & Jasmine - for unit tests
-
Webpack(v2) - for minification/optimization and bundling(building) the package.
-
ESDoc(v0.5.2) - for generating documentation (Refer : https://esdoc.org/)
-
Editor Config - To make sure all the developers follow same editor configurations.