jiek 2.3.0 → 2.3.2
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/.internal/bin/common.cjs +9 -8
- package/dist/.internal/bin/common.d.cts +4 -0
- package/dist/.internal/bin/common.d.ts +4 -0
- package/dist/.internal/bin/common.js +9 -8
- package/dist/.internal/rollup/base.d.cts +23 -0
- package/dist/.internal/rollup/base.d.ts +23 -0
- package/dist/.internal/utils/resolveExports.cjs +10 -4
- package/dist/.internal/utils/resolveExports.d.cts +2 -1
- package/dist/.internal/utils/resolveExports.d.ts +2 -1
- package/dist/.internal/utils/resolveExports.js +11 -5
- package/dist/bin/index.cjs +45 -24
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/rollup/index.cjs +106 -6
- package/dist/rollup/index.js +105 -6
- package/dist/rollup-plugin-utils.cjs +4135 -0
- package/dist/rollup-plugin-utils.d.cts +10 -0
- package/dist/rollup-plugin-utils.d.ts +10 -0
- package/dist/rollup-plugin-utils.js +4127 -0
- package/package.json +8 -5
- package/rollup-plugin-utils/package.json +1 -0
- package/src/commands/build.ts +18 -2
- package/src/commands/publish.ts +77 -46
- package/src/rollup/base.ts +14 -0
- package/src/rollup/index.ts +53 -6
- package/src/rollup/plugins/replace.ts +96 -0
- package/src/rollup-plugin-utils.ts +32 -0
- package/src/utils/resolveExports.ts +12 -5
@@ -37,7 +37,7 @@ var Koa__default = /*#__PURE__*/_interopDefault(Koa);
|
|
37
37
|
|
38
38
|
var name = "jiek";
|
39
39
|
var type = "module";
|
40
|
-
var version = "2.
|
40
|
+
var version = "2.3.1";
|
41
41
|
var description$1 = "A lightweight toolkit for compiling and managing libraries based on `package.json` metadata and suitable for `Monorepo`.";
|
42
42
|
var author = "YiJie <yijie4188@gmail.com>";
|
43
43
|
var homepage = "https://github.com/NWYLZW/jiek/tree/master/packages/jiek#readme";
|
@@ -63,7 +63,8 @@ var exports$1 = {
|
|
63
63
|
require: "./bin-helper/index.cjs",
|
64
64
|
"default": "./bin-helper/index.js"
|
65
65
|
},
|
66
|
-
"./rollup": "./src/rollup/index.ts"
|
66
|
+
"./rollup": "./src/rollup/index.ts",
|
67
|
+
"./rollup-plugin-utils": "./src/rollup-plugin-utils.ts"
|
67
68
|
};
|
68
69
|
var imports = {
|
69
70
|
"#~/*": "./src/*.ts"
|
@@ -113,6 +114,7 @@ var dependencies = {
|
|
113
114
|
"js-yaml": "^4.1.0",
|
114
115
|
"jsonc-parser": "^3.2.1",
|
115
116
|
koa: "^2.15.3",
|
117
|
+
"magic-string": "^0.30.17",
|
116
118
|
rollup: "^4.0.0"
|
117
119
|
};
|
118
120
|
var devDependencies = {
|
@@ -136,9 +138,6 @@ var devDependencies = {
|
|
136
138
|
"rollup-plugin-swc3": "^0.12.1",
|
137
139
|
"vite-bundle-analyzer": "0.16.0-beta.3"
|
138
140
|
};
|
139
|
-
var publishConfig = {
|
140
|
-
directory: "./dist/.internal"
|
141
|
-
};
|
142
141
|
var pkg = {
|
143
142
|
name: name,
|
144
143
|
type: type,
|
@@ -156,8 +155,7 @@ var pkg = {
|
|
156
155
|
scripts: scripts,
|
157
156
|
peerDependencies: peerDependencies,
|
158
157
|
dependencies: dependencies,
|
159
|
-
devDependencies: devDependencies
|
160
|
-
publishConfig: publishConfig
|
158
|
+
devDependencies: devDependencies
|
161
159
|
};
|
162
160
|
|
163
161
|
const entriesDescription = `
|
@@ -469,6 +467,7 @@ command = command.description(description).option("-t, --type <TYPE>", `The type
|
|
469
467
|
"Only output minify files, but dts files will still be output, it only replaces the js files.",
|
470
468
|
parseBoolean
|
471
469
|
);
|
470
|
+
command = command.option("--skipJS", 'Skip entries which end with ".js".', parseBoolean);
|
472
471
|
command = command.option("--features.keepImportAttributes", "Keep the import attributes in the output.");
|
473
472
|
command = command.option("--tsconfig <TSCONFIG>", "The path of the tsconfig file which is used to generate js and dts files.", String).option("--dtsconfig <DTSCONFIG>", "The path of the tsconfig file which is used to generate dts files.", String);
|
474
473
|
command = command.option("-w, --watch", "Watch the file changes.", parseBoolean).option("-p, --port <PORT>", "The port of the server.", Number.parseInt, 8888);
|
@@ -491,7 +490,8 @@ command.action(async (commandFiltersOrEntries, options) => {
|
|
491
490
|
noClean,
|
492
491
|
onlyMin,
|
493
492
|
tsconfig,
|
494
|
-
dtsconfig
|
493
|
+
dtsconfig,
|
494
|
+
skipJS
|
495
495
|
} = options;
|
496
496
|
const resolvedType = type ?? DEFAULT_BUILDER_TYPE;
|
497
497
|
if (!withoutJs) {
|
@@ -554,6 +554,7 @@ command.action(async (commandFiltersOrEntries, options) => {
|
|
554
554
|
JIEK_MINIFY_TYPE: minifyType,
|
555
555
|
JIEK_TSCONFIG: tsconfig,
|
556
556
|
JIEK_DTSCONFIG: dtsconfig,
|
557
|
+
JIEK_SKIP_JS: String(skipJS),
|
557
558
|
JIEK_FEATURES: JSON.stringify({
|
558
559
|
keepImportAttributes: options["features.keepImportAttributes"]
|
559
560
|
}),
|
@@ -6,6 +6,10 @@ import 'rollup';
|
|
6
6
|
|
7
7
|
declare module 'jiek' {
|
8
8
|
interface Config {
|
9
|
+
/**
|
10
|
+
* Skip entries which end with '.js'.
|
11
|
+
*/
|
12
|
+
skipJS?: boolean;
|
9
13
|
build?: TemplateOptions & {
|
10
14
|
/**
|
11
15
|
* Whether to run in silent mode, only active when configured in the workspace root or cwd.
|
@@ -6,6 +6,10 @@ import 'rollup';
|
|
6
6
|
|
7
7
|
declare module 'jiek' {
|
8
8
|
interface Config {
|
9
|
+
/**
|
10
|
+
* Skip entries which end with '.js'.
|
11
|
+
*/
|
12
|
+
skipJS?: boolean;
|
9
13
|
build?: TemplateOptions & {
|
10
14
|
/**
|
11
15
|
* Whether to run in silent mode, only active when configured in the workspace root or cwd.
|
@@ -30,7 +30,7 @@ import 'node:stream/promises';
|
|
30
30
|
|
31
31
|
var name = "jiek";
|
32
32
|
var type = "module";
|
33
|
-
var version = "2.
|
33
|
+
var version = "2.3.1";
|
34
34
|
var description$1 = "A lightweight toolkit for compiling and managing libraries based on `package.json` metadata and suitable for `Monorepo`.";
|
35
35
|
var author = "YiJie <yijie4188@gmail.com>";
|
36
36
|
var homepage = "https://github.com/NWYLZW/jiek/tree/master/packages/jiek#readme";
|
@@ -56,7 +56,8 @@ var exports = {
|
|
56
56
|
require: "./bin-helper/index.cjs",
|
57
57
|
"default": "./bin-helper/index.js"
|
58
58
|
},
|
59
|
-
"./rollup": "./src/rollup/index.ts"
|
59
|
+
"./rollup": "./src/rollup/index.ts",
|
60
|
+
"./rollup-plugin-utils": "./src/rollup-plugin-utils.ts"
|
60
61
|
};
|
61
62
|
var imports = {
|
62
63
|
"#~/*": "./src/*.ts"
|
@@ -106,6 +107,7 @@ var dependencies = {
|
|
106
107
|
"js-yaml": "^4.1.0",
|
107
108
|
"jsonc-parser": "^3.2.1",
|
108
109
|
koa: "^2.15.3",
|
110
|
+
"magic-string": "^0.30.17",
|
109
111
|
rollup: "^4.0.0"
|
110
112
|
};
|
111
113
|
var devDependencies = {
|
@@ -129,9 +131,6 @@ var devDependencies = {
|
|
129
131
|
"rollup-plugin-swc3": "^0.12.1",
|
130
132
|
"vite-bundle-analyzer": "0.16.0-beta.3"
|
131
133
|
};
|
132
|
-
var publishConfig = {
|
133
|
-
directory: "./dist/.internal"
|
134
|
-
};
|
135
134
|
var pkg = {
|
136
135
|
name: name,
|
137
136
|
type: type,
|
@@ -149,8 +148,7 @@ var pkg = {
|
|
149
148
|
scripts: scripts,
|
150
149
|
peerDependencies: peerDependencies,
|
151
150
|
dependencies: dependencies,
|
152
|
-
devDependencies: devDependencies
|
153
|
-
publishConfig: publishConfig
|
151
|
+
devDependencies: devDependencies
|
154
152
|
};
|
155
153
|
|
156
154
|
const entriesDescription = `
|
@@ -462,6 +460,7 @@ command = command.description(description).option("-t, --type <TYPE>", `The type
|
|
462
460
|
"Only output minify files, but dts files will still be output, it only replaces the js files.",
|
463
461
|
parseBoolean
|
464
462
|
);
|
463
|
+
command = command.option("--skipJS", 'Skip entries which end with ".js".', parseBoolean);
|
465
464
|
command = command.option("--features.keepImportAttributes", "Keep the import attributes in the output.");
|
466
465
|
command = command.option("--tsconfig <TSCONFIG>", "The path of the tsconfig file which is used to generate js and dts files.", String).option("--dtsconfig <DTSCONFIG>", "The path of the tsconfig file which is used to generate dts files.", String);
|
467
466
|
command = command.option("-w, --watch", "Watch the file changes.", parseBoolean).option("-p, --port <PORT>", "The port of the server.", Number.parseInt, 8888);
|
@@ -484,7 +483,8 @@ command.action(async (commandFiltersOrEntries, options) => {
|
|
484
483
|
noClean,
|
485
484
|
onlyMin,
|
486
485
|
tsconfig,
|
487
|
-
dtsconfig
|
486
|
+
dtsconfig,
|
487
|
+
skipJS
|
488
488
|
} = options;
|
489
489
|
const resolvedType = type ?? DEFAULT_BUILDER_TYPE;
|
490
490
|
if (!withoutJs) {
|
@@ -547,6 +547,7 @@ command.action(async (commandFiltersOrEntries, options) => {
|
|
547
547
|
JIEK_MINIFY_TYPE: minifyType,
|
548
548
|
JIEK_TSCONFIG: tsconfig,
|
549
549
|
JIEK_DTSCONFIG: dtsconfig,
|
550
|
+
JIEK_SKIP_JS: String(skipJS),
|
550
551
|
JIEK_FEATURES: JSON.stringify({
|
551
552
|
keepImportAttributes: options["features.keepImportAttributes"]
|
552
553
|
}),
|
@@ -3,6 +3,16 @@ import * as rollup_plugin_swc3 from 'rollup-plugin-swc3';
|
|
3
3
|
import * as rollup_plugin_esbuild from 'rollup-plugin-esbuild';
|
4
4
|
import { OutputOptions, InputPluginOption } from 'rollup';
|
5
5
|
|
6
|
+
interface ReplacementFuncCtx {
|
7
|
+
type: 'transform' | 'renderChunk';
|
8
|
+
id: string;
|
9
|
+
code: string;
|
10
|
+
start: number;
|
11
|
+
end: number;
|
12
|
+
}
|
13
|
+
type ReplacementFunc = (ctx: ReplacementFuncCtx) => string;
|
14
|
+
type Replacements = Record<string, string | ReplacementFunc>;
|
15
|
+
|
6
16
|
type Mapping2ROO<K extends keyof OutputOptions> = OutputOptions[K] | {
|
7
17
|
js?: OutputOptions[K];
|
8
18
|
dts?: OutputOptions[K];
|
@@ -114,6 +124,19 @@ interface TemplateOptions {
|
|
114
124
|
* ```
|
115
125
|
*/
|
116
126
|
injects?: Record<string, string | [string, string]>;
|
127
|
+
/**
|
128
|
+
* Replace the specified content in the code.
|
129
|
+
*
|
130
|
+
* @example
|
131
|
+
* ```js
|
132
|
+
* {
|
133
|
+
* 'process.env.DEBUG': 'false',
|
134
|
+
* 'process.env.NODE_ENV': JSON.stringify('production'),
|
135
|
+
* 'process.env.BUILD_PATH': ctx => JSON.stringify(ctx.id)
|
136
|
+
* }
|
137
|
+
* ```
|
138
|
+
*/
|
139
|
+
replacements?: Replacements;
|
117
140
|
}
|
118
141
|
|
119
142
|
export { BUILDER_TYPES, BUILDER_TYPE_PACKAGE_NAME_MAP, type ConfigGenerateContext, type Mapping2ROO, type OutputControl, type TemplateOptions };
|
@@ -3,6 +3,16 @@ import * as rollup_plugin_swc3 from 'rollup-plugin-swc3';
|
|
3
3
|
import * as rollup_plugin_esbuild from 'rollup-plugin-esbuild';
|
4
4
|
import { OutputOptions, InputPluginOption } from 'rollup';
|
5
5
|
|
6
|
+
interface ReplacementFuncCtx {
|
7
|
+
type: 'transform' | 'renderChunk';
|
8
|
+
id: string;
|
9
|
+
code: string;
|
10
|
+
start: number;
|
11
|
+
end: number;
|
12
|
+
}
|
13
|
+
type ReplacementFunc = (ctx: ReplacementFuncCtx) => string;
|
14
|
+
type Replacements = Record<string, string | ReplacementFunc>;
|
15
|
+
|
6
16
|
type Mapping2ROO<K extends keyof OutputOptions> = OutputOptions[K] | {
|
7
17
|
js?: OutputOptions[K];
|
8
18
|
dts?: OutputOptions[K];
|
@@ -114,6 +124,19 @@ interface TemplateOptions {
|
|
114
124
|
* ```
|
115
125
|
*/
|
116
126
|
injects?: Record<string, string | [string, string]>;
|
127
|
+
/**
|
128
|
+
* Replace the specified content in the code.
|
129
|
+
*
|
130
|
+
* @example
|
131
|
+
* ```js
|
132
|
+
* {
|
133
|
+
* 'process.env.DEBUG': 'false',
|
134
|
+
* 'process.env.NODE_ENV': JSON.stringify('production'),
|
135
|
+
* 'process.env.BUILD_PATH': ctx => JSON.stringify(ctx.id)
|
136
|
+
* }
|
137
|
+
* ```
|
138
|
+
*/
|
139
|
+
replacements?: Replacements;
|
117
140
|
}
|
118
141
|
|
119
142
|
export { BUILDER_TYPES, BUILDER_TYPE_PACKAGE_NAME_MAP, type ConfigGenerateContext, type Mapping2ROO, type OutputControl, type TemplateOptions };
|
@@ -49,7 +49,8 @@ function resolveExports({
|
|
49
49
|
// FIXME dts support
|
50
50
|
outdir = getOutDirs({ pkgName, defaultOutdir, config, cwd: dir }).js,
|
51
51
|
noFilter,
|
52
|
-
isPublish
|
52
|
+
isPublish,
|
53
|
+
skipJS
|
53
54
|
}) {
|
54
55
|
const {
|
55
56
|
build = {},
|
@@ -61,7 +62,9 @@ function resolveExports({
|
|
61
62
|
const {
|
62
63
|
crossModuleConvertor = crossModuleConvertorDefault
|
63
64
|
} = build;
|
64
|
-
const [, resolvedEntrypoints] = entrypoints.resolveEntrypoints(entrypoints$1
|
65
|
+
const [, resolvedEntrypoints] = entrypoints.resolveEntrypoints(entrypoints$1, {
|
66
|
+
allowJS: !skipJS
|
67
|
+
});
|
65
68
|
if (entries) {
|
66
69
|
Object.entries(resolvedEntrypoints).forEach(([key]) => {
|
67
70
|
if (!entries.some((e) => index.micromatchExports.isMatch(key, e, { matchBase: true }))) {
|
@@ -75,7 +78,9 @@ function resolveExports({
|
|
75
78
|
skipValue: [
|
76
79
|
// ignore values that filename starts with `.jk-noentry`
|
77
80
|
/(^|\/)\.jk-noentry/,
|
78
|
-
...entrypoints.
|
81
|
+
...entrypoints.getDefaultSkipValues({
|
82
|
+
allowJS: !skipJS
|
83
|
+
})
|
79
84
|
]
|
80
85
|
}
|
81
86
|
);
|
@@ -108,7 +113,8 @@ function resolveExports({
|
|
108
113
|
withSource: isPublish ? withSource : void 0,
|
109
114
|
withConditional: {
|
110
115
|
...crossModuleWithConditional
|
111
|
-
}
|
116
|
+
},
|
117
|
+
allowJS: !skipJS
|
112
118
|
}),
|
113
119
|
outdir
|
114
120
|
];
|
@@ -20,7 +20,8 @@ interface ResolveExportsOptions {
|
|
20
20
|
defaultOutdir?: string;
|
21
21
|
noFilter?: boolean;
|
22
22
|
isPublish?: boolean;
|
23
|
+
skipJS?: boolean;
|
23
24
|
}
|
24
|
-
declare function resolveExports({ entrypoints, pkgName, pkgIsModule, entries, config, dir, defaultOutdir, outdir, noFilter, isPublish }: ResolveExportsOptions): readonly [any, any, string];
|
25
|
+
declare function resolveExports({ entrypoints, pkgName, pkgIsModule, entries, config, dir, defaultOutdir, outdir, noFilter, isPublish, skipJS }: ResolveExportsOptions): readonly [any, any, string];
|
25
26
|
|
26
27
|
export { type ResolveExportsOptions, getOutDirs, resolveExports };
|
@@ -20,7 +20,8 @@ interface ResolveExportsOptions {
|
|
20
20
|
defaultOutdir?: string;
|
21
21
|
noFilter?: boolean;
|
22
22
|
isPublish?: boolean;
|
23
|
+
skipJS?: boolean;
|
23
24
|
}
|
24
|
-
declare function resolveExports({ entrypoints, pkgName, pkgIsModule, entries, config, dir, defaultOutdir, outdir, noFilter, isPublish }: ResolveExportsOptions): readonly [any, any, string];
|
25
|
+
declare function resolveExports({ entrypoints, pkgName, pkgIsModule, entries, config, dir, defaultOutdir, outdir, noFilter, isPublish, skipJS }: ResolveExportsOptions): readonly [any, any, string];
|
25
26
|
|
26
27
|
export { type ResolveExportsOptions, getOutDirs, resolveExports };
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { isAbsolute, relative, resolve } from 'node:path';
|
2
2
|
import process from 'node:process';
|
3
|
-
import { resolveEntrypoints, filterLeafs,
|
3
|
+
import { resolveEntrypoints, filterLeafs, getDefaultSkipValues, entrypoints2Exports } from '@jiek/pkger/entrypoints';
|
4
4
|
import { m as micromatchExports } from '../.chunks/index.B6RQz1DZ.js';
|
5
5
|
import { intersection } from './intersection.js';
|
6
6
|
import 'util';
|
@@ -43,7 +43,8 @@ function resolveExports({
|
|
43
43
|
// FIXME dts support
|
44
44
|
outdir = getOutDirs({ pkgName, defaultOutdir, config, cwd: dir }).js,
|
45
45
|
noFilter,
|
46
|
-
isPublish
|
46
|
+
isPublish,
|
47
|
+
skipJS
|
47
48
|
}) {
|
48
49
|
const {
|
49
50
|
build = {},
|
@@ -55,7 +56,9 @@ function resolveExports({
|
|
55
56
|
const {
|
56
57
|
crossModuleConvertor = crossModuleConvertorDefault
|
57
58
|
} = build;
|
58
|
-
const [, resolvedEntrypoints] = resolveEntrypoints(entrypoints
|
59
|
+
const [, resolvedEntrypoints] = resolveEntrypoints(entrypoints, {
|
60
|
+
allowJS: !skipJS
|
61
|
+
});
|
59
62
|
if (entries) {
|
60
63
|
Object.entries(resolvedEntrypoints).forEach(([key]) => {
|
61
64
|
if (!entries.some((e) => micromatchExports.isMatch(key, e, { matchBase: true }))) {
|
@@ -69,7 +72,9 @@ function resolveExports({
|
|
69
72
|
skipValue: [
|
70
73
|
// ignore values that filename starts with `.jk-noentry`
|
71
74
|
/(^|\/)\.jk-noentry/,
|
72
|
-
...
|
75
|
+
...getDefaultSkipValues({
|
76
|
+
allowJS: !skipJS
|
77
|
+
})
|
73
78
|
]
|
74
79
|
}
|
75
80
|
);
|
@@ -102,7 +107,8 @@ function resolveExports({
|
|
102
107
|
withSource: isPublish ? withSource : void 0,
|
103
108
|
withConditional: {
|
104
109
|
...crossModuleWithConditional
|
105
|
-
}
|
110
|
+
},
|
111
|
+
allowJS: !skipJS
|
106
112
|
}),
|
107
113
|
outdir
|
108
114
|
];
|
package/dist/bin/index.cjs
CHANGED
@@ -62,7 +62,14 @@ async function forEachSelectedProjectsGraphEntries(callback) {
|
|
62
62
|
callback(dir, manifest);
|
63
63
|
}
|
64
64
|
}
|
65
|
-
|
65
|
+
const attachPublishOptions = (command) => command.option("-b, --bumper <bumper>", "bump version", "patch").option("-no-b, --no-bumper", "no bump version").option("-o, --outdir <OUTDIR>", outdirDescription, String, "dist").option("--skipJS", 'skip entries which end with ".js"');
|
66
|
+
attachPublishOptions(
|
67
|
+
commander.program.command("publish").description(description).aliases(["pub", "p"])
|
68
|
+
).action(async ({
|
69
|
+
outdir,
|
70
|
+
bumper: bumper$1,
|
71
|
+
skipJS
|
72
|
+
}) => {
|
66
73
|
let shouldPassThrough = false;
|
67
74
|
const passThroughOptions = process__default.default.argv.reduce(
|
68
75
|
(acc, value) => {
|
@@ -88,18 +95,24 @@ commander.program.command("publish").description(description).aliases(["pub", "p
|
|
88
95
|
env: {
|
89
96
|
...process__default.default.env,
|
90
97
|
JIEK_PUBLISH_OUTDIR: JSON.stringify(outdir),
|
91
|
-
JIEK_PUBLISH_BUMPER: JSON.stringify(bumper$1)
|
98
|
+
JIEK_PUBLISH_BUMPER: JSON.stringify(bumper$1),
|
99
|
+
JIEK_PUBLISH_SKIP_JS: JSON.stringify(skipJS)
|
92
100
|
}
|
93
101
|
});
|
94
102
|
});
|
95
103
|
});
|
96
|
-
async function prepublish({
|
104
|
+
async function prepublish({
|
105
|
+
bumper: bumper$1,
|
106
|
+
skipJS
|
107
|
+
}) {
|
97
108
|
const {
|
98
109
|
JIEK_PUBLISH_OUTDIR: outdirEnv,
|
99
|
-
JIEK_PUBLISH_BUMPER: bumperEnv
|
110
|
+
JIEK_PUBLISH_BUMPER: bumperEnv,
|
111
|
+
JIEK_PUBLISH_SKIP_JS: skipJSEnv
|
100
112
|
} = process__default.default.env;
|
101
113
|
const outdir = outdirEnv ? JSON.parse(outdirEnv) : "dist";
|
102
114
|
bumper$1 = bumper$1 ?? (bumperEnv ? JSON.parse(bumperEnv) : false);
|
115
|
+
skipJS = skipJS ?? (skipJSEnv ? JSON.parse(skipJSEnv) : void 0);
|
103
116
|
const generateNewManifest = (dir, manifest, config) => {
|
104
117
|
const {
|
105
118
|
name,
|
@@ -118,7 +131,8 @@ async function prepublish({ bumper: bumper$1 } = {}) {
|
|
118
131
|
config,
|
119
132
|
dir,
|
120
133
|
noFilter: true,
|
121
|
-
isPublish: true
|
134
|
+
isPublish: true,
|
135
|
+
skipJS: skipJS ?? config.skipJS
|
122
136
|
};
|
123
137
|
let resolvedOutdir = outdir;
|
124
138
|
if (entrypoints) {
|
@@ -297,7 +311,7 @@ async function prepublish({ bumper: bumper$1 } = {}) {
|
|
297
311
|
tabSize: indent.length,
|
298
312
|
insertSpaces: true
|
299
313
|
};
|
300
|
-
const newVersion = bumper$1 ? bumper.bump(oldJSON.version, bumper$1
|
314
|
+
const newVersion = bumper$1 ? bumper.bump(oldJSON.version, bumper$1) : oldJSON.version;
|
301
315
|
const modifyVersionPackageJSON = jsoncParser.applyEdits(
|
302
316
|
oldJSONString,
|
303
317
|
jsoncParser.modify(oldJSONString, ["version"], newVersion, { formattingOptions })
|
@@ -442,7 +456,7 @@ async function prepublish({ bumper: bumper$1 } = {}) {
|
|
442
456
|
}
|
443
457
|
});
|
444
458
|
}
|
445
|
-
async function postpublish() {
|
459
|
+
async function postpublish({}) {
|
446
460
|
await forEachSelectedProjectsGraphEntries((dir) => {
|
447
461
|
const jiekTempDir = path__default.default.resolve(dir, "node_modules/.jiek/.tmp");
|
448
462
|
const packageJSONPath = path__default.default.resolve(dir, "package.json");
|
@@ -462,21 +476,6 @@ async function postpublish() {
|
|
462
476
|
}
|
463
477
|
});
|
464
478
|
}
|
465
|
-
commander.program.action(async () => {
|
466
|
-
const {
|
467
|
-
npm_lifecycle_event: NPM_LIFECYCLE_EVENT
|
468
|
-
} = process__default.default.env;
|
469
|
-
switch (NPM_LIFECYCLE_EVENT) {
|
470
|
-
case "prepublish":
|
471
|
-
await prepublish();
|
472
|
-
break;
|
473
|
-
case "postpublish":
|
474
|
-
await postpublish();
|
475
|
-
break;
|
476
|
-
default:
|
477
|
-
commander.program.help();
|
478
|
-
}
|
479
|
-
});
|
480
479
|
const prepublishDescription = `
|
481
480
|
Prepare package.json for publish, you can add \`jk\` to the \`prepublish\` script in package.json, the command will automatically run \`jk prepublish\`.
|
482
481
|
.e.g
|
@@ -486,7 +485,9 @@ Prepare package.json for publish, you can add \`jk\` to the \`prepublish\` scrip
|
|
486
485
|
}
|
487
486
|
}
|
488
487
|
`.trim();
|
489
|
-
|
488
|
+
attachPublishOptions(
|
489
|
+
commander.program.command("prepublish").description(prepublishDescription)
|
490
|
+
).action(prepublish);
|
490
491
|
const postpublishDescription = `
|
491
492
|
Restore package.json after publish, you can add \`jk\` to the \`postpublish\` script in package.json, the command will automatically run \`jk postpublish\`.
|
492
493
|
.e.g
|
@@ -496,6 +497,26 @@ Restore package.json after publish, you can add \`jk\` to the \`postpublish\` sc
|
|
496
497
|
}
|
497
498
|
}
|
498
499
|
`.trim();
|
499
|
-
|
500
|
+
attachPublishOptions(
|
501
|
+
commander.program.command("postpublish").description(postpublishDescription)
|
502
|
+
).action(postpublish);
|
503
|
+
const {
|
504
|
+
npm_lifecycle_event: NPM_LIFECYCLE_EVENT
|
505
|
+
} = process__default.default.env;
|
506
|
+
if (NPM_LIFECYCLE_EVENT && [
|
507
|
+
"prepublish",
|
508
|
+
"postpublish"
|
509
|
+
].includes(NPM_LIFECYCLE_EVENT)) {
|
510
|
+
attachPublishOptions(commander.program).action(async (options) => {
|
511
|
+
switch (NPM_LIFECYCLE_EVENT) {
|
512
|
+
case "prepublish":
|
513
|
+
await prepublish(options);
|
514
|
+
break;
|
515
|
+
case "postpublish":
|
516
|
+
await postpublish(options);
|
517
|
+
break;
|
518
|
+
}
|
519
|
+
});
|
520
|
+
}
|
500
521
|
|
501
522
|
parseArgv__default.default();
|
package/dist/index.d.cts
CHANGED
@@ -2,6 +2,10 @@ import { TemplateOptions } from '#~/rollup/base';
|
|
2
2
|
|
3
3
|
declare module 'jiek' {
|
4
4
|
interface Config {
|
5
|
+
/**
|
6
|
+
* Skip entries which end with '.js'.
|
7
|
+
*/
|
8
|
+
skipJS?: boolean;
|
5
9
|
build?: TemplateOptions & {
|
6
10
|
/**
|
7
11
|
* Whether to run in silent mode, only active when configured in the workspace root or cwd.
|
package/dist/index.d.ts
CHANGED
@@ -2,6 +2,10 @@ import { TemplateOptions } from '#~/rollup/base';
|
|
2
2
|
|
3
3
|
declare module 'jiek' {
|
4
4
|
interface Config {
|
5
|
+
/**
|
6
|
+
* Skip entries which end with '.js'.
|
7
|
+
*/
|
8
|
+
skipJS?: boolean;
|
5
9
|
build?: TemplateOptions & {
|
6
10
|
/**
|
7
11
|
* Whether to run in silent mode, only active when configured in the workspace root or cwd.
|