本文整理汇总了TypeScript中ember-cli/lib/ext/promise.resolve函数的典型用法代码示例。如果您正苦于以下问题:TypeScript resolve函数的具体用法?TypeScript resolve怎么用?TypeScript resolve使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了resolve函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: fsCopy
.then((files) => Promise.all(files.map((file) => {
if (file === '.gitignore'){
// don't overwrite the .gitignore file
return Promise.resolve();
}
return fsCopy(path.join('dist', file), path.join('.', file))
})));
开发者ID:DevVersion,项目名称:angular-cli,代码行数:7,代码来源:github-pages-deploy.ts
示例2: updateBaseHref
function updateBaseHref() {
if (options.userPage) return Promise.resolve();
let indexHtml = path.join(root, 'index.html');
return fsReadFile(indexHtml, 'utf8')
.then((data) => data.replace(/<base href="\/">/g, `<base href="/${projectName}/">`))
.then((data) => fsWriteFile(indexHtml, data, 'utf8'));
}
开发者ID:DevVersion,项目名称:angular-cli,代码行数:7,代码来源:github-pages-deploy.ts
示例3: function
cleanup: function() {
var ui = this.ui;
// if (this.webpack) {
// this.webpack.cleanupAndExit();
return Promise.resolve();
// } else {
// return this.builder.cleanup().catch(function (err) {
// ui.writeLine(chalk.red('Cleanup error.'));
// ui.writeError(err);
// });
// }
},
开发者ID:TheLarkInn,项目名称:angular-cli,代码行数:13,代码来源:builder.ts
示例4: build
function build() {
if (options.skipBuild) return Promise.resolve();
return win.checkWindowsElevation(ui)
.then(() => buildTask.run(buildOptions));
}
开发者ID:DrMabuse23,项目名称:angular-cli,代码行数:5,代码来源:github-pages-deploy.ts
示例5: function
run: function(commandOptions) {
var ui = this.ui;
let promise;
// declared here so that tests can stub exec
const execPromise = Promise.denodeify(exec);
if (/.+/.test(commandOptions.ghToken) && /\w+/.test(commandOptions.ghUsername)) {
promise = Promise.resolve({
ghToken: commandOptions.ghToken,
ghUsername: commandOptions.ghUsername
});
} else {
ui.writeLine("\nIn order to deploy this project via GitHub Pages, we must first create a repository for it.");
ui.writeLine("It's safer to use a token than to use a password, so you will need to create one.\n");
ui.writeLine("Go to the following page and click 'Generate new token'.");
ui.writeLine("https://github.com/settings/tokens\n");
ui.writeLine("Choose 'public_repo' as scope and then click 'Generate token'.\n");
promise = ui.prompt([
{
name: 'ghToken',
type: 'input',
message: 'Please enter GitHub token you just created (used only once to create the repo):',
validate: function(token) {
return /.+/.test(token);
}
}, {
name: 'ghUsername',
type: 'input',
message: 'and your GitHub user name:',
validate: function(userName) {
return /\w+/.test(userName);
}
}]);
}
return promise
.then((answers) => {
return new Promise(function(resolve, reject) {
var postData = JSON.stringify({
'name': commandOptions.projectName
});
var req = https.request({
hostname: 'api.github.com',
port: 443,
path: '/user/repos',
method: 'POST',
headers: {
'Authorization': `token ${answers.ghToken}`,
'Content-Type': 'application/json',
'Content-Length': postData.length,
'User-Agent': 'angular-cli-github-pages'
}
});
req.on('response', function(response) {
if (response.statusCode === 201) {
resolve(execPromise(`git remote add origin [email protected]:${answers.ghUsername}/${commandOptions.projectName}.git`))
} else {
reject(new SilentError(`Failed to create GitHub repo. Error: ${response.statusCode} ${response.statusMessage}`));
}
});
req.write(postData);
req.end();
});
});
}
开发者ID:2blessed2bstressedbythedevilsmess,项目名称:angular-cli,代码行数:69,代码来源:create-github-repo.ts
示例6: function
run: function (commandOptions, rawArgs): Promise<void> {
this[stringUtils.camelize(this.name)](commandOptions, rawArgs);
return Promise.resolve();
},
开发者ID:2blessed2bstressedbythedevilsmess,项目名称:angular-cli,代码行数:5,代码来源:easter-egg.ts
示例7: build
function build() {
if (options.skipBuild) return Promise.resolve();
return buildTask.run(buildOptions);
}
开发者ID:mmrath,项目名称:angular-cli,代码行数:4,代码来源:github-pages-deploy.ts
示例8: function
run: function (commandOptions, rawArgs): Promise<void> {
var stringUtils = require('ember-cli/lib/utilities/string');
this[stringUtils.camelize(this.name)](commandOptions, rawArgs);
return Promise.resolve();
},
开发者ID:Bigous,项目名称:angular-cli,代码行数:6,代码来源:easter-egg.ts
注:本文中的ember-cli/lib/ext/promise.resolve函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论