forked from vercel/pkg
-
-
Notifications
You must be signed in to change notification settings - Fork 64
Expand file tree
/
Copy pathhelp.ts
More file actions
60 lines (54 loc) · 3.67 KB
/
Copy pathhelp.ts
File metadata and controls
60 lines (54 loc) · 3.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import { pc } from './colors';
export default function help() {
console.log(`
${pc.bold('pkg')} [options] <input>
${pc.dim('Options:')}
-h, --help output usage information
-v, --version output pkg version
-t, --targets comma-separated list of targets (see examples)
-c, --config package.json or a .json, .js, .cjs, or .mjs file with top-level config
(auto-discovered as .pkgrc, .pkgrc.json, pkg.config.js, pkg.config.cjs, or pkg.config.mjs)
--options bake v8 options into executable to run with them on
-o, --output output file name or template for several files
--out-path path to save output one or more executables
-d, --debug show more information during packaging process [off]
-b, --build don't download prebuilt base binaries, build them
--public speed up and disclose the sources of top-level project
--public-packages force specified packages to be considered public
--no-bytecode skip bytecode generation and include source files as plain js
--no-native-build skip native addons build
--fallback-to-source if bytecode generation fails for a file, ship it as plain source instead of skipping it
--no-dict comma-separated list of packages names to ignore dictionaries. Use --no-dict * to disable all dictionaries
-C, --compress [default=None] compression algorithm = Brotli, GZip, or Zstd (Zstd requires Node.js >= 22.15)
--signature enable macOS binary signing (default; use to override signature:false in config)
--no-signature skip macOS binary signing [default: sign]
--sea (Experimental) compile given file using node's SEA feature. Requires node v20.0.0 or higher and only single file is supported
--sea-node-path SEA mode: path to a base Node binary to embed instead of downloading one (overrides PKG_NODE_PATH; must match the target's platform/arch/major; single target only)
All build-shaping flags above (compress, fallback-to-source, public, public-packages,
options, bytecode, native-build, no-dict, debug, signature, sea, sea-node-path) can also
be set in the pkg config file (camelCase keys). CLI flags override config values.
${pc.dim('Examples:')}
${pc.gray('–')} Makes executables for Linux, macOS and Windows
${pc.cyan('$ pkg index.js')}
${pc.gray('–')} Takes package.json from cwd and follows 'bin' entry
${pc.cyan('$ pkg .')}
${pc.gray('–')} Makes executable for particular target machine
${pc.cyan('$ pkg -t node14-win-arm64 index.js')}
${pc.gray('–')} Makes executables for target machines of your choice
${pc.cyan('$ pkg -t node22-linux,node24-linux,node24-win index.js')}
${pc.gray('–')} Bakes '--expose-gc' and '--max-heap-size=34' into executable
${pc.cyan('$ pkg --options "expose-gc,max-heap-size=34" index.js')}
${pc.gray('–')} Consider packageA and packageB to be public
${pc.cyan('$ pkg --public-packages "packageA,packageB" index.js')}
${pc.gray('–')} Consider all packages to be public
${pc.cyan('$ pkg --public-packages "*" index.js')}
${pc.gray('–')} Bakes '--expose-gc' into executable
${pc.cyan('$ pkg --options expose-gc index.js')}
${pc.gray('–')} reduce size of the data packed inside the executable with GZip
${pc.cyan('$ pkg --compress GZip index.js')}
${pc.gray('–')} reduce size further with Zstd (Node.js >= 22.15 required on the build host)
${pc.cyan('$ pkg --compress Zstd index.js')}
${pc.gray('–')} compile the file using node's SEA feature. Creates executables for Linux, macOS and Windows
${pc.cyan('$ pkg --sea index.js')}
`);
}