A simple skeleton to start you off on your Aurelia project. Uses the following:
- Aurelia (http://aurelia.io)
- JSPM (http://jspm.io)
Just clone the repo and install the necessary node modules:
$ npm install # Install Node modules listed in ./package.json (may take a while the first time)
$ npm install -g gulp # Install Gulp
$ npm install -g jspm # Install JSPM
$ jspm install # Install JSPM modules listed in ./package.json
$ gulp # Compile and launch
Runs dev server and watches the files in the src directory. Compiles at runtime. The dev server can be found at localhost:9000
.
Compiles the source files (ES6 > ES5 and SCSS > CSS), removes comments, and minifies. Then saves them into the release folder (/dist). Production builds will fail on eslint errors (but not on warnings).
Runs unit tests with Karma using Jasmine specs.
Bundling is performed by Aurelia Bundler. A gulp task is already configured for that. Use the following command to bundle the app:
You can also unbundle.
The configuration is done by /build/config.js
file.
Under options
of dist/aurelia
add rev: true
to add bundle file revision/version.
Basic project configuration can be found in ~/build/config.js
. Here you'll be able to redefine your src and dist directories, as well as tweak what ports the server will run on.
The folder structure provided is only meant to serve as a guide, it is by no means prescriptive. It is something that has worked very well for me and my team, but use only what makes sense to you.
.
├── build # All build-related configuration
│ ├── tasks # Gulp configuration files
| ├── config.js # Project configuration settings
├── src # Application source code
| ├── styles # CSS styles
| ├── views # Components that live at a route
| ├── index.html # Initial HTML page
| └── main.js # Application bootstrap and rendering
└── karma.conf.js # Karma configuration settings
All .scss
imports will be run through the autoprefixer when compiled into CSS.
To add a unit test, simply create .spec.js
file anywhere in '/test/unit'. All imports will be relative to the "/src" directory. The entry point for Karma uses JSPM's custom require to load all these files, and Jasmine will be available to you within your test without the need to import them.
To run the unit tests, first ensure that you have followed the steps above in order to install all dependencies and successfully build the library. Once you have done that, proceed with these additional steps:
- Ensure that the Karma CLI is installed. If you need to install it, use the following command:
npm install -g karma-cli
- Install Aurelia libs for test visibility:
jspm install aurelia-framework
jspm install aurelia-http-client
jspm install aurelia-router
- You can now run the tests with this command:
karma start
Integration tests are performed with Protractor.
- Place your E2E-Tests into the folder
test/e2e/src
- Install the necessary webdriver
gulp webdriver_update
-
Configure the path to the webdriver by opening the file
protractor.conf.js
and adjusting theseleniumServerJar
property. Typically its only needed to adjust the version number. -
Make sure your app runs and is accessible
gulp
- In another console run the E2E-Tests
gulp e2e
A gulp task is already configured for that. Use the following command to export the app:
gulp export
The app will be exported into export
directory preserving the directory structure.
The configuration is done by bundles.json
file.
In addition, export.json
file is available for including individual files.
Nothing yet. Having an issue? Report it and I'll get to it as soon as possible!