@fexd/toolchain 0.1.0 → 0.1.1
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/package.json +1 -1
- package/src/install.cjs +19 -3
package/package.json
CHANGED
package/src/install.cjs
CHANGED
|
@@ -110,10 +110,12 @@ function downloadFile(url, destination) {
|
|
|
110
110
|
});
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
function extractArchive(archivePath, destination) {
|
|
113
|
+
function extractArchive(archivePath, destination, options) {
|
|
114
|
+
const opts = options || {};
|
|
114
115
|
fs.mkdirSync(destination, { recursive: true });
|
|
115
116
|
|
|
116
|
-
const
|
|
117
|
+
const spawn = opts.spawnSync || childProcess.spawnSync;
|
|
118
|
+
const result = spawn(getTarCommand(opts), ['-xf', archivePath, '-C', destination], {
|
|
117
119
|
stdio: 'inherit'
|
|
118
120
|
});
|
|
119
121
|
|
|
@@ -126,9 +128,23 @@ function extractArchive(archivePath, destination) {
|
|
|
126
128
|
}
|
|
127
129
|
}
|
|
128
130
|
|
|
131
|
+
function getTarCommand(options) {
|
|
132
|
+
const opts = options || {};
|
|
133
|
+
const platform = opts.platform || process.platform;
|
|
134
|
+
|
|
135
|
+
if (platform !== 'win32') {
|
|
136
|
+
return 'tar';
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const env = opts.env || process.env;
|
|
140
|
+
const systemRoot = env.SystemRoot || env.SYSTEMROOT || 'C:\\Windows';
|
|
141
|
+
return path.win32.join(systemRoot, 'System32', 'tar.exe');
|
|
142
|
+
}
|
|
143
|
+
|
|
129
144
|
module.exports = {
|
|
130
145
|
ensureNode,
|
|
131
146
|
ensurePnpm,
|
|
132
147
|
downloadFile,
|
|
133
|
-
extractArchive
|
|
148
|
+
extractArchive,
|
|
149
|
+
getTarCommand
|
|
134
150
|
};
|