本文整理汇总了TypeScript中ember-cli/lib/commands/generate.extend函数的典型用法代码示例。如果您正苦于以下问题:TypeScript extend函数的具体用法?TypeScript extend怎么用?TypeScript extend使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了extend函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
const GenerateCommand = EmberGenerateCommand.extend({
name: 'generate',
beforeRun: function(rawArgs: string[]) {
if (!rawArgs.length) {
return;
}
// map the blueprint name to allow for aliases
rawArgs[0] = mapBlueprintName(rawArgs[0]);
if (rawArgs[0] !== '--help' &&
!fs.existsSync(path.join(__dirname, '..', 'blueprints', rawArgs[0]))) {
SilentError.debugOrThrow('angular-cli/commands/generate', `Invalid blueprint: ${rawArgs[0]}`);
}
if (!rawArgs[1]) {
SilentError.debugOrThrow('angular-cli/commands/generate',
`The \`ng generate ${rawArgs[0]}\` command requires a name to be specified.`);
}
// Override default help to hide ember blueprints
EmberGenerateCommand.prototype.printDetailedHelp = function() {
const blueprintList = fs.readdirSync(path.join(__dirname, '..', 'blueprints'));
const blueprints = blueprintList
.filter(bp => bp.indexOf('-test') === -1)
.filter(bp => bp !== 'ng2')
.filter(bp => bp !== 'mobile')
.map(bp => Blueprint.load(path.join(__dirname, '..', 'blueprints', bp)));
let output = '';
blueprints
.forEach(function (bp) {
output += bp.printBasicHelp(false) + os.EOL;
});
this.ui.writeLine(chalk.cyan(' Available blueprints'));
this.ui.writeLine(output);
};
return EmberGenerateCommand.prototype.beforeRun.apply(this, arguments);
}
});
示例2: function
import * as EmberGenerateCommand from 'ember-cli/lib/commands/generate';
import * as fs from 'fs';
import * as path from 'path';
import * as SilentError from 'silent-error';
const GenerateCommand = EmberGenerateCommand.extend({
name: 'generate',
beforeRun: function(rawArgs) {
if (!rawArgs.length) {
return;
}
if (!fs.existsSync(path.join(__dirname, '..', 'blueprints', rawArgs[0]))) {
SilentError.debugOrThrow('angular-cli/commands/generate', `Invalid blueprint: ${rawArgs[0]}`);
}
return EmberGenerateCommand.prototype.beforeRun.apply(this, arguments);
}
});
module.exports = GenerateCommand;
module.exports.overrideCore = true;