pkgbld 1.7.1 → 1.9.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/dist/get-pkg.d.ts +2 -1
- package/dist/helpers.d.ts +8 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.js +21 -12
- package/dist/process-pkg.d.ts +2 -1
- package/dist/types.d.ts +7 -0
- package/dist/write-pkg.d.ts +2 -1
- package/package.json +20 -17
package/dist/get-pkg.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { Json } from './types';
|
|
2
|
+
export declare function getPackage(): Promise<[string, Json]>;
|
package/dist/helpers.d.ts
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { getCliOptions } from './get-cli-options';
|
|
2
|
-
|
|
2
|
+
import { OutputOptions } from 'rollup';
|
|
3
|
+
export declare function getHelpers(name: string): {
|
|
3
4
|
getGlobalName: (anInput: string) => string;
|
|
4
5
|
getExternalGlobalName: (id: string) => string;
|
|
5
6
|
umdFilter: typeof umdFilter;
|
|
6
7
|
};
|
|
7
8
|
export declare function umdFilter(config: ReturnType<typeof getCliOptions>, filename: string): boolean;
|
|
8
|
-
export declare function toArray<T>(object: T
|
|
9
|
+
export declare function toArray<T>(object: T | T[] | undefined): T[];
|
|
9
10
|
export declare function isExternalInput(id: string, inputs: string | string[], currentInput: string, config: ReturnType<typeof getCliOptions>): boolean;
|
|
10
|
-
export declare function formatInput(input: string[] | string | undefined): string
|
|
11
|
-
export declare function formatOutput(output:
|
|
11
|
+
export declare function formatInput(input: string[] | string | undefined): string;
|
|
12
|
+
export declare function formatOutput(output: OutputOptions | OutputOptions[] | undefined, field: 'dir' | 'format'): string;
|
|
12
13
|
export declare function getTimeDiff(starting: number): string;
|
|
14
|
+
export declare function getDefaultExport<T extends {
|
|
15
|
+
default?: unknown;
|
|
16
|
+
}>(importedModule: T): {};
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import '@niceties/draftlog-appender';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
+
require('@niceties/draftlog-appender');
|
|
4
5
|
var logger = require('@niceties/logger');
|
|
5
6
|
var rollup = require('rollup');
|
|
6
7
|
var fs = require('fs/promises');
|
|
@@ -66,10 +67,9 @@ async function getPackage() {
|
|
|
66
67
|
return [pkgPath, JSON.parse(buffer.toString())];
|
|
67
68
|
}
|
|
68
69
|
|
|
69
|
-
|
|
70
|
-
function getHelpers(pkg) {
|
|
70
|
+
function getHelpers(name) {
|
|
71
71
|
function getGlobalName(anInput) {
|
|
72
|
-
return camelCase(path.join(
|
|
72
|
+
return camelCase(path.join(name, path.basename(anInput, '.ts') !== 'index' ? path.basename(anInput, '.ts') : ''));
|
|
73
73
|
}
|
|
74
74
|
function getExternalGlobalName(id) {
|
|
75
75
|
if (path.isAbsolute(id)) {
|
|
@@ -91,6 +91,9 @@ function toArray(object) {
|
|
|
91
91
|
if (Array.isArray(object)) {
|
|
92
92
|
return object;
|
|
93
93
|
}
|
|
94
|
+
if (object == null) {
|
|
95
|
+
return [];
|
|
96
|
+
}
|
|
94
97
|
return [object];
|
|
95
98
|
}
|
|
96
99
|
function isExternalInput(id, inputs, currentInput, config) {
|
|
@@ -104,11 +107,15 @@ function isExternalInput(id, inputs, currentInput, config) {
|
|
|
104
107
|
return normalizedPath !== currentInput && inputs.includes(normalizedPath);
|
|
105
108
|
}
|
|
106
109
|
function formatInput(input) {
|
|
107
|
-
return Array.isArray(input) ? input.join(', ') : input;
|
|
110
|
+
return Array.isArray(input) ? input.join(', ') : (input !== null && input !== void 0 ? input : ''); // not sure if ?? '' needed
|
|
108
111
|
}
|
|
109
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
110
112
|
function formatOutput(output, field) {
|
|
111
|
-
|
|
113
|
+
var _a;
|
|
114
|
+
// can we avoid it?
|
|
115
|
+
if (output == null) {
|
|
116
|
+
return '';
|
|
117
|
+
}
|
|
118
|
+
return Array.isArray(output) ? output.map(item => item[field]).join(', ') : ((_a = output[field]) !== null && _a !== void 0 ? _a : '');
|
|
112
119
|
}
|
|
113
120
|
function getTimeDiff(starting) {
|
|
114
121
|
const now = Date.now();
|
|
@@ -203,22 +210,25 @@ function getRollupConfigs(inputs, config, helpers) {
|
|
|
203
210
|
return configs;
|
|
204
211
|
}
|
|
205
212
|
|
|
206
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
207
213
|
function processPackage(pkg, config) {
|
|
208
214
|
var _a;
|
|
209
215
|
const input = [];
|
|
210
216
|
const logger$1 = logger.createLogger();
|
|
211
|
-
if (typeof pkg
|
|
217
|
+
if (typeof pkg !== 'object' || Array.isArray(pkg)) {
|
|
218
|
+
logger$1.finish('expecting object on top level of package.json', 3 /* LogLevel.error */);
|
|
219
|
+
process.exit(-1);
|
|
220
|
+
}
|
|
221
|
+
if (typeof (pkg === null || pkg === void 0 ? void 0 : pkg.name) !== 'string') {
|
|
212
222
|
logger$1.finish('expecting name to be a string in package.json', 3 /* LogLevel.error */);
|
|
213
223
|
process.exit(-1);
|
|
214
224
|
}
|
|
215
|
-
if (!Array.isArray(pkg.files)) {
|
|
225
|
+
if (!Array.isArray(pkg === null || pkg === void 0 ? void 0 : pkg.files)) {
|
|
216
226
|
pkg.files = [];
|
|
217
227
|
}
|
|
218
228
|
if (!pkg.files.includes(config.dir)) {
|
|
219
229
|
pkg.files.push(config.dir);
|
|
220
230
|
}
|
|
221
|
-
if (typeof pkg.exports !== 'object') {
|
|
231
|
+
if (typeof pkg.exports !== 'object' && pkg.exports !== null) {
|
|
222
232
|
pkg.exports = {};
|
|
223
233
|
}
|
|
224
234
|
if (pkg.exports['.'] == null) {
|
|
@@ -265,7 +275,6 @@ function processPackage(pkg, config) {
|
|
|
265
275
|
return input;
|
|
266
276
|
}
|
|
267
277
|
|
|
268
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
269
278
|
async function writePackage(pkgPath, pkg) {
|
|
270
279
|
await fs.writeFile(pkgPath, JSON.stringify(pkg, null, 2) + '\n');
|
|
271
280
|
}
|
|
@@ -275,7 +284,7 @@ async function execute() {
|
|
|
275
284
|
const [pkgPath, pkg] = await getPackage();
|
|
276
285
|
const config = getCliOptions();
|
|
277
286
|
const inputs = processPackage(pkg, config);
|
|
278
|
-
const helpers = getHelpers(pkg);
|
|
287
|
+
const helpers = getHelpers(pkg.name);
|
|
279
288
|
const rollupConfigs = getRollupConfigs(inputs, config, helpers);
|
|
280
289
|
for (const config of rollupConfigs) {
|
|
281
290
|
const logger$1 = logger.createLogger();
|
package/dist/process-pkg.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { getCliOptions } from './get-cli-options';
|
|
2
|
-
|
|
2
|
+
import { Json } from './types';
|
|
3
|
+
export declare function processPackage(pkg: Json, config: ReturnType<typeof getCliOptions>): string[];
|
package/dist/types.d.ts
ADDED
package/dist/write-pkg.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { Json } from './types';
|
|
2
|
+
export declare function writePackage(pkgPath: string, pkg: Json): Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.
|
|
2
|
+
"version": "1.9.0",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"name": "pkgbld",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Konstantin Shutkin"
|
|
7
7
|
},
|
|
8
8
|
"bin": "./dist/index.js",
|
|
9
|
+
"main": "./dist/index.js",
|
|
10
|
+
"typings": "./dist/index.d.ts",
|
|
9
11
|
"files": [
|
|
10
12
|
"dist"
|
|
11
13
|
],
|
|
@@ -33,35 +35,36 @@
|
|
|
33
35
|
},
|
|
34
36
|
"devDependencies": {
|
|
35
37
|
"@semantic-release/changelog": "6.0.1",
|
|
36
|
-
"@semantic-release/commit-analyzer": "9.0.
|
|
38
|
+
"@semantic-release/commit-analyzer": "9.0.2",
|
|
37
39
|
"@semantic-release/git": "10.0.1",
|
|
38
|
-
"@semantic-release/npm": "
|
|
39
|
-
"@semantic-release/release-notes-generator": "10.0.
|
|
40
|
-
"@types/lodash": "4.14.
|
|
41
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
42
|
-
"@typescript-eslint/parser": "5.
|
|
40
|
+
"@semantic-release/npm": "9.0.1",
|
|
41
|
+
"@semantic-release/release-notes-generator": "10.0.3",
|
|
42
|
+
"@types/lodash": "4.14.186",
|
|
43
|
+
"@typescript-eslint/eslint-plugin": "5.41.0",
|
|
44
|
+
"@typescript-eslint/parser": "5.41.0",
|
|
43
45
|
"conventional-changelog-angular": "5.0.13",
|
|
44
|
-
"eslint": "8.
|
|
45
|
-
"semantic-release": "19.0.
|
|
46
|
-
"@rollup-extras/plugin-binify": "1.1.
|
|
46
|
+
"eslint": "8.26.0",
|
|
47
|
+
"semantic-release": "19.0.5",
|
|
48
|
+
"@rollup-extras/plugin-binify": "1.1.2"
|
|
47
49
|
},
|
|
48
50
|
"dependencies": {
|
|
49
|
-
"@niceties/logger": "1.1.
|
|
51
|
+
"@niceties/logger": "1.1.6",
|
|
52
|
+
"@niceties/draftlog-appender": "1.2.5",
|
|
50
53
|
"lodash": "4.17.21",
|
|
51
|
-
"rollup": "3.
|
|
54
|
+
"rollup": "3.2.3",
|
|
52
55
|
"rollup-plugin-terser": "7.0.2",
|
|
53
56
|
"rollup-plugin-typescript2": "0.34.1",
|
|
54
57
|
"rollup-plugin-preprocess": "0.0.4",
|
|
55
|
-
"@rollup/plugin-commonjs": "23.0.
|
|
56
|
-
"@rollup/plugin-node-resolve": "15.0.
|
|
57
|
-
"@rollup-extras/plugin-clean": "1.3.
|
|
58
|
-
"@rollup-extras/plugin-externals": "1.1.
|
|
58
|
+
"@rollup/plugin-commonjs": "23.0.2",
|
|
59
|
+
"@rollup/plugin-node-resolve": "15.0.1",
|
|
60
|
+
"@rollup-extras/plugin-clean": "1.3.2",
|
|
61
|
+
"@rollup-extras/plugin-externals": "1.1.3",
|
|
59
62
|
"typescript": "4.8.4",
|
|
60
63
|
"minimist": "1.2.7"
|
|
61
64
|
},
|
|
62
65
|
"overrides": {
|
|
63
66
|
"rollup-plugin-terser@7.0.2": {
|
|
64
|
-
"rollup": "3.
|
|
67
|
+
"rollup": "3.2.3"
|
|
65
68
|
}
|
|
66
69
|
}
|
|
67
70
|
}
|