Skip to content

Commit

Permalink
Replace Q with native promises
Browse files Browse the repository at this point in the history
  • Loading branch information
XhmikosR authored and tschaub committed Apr 16, 2020
1 parent 6b1ad31 commit 97cc3b1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions lib/git.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ exports.init = function init(cwd) {
exports.clone = function clone(repo, dir, branch, options) {
return fse.pathExists(dir).then(exists => {
if (exists) {
return Q.resolve();
return Promise.resolve();
}
return fse.ensureDir(path.dirname(path.resolve(dir))).then(() => {
const args = ['clone', repo, dir, '--branch', branch, '--single-branch'];
Expand Down Expand Up @@ -160,7 +160,7 @@ exports.checkout = function checkout(remote, branch, cwd) {
return spawn(git, ['checkout', '--orphan', branch], cwd);
}
// unhandled error
return Q.reject(error);
return Promise.reject(error);
}
);
};
Expand Down Expand Up @@ -195,7 +195,7 @@ exports.commit = function commit(message, cwd) {
return spawn(git, ['diff-index', '--quiet', 'HEAD', '.'], cwd)
.then(() => {
// nothing to commit
return Q.resolve();
return Promise.resolve();
})
.fail(() => {
return spawn(git, ['commit', '-m', message], cwd);
Expand Down
18 changes: 9 additions & 9 deletions tasks/gh-pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ function getRemoteUrl(dir, remote) {
})
.then(() => {
if (repo) {
return Q.resolve(repo);
return Promise.resolve(repo);
}
return Q.reject(
return Promise.reject(
new Error('Failed to get repo URL from options or current directory.')
);
})
.fail(err => {
return Q.reject(
return Promise.reject(
new Error(
'Failed to get remote.origin.url (task must either be run in a ' +
'git repository with a configured origin remote or must be ' +
Expand All @@ -39,7 +39,7 @@ function getRemoteUrl(dir, remote) {

function getRepo(options) {
if (options.repo) {
return Q.resolve(options.repo);
return Promise.resolve(options.repo);
}
return getRemoteUrl(process.cwd(), 'origin');
}
Expand Down Expand Up @@ -135,9 +135,9 @@ module.exports = function(grunt) {
`but expected "${repoUrl}" in ${options.clone}. ` +
'If you have changed your "repo" option, try ' +
'running `grunt gh-pages-clean` first.';
return Q.reject(new Error(message));
return Promise.reject(new Error(message));
}
return Q.resolve();
return Promise.resolve();
});
})
.then(() => {
Expand All @@ -158,7 +158,7 @@ module.exports = function(grunt) {
log('Removing files');
return git.rm(only.join(' '), options.clone);
}
return Q.resolve();
return Promise.resolve();
})
.then(() => {
log('Copying files');
Expand All @@ -180,7 +180,7 @@ module.exports = function(grunt) {
);
});
}
return Q.resolve();
return Promise.resolve();
})
.then(() => {
log('Committing');
Expand Down Expand Up @@ -210,7 +210,7 @@ module.exports = function(grunt) {
log('Pushing');
return git.push(options.remote, options.branch, options.clone);
}
return Q.resolve();
return Promise.resolve();
})
.then(
() => {
Expand Down

0 comments on commit 97cc3b1

Please sign in to comment.