1.29.4 • Published 1 month ago

pkgbld v1.29.4

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

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.

Changelog

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 pkgbld

Getting started (minimalistic start from scratch)

  1. Start by creating package.json using npm init
  2. Add pkgbld npm install --save-dev pkgbld
  3. Create src/index.ts
  4. 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,core

Where 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,umd

Where es,umd should be replaced by formats that should be compressed using terser.

sourcemaps

pkgbld --sourcemaps=es,cjs

Where 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=es

Defines what formats to build, only supports es and cjs at the moment. Use umd flag to build umd target.

preprocess

pkgbld --preprocess=index

Defines 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=dist

Directory to put output files.

sourcedir

pkgbld --sourcedir=src

Directory to search for input files.

bin

pkgbld --bin=./dist/index.cjs,./dist/index.mjs

File(s) to make executable. The first entry will be added to package.json

include-externals

pkgbld --include-externals

Bundles all externals into a package.

eject

pkgbld --eject

Ejects Rollup config.

no-ts-config

Do not check/write tsconfig.json.

no-update-package-json

pkgbld --no-update-package-json

Do 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

MIT

1.29.4

1 month ago

1.29.3

1 month ago

1.29.0

2 months ago

1.29.1

2 months ago

1.29.2

2 months ago

1.28.1

2 months ago

1.28.2

2 months ago

1.28.0

3 months ago

1.21.1

7 months ago

1.25.0

7 months ago

1.22.0

7 months ago

1.26.0

6 months ago

1.22.1

7 months ago

1.23.0

7 months ago

1.23.1

7 months ago

1.27.0

6 months ago

1.27.1

6 months ago

1.24.1

7 months ago

1.24.2

7 months ago

1.18.0

7 months ago

1.21.0

7 months ago

1.19.0

7 months ago

1.17.1

7 months ago

1.17.0

7 months ago

1.20.0

7 months ago

1.16.3

11 months ago

1.16.7

9 months ago

1.16.6

10 months ago

1.16.5

10 months ago

1.16.4

10 months ago

1.16.2

12 months ago

1.16.1

12 months ago

1.16.0

1 year ago

1.14.1

1 year ago

1.14.0

1 year ago

1.14.5

1 year ago

1.14.4

1 year ago

1.14.3

1 year ago

1.14.2

1 year ago

1.14.6

1 year ago

1.15.0

1 year ago

1.11.2

1 year ago

1.11.1

1 year ago

1.15.4

1 year ago

1.15.3

1 year ago

1.15.2

1 year ago

1.15.1

1 year ago

1.15.7

1 year ago

1.15.6

1 year ago

1.15.5

1 year ago

1.12.0

1 year ago

1.13.0

1 year ago

1.10.4

1 year ago

1.10.3

1 year ago

1.10.2

1 year ago

1.8.0

2 years ago

1.9.2

1 year ago

1.11.0

1 year ago

1.9.1

1 year ago

1.9.0

2 years ago

1.7.1

2 years ago

1.7.0

2 years ago

1.10.1

1 year ago

1.10.0

1 year ago

1.6.0

2 years ago

1.5.5

2 years ago

1.5.4

2 years ago

1.5.3

2 years ago

1.5.2

2 years ago

1.5.1

2 years ago

1.5.0

2 years ago

1.4.9

2 years ago

1.4.11

2 years ago

1.4.8

2 years ago

1.4.10

2 years ago

1.4.13

2 years ago

1.4.12

2 years ago

1.4.15

2 years ago

1.4.14

2 years ago

1.4.17

2 years ago

1.4.16

2 years ago

1.4.6

2 years ago

1.4.5

2 years ago

1.4.4

2 years ago

1.4.3

2 years ago

1.4.2

2 years ago

1.4.1

2 years ago

1.4.0

2 years ago

1.2.13

2 years ago

1.2.16

2 years ago

1.2.17

2 years ago

1.2.14

2 years ago

1.2.15

2 years ago

1.2.18

2 years ago

1.2.19

2 years ago

1.3.0

2 years ago

1.2.20

2 years ago

1.2.23

2 years ago

1.2.24

2 years ago

1.2.21

2 years ago

1.2.22

2 years ago

1.4.7

2 years ago

1.2.9

2 years ago

1.2.12

2 years ago

1.2.10

2 years ago

1.2.11

2 years ago

1.2.0

2 years ago

1.2.8

2 years ago

1.2.7

2 years ago

1.2.6

2 years ago

1.2.5

2 years ago

1.2.4

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.1.19

2 years ago

1.1.18

2 years ago

1.1.17

2 years ago

1.1.20

2 years ago

1.1.16

2 years ago

1.1.15

2 years ago

1.1.14

2 years ago

1.1.13

2 years ago

1.1.12

2 years ago

1.1.11

2 years ago

1.1.10

2 years ago

1.1.9

2 years ago

1.1.8

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago