pkgbld 1.13.0 → 1.14.0

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 CHANGED
@@ -6,7 +6,7 @@ It is simple building tool that supports building to different targets like: `es
6
6
 
7
7
  ## Why
8
8
 
9
- It is created to easily build libraries that contains mutliple subpackages (exports, entry points) because it is not that easy to do at the moment with `microbundle`, `tsdx` or `ng-packagr`.
9
+ It is created to easily build libraries that contains mutliple subpath exports (entry points, subpackages) because it is not that easy to do at the moment with `microbundle`, `tsdx` or `ng-packagr` (if you are on Typescript).
10
10
 
11
11
  ## Installation
12
12
 
@@ -15,6 +15,32 @@ Using npm:
15
15
  npm install --save-dev pkgbld
16
16
  ```
17
17
 
18
+ ### Getting started (minimalistic start from scratch)
19
+
20
+ 1. Start from creating pcakage.json using `npm init`
21
+ 2. Add pkgbld `npm install --save-dev pkgbld`
22
+ 3. Add `tsconfig.json` file into root project directory
23
+ ```json
24
+ {
25
+ "compilerOptions": {
26
+ "target": "esnext",
27
+ "module": "esnext",
28
+ "esModuleInterop": true,
29
+ "strict": true,
30
+ }
31
+ }
32
+
33
+ ```
34
+ 4. Create `src/index.ts`
35
+ 5. Add pkgbld in scripts field of your package.json like:
36
+ ```json
37
+ "scripts": {
38
+ "build": "pkgbld"
39
+ },
40
+ ```
41
+
42
+ Run `npm run build`.
43
+
18
44
  ## package.json
19
45
 
20
46
  `pkgbld` expects name field to be filled in the package.json file. `exports` field defines what entries/outputs should be build for this package.
@@ -89,6 +115,14 @@ pkgbld --bin=./dist/index.cjs,./dist/index.mjs
89
115
 
90
116
  File(s) to make executable. First entry will be added to package.json
91
117
 
118
+ ### include-externals
119
+
120
+ ```
121
+ pkgbld --include-externals
122
+ ```
123
+
124
+ Bundles all externals into package.
125
+
92
126
  # License
93
127
 
94
128
  [MIT](./LICENSE)
@@ -8,4 +8,5 @@ export declare function getCliOptions(): {
8
8
  dir: string;
9
9
  sourceDir: string;
10
10
  bin?: string[] | undefined;
11
+ includeExternals: boolean;
11
12
  };
package/dist/index.js CHANGED
@@ -33,10 +33,11 @@ const defaults = {
33
33
  sourcemapFormats: ['umd'],
34
34
  preprocess: [],
35
35
  dir: 'dist',
36
- sourceDir: 'src'
36
+ sourceDir: 'src',
37
+ includeExternals: false
37
38
  };
38
39
  function getCliOptions() {
39
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
40
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
40
41
  const parsedArgs = minimist(process.argv.slice(2));
41
42
  const umdInputs = (_b = (_a = parsedArgs.umd) === null || _a === void 0 ? void 0 : _a.split(',').map((arg) => arg.trim())) !== null && _b !== void 0 ? _b : defaults.umdInputs;
42
43
  const compressFormats = (_d = (_c = parsedArgs.compress) === null || _c === void 0 ? void 0 : _c.split(',').map((arg) => arg.trim())) !== null && _d !== void 0 ? _d : defaults.compressFormats;
@@ -46,6 +47,7 @@ function getCliOptions() {
46
47
  const dir = (_l = parsedArgs.dir) !== null && _l !== void 0 ? _l : defaults.dir;
47
48
  const sourceDir = (_m = parsedArgs.sourceDir) !== null && _m !== void 0 ? _m : defaults.sourceDir;
48
49
  const bin = (_o = parsedArgs.bin) === null || _o === void 0 ? void 0 : _o.split(',').map((arg) => arg.trim());
50
+ const includeExternals = (_p = parsedArgs['include-externals']) !== null && _p !== void 0 ? _p : defaults.includeExternals;
49
51
  return {
50
52
  umdInputs,
51
53
  compressFormats,
@@ -55,7 +57,8 @@ function getCliOptions() {
55
57
  preprocess,
56
58
  dir,
57
59
  sourceDir,
58
- bin
60
+ bin,
61
+ includeExternals
59
62
  };
60
63
  }
61
64
 
@@ -83,6 +86,9 @@ async function commonjs (provide) {
83
86
  }
84
87
 
85
88
  async function externals (provide, config, inputs) {
89
+ if (config.includeExternals) {
90
+ return;
91
+ }
86
92
  const { default: pluginExternals } = await import('@rollup-extras/plugin-externals');
87
93
  const allowGenericUmd = config.umdInputs.length === 1 && inputs.length === 1;
88
94
  if (config.formats.length > 0) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.13.0",
2
+ "version": "1.14.0",
3
3
  "license": "MIT",
4
4
  "name": "pkgbld",
5
5
  "author": {