quickbundle 0.0.0-next-da5d78a → 0.0.0-next-386ba5d
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/README.md +10 -10
- package/dist/index.mjs +16 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -113,7 +113,7 @@ yarn add quickbundle
|
|
|
113
113
|
"name": "lib", // Package name
|
|
114
114
|
"source": "./src/index.ts", // Source code entry point. Make sure that it starts with `#!/usr/bin/env node` pragme to make the binary portable for consumers who would like to use it by installing the package instead of using the generated standalone executable.
|
|
115
115
|
"bin": {
|
|
116
|
-
"your-binary-name": "./dist/index.cjs", // Binary information to get the executable name from the key and, from the value, the bundled file to generate from the source code and inject into the executable. The generated executable will be located in the same folder as the bundled file and, by default, dependending on the current operating system running the `compile` command, the executable will be named either `your-binary-name.exe` on Windows or `your-binary-name` on Linux and macOS.
|
|
116
|
+
"your-binary-name": "./dist/index.cjs", // Binary information to get the executable name from the key and, from the value, the bundled file to generate from the source code and inject into the executable. The generated executable will be located in the same folder as the bundled file and, by default, dependending on the current operating system running the `compile` command, the executable will be named either `your-binary-name.exe` on Windows or `your-binary-name` on Linux and macOS. For cross-compilation output, check the `Patterns` section.
|
|
117
117
|
},
|
|
118
118
|
// "bin": "./dist/index.cjs", // Or, if the binary name follows the package name, you can define a string-based `bin` value.
|
|
119
119
|
"scripts": {
|
|
@@ -173,21 +173,21 @@ Enabling source map generation is needed only if a build is [obfuscated (minifie
|
|
|
173
173
|
|
|
174
174
|
### Cross compilation to other platforms
|
|
175
175
|
|
|
176
|
-
By default, the `compile` command embeds the runtime at the origin of its execution which means it generates executables compatible only with machines running the same operating system
|
|
176
|
+
By default, the `compile` command embeds the runtime at the origin of its execution which means it generates executables compatible only with machines running the same operating system, processor architecture, and Node.js version.
|
|
177
177
|
|
|
178
|
-
However, Quickbundle provides the ability to target a different operating system
|
|
178
|
+
However, Quickbundle provides the ability to target a different operating system, processor architecture, or Node.js version (also known as cross-compilation):
|
|
179
179
|
|
|
180
180
|
```bash
|
|
181
|
-
quickbundle compile --
|
|
182
|
-
quickbundle compile --
|
|
183
|
-
quickbundle compile --
|
|
184
|
-
quickbundle compile --
|
|
185
|
-
quickbundle compile --
|
|
186
|
-
quickbundle compile --
|
|
181
|
+
quickbundle compile --target node-v23.1.0-darwin-arm64 # Embeds Node v23 runtime built for macOS ARM64 target
|
|
182
|
+
quickbundle compile --target node-v23.1.0-darwin-x64 # Embeds Node v23 runtime built for macOS X64 target
|
|
183
|
+
quickbundle compile --target node-v23.1.0-linux-arm64 # Embeds Node v23 runtime built for Linux ARM64 target
|
|
184
|
+
quickbundle compile --target node-v23.1.0-linux-x64 # Embeds Node v23 runtime built for Linux X64 target
|
|
185
|
+
quickbundle compile --target node-v23.1.0-win-arm64 # Embeds Node v23 runtime built for Windows ARM64 target
|
|
186
|
+
quickbundle compile --target node-v23.1.0-win-x64 # Embeds Node v23 runtime built for Windows X64 target
|
|
187
187
|
```
|
|
188
188
|
|
|
189
189
|
> [!note]
|
|
190
|
-
> The accepted
|
|
190
|
+
> The accepted target input follows the `node-vx.y.z-(darwin|linux|win)-(arm64|x64|x86)` format (for an exhaustive view, check available filenames in [https://nodejs.org/download/release/vx.y.z](https://nodejs.org/download/release/latest/)).
|
|
191
191
|
|
|
192
192
|
<br>
|
|
193
193
|
|
package/dist/index.mjs
CHANGED
|
@@ -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-386ba5d";
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* Resolve a relative path from the Quickbundle node modules directory.
|
|
@@ -393,12 +393,12 @@ const createCompileCommand = (program)=>{
|
|
|
393
393
|
name: "compile",
|
|
394
394
|
description: "Compiles the source code into a self-contained executable"
|
|
395
395
|
}).option({
|
|
396
|
-
key: "
|
|
396
|
+
key: "targetInput",
|
|
397
397
|
name: {
|
|
398
|
-
long: "
|
|
399
|
-
short: "
|
|
398
|
+
long: "target",
|
|
399
|
+
short: "t"
|
|
400
400
|
},
|
|
401
|
-
description: "Set a different
|
|
401
|
+
description: "Set a different cross-compilation target",
|
|
402
402
|
defaultValue: "local"
|
|
403
403
|
}).task({
|
|
404
404
|
key: "config",
|
|
@@ -412,24 +412,28 @@ const createCompileCommand = (program)=>{
|
|
|
412
412
|
}
|
|
413
413
|
}).task({
|
|
414
414
|
key: "osType",
|
|
415
|
-
label ({
|
|
416
|
-
return `Get
|
|
415
|
+
label ({ targetInput }) {
|
|
416
|
+
return `Get \`${targetInput}\` runtime`;
|
|
417
417
|
},
|
|
418
|
-
async handler ({
|
|
419
|
-
if (
|
|
418
|
+
async handler ({ targetInput }) {
|
|
419
|
+
if (targetInput === "local") {
|
|
420
420
|
await copyFile(process.execPath, TEMPORARY_RUNTIME_PATH);
|
|
421
421
|
return getOsType(os.type());
|
|
422
422
|
}
|
|
423
|
-
const matchedRuntimeParts = matchRuntimeParts(
|
|
423
|
+
const matchedRuntimeParts = matchRuntimeParts(targetInput);
|
|
424
424
|
if (!matchedRuntimeParts) {
|
|
425
425
|
throw new Error("Invalid `runtime` flag input. The accepted targets are the one listed in https://nodejs.org/download/release/ with the following format `node-vx.y.z-(darwin|linux|win)-(arm64|x64|x86)`.");
|
|
426
426
|
}
|
|
427
427
|
const osType = getOsType(matchedRuntimeParts.os);
|
|
428
428
|
const extension = osType === "windows" ? "zip" : "tar.gz";
|
|
429
|
-
await download(`https://nodejs.org/download/release/${matchedRuntimeParts.version}/${
|
|
429
|
+
await download(`https://nodejs.org/download/release/${matchedRuntimeParts.version}/${targetInput}.${extension}`, TEMPORARY_DOWNLOAD_PATH);
|
|
430
|
+
console.log(TEMPORARY_DOWNLOAD_PATH, {
|
|
431
|
+
directoryPath: dirname(TEMPORARY_RUNTIME_PATH),
|
|
432
|
+
filename: basename(TEMPORARY_RUNTIME_PATH)
|
|
433
|
+
});
|
|
430
434
|
await unzip({
|
|
431
435
|
path: TEMPORARY_DOWNLOAD_PATH,
|
|
432
|
-
targetArchivePath: osType === "windows" ? join(
|
|
436
|
+
targetArchivePath: osType === "windows" ? join(targetInput, "node.exe") : join(targetInput, "bin", "node")
|
|
433
437
|
}, {
|
|
434
438
|
directoryPath: dirname(TEMPORARY_RUNTIME_PATH),
|
|
435
439
|
filename: basename(TEMPORARY_RUNTIME_PATH)
|