quickbundle 0.0.0-next-386ba5d → 0.0.0-next-68182ec
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/dist/index.mjs +19 -11
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { finished } from 'node:stream/promises';
|
|
|
3
3
|
import { Readable } from 'node:stream';
|
|
4
4
|
import process from 'node:process';
|
|
5
5
|
import { resolve, dirname, join, basename } from 'node:path';
|
|
6
|
-
import { copyFile as copyFile$1, rm, writeFile as writeFile$1, rename,
|
|
6
|
+
import { mkdir, copyFile as copyFile$1, rm, writeFile as writeFile$1, rename, readFile as readFile$1 } from 'node:fs/promises';
|
|
7
7
|
import { createWriteStream } from 'node:fs';
|
|
8
8
|
import decompress from 'decompress';
|
|
9
9
|
import { watch as watch$1, rollup } from 'rollup';
|
|
@@ -19,7 +19,7 @@ import os from 'node:os';
|
|
|
19
19
|
import { gzipSize } from 'gzip-size';
|
|
20
20
|
|
|
21
21
|
var name = "quickbundle";
|
|
22
|
-
var version = "0.0.0-next-
|
|
22
|
+
var version = "0.0.0-next-68182ec";
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* Resolve a relative path from the Quickbundle node modules directory.
|
|
@@ -67,12 +67,21 @@ const writeFile = async (filePath, content)=>{
|
|
|
67
67
|
await writeFile$1(filePath, content, "utf8");
|
|
68
68
|
};
|
|
69
69
|
const download = async (url, filePath)=>{
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
try {
|
|
71
|
+
await createDirectory(dirname(filePath));
|
|
72
|
+
const { body, ok, status, statusText } = await fetch(url);
|
|
73
|
+
console.log({
|
|
74
|
+
ok,
|
|
75
|
+
status,
|
|
76
|
+
statusText
|
|
77
|
+
});
|
|
78
|
+
if (!body) {
|
|
79
|
+
throw new Error(`Empty body while attempting to download file from \`${url}\`.`);
|
|
80
|
+
}
|
|
81
|
+
await finished(Readable.fromWeb(body).pipe(createWriteStream(filePath)));
|
|
82
|
+
} catch (error) {
|
|
83
|
+
console.error("An error occurred while donwloading", error);
|
|
74
84
|
}
|
|
75
|
-
return finished(Readable.fromWeb(body).pipe(createWriteStream(filePath)));
|
|
76
85
|
};
|
|
77
86
|
const unzip = async (input, output)=>{
|
|
78
87
|
const { targetArchivePath } = input;
|
|
@@ -426,11 +435,10 @@ const createCompileCommand = (program)=>{
|
|
|
426
435
|
}
|
|
427
436
|
const osType = getOsType(matchedRuntimeParts.os);
|
|
428
437
|
const extension = osType === "windows" ? "zip" : "tar.gz";
|
|
438
|
+
await createDirectory(dirname(TEMPORARY_DOWNLOAD_PATH));
|
|
429
439
|
await download(`https://nodejs.org/download/release/${matchedRuntimeParts.version}/${targetInput}.${extension}`, TEMPORARY_DOWNLOAD_PATH);
|
|
430
|
-
console.log(
|
|
431
|
-
|
|
432
|
-
filename: basename(TEMPORARY_RUNTIME_PATH)
|
|
433
|
-
});
|
|
440
|
+
console.log("LS -AL", await helpers.exec(`ls ${TEMPORARY_PATH} -al`));
|
|
441
|
+
console.log("LS -AL DOWNLOAD", await helpers.exec(`ls ${TEMPORARY_DOWNLOAD_PATH} -al`));
|
|
434
442
|
await unzip({
|
|
435
443
|
path: TEMPORARY_DOWNLOAD_PATH,
|
|
436
444
|
targetArchivePath: osType === "windows" ? join(targetInput, "node.exe") : join(targetInput, "bin", "node")
|