本文整理匯總了TypeScript中ember-cli/lib/utilities/normalize-blueprint-option.default函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript default函數的具體用法?TypeScript default怎麽用?TypeScript default使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了default函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: SilentError
run: function (commandOptions: any, rawArgs: string[]) {
const packageName = rawArgs.shift();
if (!packageName) {
return Promise.reject(new SilentError(
`The "ng ${this.name}" command requires a name argument to be specified. ` +
`For more details, use "ng help".`));
}
commandOptions.name = packageName;
if (commandOptions.dryRun) {
commandOptions.skipGit = true;
}
if (packageName === '.') {
return Promise.reject(new SilentError(
`Trying to generate an application structure in this directory? Use "ng init" ` +
`instead.`));
}
if (!validProjectName(packageName)) {
return Promise.reject(
new SilentError(`We currently do not support a name of "${packageName}".`));
}
if (commandOptions.mobile) {
return Promise.reject(new SilentError(
'The --mobile flag has been disabled temporarily while we await an update of ' +
'angular-universal for supporting NgModule. Sorry for the inconvenience.'
));
}
commandOptions.blueprint = normalizeBlueprint(commandOptions.blueprint);
if (!commandOptions.directory) {
commandOptions.directory = packageName;
}
const createAndStepIntoDirectory =
new this.tasks.CreateAndStepIntoDirectory({ ui: this.ui, analytics: this.analytics });
const initCommand = new InitCommand({
ui: this.ui,
analytics: this.analytics,
tasks: this.tasks,
project: Project.nullProject(this.ui, this.cli)
});
return createAndStepIntoDirectory
.run({
directoryName: commandOptions.directory,
dryRun: commandOptions.dryRun
})
.then(initCommand.run.bind(initCommand, commandOptions, rawArgs));
}
示例2: function
run: function(commandOptions, rawArgs) {
const packageName = rawArgs.shift();
if (!packageName) {
return Promise.reject(new SilentError(
`The "ng ${this.name}" command requires a name argument to be specified. ` +
`For more details, use "ng help".`
));
}
commandOptions.name = packageName;
if (commandOptions.dryRun){
commandOptions.skipGit = true;
}
if (packageName === '.') {
return Promise.reject(new SilentError(
`Trying to generate an application structure in this directory? Use "ng init" ` +
`instead.`
));
}
if (!validProjectName(packageName)) {
return Promise.reject(new SilentError(
`We currently do not support a name of "${packageName}".`
));
}
commandOptions.blueprint = normalizeBlueprint(commandOptions.blueprint);
if (!commandOptions.directory) {
commandOptions.directory = packageName;
}
const createAndStepIntoDirectory = new this.tasks.CreateAndStepIntoDirectory({
ui: this.ui,
analytics: this.analytics
});
const initCommand = new InitCommand({
ui: this.ui,
analytics: this.analytics,
tasks: this.tasks,
project: Project.nullProject(this.ui, this.cli)
});
return createAndStepIntoDirectory
.run({
directoryName: commandOptions.directory,
dryRun: commandOptions.dryRun
})
.then(initCommand.run.bind(initCommand, commandOptions, rawArgs));
}
示例3: SilentError
run: function (commandOptions: any, rawArgs: string[]) {
if (commandOptions.dryRun) {
commandOptions.skipNpm = true;
commandOptions.skipBower = true;
}
const installBlueprint = new this.tasks.InstallBlueprint({
ui: this.ui,
analytics: this.analytics,
project: this.project
});
// needs an explicit check in case it's just 'undefined'
// due to passing of options from 'new' and 'addon'
let gitInit: any;
if (commandOptions.skipGit === false) {
gitInit = new GitInit({
ui: this.ui,
project: this.project
});
}
let npmInstall: any;
if (!commandOptions.skipNpm) {
npmInstall = new NpmInstall({
ui: this.ui,
analytics: this.analytics,
project: this.project
});
}
let linkCli: any;
if (commandOptions.linkCli) {
linkCli = new LinkCli({
ui: this.ui,
analytics: this.analytics,
project: this.project
});
}
let bowerInstall: any;
if (!commandOptions.skipBower) {
bowerInstall = new this.tasks.BowerInstall({
ui: this.ui,
analytics: this.analytics,
project: this.project
});
}
const project = this.project;
const packageName = commandOptions.name !== '.' && commandOptions.name || project.name();
if (!packageName) {
const message = 'The `ng ' + this.name + '` command requires a ' +
'package.json in current folder with name attribute or a specified name via arguments. ' +
'For more details, use `ng help`.';
return Promise.reject(new SilentError(message));
}
const blueprintOpts = {
dryRun: commandOptions.dryRun,
blueprint: 'ng2',
rawName: packageName,
targetFiles: rawArgs || '',
rawArgs: rawArgs.toString(),
sourceDir: commandOptions.sourceDir,
style: commandOptions.style,
prefix: commandOptions.prefix,
mobile: commandOptions.mobile,
routing: commandOptions.routing,
inlineStyle: commandOptions.inlineStyle,
inlineTemplate: commandOptions.inlineTemplate
};
if (!validProjectName(packageName)) {
return Promise.reject(
new SilentError('We currently do not support a name of `' + packageName + '`.'));
}
blueprintOpts.blueprint = normalizeBlueprint(blueprintOpts.blueprint);
return installBlueprint.run(blueprintOpts)
.then(function () {
if (commandOptions.skipGit === false) {
return gitInit.run(commandOptions, rawArgs);
}
}.bind(this))
.then(function () {
if (!commandOptions.skipNpm) {
return npmInstall.run();
}
})
.then(function () {
if (commandOptions.linkCli) {
return linkCli.run();
}
})
.then(function () {
if (!commandOptions.skipBower) {
//.........這裏部分代碼省略.........