@airstrings/cli 0.13.6 → 0.13.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/install.js +2 -2
- package/lib/binary.js +14 -1
- package/package.json +1 -1
package/install.js
CHANGED
|
@@ -6,7 +6,7 @@ const os = require('os');
|
|
|
6
6
|
const path = require('path');
|
|
7
7
|
const { execFileSync } = require('child_process');
|
|
8
8
|
|
|
9
|
-
const { target, vendorDir, binaryPath } = require('./lib/binary.js');
|
|
9
|
+
const { target, vendorDir, binaryPath, tarBinary } = require('./lib/binary.js');
|
|
10
10
|
const { checksumFor } = require('./lib/checksums.js');
|
|
11
11
|
const { version } = require('./package.json');
|
|
12
12
|
|
|
@@ -43,7 +43,7 @@ async function main() {
|
|
|
43
43
|
|
|
44
44
|
fs.rmSync(vendorDir, { recursive: true, force: true });
|
|
45
45
|
fs.mkdirSync(vendorDir, { recursive: true });
|
|
46
|
-
execFileSync(
|
|
46
|
+
execFileSync(tarBinary(), ['-xf', tmp, '-C', vendorDir]);
|
|
47
47
|
fs.rmSync(path.dirname(tmp), { recursive: true, force: true });
|
|
48
48
|
|
|
49
49
|
if (process.platform !== 'win32') {
|
package/lib/binary.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const fs = require('fs');
|
|
3
4
|
const path = require('path');
|
|
4
5
|
|
|
5
6
|
const TARGETS = {
|
|
@@ -29,4 +30,16 @@ function binaryPath(name) {
|
|
|
29
30
|
return path.join(vendorDir, `${name}${ext}`);
|
|
30
31
|
}
|
|
31
32
|
|
|
32
|
-
|
|
33
|
+
// Git Bash's GNU tar shadows Windows' bsdtar on PATH: it parses C:\ as a
|
|
34
|
+
// remote host and cannot read .zip. Always prefer the System32 one.
|
|
35
|
+
function tarBinary() {
|
|
36
|
+
if (process.platform === 'win32') {
|
|
37
|
+
const sysTar = path.join(process.env.SystemRoot || 'C:\\Windows', 'System32', 'tar.exe');
|
|
38
|
+
if (fs.existsSync(sysTar)) {
|
|
39
|
+
return sysTar;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return 'tar';
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
module.exports = { target, vendorDir, binaryPath, tarBinary };
|