@reliverse/dler 1.7.26 → 1.7.27
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 +2 -2
- package/bin/app/agg/cmd.d.ts +5 -2
- package/bin/app/agg/cmd.js +56 -20
- package/bin/app/agg/impl.js +1 -0
- package/bin/app/build/cmd.js +5 -10
- package/bin/app/build/impl.d.ts +6 -3
- package/bin/app/build/impl.js +9 -28
- package/bin/app/build/postbuild.d.ts +1 -0
- package/bin/app/build/postbuild.js +57 -0
- package/bin/app/build/ppb-utils.d.ts +16 -0
- package/bin/app/build/ppb-utils.js +99 -0
- package/bin/app/build/prebuild.d.ts +2 -0
- package/bin/app/build/prebuild.js +50 -0
- package/bin/app/check/cmd.d.ts +8 -0
- package/bin/app/check/cmd.js +63 -53
- package/bin/app/magic/cmd.d.ts +4 -0
- package/bin/app/magic/cmd.js +37 -26
- package/bin/app/pub/cmd.js +2 -9
- package/bin/app/pub/impl.js +17 -71
- package/bin/app/remdn/cmd.d.ts +43 -0
- package/bin/app/remdn/cmd.js +592 -0
- package/bin/cli.js +36 -25
- package/bin/libs/cfg/{constants.d.ts → cfg-impl/cfg-consts.d.ts} +15 -11
- package/bin/libs/cfg/{constants.js → cfg-impl/cfg-consts.js} +16 -0
- package/bin/libs/cfg/{types.d.ts → cfg-impl/cfg-types.d.ts} +58 -0
- package/bin/libs/cfg/{rse → cfg-impl/rse-config}/rse-impl/rse-define.d.ts +13 -13
- package/bin/libs/cfg/cfg-mod.d.ts +24 -24
- package/bin/libs/cfg/cfg-mod.js +35 -21
- package/bin/libs/sdk/sdk-impl/build/build-library.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/build/build-regular.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/auto.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/build.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/copy/copy-mod.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist-impl/loader.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist-impl/loaders/js.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist-impl/loaders/loaders-mod.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist-impl/loaders/postcss.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist-impl/loaders/sass.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist-impl/loaders/vue.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist-impl/make.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist-impl/utils/dts.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist-impl/utils/vue-dts.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist-mod.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/build.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/config.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/plugins/cjs.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/plugins/esbuild.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/stub.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/utils.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/watch.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/untyped/untyped-mod.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/utils.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/validate.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/config/default.js +14 -0
- package/bin/libs/sdk/sdk-impl/config/info.js +1 -1
- package/bin/libs/sdk/sdk-impl/config/init.js +16 -0
- package/bin/libs/sdk/sdk-impl/config/types.d.ts +58 -0
- package/bin/libs/sdk/sdk-impl/library-flow.d.ts +14 -7
- package/bin/libs/sdk/sdk-impl/library-flow.js +59 -13
- package/bin/libs/sdk/sdk-impl/pub/pub-library.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/pub/pub-regular.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/regular-flow.d.ts +7 -3
- package/bin/libs/sdk/sdk-impl/regular-flow.js +40 -19
- package/bin/libs/sdk/sdk-impl/rules/reliverse/dler-config-health/dler-config-health.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/rules/reliverse/file-extensions/file-extensions.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/rules/reliverse/missing-deps/deps-mod.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/rules/reliverse/no-dynamic-imports/no-dynamic-imports.d.ts +8 -2
- package/bin/libs/sdk/sdk-impl/rules/reliverse/no-dynamic-imports/no-dynamic-imports.js +50 -2
- package/bin/libs/sdk/sdk-impl/rules/reliverse/no-index-files/no-index-files.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/rules/reliverse/package-json-health/package-json-health.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/rules/reliverse/path-extensions/path-extensions.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/rules/reliverse/self-include/self-include.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/rules/reliverse/tsconfig-health/tsconfig-health.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/rules/rules-mod.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/rules/rules-utils.d.ts +0 -1
- package/bin/libs/sdk/sdk-impl/rules/rules-utils.js +1 -8
- package/bin/libs/sdk/{sdk-types.d.ts → sdk-impl/sdk-types.d.ts} +1 -1
- package/bin/libs/sdk/sdk-impl/utils/finalize.d.ts +6 -2
- package/bin/libs/sdk/sdk-impl/utils/finalize.js +25 -17
- package/bin/libs/sdk/sdk-impl/utils/pack-unpack/pu-file-utils.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/utils/pack-unpack/pu-file-utils.js +2 -2
- package/bin/libs/sdk/sdk-impl/utils/utils-fs.d.ts +1 -0
- package/bin/libs/sdk/sdk-impl/utils/utils-fs.js +8 -0
- package/bin/libs/sdk/sdk-impl/utils/utils-perf.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/utils/utils-security.d.ts +0 -1
- package/bin/libs/sdk/sdk-impl/utils/utils-security.js +0 -8
- package/bin/libs/sdk/sdk-mod.d.ts +16 -11
- package/bin/libs/sdk/sdk-mod.js +53 -7
- package/package.json +5 -4
- /package/bin/libs/cfg/{rse/rse-impl/rse-types.js → cfg-impl/cfg-types.js} +0 -0
- /package/bin/libs/cfg/{rse → cfg-impl/rse-config}/rse-impl/rse-biome.d.ts +0 -0
- /package/bin/libs/cfg/{rse → cfg-impl/rse-config}/rse-impl/rse-biome.js +0 -0
- /package/bin/libs/cfg/{rse → cfg-impl/rse-config}/rse-impl/rse-comments.d.ts +0 -0
- /package/bin/libs/cfg/{rse → cfg-impl/rse-config}/rse-impl/rse-comments.js +0 -0
- /package/bin/libs/cfg/{rse → cfg-impl/rse-config}/rse-impl/rse-consts.d.ts +0 -0
- /package/bin/libs/cfg/{rse → cfg-impl/rse-config}/rse-impl/rse-consts.js +0 -0
- /package/bin/libs/cfg/{rse → cfg-impl/rse-config}/rse-impl/rse-content.d.ts +0 -0
- /package/bin/libs/cfg/{rse → cfg-impl/rse-config}/rse-impl/rse-content.js +0 -0
- /package/bin/libs/cfg/{rse → cfg-impl/rse-config}/rse-impl/rse-core.d.ts +0 -0
- /package/bin/libs/cfg/{rse → cfg-impl/rse-config}/rse-impl/rse-core.js +0 -0
- /package/bin/libs/cfg/{rse → cfg-impl/rse-config}/rse-impl/rse-create.d.ts +0 -0
- /package/bin/libs/cfg/{rse → cfg-impl/rse-config}/rse-impl/rse-create.js +0 -0
- /package/bin/libs/cfg/{rse → cfg-impl/rse-config}/rse-impl/rse-def-utils.d.ts +0 -0
- /package/bin/libs/cfg/{rse → cfg-impl/rse-config}/rse-impl/rse-def-utils.js +0 -0
- /package/bin/libs/cfg/{rse → cfg-impl/rse-config}/rse-impl/rse-default.d.ts +0 -0
- /package/bin/libs/cfg/{rse → cfg-impl/rse-config}/rse-impl/rse-default.js +0 -0
- /package/bin/libs/cfg/{rse → cfg-impl/rse-config}/rse-impl/rse-define.js +0 -0
- /package/bin/libs/cfg/{rse → cfg-impl/rse-config}/rse-impl/rse-detect.d.ts +0 -0
- /package/bin/libs/cfg/{rse → cfg-impl/rse-config}/rse-impl/rse-detect.js +0 -0
- /package/bin/libs/cfg/{rse → cfg-impl/rse-config}/rse-impl/rse-gen-cfg.d.ts +0 -0
- /package/bin/libs/cfg/{rse → cfg-impl/rse-config}/rse-impl/rse-gen-cfg.js +0 -0
- /package/bin/libs/cfg/{rse → cfg-impl/rse-config}/rse-impl/rse-migrate.d.ts +0 -0
- /package/bin/libs/cfg/{rse → cfg-impl/rse-config}/rse-impl/rse-migrate.js +0 -0
- /package/bin/libs/cfg/{rse → cfg-impl/rse-config}/rse-impl/rse-path.d.ts +0 -0
- /package/bin/libs/cfg/{rse → cfg-impl/rse-config}/rse-impl/rse-path.js +0 -0
- /package/bin/libs/cfg/{rse → cfg-impl/rse-config}/rse-impl/rse-prompts.d.ts +0 -0
- /package/bin/libs/cfg/{rse → cfg-impl/rse-config}/rse-impl/rse-prompts.js +0 -0
- /package/bin/libs/cfg/{rse → cfg-impl/rse-config}/rse-impl/rse-read.d.ts +0 -0
- /package/bin/libs/cfg/{rse → cfg-impl/rse-config}/rse-impl/rse-read.js +0 -0
- /package/bin/libs/cfg/{rse → cfg-impl/rse-config}/rse-impl/rse-repair.d.ts +0 -0
- /package/bin/libs/cfg/{rse → cfg-impl/rse-config}/rse-impl/rse-repair.js +0 -0
- /package/bin/libs/cfg/{rse → cfg-impl/rse-config}/rse-impl/rse-schema.d.ts +0 -0
- /package/bin/libs/cfg/{rse → cfg-impl/rse-config}/rse-impl/rse-schema.js +0 -0
- /package/bin/libs/cfg/{rse → cfg-impl/rse-config}/rse-impl/rse-types.d.ts +0 -0
- /package/bin/libs/cfg/{types.js → cfg-impl/rse-config/rse-impl/rse-types.js} +0 -0
- /package/bin/libs/cfg/{rse → cfg-impl/rse-config}/rse-impl/rse-unstable.d.ts +0 -0
- /package/bin/libs/cfg/{rse → cfg-impl/rse-config}/rse-impl/rse-unstable.js +0 -0
- /package/bin/libs/cfg/{rse → cfg-impl/rse-config}/rse-impl/rse-update.d.ts +0 -0
- /package/bin/libs/cfg/{rse → cfg-impl/rse-config}/rse-impl/rse-update.js +0 -0
- /package/bin/libs/cfg/{rse → cfg-impl/rse-config}/rse-impl/rse-utils.d.ts +0 -0
- /package/bin/libs/cfg/{rse → cfg-impl/rse-config}/rse-impl/rse-utils.js +0 -0
- /package/bin/libs/cfg/{rse → cfg-impl/rse-config}/rse-mod.d.ts +0 -0
- /package/bin/libs/cfg/{rse → cfg-impl/rse-config}/rse-mod.js +0 -0
- /package/bin/libs/sdk/{sdk-types.js → sdk-impl/sdk-types.js} +0 -0
package/bin/app/check/cmd.js
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import path from "@reliverse/pathkit";
|
|
2
2
|
import { re } from "@reliverse/relico";
|
|
3
3
|
import { relinka } from "@reliverse/relinka";
|
|
4
|
-
import {
|
|
5
|
-
defineCommand,
|
|
6
|
-
selectPrompt,
|
|
7
|
-
multiselectPrompt,
|
|
8
|
-
confirmPrompt,
|
|
9
|
-
defineArgs
|
|
10
|
-
} from "@reliverse/rempts";
|
|
4
|
+
import { defineCommand, selectPrompt, multiselectPrompt, defineArgs } from "@reliverse/rempts";
|
|
11
5
|
import { checkDlerConfigHealth } from "../../libs/sdk/sdk-impl/rules/reliverse/dler-config-health/dler-config-health.js";
|
|
12
6
|
import { checkFileExtensions } from "../../libs/sdk/sdk-impl/rules/reliverse/file-extensions/file-extensions.js";
|
|
13
7
|
import { analyzeDependencies } from "../../libs/sdk/sdk-impl/rules/reliverse/missing-deps/analyzer.js";
|
|
@@ -44,6 +38,14 @@ export default defineCommand({
|
|
|
44
38
|
type: "boolean",
|
|
45
39
|
description: "output results in JSON format"
|
|
46
40
|
},
|
|
41
|
+
"no-exit": {
|
|
42
|
+
type: "boolean",
|
|
43
|
+
description: "don't exit with error code on issues (useful for pre-build checks)"
|
|
44
|
+
},
|
|
45
|
+
"no-progress": {
|
|
46
|
+
type: "boolean",
|
|
47
|
+
description: "don't show progress information (useful for pre-build checks)"
|
|
48
|
+
},
|
|
47
49
|
// --- deps args ---
|
|
48
50
|
deps: {
|
|
49
51
|
type: "boolean",
|
|
@@ -126,7 +128,6 @@ export default defineCommand({
|
|
|
126
128
|
);
|
|
127
129
|
let dir;
|
|
128
130
|
let checks;
|
|
129
|
-
let strict;
|
|
130
131
|
if (args.directory) {
|
|
131
132
|
dir = args.directory;
|
|
132
133
|
} else {
|
|
@@ -184,14 +185,6 @@ export default defineCommand({
|
|
|
184
185
|
]
|
|
185
186
|
});
|
|
186
187
|
}
|
|
187
|
-
if (args.strict !== void 0) {
|
|
188
|
-
strict = args.strict;
|
|
189
|
-
} else {
|
|
190
|
-
strict = await confirmPrompt({
|
|
191
|
-
title: "activate strict mode?",
|
|
192
|
-
content: "strict mode requires explicit extensions (no empty extensions). files: .ts in src/jsr dirs, .js in npm dirs. imports: .js in src/npm dirs, .ts in jsr dirs. templates folder is always exempt."
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
188
|
if (checks.length === 0) {
|
|
196
189
|
relinka("warn", "no checks selected, exiting...");
|
|
197
190
|
return;
|
|
@@ -206,92 +199,109 @@ export default defineCommand({
|
|
|
206
199
|
for (const directory of directories) {
|
|
207
200
|
relinka("info", `
|
|
208
201
|
checking directory: ${directory}`);
|
|
209
|
-
const onProgress = (current, total) => {
|
|
202
|
+
const onProgress = args["no-progress"] ? void 0 : (current, total) => {
|
|
210
203
|
if (current % 10 === 0 || current === total) {
|
|
211
204
|
process.stdout.write(`\r progress: ${current}/${total} files...`);
|
|
212
205
|
}
|
|
213
206
|
};
|
|
214
207
|
try {
|
|
215
208
|
if (checks.includes("package-json-health")) {
|
|
216
|
-
process.stdout.write(" checking package.json health...\n");
|
|
217
209
|
const result = await checkPackageJsonHealth();
|
|
218
|
-
process.stdout.write("\r");
|
|
219
210
|
displayCheckResults("package.json health", directory, result);
|
|
211
|
+
if (!result.success && !args["no-exit"]) {
|
|
212
|
+
process.exit(1);
|
|
213
|
+
}
|
|
220
214
|
}
|
|
221
215
|
if (checks.includes("tsconfig-health")) {
|
|
222
|
-
process.stdout.write(" checking tsconfig.json health...\n");
|
|
223
216
|
const result = await checkTsConfigHealth();
|
|
224
|
-
process.stdout.write("\r");
|
|
225
217
|
displayCheckResults("tsconfig.json health", directory, result);
|
|
218
|
+
if (!result.success && !args["no-exit"]) {
|
|
219
|
+
process.exit(1);
|
|
220
|
+
}
|
|
226
221
|
}
|
|
227
222
|
if (checks.includes("dler-config-health")) {
|
|
228
|
-
process.stdout.write(" checking libs main file format...\n");
|
|
229
223
|
const result = await checkDlerConfigHealth();
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
process.stdout.write(" checking missing dependencies...\n");
|
|
235
|
-
const result = await checkMissingDependencies({
|
|
236
|
-
directory,
|
|
237
|
-
strict: false,
|
|
238
|
-
// not used for deps check
|
|
239
|
-
moduleResolution: "bundler",
|
|
240
|
-
// not used for deps check
|
|
241
|
-
onProgress
|
|
242
|
-
});
|
|
243
|
-
process.stdout.write("\r");
|
|
244
|
-
displayCheckResults("missing dependencies", directory, result);
|
|
224
|
+
displayCheckResults("dler configuration health", directory, result);
|
|
225
|
+
if (!result.success && !args["no-exit"]) {
|
|
226
|
+
process.exit(1);
|
|
227
|
+
}
|
|
245
228
|
}
|
|
246
229
|
if (checks.includes("file-extensions")) {
|
|
247
|
-
process.stdout.write(" checking file extensions...\n");
|
|
248
230
|
const result = await checkFileExtensions({
|
|
249
231
|
directory,
|
|
250
|
-
strict,
|
|
232
|
+
strict: args.strict,
|
|
251
233
|
moduleResolution: "bundler",
|
|
252
234
|
onProgress
|
|
253
235
|
});
|
|
254
|
-
process.stdout.write("\r");
|
|
255
236
|
displayCheckResults("file extensions", directory, result);
|
|
237
|
+
if (!result.success && !args["no-exit"]) {
|
|
238
|
+
process.exit(1);
|
|
239
|
+
}
|
|
256
240
|
}
|
|
257
241
|
if (checks.includes("path-extensions")) {
|
|
258
|
-
process.stdout.write(" checking import path extensions...\n");
|
|
259
242
|
const result = await checkPathExtensions({
|
|
260
243
|
directory,
|
|
261
|
-
strict,
|
|
244
|
+
strict: args.strict,
|
|
262
245
|
moduleResolution: "bundler",
|
|
263
246
|
onProgress
|
|
264
247
|
});
|
|
265
|
-
process.stdout.write("\r");
|
|
266
248
|
displayCheckResults("path extensions", directory, result);
|
|
249
|
+
if (!result.success && !args["no-exit"]) {
|
|
250
|
+
process.exit(1);
|
|
251
|
+
}
|
|
267
252
|
}
|
|
268
253
|
if (checks.includes("self-include")) {
|
|
269
|
-
process.stdout.write(" checking self-includes...\n");
|
|
270
254
|
const result = await checkSelfInclude({
|
|
271
255
|
directory,
|
|
272
|
-
strict,
|
|
256
|
+
strict: args.strict,
|
|
273
257
|
moduleResolution: "bundler",
|
|
274
258
|
onProgress
|
|
275
259
|
});
|
|
276
|
-
|
|
277
|
-
|
|
260
|
+
displayCheckResults("self-include", directory, result);
|
|
261
|
+
if (!result.success && !args["no-exit"]) {
|
|
262
|
+
process.exit(1);
|
|
263
|
+
}
|
|
278
264
|
}
|
|
279
265
|
if (checks.includes("no-index-files")) {
|
|
280
|
-
process.stdout.write(" checking for index files...\n");
|
|
281
266
|
const result = await checkNoIndexFiles({
|
|
282
267
|
directory,
|
|
283
|
-
strict,
|
|
268
|
+
strict: args.strict,
|
|
284
269
|
moduleResolution: "bundler",
|
|
285
270
|
onProgress
|
|
286
271
|
});
|
|
287
|
-
process.stdout.write("\r");
|
|
288
272
|
displayCheckResults("no index files", directory, result);
|
|
273
|
+
if (!result.success && !args["no-exit"]) {
|
|
274
|
+
process.exit(1);
|
|
275
|
+
}
|
|
289
276
|
}
|
|
290
277
|
if (checks.includes("no-dynamic-imports")) {
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
278
|
+
const result = await checkNoDynamicImports({
|
|
279
|
+
directory,
|
|
280
|
+
onProgress
|
|
281
|
+
});
|
|
294
282
|
displayCheckResults("no dynamic imports", directory, result);
|
|
283
|
+
if (!result.success && !args["no-exit"]) {
|
|
284
|
+
process.exit(1);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
if (checks.includes("missing-deps")) {
|
|
288
|
+
const result = await checkMissingDependencies({
|
|
289
|
+
directory,
|
|
290
|
+
strict: args.strict,
|
|
291
|
+
moduleResolution: "bundler",
|
|
292
|
+
onProgress,
|
|
293
|
+
json: args.json,
|
|
294
|
+
builtins: args.builtins,
|
|
295
|
+
dev: args.dev,
|
|
296
|
+
peer: args.peer,
|
|
297
|
+
optional: args.optional,
|
|
298
|
+
fix: args.fix,
|
|
299
|
+
depth: args.depth
|
|
300
|
+
});
|
|
301
|
+
displayCheckResults("missing dependencies", directory, result);
|
|
302
|
+
if (!result.success && !args["no-exit"]) {
|
|
303
|
+
process.exit(1);
|
|
304
|
+
}
|
|
295
305
|
}
|
|
296
306
|
} catch (error) {
|
|
297
307
|
relinka(
|
package/bin/app/magic/cmd.d.ts
CHANGED
package/bin/app/magic/cmd.js
CHANGED
|
@@ -5,35 +5,12 @@ export default defineCommand({
|
|
|
5
5
|
meta: {
|
|
6
6
|
name: "magic",
|
|
7
7
|
version: "1.0.0",
|
|
8
|
-
description:
|
|
9
|
-
Target Types:
|
|
10
|
-
1. Distribution Targets (dist-*):
|
|
11
|
-
- dist-npm: Process files in dist-npm/bin
|
|
12
|
-
- dist-jsr: Process files in dist-jsr/bin
|
|
13
|
-
- dist-libs: Process all libraries in dist-libs
|
|
14
|
-
- dist-libs/<lib>: Process specific library (e.g., dist-libs/sdk)
|
|
15
|
-
For dist-* targets, magic directives are first searched in src/ directory,
|
|
16
|
-
then applied to corresponding files in the distribution directories.
|
|
17
|
-
2. Custom Targets:
|
|
18
|
-
- Any directory name that is not dist-* (e.g., "my-output", "custom-build")
|
|
19
|
-
For custom targets, magic directives are processed directly in the target files.
|
|
20
|
-
No source directory scanning is performed.
|
|
21
|
-
Examples:
|
|
22
|
-
# Process all distribution targets
|
|
23
|
-
dler magic dist-npm dist-jsr dist-libs
|
|
24
|
-
# Process specific library
|
|
25
|
-
dler magic dist-libs/sdk
|
|
26
|
-
# Process custom target
|
|
27
|
-
dler magic my-custom-output
|
|
28
|
-
# Mix distribution and custom targets
|
|
29
|
-
dler magic dist-npm my-custom-output`
|
|
8
|
+
description: "Apply magic directives to files"
|
|
30
9
|
},
|
|
31
10
|
args: defineArgs({
|
|
32
11
|
targets: {
|
|
33
12
|
type: "array",
|
|
34
|
-
description:
|
|
35
|
-
- Distribution targets: dist-npm, dist-jsr, dist-libs, dist-libs/<lib>
|
|
36
|
-
- Custom targets: any directory name that is not dist-*`,
|
|
13
|
+
description: "Targets to process. Can be: 1) Distribution targets: dist-npm, dist-jsr, dist-libs, dist-libs/<lib>; 2) Custom targets: any directory name that is not dist-*",
|
|
37
14
|
required: true
|
|
38
15
|
},
|
|
39
16
|
lib: {
|
|
@@ -54,10 +31,44 @@ Examples:
|
|
|
54
31
|
type: "boolean",
|
|
55
32
|
description: "Stop processing on first error (default: true)",
|
|
56
33
|
default: true
|
|
34
|
+
},
|
|
35
|
+
about: {
|
|
36
|
+
type: "boolean",
|
|
37
|
+
description: "Show about message"
|
|
57
38
|
}
|
|
58
39
|
}),
|
|
59
40
|
async run({ args }) {
|
|
60
|
-
const { targets, lib, concurrency, batchSize, stopOnError } = args;
|
|
41
|
+
const { targets, lib, concurrency, batchSize, stopOnError, about } = args;
|
|
42
|
+
if (about) {
|
|
43
|
+
console.log(
|
|
44
|
+
`Apply magic directives to files.
|
|
45
|
+
--------------------------------
|
|
46
|
+
Target Types:
|
|
47
|
+
1. Distribution Targets (dist-*):
|
|
48
|
+
- dist-npm: Process files in dist-npm/bin
|
|
49
|
+
- dist-jsr: Process files in dist-jsr/bin
|
|
50
|
+
- dist-libs: Process all libraries in dist-libs
|
|
51
|
+
- dist-libs/<lib>: Process specific library (e.g., dist-libs/sdk)
|
|
52
|
+
For dist-* targets, magic directives are first searched in src/ directory,
|
|
53
|
+
then applied to corresponding files in the distribution directories.
|
|
54
|
+
2. Custom Targets:
|
|
55
|
+
- Any directory name that is not dist-* (e.g., "my-output", "custom-build")
|
|
56
|
+
For custom targets, magic directives are processed directly in the target files.
|
|
57
|
+
No source directory scanning is performed.
|
|
58
|
+
Examples:
|
|
59
|
+
# Process all distribution targets
|
|
60
|
+
dler magic dist-npm dist-jsr dist-libs
|
|
61
|
+
# Process specific library
|
|
62
|
+
dler magic dist-libs/sdk
|
|
63
|
+
# Process custom target
|
|
64
|
+
dler magic my-custom-output
|
|
65
|
+
# Mix distribution and custom targets
|
|
66
|
+
dler magic dist-npm my-custom-output
|
|
67
|
+
--------------------------------------------
|
|
68
|
+
For more information, see README.md#15-magic`
|
|
69
|
+
);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
61
72
|
if (lib) {
|
|
62
73
|
if (!targets?.includes("dist-libs")) {
|
|
63
74
|
throw new Error(
|
package/bin/app/pub/cmd.js
CHANGED
|
@@ -2,11 +2,10 @@ import { defineArgs, defineCommand } from "@reliverse/rempts";
|
|
|
2
2
|
import { dlerPub } from "./impl.js";
|
|
3
3
|
import { ensureDlerConfig } from "../../libs/sdk/sdk-impl/config/init.js";
|
|
4
4
|
import { getConfigDler } from "../../libs/sdk/sdk-impl/config/load.js";
|
|
5
|
-
import { removeDistFolders } from "../../libs/sdk/sdk-mod.js";
|
|
6
5
|
export default defineCommand({
|
|
7
6
|
meta: {
|
|
8
|
-
name: "
|
|
9
|
-
description: "Build the project"
|
|
7
|
+
name: "pub",
|
|
8
|
+
description: "Build and publish the project"
|
|
10
9
|
},
|
|
11
10
|
args: defineArgs({
|
|
12
11
|
dev: {
|
|
@@ -17,12 +16,6 @@ export default defineCommand({
|
|
|
17
16
|
async run({ args }) {
|
|
18
17
|
await ensureDlerConfig(args.dev);
|
|
19
18
|
const config = await getConfigDler();
|
|
20
|
-
await removeDistFolders(
|
|
21
|
-
config.distNpmDirName,
|
|
22
|
-
config.distJsrDirName,
|
|
23
|
-
config.libsDirDist,
|
|
24
|
-
config.libsList
|
|
25
|
-
);
|
|
26
19
|
await dlerPub(args.dev, config);
|
|
27
20
|
}
|
|
28
21
|
});
|
package/bin/app/pub/impl.js
CHANGED
|
@@ -1,33 +1,16 @@
|
|
|
1
1
|
import { bumpHandler, isBumpDisabled, setBumpDisabledValueTo } from "@reliverse/bleump";
|
|
2
|
-
import
|
|
3
|
-
import fs from "@reliverse/relifso";
|
|
4
|
-
import { relinka } from "@reliverse/relinka";
|
|
2
|
+
import { dlerBuild } from "../build/impl.js";
|
|
5
3
|
import { getConfigDler } from "../../libs/sdk/sdk-impl/config/load.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { finalizeBuildPub } from "../../libs/sdk/sdk-impl/utils/finalize.js";
|
|
10
|
-
import { resolveAllCrossLibs } from "../../libs/sdk/sdk-impl/utils/resolve-cross-libs.js";
|
|
11
|
-
import { removeDistFolders } from "../../libs/sdk/sdk-impl/utils/utils-clean.js";
|
|
12
|
-
import { PROJECT_ROOT } from "../../libs/sdk/sdk-impl/utils/utils-consts.js";
|
|
4
|
+
import { library_pubFlow } from "../../libs/sdk/sdk-impl/library-flow.js";
|
|
5
|
+
import { regular_pubFlow } from "../../libs/sdk/sdk-impl/regular-flow.js";
|
|
6
|
+
import { finalizeBuild, finalizePub } from "../../libs/sdk/sdk-impl/utils/finalize.js";
|
|
13
7
|
import { handleDlerError } from "../../libs/sdk/sdk-impl/utils/utils-error-cwd.js";
|
|
14
|
-
import { createPerfTimer } from "../../libs/sdk/sdk-impl/utils/utils-perf.js";
|
|
15
8
|
export async function dlerPub(isDev, config) {
|
|
16
|
-
const timer = createPerfTimer();
|
|
17
9
|
let effectiveConfig = config;
|
|
18
10
|
try {
|
|
19
11
|
if (!effectiveConfig) {
|
|
20
12
|
effectiveConfig = await getConfigDler();
|
|
21
13
|
}
|
|
22
|
-
if (effectiveConfig.logsFreshFile) {
|
|
23
|
-
await fs.remove(path.join(PROJECT_ROOT, effectiveConfig.logsFileName));
|
|
24
|
-
}
|
|
25
|
-
await removeDistFolders(
|
|
26
|
-
effectiveConfig.distNpmDirName,
|
|
27
|
-
effectiveConfig.distJsrDirName,
|
|
28
|
-
effectiveConfig.libsDirDist,
|
|
29
|
-
effectiveConfig.libsList
|
|
30
|
-
);
|
|
31
14
|
const bumpIsDisabled = await isBumpDisabled();
|
|
32
15
|
if (!bumpIsDisabled && !effectiveConfig.commonPubPause) {
|
|
33
16
|
try {
|
|
@@ -42,58 +25,21 @@ export async function dlerPub(isDev, config) {
|
|
|
42
25
|
throw new Error("[.config/dler.ts] Failed to set bumpDisable to true");
|
|
43
26
|
}
|
|
44
27
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
await
|
|
28
|
+
const { timer, effectiveConfig: buildConfig } = await dlerBuild(isDev, effectiveConfig);
|
|
29
|
+
if (effectiveConfig.commonPubPause) {
|
|
30
|
+
await finalizeBuild(timer, effectiveConfig.commonPubPause, "pub");
|
|
31
|
+
} else {
|
|
32
|
+
await regular_pubFlow(timer, isDev, buildConfig);
|
|
33
|
+
await library_pubFlow(timer, isDev, buildConfig);
|
|
34
|
+
await finalizePub(
|
|
35
|
+
timer,
|
|
36
|
+
buildConfig.libsList,
|
|
37
|
+
buildConfig.distNpmDirName,
|
|
38
|
+
buildConfig.distJsrDirName,
|
|
39
|
+
buildConfig.libsDirDist
|
|
40
|
+
);
|
|
50
41
|
}
|
|
51
|
-
relinka("log", "[processDistDirectory] dist-npm");
|
|
52
|
-
await processDistDirectory("dist-npm", "~");
|
|
53
|
-
relinka("log", "[processDistDirectory] dist-jsr");
|
|
54
|
-
await processDistDirectory("dist-jsr", "~");
|
|
55
|
-
await finalizeBuildPub(
|
|
56
|
-
timer,
|
|
57
|
-
effectiveConfig.commonPubPause,
|
|
58
|
-
effectiveConfig.libsList,
|
|
59
|
-
effectiveConfig.distNpmDirName,
|
|
60
|
-
effectiveConfig.distJsrDirName,
|
|
61
|
-
effectiveConfig.libsDirDist
|
|
62
|
-
);
|
|
63
42
|
} catch (error) {
|
|
64
43
|
handleDlerError(error);
|
|
65
44
|
}
|
|
66
45
|
}
|
|
67
|
-
async function directoryExists(dirPath) {
|
|
68
|
-
try {
|
|
69
|
-
const stat = await fs.stat(dirPath);
|
|
70
|
-
return stat.isDirectory();
|
|
71
|
-
} catch (error) {
|
|
72
|
-
if (error instanceof Error && error.code === "ENOENT") {
|
|
73
|
-
return false;
|
|
74
|
-
}
|
|
75
|
-
throw error;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
async function processDistDirectory(dir, alias) {
|
|
79
|
-
const modifiedFiles = [];
|
|
80
|
-
try {
|
|
81
|
-
const binDir = path.join(dir, "bin");
|
|
82
|
-
const binDirExists = await directoryExists(binDir);
|
|
83
|
-
if (binDirExists) {
|
|
84
|
-
await convertImportsAliasToRelative({
|
|
85
|
-
targetDir: binDir,
|
|
86
|
-
aliasToReplace: alias,
|
|
87
|
-
pathExtFilter: "js-ts-none"
|
|
88
|
-
// displayLogsOnlyFor: [
|
|
89
|
-
// "dist-npm/bin/libs/cfg/cfg-mod.js",
|
|
90
|
-
// "dist-jsr/bin/libs/cfg/cfg-mod.ts",
|
|
91
|
-
// ],
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
} catch (error) {
|
|
95
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
96
|
-
throw error;
|
|
97
|
-
}
|
|
98
|
-
return modifiedFiles;
|
|
99
|
-
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
interface DirOptions {
|
|
2
|
+
/** File extensions to include (e.g. ".ts"). If omitted, include all. */
|
|
3
|
+
includeExt?: string[];
|
|
4
|
+
/** File extensions to exclude. */
|
|
5
|
+
excludeExt?: string[];
|
|
6
|
+
}
|
|
7
|
+
type DirConfig = Record<string, DirOptions>;
|
|
8
|
+
type ExtMap = Record<string, [string, string, string]>;
|
|
9
|
+
interface ConfigFile {
|
|
10
|
+
title?: string;
|
|
11
|
+
output?: string;
|
|
12
|
+
dirs: DirConfig;
|
|
13
|
+
"ext-map"?: ExtMap;
|
|
14
|
+
}
|
|
15
|
+
export declare function scanDirectories(config?: ConfigFile, configPath?: string, outputPath?: string): Promise<void>;
|
|
16
|
+
declare const _default: import("@reliverse/rempts").Command<{
|
|
17
|
+
mode: {
|
|
18
|
+
type: "string";
|
|
19
|
+
allowed: string[];
|
|
20
|
+
description: string;
|
|
21
|
+
};
|
|
22
|
+
configPath: {
|
|
23
|
+
type: "string";
|
|
24
|
+
description: string;
|
|
25
|
+
};
|
|
26
|
+
outputFilePath: {
|
|
27
|
+
type: "string";
|
|
28
|
+
description: string;
|
|
29
|
+
};
|
|
30
|
+
initConfig: {
|
|
31
|
+
type: "string";
|
|
32
|
+
description: string;
|
|
33
|
+
};
|
|
34
|
+
processLibsOnly: {
|
|
35
|
+
type: "boolean";
|
|
36
|
+
description: string;
|
|
37
|
+
};
|
|
38
|
+
preventLibsProcessing: {
|
|
39
|
+
type: "boolean";
|
|
40
|
+
description: string;
|
|
41
|
+
};
|
|
42
|
+
}>;
|
|
43
|
+
export default _default;
|