@appthreat/caxa 0.0.6 → 0.0.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/README.md +0 -2
- package/build/index.d.mts +1 -4
- package/build/index.d.mts.map +1 -1
- package/build/index.mjs +6 -14
- package/build/index.mjs.map +1 -1
- package/package.json +1 -2
- package/source/index.mts +4 -27
package/README.md
CHANGED
|
@@ -69,8 +69,6 @@ Options:
|
|
|
69
69
|
-o, --output <output> [Required] The path where the executable will be produced. On Windows, must end in ‘.exe’. In macOS and Linux, may have no extension to produce regular binary. In macOS and Linux, may end in ‘.sh’ to use the Shell Stub, which is a bit smaller, but depends on some tools being installed on the end-user machine, for example, ‘tar’, ‘tail’, and so forth. In macOS, may end in ‘.app’ to generate a macOS Application Bundle.
|
|
70
70
|
-F, --no-force [Advanced] Don’t overwrite output if it exists.
|
|
71
71
|
-e, --exclude <path...> [Advanced] Paths to exclude from the build. The paths are passed to https://github.com/sindresorhus/globby and paths that match will be excluded. [Super-Advanced, Please don’t use] If you wish to emulate ‘--include’, you may use ‘--exclude "*" ".*" "!path-to-include" ...’. The problem with ‘--include’ is that if you change your project structure but forget to change the caxa invocation, then things will subtly fail only in the packaged version.
|
|
72
|
-
-D, --no-dedupe [Advanced] Don’t run ‘npm dedupe --production’ on the build directory.
|
|
73
|
-
-p, --prepare-command <command> [Advanced] Command to run on the build directory after ‘npm dedupe --production’, before packaging.
|
|
74
72
|
-N, --no-include-node [Advanced] Don’t copy the Node.js executable to ‘{{caxa}}/node_modules/.bin/node’.
|
|
75
73
|
-s, --stub <path> [Advanced] Path to the stub.
|
|
76
74
|
--identifier <identifier> [Advanced] Build identifier, which is part of the path in which the application will be unpacked.
|
package/build/index.d.mts
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import fs from "fs-extra";
|
|
3
|
-
export default function caxa({ input, output, command, force, exclude, filter,
|
|
3
|
+
export default function caxa({ input, output, command, force, exclude, filter, includeNode, stub, identifier, removeBuildDirectory, uncompressionMessage, }: {
|
|
4
4
|
input: string;
|
|
5
5
|
output: string;
|
|
6
6
|
command: string[];
|
|
7
7
|
force?: boolean;
|
|
8
8
|
exclude?: string[];
|
|
9
9
|
filter?: fs.CopyFilterSync | fs.CopyFilterAsync;
|
|
10
|
-
dedupe?: boolean;
|
|
11
|
-
prepareCommand?: string;
|
|
12
|
-
prepare?: (buildDirectory: string) => Promise<void>;
|
|
13
10
|
includeNode?: boolean;
|
|
14
11
|
stub?: string;
|
|
15
12
|
identifier?: string;
|
package/build/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../source/index.mts"],"names":[],"mappings":";AAMA,OAAO,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../source/index.mts"],"names":[],"mappings":";AAMA,OAAO,EAAE,MAAM,UAAU,CAAC;AAiC1B,wBAA8B,IAAI,CAAC,EACjC,KAAK,EACL,MAAM,EACN,OAAO,EACP,KAAY,EACZ,OAAyB,EACzB,MAUI,EACJ,WAAkB,EAClB,IAKC,EACD,UAGC,EACD,oBAA2B,EAC3B,oBAAoB,GACrB,EAAE;IACD,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,CAAC,EAAE,EAAE,CAAC,cAAc,GAAG,EAAE,CAAC,eAAe,CAAC;IAChD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,GAAG,OAAO,CAAC,IAAI,CAAC,CAyIhB"}
|
package/build/index.mjs
CHANGED
|
@@ -5,7 +5,6 @@ import os from "node:os";
|
|
|
5
5
|
import stream from "node:stream/promises";
|
|
6
6
|
import fs from "fs-extra";
|
|
7
7
|
import { globbySync } from "globby";
|
|
8
|
-
import { execa, execaCommand } from "execa";
|
|
9
8
|
import cryptoRandomString from "crypto-random-string";
|
|
10
9
|
import bash from "dedent";
|
|
11
10
|
import archiver from "archiver";
|
|
@@ -17,6 +16,8 @@ const defaultExcludes = [
|
|
|
17
16
|
".*",
|
|
18
17
|
"*.exe",
|
|
19
18
|
"*.exe.sha256",
|
|
19
|
+
"*.yml",
|
|
20
|
+
"*.sh",
|
|
20
21
|
"package-lock.json",
|
|
21
22
|
"pnpm-lock.yaml",
|
|
22
23
|
"tsconfig.json",
|
|
@@ -30,6 +31,8 @@ const defaultExcludes = [
|
|
|
30
31
|
"test/**",
|
|
31
32
|
"types/**",
|
|
32
33
|
"bom.json",
|
|
34
|
+
"biome.json",
|
|
35
|
+
"jest.config.js",
|
|
33
36
|
];
|
|
34
37
|
export default async function caxa({ input, output, command, force = true, exclude = defaultExcludes, filter = (() => {
|
|
35
38
|
if (!exclude.length) {
|
|
@@ -40,11 +43,7 @@ export default async function caxa({ input, output, command, force = true, exclu
|
|
|
40
43
|
onlyFiles: false,
|
|
41
44
|
}).map((pathToExclude) => path.normalize(pathToExclude));
|
|
42
45
|
return (pathToCopy) => !pathsToExclude.includes(path.normalize(pathToCopy));
|
|
43
|
-
})(),
|
|
44
|
-
if (prepareCommand === undefined)
|
|
45
|
-
return;
|
|
46
|
-
await execaCommand(prepareCommand, { cwd: buildDirectory, shell: true });
|
|
47
|
-
}, includeNode = true, stub = url.fileURLToPath(new URL(`../stubs/stub--${process.platform}--${process.arch}`, import.meta.url)), identifier = path.join(path.basename(path.basename(path.basename(output, ".exe"), ".app"), ".sh"), cryptoRandomString({ length: 10, type: "alphanumeric" }).toLowerCase()), removeBuildDirectory = true, uncompressionMessage, }) {
|
|
46
|
+
})(), includeNode = true, stub = url.fileURLToPath(new URL(`../stubs/stub--${process.platform}--${process.arch}`, import.meta.url)), identifier = path.join(path.basename(path.basename(path.basename(output, ".exe"), ".app"), ".sh"), cryptoRandomString({ length: 10, type: "alphanumeric" }).toLowerCase()), removeBuildDirectory = true, uncompressionMessage, }) {
|
|
48
47
|
if (!(await fs.pathExists(input)) || !(await fs.lstat(input)).isDirectory())
|
|
49
48
|
throw new Error(`Input isn’t a directory: ‘${input}’.`);
|
|
50
49
|
if ((await fs.pathExists(output)) && !force)
|
|
@@ -53,9 +52,6 @@ export default async function caxa({ input, output, command, force = true, exclu
|
|
|
53
52
|
throw new Error("Windows executable must end in ‘.exe’.");
|
|
54
53
|
const buildDirectory = path.join(os.tmpdir(), "caxa/builds", cryptoRandomString({ length: 10, type: "alphanumeric" }).toLowerCase());
|
|
55
54
|
await fs.copy(input, buildDirectory, { filter });
|
|
56
|
-
if (dedupe)
|
|
57
|
-
await execa("npm", ["dedupe", "--production"], { cwd: buildDirectory });
|
|
58
|
-
await prepare(buildDirectory);
|
|
59
55
|
if (includeNode) {
|
|
60
56
|
const node = path.join(buildDirectory, "node_modules/.bin", path.basename(process.execPath));
|
|
61
57
|
await fs.ensureDir(path.dirname(node));
|
|
@@ -147,8 +143,6 @@ if (url.fileURLToPath(import.meta.url) === (await fs.realpath(process.argv[1])))
|
|
|
147
143
|
.requiredOption("-o, --output <output>", "[Required] The path where the executable will be produced. On Windows, must end in ‘.exe’. In macOS and Linux, may have no extension to produce regular binary. In macOS and Linux, may end in ‘.sh’ to use the Shell Stub, which is a bit smaller, but depends on some tools being installed on the end-user machine, for example, ‘tar’, ‘tail’, and so forth. In macOS, may end in ‘.app’ to generate a macOS Application Bundle.")
|
|
148
144
|
.option("-F, --no-force", "[Advanced] Don’t overwrite output if it exists.")
|
|
149
145
|
.option("-e, --exclude <path...>", `[Advanced] Paths to exclude from the build. The paths are passed to https://github.com/sindresorhus/globby and paths that match will be excluded. [Super-Advanced, Please don’t use] If you wish to emulate ‘--include’, you may use ‘--exclude "*" ".*" "!path-to-include" ...’. The problem with ‘--include’ is that if you change your project structure but forget to change the caxa invocation, then things will subtly fail only in the packaged version.`)
|
|
150
|
-
.option("--dedupe", "[Advanced] Run ‘npm dedupe --production’ on the build directory.")
|
|
151
|
-
.option("-p, --prepare-command <command>", "[Advanced] Command to run on the build directory after ‘npm dedupe --production’, before packaging.")
|
|
152
146
|
.option("-N, --no-include-node", "[Advanced] Don’t copy the Node.js executable to ‘{{caxa}}/node_modules/.bin/node’.")
|
|
153
147
|
.option("-s, --stub <path>", "[Advanced] Path to the stub.")
|
|
154
148
|
.option("--identifier <identifier>", "[Advanced] Build identifier, which is part of the path in which the application will be unpacked.")
|
|
@@ -171,7 +165,7 @@ if (url.fileURLToPath(import.meta.url) === (await fs.realpath(process.argv[1])))
|
|
|
171
165
|
macOS (Application Bundle):
|
|
172
166
|
$ caxa --input "examples/echo-command-line-parameters" --output "Echo Command Line Parameters.app" -- "{{caxa}}/node_modules/.bin/node" "{{caxa}}/index.mjs" "some" "embedded arguments" "--an-option-thats-part-of-the-command"
|
|
173
167
|
`)
|
|
174
|
-
.action(async (command, { input, output, force, exclude,
|
|
168
|
+
.action(async (command, { input, output, force, exclude, includeNode, stub, identifier, removeBuildDirectory, uncompressionMessage, }) => {
|
|
175
169
|
try {
|
|
176
170
|
await caxa({
|
|
177
171
|
input,
|
|
@@ -179,8 +173,6 @@ if (url.fileURLToPath(import.meta.url) === (await fs.realpath(process.argv[1])))
|
|
|
179
173
|
command,
|
|
180
174
|
force,
|
|
181
175
|
exclude,
|
|
182
|
-
dedupe,
|
|
183
|
-
prepareCommand,
|
|
184
176
|
includeNode,
|
|
185
177
|
stub,
|
|
186
178
|
identifier,
|
package/build/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../source/index.mts"],"names":[],"mappings":";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jB,EACE,KAAK,EACL,MAAM,EACN,KAAK,EACL,OAAO,EACP,WAAW,EACX,IAAI,EACJ,UAAU,EACV,oBAAoB,EACpB,oBAAoB,GAWrB,EACD,EAAE;QACF,IAAI,CAAC;YACH,MAAM,IAAI,CAAC;gBACT,KAAK;gBACL,MAAM;gBACN,OAAO;gBACP,KAAK;gBACL,OAAO;gBACP,WAAW;gBACX,IAAI;gBACJ,UAAU;gBACV,oBAAoB;gBACpB,oBAAoB;aACrB,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YAC7B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CACF;SACA,kBAAkB,EAAE;SACpB,UAAU,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appthreat/caxa",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"description": "Package Node.js applications into executable binaries",
|
|
5
5
|
"author": "Team AppThreat <cloud@appthreat.com>",
|
|
6
6
|
"homepage": "https://github.com/appthreat/caxa",
|
|
@@ -30,7 +30,6 @@
|
|
|
30
30
|
"commander": "^12.1.0",
|
|
31
31
|
"crypto-random-string": "^5.0.0",
|
|
32
32
|
"dedent": "^1.5.3",
|
|
33
|
-
"execa": "^9.4.0",
|
|
34
33
|
"fs-extra": "^11.2.0",
|
|
35
34
|
"globby": "^14.0.2"
|
|
36
35
|
},
|
package/source/index.mts
CHANGED
|
@@ -6,7 +6,6 @@ import os from "node:os";
|
|
|
6
6
|
import stream from "node:stream/promises";
|
|
7
7
|
import fs from "fs-extra";
|
|
8
8
|
import { globbySync } from "globby";
|
|
9
|
-
import { execa, execaCommand } from "execa";
|
|
10
9
|
import cryptoRandomString from "crypto-random-string";
|
|
11
10
|
import bash from "dedent";
|
|
12
11
|
import archiver from "archiver";
|
|
@@ -19,6 +18,8 @@ const defaultExcludes = [
|
|
|
19
18
|
".*",
|
|
20
19
|
"*.exe",
|
|
21
20
|
"*.exe.sha256",
|
|
21
|
+
"*.yml",
|
|
22
|
+
"*.sh",
|
|
22
23
|
"package-lock.json",
|
|
23
24
|
"pnpm-lock.yaml",
|
|
24
25
|
"tsconfig.json",
|
|
@@ -32,6 +33,8 @@ const defaultExcludes = [
|
|
|
32
33
|
"test/**",
|
|
33
34
|
"types/**",
|
|
34
35
|
"bom.json",
|
|
36
|
+
"biome.json",
|
|
37
|
+
"jest.config.js",
|
|
35
38
|
];
|
|
36
39
|
|
|
37
40
|
export default async function caxa({
|
|
@@ -51,12 +54,6 @@ export default async function caxa({
|
|
|
51
54
|
return (pathToCopy: string) =>
|
|
52
55
|
!pathsToExclude.includes(path.normalize(pathToCopy));
|
|
53
56
|
})(),
|
|
54
|
-
dedupe = false,
|
|
55
|
-
prepareCommand,
|
|
56
|
-
prepare = async (buildDirectory: string) => {
|
|
57
|
-
if (prepareCommand === undefined) return;
|
|
58
|
-
await execaCommand(prepareCommand, { cwd: buildDirectory, shell: true });
|
|
59
|
-
},
|
|
60
57
|
includeNode = true,
|
|
61
58
|
stub = url.fileURLToPath(
|
|
62
59
|
new URL(
|
|
@@ -77,9 +74,6 @@ export default async function caxa({
|
|
|
77
74
|
force?: boolean;
|
|
78
75
|
exclude?: string[];
|
|
79
76
|
filter?: fs.CopyFilterSync | fs.CopyFilterAsync;
|
|
80
|
-
dedupe?: boolean;
|
|
81
|
-
prepareCommand?: string;
|
|
82
|
-
prepare?: (buildDirectory: string) => Promise<void>;
|
|
83
77
|
includeNode?: boolean;
|
|
84
78
|
stub?: string;
|
|
85
79
|
identifier?: string;
|
|
@@ -99,9 +93,6 @@ export default async function caxa({
|
|
|
99
93
|
cryptoRandomString({ length: 10, type: "alphanumeric" }).toLowerCase(),
|
|
100
94
|
);
|
|
101
95
|
await fs.copy(input, buildDirectory, { filter });
|
|
102
|
-
if (dedupe)
|
|
103
|
-
await execa("npm", ["dedupe", "--production"], { cwd: buildDirectory });
|
|
104
|
-
await prepare(buildDirectory);
|
|
105
96
|
if (includeNode) {
|
|
106
97
|
const node = path.join(
|
|
107
98
|
buildDirectory,
|
|
@@ -244,14 +235,6 @@ if (url.fileURLToPath(import.meta.url) === (await fs.realpath(process.argv[1])))
|
|
|
244
235
|
"-e, --exclude <path...>",
|
|
245
236
|
`[Advanced] Paths to exclude from the build. The paths are passed to https://github.com/sindresorhus/globby and paths that match will be excluded. [Super-Advanced, Please don’t use] If you wish to emulate ‘--include’, you may use ‘--exclude "*" ".*" "!path-to-include" ...’. The problem with ‘--include’ is that if you change your project structure but forget to change the caxa invocation, then things will subtly fail only in the packaged version.`,
|
|
246
237
|
)
|
|
247
|
-
.option(
|
|
248
|
-
"--dedupe",
|
|
249
|
-
"[Advanced] Run ‘npm dedupe --production’ on the build directory.",
|
|
250
|
-
)
|
|
251
|
-
.option(
|
|
252
|
-
"-p, --prepare-command <command>",
|
|
253
|
-
"[Advanced] Command to run on the build directory after ‘npm dedupe --production’, before packaging.",
|
|
254
|
-
)
|
|
255
238
|
.option(
|
|
256
239
|
"-N, --no-include-node",
|
|
257
240
|
"[Advanced] Don’t copy the Node.js executable to ‘{{caxa}}/node_modules/.bin/node’.",
|
|
@@ -304,8 +287,6 @@ if (url.fileURLToPath(import.meta.url) === (await fs.realpath(process.argv[1])))
|
|
|
304
287
|
output,
|
|
305
288
|
force,
|
|
306
289
|
exclude,
|
|
307
|
-
dedupe,
|
|
308
|
-
prepareCommand,
|
|
309
290
|
includeNode,
|
|
310
291
|
stub,
|
|
311
292
|
identifier,
|
|
@@ -316,8 +297,6 @@ if (url.fileURLToPath(import.meta.url) === (await fs.realpath(process.argv[1])))
|
|
|
316
297
|
output: string;
|
|
317
298
|
force?: boolean;
|
|
318
299
|
exclude?: string[];
|
|
319
|
-
dedupe?: boolean;
|
|
320
|
-
prepareCommand?: string;
|
|
321
300
|
includeNode?: boolean;
|
|
322
301
|
stub?: string;
|
|
323
302
|
identifier?: string;
|
|
@@ -332,8 +311,6 @@ if (url.fileURLToPath(import.meta.url) === (await fs.realpath(process.argv[1])))
|
|
|
332
311
|
command,
|
|
333
312
|
force,
|
|
334
313
|
exclude,
|
|
335
|
-
dedupe,
|
|
336
|
-
prepareCommand,
|
|
337
314
|
includeNode,
|
|
338
315
|
stub,
|
|
339
316
|
identifier,
|