pkgbld 1.16.2 → 1.16.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -15
- package/dist/index.js +14 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
*Build your libraries with ease*
|
|
4
4
|
|
|
5
|
-
Rollup
|
|
5
|
+
Rollup-based build tool for building libraries based on package.json config and simple CLI options.
|
|
6
6
|
|
|
7
|
-
It is a simple building tool that supports building to different targets like
|
|
7
|
+
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`.
|
|
8
8
|
|
|
9
9
|
[Changelog](./CHANGELOG.md)
|
|
10
10
|
|
|
11
11
|
## Why
|
|
12
12
|
|
|
13
|
-
It is created to easily build libraries that
|
|
13
|
+
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).
|
|
14
14
|
|
|
15
15
|
## Installation
|
|
16
16
|
|
|
@@ -21,10 +21,10 @@ npm install --save-dev pkgbld
|
|
|
21
21
|
|
|
22
22
|
### Getting started (minimalistic start from scratch)
|
|
23
23
|
|
|
24
|
-
1. Start
|
|
24
|
+
1. Start by creating package.json using `npm init`
|
|
25
25
|
2. Add pkgbld `npm install --save-dev pkgbld`
|
|
26
26
|
3. Create `src/index.ts`
|
|
27
|
-
4. Add pkgbld in scripts field of your package.json like:
|
|
27
|
+
4. Add pkgbld in the 'scripts' field of your package.json like:
|
|
28
28
|
|
|
29
29
|
```json
|
|
30
30
|
"scripts": {
|
|
@@ -46,9 +46,9 @@ Run `npm run build`.
|
|
|
46
46
|
pkgbld --umd=index,core
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
-
Where `index,core` should be replaced by entry points that should be
|
|
49
|
+
Where `index,core` should be replaced by entry points that should be compiled in umd format, `index` is the top level `'.'` entry point.
|
|
50
50
|
|
|
51
|
-
If `package.json`
|
|
51
|
+
If `package.json` defines the `umd` field option will default to `index``.
|
|
52
52
|
|
|
53
53
|
### compress
|
|
54
54
|
|
|
@@ -64,7 +64,7 @@ Where `es,umd` should be replaced by formats that should be compressed using ter
|
|
|
64
64
|
pkgbld --sourcemaps=es,cjs
|
|
65
65
|
```
|
|
66
66
|
|
|
67
|
-
Where `es,cjs` should be replaced by targets for which
|
|
67
|
+
Where `es,cjs` should be replaced by targets for which source maps should be generated. Default `umd`.
|
|
68
68
|
|
|
69
69
|
Supported targets for this option: `es`, `cjs` and `umd`.
|
|
70
70
|
|
|
@@ -106,7 +106,7 @@ Directory to search for input files.
|
|
|
106
106
|
pkgbld --bin=./dist/index.cjs,./dist/index.mjs
|
|
107
107
|
```
|
|
108
108
|
|
|
109
|
-
File(s) to make executable.
|
|
109
|
+
File(s) to make executable. The first entry will be added to package.json
|
|
110
110
|
|
|
111
111
|
### include-externals
|
|
112
112
|
|
|
@@ -126,11 +126,7 @@ Ejects Rollup config.
|
|
|
126
126
|
|
|
127
127
|
### no-ts-config
|
|
128
128
|
|
|
129
|
-
|
|
130
|
-
pkgbld --no-ts-config
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
Do not check / write tsconfig.json.
|
|
129
|
+
Do not check/write tsconfig.json.
|
|
134
130
|
|
|
135
131
|
### no-update-package-json
|
|
136
132
|
|
|
@@ -144,7 +140,7 @@ Do not write package.json.
|
|
|
144
140
|
|
|
145
141
|
`pkgbld` reads all installed packages named `pkgbld-plugin-*` and assumes they are plugins
|
|
146
142
|
|
|
147
|
-
Plugins suppose to implement one or more of following interface methods as their package exports:
|
|
143
|
+
Plugins suppose to implement one or more of the following interface methods as their package exports:
|
|
148
144
|
|
|
149
145
|
```
|
|
150
146
|
interface PkgbldPlugin {
|
package/dist/index.js
CHANGED
|
@@ -475,6 +475,13 @@ function processPackage(pkg, config, plugins) {
|
|
|
475
475
|
pkg.exports['.'] = {};
|
|
476
476
|
}
|
|
477
477
|
pkg.exports['./package.json'] = './package.json';
|
|
478
|
+
if (allowEsm && !allowCjs && typeof pkg.type !== 'string') {
|
|
479
|
+
pkg.type = 'module';
|
|
480
|
+
}
|
|
481
|
+
if (typeof pkg.typings === 'string') {
|
|
482
|
+
delete pkg.typings;
|
|
483
|
+
}
|
|
484
|
+
pkg.types = `./${config.dir}/index.d.ts`;
|
|
478
485
|
if (allowUmd && typeof pkg.umd === 'string') {
|
|
479
486
|
pkg.umd = `./${config.dir}/index.umd.js`;
|
|
480
487
|
if (!config.umdInputs.includes('index')) {
|
|
@@ -506,13 +513,16 @@ function processPackage(pkg, config, plugins) {
|
|
|
506
513
|
if (allowCjs && typeof pkg.main !== 'string') {
|
|
507
514
|
pkg.main = `./${config.dir}/index.cjs`;
|
|
508
515
|
}
|
|
516
|
+
if (allowEsm && !allowCjs && typeof pkg.main !== 'string') {
|
|
517
|
+
pkg.main = `./${config.dir}/index.mjs`;
|
|
518
|
+
}
|
|
509
519
|
if (allowCjs && pkg.main !== pkg.exports['.'].require) {
|
|
510
520
|
pkg.exports['.'].require = pkg.main;
|
|
511
521
|
}
|
|
512
|
-
if (allowEsm && typeof pkg.module !== 'string') {
|
|
522
|
+
if (allowCjs && allowEsm && typeof pkg.module !== 'string') {
|
|
513
523
|
pkg.module = `./${config.dir}/index.mjs`;
|
|
514
524
|
}
|
|
515
|
-
if (
|
|
525
|
+
if (pkg.module !== pkg.exports['.']?.default) {
|
|
516
526
|
pkg.exports['.'].default = pkg.module;
|
|
517
527
|
}
|
|
518
528
|
if (allowUmd && config.umdInputs.includes('index')) {
|
|
@@ -542,7 +552,7 @@ function processPackage(pkg, config, plugins) {
|
|
|
542
552
|
config.formats.push('umd');
|
|
543
553
|
}
|
|
544
554
|
for (const plugin of plugins) {
|
|
545
|
-
plugin.processPackageJson
|
|
555
|
+
plugin.processPackageJson?.(pkg, inputs, logger$1);
|
|
546
556
|
}
|
|
547
557
|
return inputs;
|
|
548
558
|
}
|
|
@@ -551,7 +561,7 @@ async function writeJson(path, json) {
|
|
|
551
561
|
await fs.writeFile(path, JSON.stringify(json, null, 2) + '\n');
|
|
552
562
|
}
|
|
553
563
|
|
|
554
|
-
var version = "1.16.
|
|
564
|
+
var version = "1.16.4";
|
|
555
565
|
var license = "MIT";
|
|
556
566
|
var name = "pkgbld";
|
|
557
567
|
var author = {
|
package/package.json
CHANGED