A concise toolkit for packaging and creating deterministic release artifacts.
@packlet/core– Core utilities: artifact manifest, validation, name derivation, copy helpers@packlet/gpr– Tools for preparing GitHub Packages (GPR) scoped variants and tarballs@packlet/cli– Unified CLI exposingpackletcommands (gpr,validate,list-artifacts)@packlet/build– Lightweight build wrapper (ESM+CJS+d.ts) usable in any TS/JS package
- Deterministic packing and artifact generation belong to
packlet. - Orchestration and publishing (CI, tokens, releases) are handled by
sailet— see related docs indocs/. - Both interact through a stable
artifacts.jsonmanifest.
# install & build
bun install
bun run build
# prepare a GPR variant and output a JSON manifest
node packages/cli/dist/index.mjs gpr --root packages/gpr --json
# list artifacts (human or JSON output)
node packages/cli/dist/index.mjs list-artifacts --artifacts packages/gpr/.artifacts
node packages/cli/dist/index.mjs list-artifacts --artifacts packages/gpr/.artifacts --json
# validate dist
node packages/cli/dist/index.mjs validate --root packages/gpr --jsonAll packages are built with the lightweight wrapper @packlet/build, which standardizes:
- ESM outputs:
dist/index.mjs(CJS available via--cjswhen explicitly requested) - Type declarations:
dist/index.d.tsviatsc --emitDeclarationOnly - Minification: enabled by default (use
--no-minifyto disable during debugging)
Typical package scripts:
{
"scripts": {
"build": "node packages/build/dist/cli.mjs build --sourcemap none --external-auto",
"build:cli": "node packages/build/dist/cli.mjs build --cjs --exec-js --sourcemap none --external-auto"
},
"devDependencies": {
"@packlet/build": "workspace:*"
}
}For CLI packages (including the umbrella packlet and @packlet/cli), --exec-js marks the built entry executable (prefers index.mjs).
Each package maintains its own CHANGELOG.md generated by Changesets during real releases. The umbrella packlet package contains an aggregate changelog that summarizes notable changes across all packages; it is populated only when a release is performed. This keeps history clear while avoiding noise between releases.
-
packlet build– Build ESM + CJS outputs and emit.d.ts(flags:--entry,--outdir,--formats,--sourcemap,--no-types,--target,--exec-js,--no-minify) -
packlet gpr– Prepare a GPR-staged package and tarballs Flags:--root,--gpr-dir,--artifacts,--dist,--scope,--registry,--name,--include-readme,--no-include-readme,--include-license,--no-include-license,--json,--manifest <file> -
packlet validate– Verify required dist entries (index.js,index.mjs,index.d.ts) -
packlet list-artifacts– List all.tgzfiles in an artifacts directory
Note
@packlet/gpr also provides a lightweight prepare subcommand (mainly for CI or testing).
It conditionally stages the GPR variant if packlet.gpr is enabled and dist/ exists.
Supported flags: --root, --dist, --gpr-dir, --artifacts, --scope, --registry, --name,
with optional --json and --manifest <file> for machine-readable output.
Running packlet gpr generates <root>/.artifacts/artifacts.json:
{
"schemaVersion": 1,
"packageName": "<base-name>",
"scopedName": "@<scope>/<base-name>",
"version": "<semver>",
"artifacts": [
{ "file": "<name>-<version>.tgz", "size": 12345, "sha512": "..." }
]
}Priority used when deriving the staged GPR package name:
- Explicit overrides
packlet.gprNameinpackage.json(scoped or unscoped), or--nameflag /GPR_NAMEenv (scoped or unscoped)
- Monorepo default: package name
- In monorepos, we prefer the package's own name (scope stripped) as base.
- Single-package repos
- Use repo name from
repository.urlif present, otherwisepackage.json.name(scope stripped).
Unscoped bases are combined with the chosen scope (default kazvizian).
You can set packlet.gprName to values like packlet-core (becomes @kazvizian/packlet-core) or a fully
scoped value @acme/packlet-core to force a specific name.
Temporary test fixtures are created under .temp/ and cleaned up automatically.
- Windows runners do not honor POSIX execute bits. Tests that verify
chmod +xfall back to asserting file presence on Windows. npm packcan be slow/flaky on Windows. The GPR preparation logic auto-skips packing whenCI=trueand the platform is Windows, or whenGPR_SKIP_PACK=trueis set.
Environment variables:
GPR_SKIP_PACK=true— force skipnpm packin GPR preparation.CI=trueon Windows — implicitly skipsnpm pack.
MIT © KazViz