pkgbld v1.35.1
pkgbld
Build your libraries with ease
Rollup-based build tool for building libraries based on package.json config and simple CLI options.
It is a simple building tool that supports building to different targets like es, cjs, umd without additional transformation other than minification using terser or preprocess using rollup-plugin-preprocess.
Why
It is created to easily build libraries that contain multiple subpath exports (entry points, sub-packages) because it is not that easy to do at the moment with microbundle, tsdx or ng-packagr (if you are on Typescript).
Installation
Using npm:
npm install --save-dev pkgbldGetting started (minimalistic start from scratch)
- Start by creating package.json using
npm init - Add pkgbld
npm install --save-dev pkgbld - Create
src/index.ts - Add pkgbld in the 'scripts' field of your package.json like:
"scripts": {
"build": "pkgbld"
},Run npm run build.
package.json
pkgbld expects the name field to be filled in the package.json file. exports field defines what entries/outputs should be built for this package.
CLI options
umd
pkgbld --umd=index,coreWhere index,core should be replaced by entry points that should be compiled in umd format, index is the top level '.' entry point.
If package.json defines the umd field option will default to `index.
compress
pkgbld --compress=es,umdWhere es,umd should be replaced by formats that should be compressed using terser.
sourcemaps
pkgbld --sourcemaps=es,cjsWhere es,cjs should be replaced by targets for which source maps should be generated. Default umd.
Supported targets for this option: es, cjs and umd.
formats
pkgbld --formats=esDefines what formats to build, only supports es and cjs at the moment. Use umd flag to build umd target.
preprocess
pkgbld --preprocess=indexDefines what entry points/files should be preprocessed using rollup-plugin-preprocess. The entry point will be defined as variable es (for esm target), cjs (for commonjs) and umd (for umd) depending on the target type. Please request more variables / more granular logic if you want more.
dir
pkgbld --dir=distDirectory to put output files.
sourcedir
pkgbld --sourcedir=srcDirectory to search for input files.
bin
pkgbld --bin=./dist/index.cjs,./dist/index.mjsFile(s) to make executable. The first entry will be added to package.json
include-externals
pkgbld --include-externalsBundles all externals into a package.
eject
pkgbld --ejectEjects Rollup config.
no-ts-config
Do not check/write tsconfig.json.
no-update-package-json
pkgbld --no-update-package-jsonDo not write package.json.
Plugin API
pkgbld reads all installed packages named pkgbld-plugin-* and assumes they are plugins
Plugins suppose to implement one or more of the following interface methods as their package exports:
interface PkgbldPlugin {
options(parsedArgs: {[key: string]: string | number}, options: ReturnType<typeof getCliOptions>): void;
processPackageJson(packageJson: PackageJson, inputs: string[], logger: Logger): void;
processTsConfig(config: Json): void;
providePlugins(provider: Provider, config: Record<string, string | string[] | boolean>, inputs: string[]): Promise<void>;
getExtraOutputSettings(format: InternalModuleFormat, inputs: string[]): Partial<OutputOptions>;
buildEnd(): Promise<void>;
}License
9 months ago
9 months ago
8 months ago
8 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago