olly-molly 0.2.12 → 0.2.13
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/bin/cli.js +5 -4
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -46,7 +46,7 @@ function getPrebuiltUrl(version) {
|
|
|
46
46
|
return null;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
function download(url, destDir, { allowNotFound = false } = {}) {
|
|
49
|
+
function download(url, destDir, { allowNotFound = false, stripComponents = 1 } = {}) {
|
|
50
50
|
return new Promise((resolve, reject) => {
|
|
51
51
|
const tmp = path.join(os.tmpdir(), 'olly-molly.tar.gz');
|
|
52
52
|
const file = fs.createWriteStream(tmp);
|
|
@@ -66,7 +66,8 @@ function download(url, destDir, { allowNotFound = false } = {}) {
|
|
|
66
66
|
file.on('finish', () => {
|
|
67
67
|
file.close();
|
|
68
68
|
fs.mkdirSync(destDir, { recursive: true });
|
|
69
|
-
|
|
69
|
+
const stripArg = stripComponents > 0 ? ` --strip-components=${stripComponents}` : '';
|
|
70
|
+
execSync(`tar -xzf "${tmp}" -C "${destDir}"${stripArg}`, { stdio: 'pipe' });
|
|
70
71
|
fs.unlinkSync(tmp);
|
|
71
72
|
resolve(true);
|
|
72
73
|
});
|
|
@@ -144,13 +145,13 @@ async function main() {
|
|
|
144
145
|
|
|
145
146
|
async function downloadApp() {
|
|
146
147
|
if (prebuiltUrl) {
|
|
147
|
-
const ok = await download(prebuiltUrl, APP_DIR, { allowNotFound: true });
|
|
148
|
+
const ok = await download(prebuiltUrl, APP_DIR, { allowNotFound: true, stripComponents: 0 });
|
|
148
149
|
if (ok) {
|
|
149
150
|
usedPrebuilt = true;
|
|
150
151
|
return;
|
|
151
152
|
}
|
|
152
153
|
}
|
|
153
|
-
await download(SOURCE_TARBALL_URL, APP_DIR);
|
|
154
|
+
await download(SOURCE_TARBALL_URL, APP_DIR, { stripComponents: 1 });
|
|
154
155
|
usedPrebuilt = false;
|
|
155
156
|
}
|
|
156
157
|
|