-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ee69d1b
Showing
41 changed files
with
1,862 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
node_modules | ||
jspm_packages | ||
bower_components | ||
.idea | ||
.DS_STORE | ||
/dist | ||
build/reports |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"esnext": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
# aurelia-skeleton-navigation | ||
|
||
[![ZenHub](https://raw.githubusercontent.com/ZenHubIO/support/master/zenhub-badge.png)](https://zenhub.io) | ||
[![Join the chat at https://gitter.im/aurelia/discuss](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/aurelia/discuss?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) | ||
|
||
This skeleton is part of the [Aurelia](http://www.aurelia.io/) platform. It sets up a standard navigation-style app using gulp to build your ES6 code with the Babel compiler. Karma/Protractor/Jasmine testing is also configured. | ||
|
||
> To keep up to date on [Aurelia](http://www.aurelia.io/), please visit and subscribe to [the official blog](http://blog.durandal.io/). If you have questions, we invite you to [join us on Gitter](https://gitter.im/aurelia/discuss). If you would like to have deeper insight into our development process, please install the [ZenHub](https://zenhub.io) Chrome Extension and visit any of our repository's boards. You can get an overview of all Aurelia work by visiting [the framework board](https://github.com/aurelia/framework#boards). | ||
## Running The App | ||
|
||
To run the app, follow these steps. | ||
|
||
1. Ensure that [NodeJS](http://nodejs.org/) is installed. This provides the platform on which the build tooling runs. | ||
2. From the project folder, execute the following command: | ||
|
||
```shell | ||
npm install | ||
``` | ||
3. Ensure that [Gulp](http://gulpjs.com/) is installed. If you need to install it, use the following command: | ||
|
||
```shell | ||
npm install -g gulp | ||
``` | ||
4. Ensure that [jspm](http://jspm.io/) is installed. If you need to install it, use the following command: | ||
|
||
```shell | ||
npm install -g jspm | ||
``` | ||
> **Note:** jspm queries GitHub to install semver packages, but GitHub has a rate limit on anonymous API requests. It is advised that you configure jspm with your GitHub credentials in order to avoid problems. You can do this by executing `jspm registry config github` and following the prompts. If you choose to authorize jspm by an access token instead of giving your password (see GitHub `Settings > Personal Access Tokens`), `public_repo` access for the token is required. | ||
5. Install the client-side dependencies with jspm: | ||
|
||
```shell | ||
jspm install -y | ||
``` | ||
>**Note:** Windows users, if you experience an error of "unknown command unzip" you can solve this problem by doing `npm install -g unzip` and then re-running `jspm install`. | ||
6. To run the app, execute the following command: | ||
|
||
```shell | ||
gulp watch | ||
``` | ||
7. Browse to [http://localhost:9000](http://localhost:9000) to see the app. You can make changes in the code found under `src` and the browser should auto-refresh itself as you save files. | ||
|
||
> Note: At present there is a bug in the HTMLImports polyfill which only occurs on IE. We have submitted a pull request to the team with the fix. In the mean time, if you want to test on IE, you can work around the issue by explicitly adding a script tag before you load system.js. The script tag should look something like this (be sure to confirm the version number): | ||
```html | ||
<script src="jspm_packages/github/webcomponents/[email protected]/HTMLImports.js"></script> | ||
``` | ||
|
||
## Running The App under Electron | ||
|
||
To run the app under [Electron](http://electron.atom.io), follow these steps. | ||
|
||
1. Install [Electron](http://electron.atom.io) | ||
|
||
```shell | ||
npm install electron-prebuilt -g | ||
``` | ||
2. To start the app, execute the following command: | ||
|
||
```shell | ||
electron . | ||
``` | ||
|
||
|
||
## Bundling | ||
Bundling is performed by [Aurelia Bundler](http://github.com/aurelia/bundler). A gulp task is already configured for that. Use the following command to bundle the app: | ||
|
||
```shell | ||
gulp bundle | ||
``` | ||
|
||
You can also unbundle using the command bellow: | ||
|
||
```shell | ||
gulp unbundle | ||
``` | ||
|
||
## Running The Unit Tests | ||
|
||
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: | ||
|
||
1. Ensure that the [Karma](http://karma-runner.github.io/) CLI is installed. If you need to install it, use the following command: | ||
|
||
```shell | ||
npm install -g karma-cli | ||
``` | ||
2. Install Aurelia libs for test visibility: | ||
|
||
```shell | ||
jspm install aurelia-framework | ||
jspm install aurelia-http-client | ||
jspm install aurelia-router | ||
``` | ||
3. You can now run the tests with this command: | ||
|
||
```shell | ||
karma start | ||
``` | ||
|
||
## Running The E2E Tests | ||
Integration tests are performed with [Protractor](http://angular.github.io/protractor/#/). | ||
|
||
1. Place your E2E-Tests into the folder ```test/e2e/src``` | ||
2. Install the necessary webdriver | ||
|
||
```shell | ||
gulp webdriver_update | ||
``` | ||
|
||
3. Configure the path to the webdriver by opening the file ```protractor.conf.js``` and adjusting the ```seleniumServerJar``` property. Typically its only needed to adjust the version number. | ||
|
||
4. Make sure your app runs and is accessible | ||
|
||
```shell | ||
gulp watch | ||
``` | ||
|
||
5. In another console run the E2E-Tests | ||
|
||
```shell | ||
gulp e2e | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* Aurelia Protractor Plugin */ | ||
function addValueBindLocator() { | ||
by.addLocator('valueBind', function (bindingModel, opt_parentElement) { | ||
var using = opt_parentElement || document; | ||
var matches = using.querySelectorAll('*[value\\.bind="' + bindingModel +'"]'); | ||
var result; | ||
|
||
if (matches.length === 0) { | ||
result = null; | ||
} else if (matches.length === 1) { | ||
result = matches[0]; | ||
} else { | ||
result = matches; | ||
} | ||
|
||
return result; | ||
}); | ||
} | ||
|
||
function loadAndWaitForAureliaPage(pageUrl) { | ||
browser.get(pageUrl); | ||
return browser.executeAsyncScript( | ||
'var cb = arguments[arguments.length - 1];' + | ||
'document.addEventListener("aurelia-composed", function (e) {' + | ||
' cb("Aurelia App composed")' + | ||
'}, false);' | ||
).then(function(result){ | ||
console.log(result); | ||
return result; | ||
}); | ||
} | ||
|
||
function waitForRouterComplete() { | ||
return browser.executeAsyncScript( | ||
'var cb = arguments[arguments.length - 1];' + | ||
'document.querySelector("[aurelia-app]")' + | ||
'.aurelia.subscribeOnce("router:navigation:complete", function() {' + | ||
' cb(true)' + | ||
'});' | ||
).then(function(result){ | ||
return result; | ||
}); | ||
} | ||
|
||
/* Plugin hooks */ | ||
exports.setup = function(config) { | ||
// Ignore the default Angular synchronization helpers | ||
browser.ignoreSynchronization = true; | ||
|
||
// add the aurelia specific valueBind locator | ||
addValueBindLocator(); | ||
|
||
// attach a new way to browser.get a page and wait for Aurelia to complete loading | ||
browser.loadAndWaitForAureliaPage = loadAndWaitForAureliaPage; | ||
|
||
// wait for router navigations to complete | ||
browser.waitForRouterComplete = waitForRouterComplete; | ||
}; | ||
|
||
exports.teardown = function(config) {}; | ||
exports.postResults = function(config) {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
var yargs = require('yargs'); | ||
|
||
var argv = yargs.argv, | ||
validBumpTypes = "major|minor|patch|prerelease".split("|"), | ||
bump = (argv.bump || 'patch').toLowerCase(); | ||
|
||
if(validBumpTypes.indexOf(bump) === -1) { | ||
throw new Error('Unrecognized bump "' + bump + '".'); | ||
} | ||
|
||
module.exports = { | ||
bump: bump | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module.exports = { | ||
modules: 'system', | ||
moduleIds: false, | ||
comments: false, | ||
compact: false, | ||
stage:2, | ||
optional: [ | ||
"es7.decorators", | ||
"es7.classProperties" | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
var path = require('path'); | ||
|
||
var appRoot = 'src/'; | ||
var outputRoot = 'dist/'; | ||
|
||
module.exports = { | ||
root: appRoot, | ||
source: appRoot + '**/*.js', | ||
html: appRoot + '**/*.html', | ||
css: appRoot + '**/*.css', | ||
style: 'styles/**/*.css', | ||
output: outputRoot, | ||
doc:'./doc', | ||
e2eSpecsSrc: 'test/e2e/src/*.js', | ||
e2eSpecsDist: 'test/e2e/dist/' | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
var gulp = require('gulp'); | ||
var runSequence = require('run-sequence'); | ||
var changed = require('gulp-changed'); | ||
var plumber = require('gulp-plumber'); | ||
var to5 = require('gulp-babel'); | ||
var sourcemaps = require('gulp-sourcemaps'); | ||
var paths = require('../paths'); | ||
var compilerOptions = require('../babel-options'); | ||
var assign = Object.assign || require('object.assign'); | ||
var notify = require("gulp-notify"); | ||
|
||
// transpiles changed es6 files to SystemJS format | ||
// the plumber() call prevents 'pipe breaking' caused | ||
// by errors from other gulp plugins | ||
// https://www.npmjs.com/package/gulp-plumber | ||
gulp.task('build-system', function () { | ||
return gulp.src(paths.source) | ||
.pipe(plumber({errorHandler: notify.onError("Error: <%= error.message %>")})) | ||
.pipe(changed(paths.output, {extension: '.js'})) | ||
.pipe(sourcemaps.init({loadMaps: true})) | ||
.pipe(to5(assign({}, compilerOptions, {modules:'system'}))) | ||
.pipe(sourcemaps.write({includeContent: true})) | ||
.pipe(gulp.dest(paths.output)); | ||
}); | ||
|
||
// copies changed html files to the output directory | ||
gulp.task('build-html', function () { | ||
return gulp.src(paths.html) | ||
.pipe(changed(paths.output, {extension: '.html'})) | ||
.pipe(gulp.dest(paths.output)); | ||
}); | ||
|
||
// copies changed css files to the output directory | ||
gulp.task('build-css', function () { | ||
return gulp.src(paths.css) | ||
.pipe(changed(paths.output, {extension: '.css'})) | ||
.pipe(gulp.dest(paths.output)); | ||
}); | ||
|
||
// this task calls the clean task (located | ||
// in ./clean.js), then runs the build-system | ||
// and build-html tasks in parallel | ||
// https://www.npmjs.com/package/gulp-run-sequence | ||
gulp.task('build', function(callback) { | ||
return runSequence( | ||
'clean', | ||
['build-system', 'build-html', 'build-css'], | ||
callback | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
var gulp = require('gulp'); | ||
var bundler = require('aurelia-bundler'); | ||
|
||
var config = { | ||
force: true, | ||
packagePath: '.', | ||
bundles: { | ||
"dist/app-build": { | ||
includes: [ | ||
'*', | ||
'*.html!text', | ||
'*.css!text', | ||
'bootstrap/css/bootstrap.css!text' | ||
], | ||
options: { | ||
inject: true, | ||
minify: true | ||
} | ||
}, | ||
"dist/aurelia": { | ||
includes: [ | ||
'aurelia-bootstrapper', | ||
'aurelia-fetch-client', | ||
'aurelia-router', | ||
'aurelia-animator-css', | ||
'github:aurelia/templating-binding', | ||
'github:aurelia/templating-resources', | ||
'github:aurelia/templating-router', | ||
'github:aurelia/loader-default', | ||
'github:aurelia/history-browser', | ||
'github:aurelia/logging-console' | ||
], | ||
options: { | ||
inject: true, | ||
minify: true | ||
} | ||
} | ||
} | ||
}; | ||
|
||
gulp.task('bundle', function() { | ||
return bundler.bundle(config); | ||
}); | ||
|
||
gulp.task('unbundle', function() { | ||
return bundler.unbundle(config); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
var gulp = require('gulp'); | ||
var paths = require('../paths'); | ||
var del = require('del'); | ||
var vinylPaths = require('vinyl-paths'); | ||
|
||
// deletes all files in the output path | ||
gulp.task('clean', function() { | ||
return gulp.src([paths.output]) | ||
.pipe(vinylPaths(del)); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
var gulp = require('gulp'); | ||
var tools = require('aurelia-tools'); | ||
|
||
// source code for the tasks called in this file | ||
// is located at: https://github.com/aurelia/tools/blob/master/src/dev.js | ||
|
||
// updates dependencies in this folder | ||
// from folders in the parent directory | ||
gulp.task('update-own-deps', function(){ | ||
tools.updateOwnDependenciesFromLocalRepositories(); | ||
}); | ||
|
||
// quickly pulls in all of the aurelia | ||
// github repos, placing them up one directory | ||
// from where the command is executed, | ||
// then runs `npm install` | ||
// and `gulp build` for each repo | ||
gulp.task('build-dev-env', function () { | ||
tools.buildDevEnv(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
var gulp = require('gulp'); | ||
var tools = require('aurelia-tools'); | ||
var paths = require('../paths'); | ||
var yuidoc = require('gulp-yuidoc'); | ||
|
||
// uses yui to generate documentation to doc/api.json | ||
gulp.task('doc-generate', function(){ | ||
return gulp.src(paths.source) | ||
.pipe(yuidoc.parser(null, 'api.json')) | ||
.pipe(gulp.dest(paths.doc)); | ||
}); | ||
|
||
// takes output of doc-generate task | ||
// and cleans it up for use with aurelia | ||
// documentation app | ||
gulp.task('doc', ['doc-generate'], function(){ | ||
tools.transformAPIModel(paths.doc); | ||
}); |
Oops, something went wrong.