Skip to content

Commit

Permalink
initial
Browse files Browse the repository at this point in the history
  • Loading branch information
psnider committed Mar 26, 2022
0 parents commit 95a8019
Show file tree
Hide file tree
Showing 131 changed files with 4,729 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.DS_Store
node_modules

33 changes: 33 additions & 0 deletions Aurelia-bootstrap-notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# `aurelia-app`

This project is bootstrapped by [aurelia-cli](https://github.com/aurelia/cli).

For more information, go to https://aurelia.io/docs/cli/webpack

## Run dev app

Run `npm start`, then open `http://localhost:8080`

You can change the standard webpack configurations from CLI easily with something like this: `npm start -- --open --port 8888`. However, it is better to change the respective npm scripts or `webpack.config.js` with these options, as per your need.

To enable Webpack Bundle Analyzer, do `npm run analyze` (production build).

To enable hot module reload, do `npm start -- --hmr`.

To change dev server port, do `npm start -- --port 8888`.

To change dev server host, do `npm start -- --host 127.0.0.1`

**PS:** You could mix all the flags as well, `npm start -- --host 127.0.0.1 --port 7070 --open --hmr`

For long time aurelia-cli user, you can still use `au run` with those arguments like `au run --env prod --open --hmr`. But `au run` now simply executes `npm start` command.

## Build for production

Run `npm run build`, or the old way `au build --env prod`.

## Unit tests

Run `au test` (or `au jest`).

To run in watch mode, `au test --watch` or `au jest --watch`.
14 changes: 14 additions & 0 deletions ReadMe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

# Errors

### All
- Don't allow duplicate messages.
- Fix the background so it works on mobile.

### Aurelia
- clean up the hamburger menu
- After getting new game, display message in New Game Controls for a few seconds so controls are not available.
- click on signboard message to freeze it?, option to delete it?
- add easy method to contest a word


30 changes: 30 additions & 0 deletions aurelia_project/aurelia.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "aurelia-app",
"type": "project:application",
"paths": {
"root": "src",
"resources": "resources",
"elements": "resources/elements",
"attributes": "resources/attributes",
"valueConverters": "resources/value-converters",
"bindingBehaviors": "resources/binding-behaviors"
},
"transpiler": {
"id": "typescript",
"fileExtension": ".ts"
},
"build": {
"options": {
"server": "dev",
"extractCss": "prod",
"coverage": false
}
},
"platform": {
"hmr": false,
"open": false,
"port": 8080,
"host": "localhost",
"output": "dist"
}
}
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."
}
38 changes: 38 additions & 0 deletions aurelia_project/generators/attribute.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import {inject} from 'aurelia-dependency-injection';
import {Project, ProjectItem, CLIOptions, UI} from 'aurelia-cli';

@inject(Project, CLIOptions, UI)
export default class AttributeGenerator {
constructor(private project: Project, private options: CLIOptions, private ui: UI) { }

async execute() {
const name = await this.ui.ensureAnswer(
this.options.args[0],
'What would you like to call the custom attribute?'
);

let fileName = this.project.makeFileName(name);
let className = this.project.makeClassName(name);

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

await this.project.commitChanges();
await this.ui.log(`Created ${fileName}.`);
}

generateSource(className) {
return `import {autoinject} from 'aurelia-framework';
@autoinject()
export class ${className}CustomAttribute {
constructor(private element: Element) { }
valueChanged(newValue, oldValue) {
//
}
}
`;
}
}
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."
}
37 changes: 37 additions & 0 deletions aurelia_project/generators/binding-behavior.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import {inject} from 'aurelia-dependency-injection';
import {Project, ProjectItem, CLIOptions, UI} from 'aurelia-cli';

@inject(Project, CLIOptions, UI)
export default class BindingBehaviorGenerator {
constructor(private project: Project, private options: CLIOptions, private ui: UI) { }

async execute() {
const name = await this.ui.ensureAnswer(
this.options.args[0],
'What would you like to call the binding behavior?'
);

let fileName = this.project.makeFileName(name);
let className = this.project.makeClassName(name);

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

await this.project.commitChanges();
await 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/component.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "component",
"description": "Creates a custom component class and template (view model and view), placing them in the project source folder (or optionally in sub folders)."
}
49 changes: 49 additions & 0 deletions aurelia_project/generators/component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { inject } from 'aurelia-dependency-injection';
import { Project, ProjectItem, CLIOptions, UI } from 'aurelia-cli';
import * as path from 'path';

@inject(Project, CLIOptions, UI)
export default class ElementGenerator {
constructor(private project: Project, private options: CLIOptions, private ui: UI) { }

async execute() {
const name = await this.ui.ensureAnswer(
this.options.args[0],
'What would you like to call the component?'
);

const subFolders = await this.ui.ensureAnswer(
this.options.args[1],
'What sub-folder would you like to add it to?\nIf it doesn\'t exist it will be created for you.\n\nDefault folder is "." relative to the source folder src/', "."
);

let fileName = this.project.makeFileName(name);
let className = this.project.makeClassName(name);

this.project.root.add(
ProjectItem.text(path.join(subFolders, fileName + '.ts'), this.generateJSSource(className)),
ProjectItem.text(path.join(subFolders, fileName + '.html'), this.generateHTMLSource(className))
);

await this.project.commitChanges();
await this.ui.log(`Created ${name} in the '${path.join(this.project.root.name, subFolders)}' folder`);
}

generateJSSource(className) {
return `export class ${className} {
message: string;
constructor() {
this.message = 'Hello world';
}
}
`
}

generateHTMLSource(className) {
return `<template>
<h1>\${message}</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."
}
45 changes: 45 additions & 0 deletions aurelia_project/generators/element.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import {inject} from 'aurelia-dependency-injection';
import {Project, ProjectItem, CLIOptions, UI} from 'aurelia-cli';

@inject(Project, CLIOptions, UI)
export default class ElementGenerator {
constructor(private project: Project, private options: CLIOptions, private ui: UI) { }

async execute() {
const name = await this.ui.ensureAnswer(
this.options.args[0],
'What would you like to call the custom element?'
);

let fileName = this.project.makeFileName(name);
let className = this.project.makeClassName(name);

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

await this.project.commitChanges();
await 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/generator.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "generator",
"description": "Creates a generator class and places it in the project generators folder."
}
68 changes: 68 additions & 0 deletions aurelia_project/generators/generator.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import {inject} from 'aurelia-dependency-injection';
import {Project, ProjectItem, CLIOptions, UI} from 'aurelia-cli';

@inject(Project, CLIOptions, UI)
export default class GeneratorGenerator {
constructor(private project: Project, private options: CLIOptions, private ui: UI) { }

async execute() {
const name = await this.ui.ensureAnswer(
this.options.args[0],
'What would you like to call the generator?'
);

let fileName = this.project.makeFileName(name);
let className = this.project.makeClassName(name);

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

await this.project.commitChanges()
await this.ui.log(`Created ${fileName}.`);
}

generateSource(className) {
return `import {inject} from 'aurelia-dependency-injection';
import {Project, ProjectItem, CLIOptions, UI} from 'aurelia-cli';
@inject(Project, CLIOptions, UI)
export default class ${className}Generator {
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 new item?')
.then(name => {
let fileName = this.project.makeFileName(name);
let className = this.project.makeClassName(name);
this.project.elements.add(
ProjectItem.text(\`\${fileName}.ts\`, this.generateSource(className))
);
return this.project.commitChanges()
.then(() => this.ui.log(\`Created \${fileName}.\`));
});
}
generateSource(className) {
return \`import {bindable} from 'aurelia-framework';
export class \${className} {
@bindable value;
valueChanged(newValue, oldValue) {
//
}
}
\`
}
}
`;
}
}
4 changes: 4 additions & 0 deletions aurelia_project/generators/task.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "task",
"description": "Creates a task and places it in the project tasks folder."
}
36 changes: 36 additions & 0 deletions aurelia_project/generators/task.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import {inject} from 'aurelia-dependency-injection';
import {Project, ProjectItem, CLIOptions, UI} from 'aurelia-cli';

@inject(Project, CLIOptions, UI)
export default class TaskGenerator {
constructor(private project: Project, private options: CLIOptions, private ui: UI) { }

async execute() {
const name = await this.ui.ensureAnswer(
this.options.args[0],
'What would you like to call the task?'
);

let fileName = this.project.makeFileName(name);
let functionName = this.project.makeFunctionName(name);

this.project.tasks.add(
ProjectItem.text(`${fileName}.ts`, this.generateSource(functionName))
);

await this.project.commitChanges();
await this.ui.log(`Created ${fileName}.`);
}

generateSource(functionName) {
return `import * as gulp from 'gulp';
import * as project from '../aurelia.json';
export default function ${functionName}() {
return gulp.src(project.paths.???)
.pipe(gulp.dest(project.paths.output));
}
`;

}
}
Loading

0 comments on commit 95a8019

Please sign in to comment.