本文整理汇总了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))
})));
示例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'));
}
示例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);
// });
// }
},
示例4: build
function build() {
if (options.skipBuild) return Promise.resolve();
return win.checkWindowsElevation(ui)
.then(() => buildTask.run(buildOptions));
}
示例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 git@github.com:${answers.ghUsername}/${commandOptions.projectName}.git`))
} else {
reject(new SilentError(`Failed to create GitHub repo. Error: ${response.statusCode} ${response.statusMessage}`));
}
});
req.write(postData);
req.end();
});
});
}
示例6: function
run: function (commandOptions, rawArgs): Promise<void> {
this[stringUtils.camelize(this.name)](commandOptions, rawArgs);
return Promise.resolve();
},
示例7: build
function build() {
if (options.skipBuild) return Promise.resolve();
return buildTask.run(buildOptions);
}
示例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();
},