Skip to content

Commit

Permalink
add bootstrap code from test project
Browse files Browse the repository at this point in the history
  • Loading branch information
bnavetta committed Aug 10, 2015
1 parent 1b0ec13 commit f5e8d8d
Show file tree
Hide file tree
Showing 18 changed files with 388 additions and 85 deletions.
38 changes: 33 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,39 @@
# aurelia-skeleton-plugin
# aurelia-polymer

[![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 plugin configures [Aurelia](http://www.aurelia.io/) and [Polymer](https://www.polymer-project.org/)
to work with each other.

This skeleton is part of the [Aurelia](http://www.aurelia.io/) platform. It sets up a standard aurelia plugin using gulp to build your ES6 code with the Babel compiler. Karma/Jasmine testing is also configured.
## Installation and Usage

> 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).
1. Install the plugin via `jspm`
```
jspm install aurelia-polymer=github:roguePanda/aurelia-polymer@^0.1.0
```

2. Use [manual bootstrapping](http://aurelia.io/docs#startup-and-configuration).

3. In your `configure` function, load the plugin.

```js
export function configure(aurelia) {
aurelia.use
.standardConfiguration()
.developmentLogging()
.plugin('aurelia-polymer');

aurelia.start().then(a => a.setRoot());
}
```

4. In `index.html`, defer loading Aurelia until Polymer has loaded.

```html
<script>
document.addEventListener('WebComponentsReady', function() {
System.import('aurelia-bootstrapper');
});
</script>
```

## Building The Code

Expand Down
89 changes: 89 additions & 0 deletions config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
System.config({
"baseURL": "/",
"transpiler": "babel",
"babelOptions": {
"optional": [
"es7.classProperties",
"es7.decorators",
"runtime"
]
},
"paths": {
"*": "*.js",
"github:*": "jspm_packages/github/*.js",
"npm:*": "jspm_packages/npm/*.js",
"dialog/*": "dist/commonjs/*.js"
}
});

System.config({
"map": {
"aurelia-framework": "github:aurelia/[email protected]",
"aurelia-templating-binding": "github:aurelia/[email protected]",
"babel": "npm:[email protected]",
"babel-runtime": "npm:[email protected]",
"core-js": "npm:[email protected]",
"traceur": "github:jmcriffey/[email protected]",
"traceur-runtime": "github:jmcriffey/[email protected]",
"github:aurelia/[email protected]": {
"aurelia-dependency-injection": "github:aurelia/[email protected]",
"aurelia-metadata": "github:aurelia/[email protected]",
"aurelia-task-queue": "github:aurelia/[email protected]",
"core-js": "npm:[email protected]"
},
"github:aurelia/[email protected]": {
"aurelia-logging": "github:aurelia/[email protected]",
"aurelia-metadata": "github:aurelia/[email protected]",
"core-js": "npm:[email protected]"
},
"github:aurelia/[email protected]": {
"aurelia-binding": "github:aurelia/[email protected]",
"aurelia-dependency-injection": "github:aurelia/[email protected]",
"aurelia-loader": "github:aurelia/[email protected]",
"aurelia-logging": "github:aurelia/[email protected]",
"aurelia-metadata": "github:aurelia/[email protected]",
"aurelia-path": "github:aurelia/[email protected]",
"aurelia-task-queue": "github:aurelia/[email protected]",
"aurelia-templating": "github:aurelia/[email protected]",
"core-js": "npm:[email protected]"
},
"github:aurelia/[email protected]": {
"aurelia-html-template-element": "github:aurelia/[email protected]",
"aurelia-metadata": "github:aurelia/[email protected]",
"aurelia-path": "github:aurelia/[email protected]",
"core-js": "npm:[email protected]",
"webcomponentsjs": "github:webcomponents/[email protected]"
},
"github:aurelia/[email protected]": {
"core-js": "npm:[email protected]"
},
"github:aurelia/[email protected]": {
"aurelia-binding": "github:aurelia/[email protected]",
"aurelia-logging": "github:aurelia/[email protected]",
"aurelia-templating": "github:aurelia/[email protected]"
},
"github:aurelia/[email protected]": {
"aurelia-binding": "github:aurelia/[email protected]",
"aurelia-dependency-injection": "github:aurelia/[email protected]",
"aurelia-html-template-element": "github:aurelia/[email protected]",
"aurelia-loader": "github:aurelia/[email protected]",
"aurelia-logging": "github:aurelia/[email protected]",
"aurelia-metadata": "github:aurelia/[email protected]",
"aurelia-path": "github:aurelia/[email protected]",
"aurelia-task-queue": "github:aurelia/[email protected]",
"core-js": "npm:[email protected]"
},
"github:jspm/[email protected]": {
"process": "npm:[email protected]"
},
"npm:[email protected]": {
"process": "github:jspm/[email protected]"
},
"npm:[email protected]": {
"fs": "github:jspm/[email protected]",
"process": "github:jspm/[email protected]",
"systemjs-json": "github:systemjs/[email protected]"
}
}
});

3 changes: 0 additions & 3 deletions dist/amd/hello-world.html

This file was deleted.

15 changes: 0 additions & 15 deletions dist/amd/hello-world.js

This file was deleted.

50 changes: 48 additions & 2 deletions dist/amd/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,58 @@
define(['exports'], function (exports) {
define(['exports', 'aurelia-framework', 'aurelia-templating-binding'], function (exports, _aureliaFramework, _aureliaTemplatingBinding) {
'use strict';

Object.defineProperty(exports, '__esModule', {
value: true
});
exports.configure = configure;

function registerElement(eventManager, bindingLanguage, prototype) {
var propertyConfig = { 'bind-value': ['change'] };

function handleProp(propName, prop) {
if (prop.notify) {
propertyConfig[propName] = ['change'];
}
}

Object.keys(prototype.properties).forEach(function (propName) {
return handleProp(propName, prototype.properties[propName]);
});

prototype.behaviors.forEach(function (behavior) {
if (typeof behavior.properties != 'undefined') {
Object.keys(behavior.properties).forEach(function (propName) {
return handleProp(propName, behavior.properties[propName]);
});
}
});

eventManager.registerElementConfig({
tagName: prototype.is,
properties: propertyConfig
});
}

function configure(aurelia) {
aurelia.globalizeResources('./hello-world');
var eventManager = aurelia.container.get(_aureliaFramework.EventManager);
var bindingLanguage = aurelia.container.get(_aureliaTemplatingBinding.TemplatingBindingLanguage);
var observerLocator = aurelia.container.get(_aureliaFramework.ObserverLocator);

bindingLanguage.attributeMap['bind-value'] = 'bindValue';

var registrations = Polymer.telemetry.observations;
registrations.forEach(function (prototype) {
return registerElement(eventManager, bindingLanguage, prototype);
});
observerLocator.getArrayObserver(registrations).subscribe(function (changes) {
changes.forEach(function (change) {
if (change.type === "splice" && change.addedCount > 0) {
for (var i = 0; i < change.addedCount; i++) {
var prototype = change.object[change.index + i - 1];
registerElement(eventManager, bindingLanguage, prototype);
}
}
});
});
}
});
3 changes: 0 additions & 3 deletions dist/commonjs/hello-world.html

This file was deleted.

13 changes: 0 additions & 13 deletions dist/commonjs/hello-world.js

This file was deleted.

52 changes: 51 additions & 1 deletion dist/commonjs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,56 @@ Object.defineProperty(exports, '__esModule', {
});
exports.configure = configure;

var _aureliaFramework = require('aurelia-framework');

var _aureliaTemplatingBinding = require('aurelia-templating-binding');

function registerElement(eventManager, bindingLanguage, prototype) {
var propertyConfig = { 'bind-value': ['change'] };

function handleProp(propName, prop) {
if (prop.notify) {
propertyConfig[propName] = ['change'];
}
}

Object.keys(prototype.properties).forEach(function (propName) {
return handleProp(propName, prototype.properties[propName]);
});

prototype.behaviors.forEach(function (behavior) {
if (typeof behavior.properties != 'undefined') {
Object.keys(behavior.properties).forEach(function (propName) {
return handleProp(propName, behavior.properties[propName]);
});
}
});

eventManager.registerElementConfig({
tagName: prototype.is,
properties: propertyConfig
});
}

function configure(aurelia) {
aurelia.globalizeResources('./hello-world');
var eventManager = aurelia.container.get(_aureliaFramework.EventManager);
var bindingLanguage = aurelia.container.get(_aureliaTemplatingBinding.TemplatingBindingLanguage);
var observerLocator = aurelia.container.get(_aureliaFramework.ObserverLocator);

bindingLanguage.attributeMap['bind-value'] = 'bindValue';

var registrations = Polymer.telemetry.observations;
registrations.forEach(function (prototype) {
return registerElement(eventManager, bindingLanguage, prototype);
});
observerLocator.getArrayObserver(registrations).subscribe(function (changes) {
changes.forEach(function (change) {
if (change.type === "splice" && change.addedCount > 0) {
for (var i = 0; i < change.addedCount; i++) {
var prototype = change.object[change.index + i - 1];
registerElement(eventManager, bindingLanguage, prototype);
}
}
});
});
}
3 changes: 0 additions & 3 deletions dist/es6/hello-world.html

This file was deleted.

1 change: 0 additions & 1 deletion dist/es6/hello-world.js

This file was deleted.

47 changes: 46 additions & 1 deletion dist/es6/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,48 @@
import {EventManager, ObserverLocator} from 'aurelia-framework';
import {TemplatingBindingLanguage} from 'aurelia-templating-binding';

function registerElement(eventManager, bindingLanguage, prototype) {
var propertyConfig = {'bind-value': ['change']}; // Not explicitly listed for all elements that use it

function handleProp(propName, prop) {
if (prop.notify) {
propertyConfig[propName] = ['change'];
}
}

Object.keys(prototype.properties)
.forEach(propName => handleProp(propName, prototype.properties[propName]));

prototype.behaviors.forEach(behavior => {
if (typeof behavior.properties != 'undefined') {
Object.keys(behavior.properties)
.forEach(propName => handleProp(propName, behavior.properties[propName]));
}
});

eventManager.registerElementConfig({
tagName: prototype.is,
properties: propertyConfig
});
}

export function configure(aurelia){
aurelia.globalizeResources('./hello-world');
let eventManager = aurelia.container.get(EventManager);
let bindingLanguage = aurelia.container.get(TemplatingBindingLanguage);
let observerLocator = aurelia.container.get(ObserverLocator);

bindingLanguage.attributeMap['bind-value'] = 'bindValue';

let registrations = Polymer.telemetry.observations;
registrations.forEach(prototype => registerElement(eventManager, bindingLanguage, prototype));
observerLocator.getArrayObserver(registrations).subscribe(changes => {
changes.forEach(change => {
if (change.type === "splice" && change.addedCount > 0) {
for (let i = 0; i < change.addedCount; i++) {
let prototype = change.object[change.index + i - 1];
registerElement(eventManager, bindingLanguage, prototype);
}
}
});
});
}
3 changes: 0 additions & 3 deletions dist/system/hello-world.html

This file was deleted.

18 changes: 0 additions & 18 deletions dist/system/hello-world.js

This file was deleted.

Loading

0 comments on commit f5e8d8d

Please sign in to comment.