@repo-toolkit/publish-package
v0.6.0
Published
Build, stage, and publish a single package to npm
Maintainers
Readme
@repo-toolkit/publish-package
Build, stage, and publish a single package to npm.
Installation
pnpm add -D @repo-toolkit/publish-packageCLI
repo-toolkit-publish-packageWhen package.json.version already contains the real release version, you can
omit --version. If it still uses the placeholder, pass --version
explicitly.
Useful flags:
--config <path>--cwd <path>--root-dir <path>--package-json <path>--version <version>(alias:--tag)--npm-tag <dist-tag>--publish-dir <path>--version-placeholder <text>--package-files <file>[,<file>](replaces defaults)--include-package-file <path>(repeatable, additive)--no-default-package-files--root-files <file>[,<file>](replaces defaults)--include-root-file <path>(repeatable, additive)--no-default-root-files--build-command <command>--skip-build--access <level>--registry <url>--otp <code>--provenance--dry-run
JavaScript API
import { publishPackage } from '@repo-toolkit/publish-package';
publishPackage({
cwd: '/path/to/package',
version: '1.2.3',
rootFiles: ['LICENSE'],
packageFiles: ['README.md', 'CHANGELOG.md'],
publishDir: 'dist',
versionPlaceholder: '0.0.0-PLACEHOLDER',
dryRun: true,
});Exports
createPublishPackageJson(...)— rewrite a package manifest for publish.resolvePublishPackagePlan(options)— resolve file/version/publish metadata without publishing.publishPackage(options)— run the build/copy/npm-publish pipeline for one package.inferNpmTag(version)— derive the npm dist-tag from a version string.isPlainObject(value)— shared object guard used by the config loaders and manifest rewriters.
Options
cwd(string) Package root directory. Defaults toprocess.cwd().rootDir(string) Directory to sourcerootFilesfrom. Defaults tocwd.packageJsonPath(string) Source package.json path. Defaults topackage.json.version(string) Target package version. Defaults topackage.json.version. A leadingvis stripped.npmTag(string) npm dist-tag. Defaults to the prereleasepreid.packageFiles(string[]) Files copied from the package root into the publish dir (default:['README.md', 'CHANGELOG.md', 'llms.txt']). Missing files are skipped. Subpaths are flattened (docs/llms.txt→dist/llms.txt).includePackageFiles(string[]) Additional files appended topackageFiles.noDefaultPackageFiles(boolean) Skip copying default package files.rootFiles(string[]) Files copied fromrootDirinto the publish dir (default:['LICENSE']). Missing files are skipped.includeRootFiles(string[]) Additional files appended torootFiles.noDefaultRootFiles(boolean) Skip copying default root files.publishDir(string) Publish directory inside the package root (default:dist).versionPlaceholder(string) Placeholder rewritten to the target version (default:0.0.0-PLACEHOLDER).buildCommand(string) Command used to build the publish dir (default:pnpm build).skipBuild(boolean) Skip the build step.access(string) npm publish access level (default:public).registry(string) npm registry URL.otp(string) npm OTP code.provenance(boolean) Request npm provenance attestation.dryRun(boolean) Forward--dry-runtonpm publish.internalPackageNames(string[] | Set<string>) Names treated as internal workspace packages for dependency-range rewriting.
Docs
The longer guide lives in the workspace documentation site under
website/docs/packages/publish-package.md.
