Commit 2ae63c6b authored by Andres Käver's avatar Andres Käver
Browse files

Initial commit

parents
# 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 = 4
dev-app
# don't ever lint node_modules
node_modules
# don't lint build output (make sure it's set to your correct build folder name)
dist
# don't lint nyc coverage output
coverage
# don't lint framework
aurelia_project
# leave webpack alone
webpack.config.js
module.exports = {
root: true,
parser: '@typescript-eslint/parser', // Specifies the ESLint parser
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended', // Uses the recommended rules from @typescript-eslint/eslint-plugin
],
parserOptions: {
ecmaVersion: 2020, // Allows for the parsing of modern ECMAScript features
sourceType: 'module', // Allows for the use of imports
ecmaFeatures: {
jsx: true, // Allows for the parsing of JSX
},
},
settings: {
},
rules: {
// Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs
// e.g. '@typescript-eslint/explicit-function-return-type': 'off',
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/interface-name-prefix": [
"error",
{
"prefixWithI": "always"
}
],
},
};
# You may want to customise this file depending on your Operating System
# and the editor that you use.
#
# We recommend that you use a Global Gitignore for files that are not related
# to the project. (https://help.github.com/articles/ignoring-files/#create-a-global-gitignore)
# OS
#
# Ref: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore
# Ref: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore
# Ref: https://github.com/github/gitignore/blob/master/Global/Linux.gitignore
.DS_STORE
Thumbs.db
# Editors
#
# Ref: https://github.com/github/gitignore/blob/master/Global
# Ref: https://github.com/github/gitignore/blob/master/Global/JetBrains.gitignore
# Ref: https://github.com/github/gitignore/blob/master/Global/VisualStudioCode.gitignore
.idea
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
# Dependencies
node_modules
# Compiled files
/scripts
/src/environment.js
/src/environment.ts
/dist
/test/coverage-jest
/test/coverage-karma
{
"recommendations": [
"AureliaEffect.aurelia",
"msjsdiag.debugger-for-chrome",
"steoates.autoimport",
"EditorConfig.EditorConfig",
"christian-kohler.path-intellisense",
"behzad88.Aurelia"
]
}
\ No newline at end of file
{
"version": "0.2.0",
"configurations": [
{
"name": "Chrome",
"type": "chrome",
"request": "launch",
"url": "http://localhost:8080",
"webRoot": "${workspaceRoot}/src",
"userDataDir": "${workspaceRoot}/.chrome",
"sourceMapPathOverrides": {
"webpack:///./src/*": "${webRoot}/*"
}
}
]
}
\ No newline at end of file
{
"typescript.tsdk": "node_modules/typescript/lib",
"html.suggest.angular1": false,
"html.suggest.ionic": false
}
\ No newline at end of file
# `sportmap-aurelia`
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`.
{
"name": "sportmap-aurelia",
"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"
},
"packageManager": "npm"
}
\ No newline at end of file
{
"name": "attribute",
"description": "Creates a custom attribute class and places it in the project resources."
}
\ No newline at end of file
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) {
//
}
}
`;
}
}
{
"name": "binding-behavior",
"description": "Creates a binding behavior class and places it in the project resources."
}
\ No newline at end of file
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) {
//
}
}
`
}
}
{
"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)."
}
\ No newline at end of file
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 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>
`
}
}
{
"name": "element",
"description": "Creates a custom element class and template, placing them in the project resources."
}
\ No newline at end of file
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>
`;
}
}
{
"name": "generator",
"description": "Creates a generator class and places it in the project generators folder."
}
\ No newline at end of file
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) {
//
}
}
\`
}
}
`;
}
}
{
"name": "task",
"description": "Creates a task and places it in the project tasks folder."
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment