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

Initial commit

parents
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));
}
`;
}
}
{
"name": "value-converter",
"description": "Creates a value converter 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 ValueConverterGenerator {
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 value converter?'
);
let fileName = this.project.makeFileName(name);
let className = this.project.makeClassName(name);
this.project.valueConverters.add(
ProjectItem.text(`${fileName}.ts`, this.generateSource(className))
);
await this.project.commitChanges();
await this.ui.log(`Created ${fileName}.`);
}
generateSource(className) {
return `export class ${className}ValueConverter {
toView(value) {
//
}
fromView(value) {
//
}
}
`;
}
}
{
"name": "build",
"description": "Builds and processes all application assets. It is an alias of the `npm run build:dev`, you may use either of those; see README for more details.",
"flags": [
{
"name": "analyze",
"description": "Enable Webpack Bundle Analyzer. Typically paired with --env prod",
"type": "boolean"
},
{
"name": "env",
"description": "Sets the build environment.",
"type": "string"
},
{
"name": "watch",
"description": "Watches source files for changes and refreshes the bundles automatically.",
"type": "boolean"
}
]
}
\ No newline at end of file
import { NPM } from 'aurelia-cli';
export default function() {
console.log('`au build` is an alias of the `npm run build:dev`, you may use either of those; see README for more details.');
const args = process.argv.slice(3);
return (new NPM()).run('run', ['build:dev', '--', ... cleanArgs(args)]);
}
// Cleanup --env prod to --env.production
// for backwards compatibility
function cleanArgs(args) {
const cleaned = [];
for (let i = 0, ii = args.length; i < ii; i++) {
if (args[i] === '--env' && i < ii - 1) {
const env = args[++i].toLowerCase();
if (env.startsWith('prod')) {
cleaned.push('--env.production');
} else if (env.startsWith('test')) {
cleaned.push('--tests');
}
} else {
cleaned.push(args[i]);
}
}
return cleaned;
}
{
"name": "run",
"description": "Builds the application and serves up the assets via a local web server, watching files for changes as you work. It is an alias of the `npm start`, you may use either of those; see README for more details.",
"flags": [
{
"name": "analyze",
"description": "Enable Webpack Bundle Analyzer. Typically paired with --env prod",
"type": "boolean"
},
{
"name": "env",
"description": "Sets the build environment.",
"type": "string"
},
{
"name": "hmr",
"description": "Enable Hot Module Reload",
"type": "boolean"
},
{
"name": "port",
"description": "Set port number of the dev server",
"type": "string"
},
{
"name": "host",
"description": "Set host address of the dev server, the accessible URL",
"type": "string"
},
{
"name": "open",
"description": "Open the default browser at the application location.",
"type": "boolean"
}
]
}
\ No newline at end of file
import { NPM } from 'aurelia-cli';
import * as kill from 'tree-kill';
import { platform } from '../aurelia.json';
const npm = new NPM();
function run() {
console.log('`au run` is an alias of the `npm start`, you may use either of those; see README for more details.');
const args = process.argv.slice(3);
return npm.run('start', ['--', ... cleanArgs(args)]);
}
// Cleanup --env prod to --env.production
// for backwards compatibility
function cleanArgs(args) {
let host;
const cleaned = [];
for (let i = 0, ii = args.length; i < ii; i++) {
if (args[i] === '--env' && i < ii - 1) {
const env = args[++i].toLowerCase();
if (env.startsWith('prod')) {
cleaned.push('--env.production');
} else if (env.startsWith('test')) {
cleaned.push('--tests');
}
} else if (args[i] === '--host' && i < ii -1) {
host = args[++i];
} else {
cleaned.push(args[i]);
}
}
// Deal with --host before webpack-dev-server calls webpack config.
// Because of https://discourse.aurelia.io/t/changing-platform-host-in-aurelia-json-doesnt-change-the-host-ip/3043/10?u=huochunpeng
if (!host) host = platform.host;
if (host) cleaned.push('--host', host);
return cleaned;
}
const shutdownAppServer = () => {
if (npm && npm.proc) {
kill(npm.proc.pid);
}
};
export { run as default, shutdownAppServer };
{
"debug": true,
"testing": true
}
\ No newline at end of file
{
"debug": false,
"testing": false
}
\ No newline at end of file
favicon.ico

14.7 KB

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title><%- htmlWebpackPlugin.options.metadata.title %></title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<base href="<%- htmlWebpackPlugin.options.metadata.baseUrl %>">
<!-- imported CSS are concatenated and added automatically -->
</head>
<body aurelia-app="main">
</body>
</html>
This diff is collapsed.
{
"name": "sportmap-aurelia",
"description": "An Aurelia client application.",
"version": "0.1.0",
"repository": {
"type": "???",
"url": "???"
},
"license": "MIT",
"dependencies": {
"aurelia-animator-css": "^1.0.4",
"aurelia-bootstrapper": "^2.3.3",
"bootstrap": "^4.4.1",
"eslint": "^6.8.0",
"font-awesome": "^4.7.0",
"jquery": "3.4.1",
"popper.js": "^1.16.1"
},
"devDependencies": {
"@types/bootstrap": "^4.3.2",
"@types/jquery": "^3.3.35",
"@types/lodash": "^4.14.149",
"@types/node": "^13.7.6",
"@types/webpack": "^4.41.6",
"@typescript-eslint/eslint-plugin": "^2.29.0",
"@typescript-eslint/parser": "^2.29.0",
"app-settings-loader": "^1.0.3",
"aurelia-cli": "^1.3.1",
"aurelia-testing": "^1.0.0",
"aurelia-webpack-plugin": "^4.0.0",
"autoprefixer": "^9.7.4",
"clean-webpack-plugin": "^3.0.0",
"copy-webpack-plugin": "^5.1.1",
"css-loader": "^3.4.2",
"cssnano": "^4.1.10",
"duplicate-package-checker-webpack-plugin": "^3.0.0",
"eslint-loader": "^4.0.0",
"expose-loader": "^0.7.5",
"file-loader": "^5.1.0",
"gulp": "^4.0.0",
"html-loader": "^0.5.5",
"html-webpack-plugin": "^3.2.0",
"istanbul-instrumenter-loader": "^3.0.1",
"json-loader": "^0.5.7",
"mini-css-extract-plugin": "^0.9.0",
"minimatch": "^3.0.4",
"postcss-loader": "^3.0.0",
"promise-polyfill": "^8.1.3",
"style-loader": "^1.1.3",
"through2": "^3.0.1",
"tree-kill": "^1.2.1",
"ts-loader": "^6.2.1",
"ts-node": "^8.6.2",
"typescript": "^3.8.2",
"url-loader": "^3.0.0",
"vinyl-fs": "^3.0.3",
"webpack": "^4.41.6",
"webpack-bundle-analyzer": "^3.6.0",
"webpack-cli": "^3.3.11",
"webpack-dev-server": "^3.10.3"
},
"browserslist": [
"defaults"
],
"scripts": {
"build": "webpack --env.production --extractCss",
"start": "webpack-dev-server --extractCss",
"build:dev": "webpack --extractCss",
"analyze": "webpack --env.production --analyze",
"lint": "npx eslint . --ext .js,.jsx,.ts,.tsx"
},
"engines": {
"node": ">=8.9.0"
}
}
<template>
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
<div class="container">
<a class="navbar-brand" href="#">SportMap</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar"
aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbar">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item">
<a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Disabled</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="dropdown01" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">Dropdown</a>
<div class="dropdown-menu" aria-labelledby="dropdown01">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<a class="dropdown-item" href="#">Something else here</a>
</div>
</li>
</ul>
</div>
</div>
</nav>
<div class="container">
<main role="main">
${envstr}
<router-view></router-view>
</main>
</div>
</template>
import { PLATFORM } from 'aurelia-pal';
import { autoinject } from 'aurelia-framework';
import { RouterConfiguration, Router } from 'aurelia-router';
import * as environment from '../config/environment.json';
@autoinject
export class App {
router?: Router;
envstr = JSON.stringify(environment);
configureRouter(config: RouterConfiguration, router: Router): void {
this.router = router;
config.title = 'SportMap';
config.map([
{route: ['','home'], name: 'home', moduleId: PLATFORM.moduleName('views/home/index'), nav: true, title: 'Home'},
]);
config.mapUnknownRoutes('views/home/index');
}
}
import {Aurelia} from 'aurelia-framework';
import * as environment from '../config/environment.json';
import {PLATFORM} from 'aurelia-pal';
import 'jquery';
import 'popper.js';
import 'bootstrap';
import 'bootstrap/dist/css/bootstrap.min.css';
import 'font-awesome/css/font-awesome.min.css';
import '../static/site.css';
export function configure(aurelia: Aurelia): void {
aurelia.use
.standardConfiguration()
.feature(PLATFORM.moduleName('resources/index'));
aurelia.use.developmentLogging(environment.debug ? 'debug' : 'warn');
if (environment.testing) {
aurelia.use.plugin(PLATFORM.moduleName('aurelia-testing'));
}
aurelia.start().then(() => aurelia.setRoot(PLATFORM.moduleName('app')));
}
import { FrameworkConfiguration } from 'aurelia-framework';
export function configure(config: FrameworkConfiguration): void {
//config.globalResources([]);
}
<template>
home-index
</template>
export class HomeIndex {
}
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