Skip to content

Commit 06e7300

Browse files
authored
Merge pull request #61 from jokeyrhyme/greenkeeper/execa-2.0.0
Update execa to the latest version 🚀
2 parents d11e256 + 163cdaa commit 06e7300

File tree

5 files changed

+2061
-2217
lines changed

5 files changed

+2061
-2217
lines changed

lib/fs.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ const { tmpdir } = require('os');
66
const { dirname, join: joinPath } = require('path');
77
const { promisify } = require('util');
88

9-
const execa = require('execa');
109
const mkdirp = require('mkdirp');
1110

1211
/* ::
@@ -72,14 +71,8 @@ async function unlinkIfExists(filePath /* : string */) {
7271
}
7372
}
7473

75-
async function which(command /* : string */) {
76-
const { stdout } = await execa.shell(`which ${command}`);
77-
return stdout;
78-
}
79-
8074
module.exports = {
8175
backupFiles,
8276
copyFiles,
8377
unlinkIfExists,
84-
which,
8578
};

lib/fs.test.js

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,14 @@
11
/* eslint-env jest */
22
'use strict';
33

4-
const {
5-
access,
6-
7-
mkdtemp,
8-
readdir,
9-
readFile,
10-
writeFile,
11-
} = require('fs');
4+
const { access, mkdtemp, readdir, readFile, writeFile } = require('fs');
125
const { tmpdir } = require('os');
136
const { basename, join: joinPath } = require('path');
147
const { promisify } = require('util');
158

169
const rimraf = require('rimraf');
1710

18-
const { backupFiles, copyFiles, unlinkIfExists, which } = require('./fs.js');
11+
const { backupFiles, copyFiles, unlinkIfExists } = require('./fs.js');
1912

2013
const PROJECT_DIR = joinPath(__dirname, '..');
2114

@@ -104,10 +97,3 @@ describe('unlinkIfExists()', () => {
10497
await unlinkIfExists(joinPath(tempDir, 'does-not-exist'));
10598
});
10699
});
107-
108-
describe('which()', () => {
109-
it('find `env`', async () => {
110-
const got = await which('env');
111-
expect(got).toEqual('/usr/bin/env');
112-
});
113-
});

lib/git-crypt.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,9 @@ const { promisify } = require('util');
99
const execa = require('execa');
1010
const mkdirp = require('mkdirp');
1111
const rimraf = require('rimraf');
12+
const which = require('which');
1213

13-
const {
14-
backupFiles,
15-
copyFiles,
16-
unlinkIfExists,
17-
which,
18-
} = require('../lib/fs.js');
14+
const { backupFiles, copyFiles, unlinkIfExists } = require('../lib/fs.js');
1915
const {
2016
commitChanges,
2117
setLocalConfig,
@@ -139,7 +135,7 @@ type InstallHooksOptions = {
139135
async function installHooks({
140136
cwd = process.cwd(),
141137
} /* : InstallHooksOptions */ = {}) {
142-
const command = await which('git-crypt');
138+
const command = await promisify(which)('git-crypt');
143139
await setLocalConfig({
144140
cwd,
145141
key: 'diff.git-crypt.textconv',

0 commit comments

Comments
 (0)