Skip to content

Commit

Permalink
Replace q-io with fs-extra.
Browse files Browse the repository at this point in the history
  • Loading branch information
XhmikosR committed Apr 14, 2020
1 parent 8cc2209 commit dbe7f9e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 135 deletions.
11 changes: 5 additions & 6 deletions lib/git.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
const cp = require('child_process');
const path = require('path');
const util = require('util');

const fse = require('fs-extra');
const Q = require('q');
const fs = require('q-io/fs');

let git = 'git';

Expand Down Expand Up @@ -88,11 +87,11 @@ exports.init = function init(cwd) {
* @return {Promise} A promise.
*/
exports.clone = function clone(repo, dir, branch, options) {
return fs.exists(dir).then(exists => {
return fse.pathExists(dir).then(exists => {
if (exists) {
return Q.resolve();
}
return fs.makeTree(path.dirname(path.resolve(dir))).then(() => {
return fse.ensureDir(path.dirname(path.resolve(dir))).then(() => {
const args = ['clone', repo, dir, '--branch', branch, '--single-branch'];
if (options.depth) {
args.push('--depth', options.depth);
Expand Down Expand Up @@ -161,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 @@ -196,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
128 changes: 0 additions & 128 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"fs-extra": "^9.0.0",
"graceful-fs": "^4.2.3",
"q": "^1.5.1",
"q-io": "^1.13.6",
"url-safe": "^2.0.0"
},
"devDependencies": {
Expand Down

0 comments on commit dbe7f9e

Please sign in to comment.