mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-06 04:22:01 +00:00
* Add API for frameworks and examples * Adjust headers * Update frameworks list * Always use latest * Add types * Use now repo for downloading and listing * Use .existsSync * Remove unused packages * Use 307 for redirect * Add examples * Update tsconfig.json Co-Authored-By: Steven <steven@ceriously.com> * Make examples unique * Remove detectors from frameworks API * Use /api instead of Next.js * Install dependencies * Rename project * Change name * Empty * Change name * Update api/tsconfig.json Co-Authored-By: Steven <steven@ceriously.com> * Update examples Co-authored-by: Steven <steven@ceriously.com>
42 lines
973 B
JavaScript
42 lines
973 B
JavaScript
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;
|
|
}
|
|
|
|
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}.js`, 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) {
|
|
//
|
|
}
|
|
}
|
|
`;
|
|
}
|
|
}
|