Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
awilczek committed Oct 27, 2016
0 parents commit f043981
Show file tree
Hide file tree
Showing 46 changed files with 26,116 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"sourceMap": true,
"moduleIds": false,
"comments": false,
"compact": false,
"code": true,
"presets": [ "es2015-loose", "stage-1"],
"plugins": [
"syntax-flow",
"transform-decorators-legacy",
"transform-flow-strip-types"
]
}
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# EditorConfig is awesome: http://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true

# 2 space indentation
[**.*]
indent_style = space
indent_size = 2
3 changes: 3 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "./node_modules/aurelia-tools/.eslintrc.json"
}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
.idea
.DS_STORE
142 changes: 142 additions & 0 deletions aurelia_project/aurelia.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
{
"name": "aurelia-app",
"type": "project:application",
"platform": {
"id": "web",
"displayName": "Web",
"output": "scripts",
"index": "index.html"
},
"transpiler": {
"id": "babel",
"displayName": "Babel",
"fileExtension": ".js",
"options": {
"plugins": [
"transform-es2015-modules-amd"
]
},
"source": "src/**/*.js"
},
"markupProcessor": {
"id": "none",
"displayName": "None",
"fileExtension": ".html",
"source": "src/**/*.html"
},
"cssProcessor": {
"id": "none",
"displayName": "None",
"fileExtension": ".css",
"source": "src/**/*.css"
},
"editor": {
"id": "webstorm",
"displayName": "WebStorm"
},
"unitTestRunner": {
"id": "karma",
"displayName": "Karma",
"source": "test/unit/**/*.js"
},
"paths": {
"root": "src",
"resources": "src/resources",
"elements": "src/resources/elements",
"attributes": "src/resources/attributes",
"valueConverters": "src/resources/value-converters",
"bindingBehaviors": "src/resources/binding-behaviors"
},
"testFramework": {
"id": "jasmine",
"displayName": "Jasmine"
},
"build": {
"targets": [
{
"id": "web",
"displayName": "Web",
"output": "scripts",
"index": "index.html"
}
],
"loader": {
"type": "require",
"configTarget": "vendor-bundle.js",
"includeBundleMetadataInConfig": "auto",
"plugins": [
{
"name": "text",
"extensions": [
".html",
".css"
],
"stub": true
}
]
},
"options": {
"minify": "stage & prod",
"sourcemaps": "dev & stage"
},
"bundles": [
{
"name": "app-bundle.js",
"source": [
"[**/*.js]",
"**/*.{css,html}"
]
},
{
"name": "vendor-bundle.js",
"prepend": [
"node_modules/bluebird/js/browser/bluebird.core.js",
"scripts/require.js"
],
"dependencies": [
"aurelia-binding",
"aurelia-bootstrapper",
"aurelia-dependency-injection",
"aurelia-event-aggregator",
"aurelia-framework",
"aurelia-history",
"aurelia-history-browser",
"aurelia-loader",
"aurelia-loader-default",
"aurelia-logging",
"aurelia-logging-console",
"aurelia-metadata",
"aurelia-pal",
"aurelia-pal-browser",
"aurelia-path",
"aurelia-polyfills",
"aurelia-route-recognizer",
"aurelia-router",
"aurelia-task-queue",
"aurelia-templating",
"aurelia-templating-binding",
{
"name": "text",
"path": "../scripts/text"
},
{
"name": "aurelia-templating-resources",
"path": "../node_modules/aurelia-templating-resources/dist/amd",
"main": "aurelia-templating-resources"
},
{
"name": "aurelia-templating-router",
"path": "../node_modules/aurelia-templating-router/dist/amd",
"main": "aurelia-templating-router"
},
{
"name": "aurelia-testing",
"path": "../node_modules/aurelia-testing/dist/amd",
"main": "aurelia-testing",
"env": "dev"
}
]
}
]
}
}
4 changes: 4 additions & 0 deletions aurelia_project/environments/dev.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export default {
debug: true,
testing: true
};
4 changes: 4 additions & 0 deletions aurelia_project/environments/prod.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export default {
debug: false,
testing: false
};
4 changes: 4 additions & 0 deletions aurelia_project/environments/stage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export default {
debug: true,
testing: false
};
44 changes: 44 additions & 0 deletions aurelia_project/generators/attribute.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import {inject} from 'aurelia-dependency-injection';
import {Project, ProjectItem, CLIOptions, UI} from 'aurelia-cli';

@inject(Project, CLIOptions, UI)
export default class AttributeGenerator {
constructor(project, options, ui) {
this.project = project;
this.options = options;
this.ui = ui;
}

execute() {
return this.ui
.ensureAnswer(this.options.args[0], 'What would you like to call the custom attribute?')
.then(name => {
let fileName = this.project.makeFileName(name);
let className = this.project.makeClassName(name);

this.project.attributes.add(
ProjectItem.text(`${fileName}.js`, this.generateSource(className))
);

return this.project.commitChanges()
.then(() => this.ui.log(`Created ${fileName}.`));
});
}

generateSource(className) {
return `import {inject} from 'aurelia-framework';
@inject(Element)
export class ${className}CustomAttribute {
constructor(element) {
this.element = element;
}
valueChanged(newValue, oldValue) {
}
}
`;
}
}
4 changes: 4 additions & 0 deletions aurelia_project/generators/attribute.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "attribute",
"description": "Creates a custom attribute class and places it in the project resources."
}
41 changes: 41 additions & 0 deletions aurelia_project/generators/binding-behavior.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import {inject} from 'aurelia-dependency-injection';
import {Project, ProjectItem, CLIOptions, UI} from 'aurelia-cli';

@inject(Project, CLIOptions, UI)
export default class BindingBehaviorGenerator {
constructor(project, options, ui) {
this.project = project;
this.options = options;
this.ui = ui;
}

execute() {
return this.ui
.ensureAnswer(this.options.args[0], 'What would you like to call the binding behavior?')
.then(name => {
let fileName = this.project.makeFileName(name);
let className = this.project.makeClassName(name);

this.project.bindingBehaviors.add(
ProjectItem.text(`${fileName}.js`, this.generateSource(className))
);

return this.project.commitChanges()
.then(() => this.ui.log(`Created ${fileName}.`));
});
}

generateSource(className) {
return `export class ${className}BindingBehavior {
bind(binding, source) {
}
unbind(binding, source) {
}
}
`
}
}
4 changes: 4 additions & 0 deletions aurelia_project/generators/binding-behavior.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "binding-behavior",
"description": "Creates a binding behavior class and places it in the project resources."
}
48 changes: 48 additions & 0 deletions aurelia_project/generators/element.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import {inject} from 'aurelia-dependency-injection';
import {Project, ProjectItem, CLIOptions, UI} from 'aurelia-cli';

@inject(Project, CLIOptions, UI)
export default class ElementGenerator {
constructor(project, options, ui) {
this.project = project;
this.options = options;
this.ui = ui;
}

execute() {
return this.ui
.ensureAnswer(this.options.args[0], 'What would you like to call the custom element?')
.then(name => {
let fileName = this.project.makeFileName(name);
let className = this.project.makeClassName(name);

this.project.elements.add(
ProjectItem.text(`${fileName}.js`, this.generateJSSource(className)),
ProjectItem.text(`${fileName}.html`, this.generateHTMLSource(className))
);

return this.project.commitChanges()
.then(() => this.ui.log(`Created ${fileName}.`));
});
}

generateJSSource(className) {
return `import {bindable} from 'aurelia-framework';
export class ${className} {
@bindable value;
valueChanged(newValue, oldValue) {
}
}
`;
}

generateHTMLSource(className) {
return `<template>
<h1>\${value}</h1>
</template>`;
}
}
4 changes: 4 additions & 0 deletions aurelia_project/generators/element.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "element",
"description": "Creates a custom element class and template, placing them in the project resources."
}
Loading

0 comments on commit f043981

Please sign in to comment.