@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/README.md
CHANGED
|
@@ -127,7 +127,7 @@ if you run just `dler` — it will display a list of commands which you can laun
|
|
|
127
127
|
|
|
128
128
|
## **available commands**
|
|
129
129
|
|
|
130
|
-
[agg](#1-agg) [build](#2-build) [check](#3-check) [conv](#4-conv) [copy](#6-copy) [init](#7-init) [inject](#8-inject) [libs](#9-libs) [merge](#10-merge) [migrate](#11-migrate) [pub](#12-pub) [rempts](#13-rempts) [rename](#14-rename) [spell](#15-
|
|
130
|
+
[agg](#1-agg) [build](#2-build) [check](#3-check) [conv](#4-conv) [copy](#6-copy) [init](#7-init) [inject](#8-inject) [libs](#9-libs) [merge](#10-merge) [migrate](#11-migrate) [pub](#12-pub) [rempts](#13-rempts) [rename](#14-rename) [spell](#15-magic) [split](#16-split) [pack](#17-pack) [unpack](#18-unpack)
|
|
131
131
|
|
|
132
132
|
### 1. `agg`
|
|
133
133
|
|
|
@@ -601,7 +601,7 @@ bun dler rempts --init cmd1 cmd2
|
|
|
601
601
|
bun dler rename ...
|
|
602
602
|
```
|
|
603
603
|
|
|
604
|
-
### 15. `
|
|
604
|
+
### 15. `magic`
|
|
605
605
|
|
|
606
606
|
> Contributors: Please check the [docs/cmds/SPELLS.md](./docs/cmds/SPELLS.md) file for more technical details.
|
|
607
607
|
|
package/bin/app/agg/cmd.d.ts
CHANGED
|
@@ -10,7 +10,6 @@ declare const _default: import("@reliverse/rempts").Command<{
|
|
|
10
10
|
input: {
|
|
11
11
|
description: string;
|
|
12
12
|
type: "string";
|
|
13
|
-
required: true;
|
|
14
13
|
};
|
|
15
14
|
named: {
|
|
16
15
|
description: string;
|
|
@@ -20,7 +19,6 @@ declare const _default: import("@reliverse/rempts").Command<{
|
|
|
20
19
|
out: {
|
|
21
20
|
description: string;
|
|
22
21
|
type: "string";
|
|
23
|
-
required: true;
|
|
24
22
|
};
|
|
25
23
|
recursive: {
|
|
26
24
|
description: string;
|
|
@@ -69,5 +67,10 @@ declare const _default: import("@reliverse/rempts").Command<{
|
|
|
69
67
|
description: string;
|
|
70
68
|
type: "string";
|
|
71
69
|
};
|
|
70
|
+
nonInteractive: {
|
|
71
|
+
description: string;
|
|
72
|
+
type: "boolean";
|
|
73
|
+
default: false;
|
|
74
|
+
};
|
|
72
75
|
}>;
|
|
73
76
|
export default _default;
|
package/bin/app/agg/cmd.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import path from "@reliverse/pathkit";
|
|
2
|
-
import { defineArgs, defineCommand } from "@reliverse/rempts";
|
|
2
|
+
import { defineArgs, defineCommand, inputPrompt } from "@reliverse/rempts";
|
|
3
3
|
import { useAggregator } from "./impl.js";
|
|
4
4
|
export default defineCommand({
|
|
5
5
|
args: defineArgs({
|
|
@@ -13,8 +13,7 @@ export default defineCommand({
|
|
|
13
13
|
},
|
|
14
14
|
input: {
|
|
15
15
|
description: "Directory containing .ts/.js files (--input <directory>)",
|
|
16
|
-
type: "string"
|
|
17
|
-
required: true
|
|
16
|
+
type: "string"
|
|
18
17
|
},
|
|
19
18
|
named: {
|
|
20
19
|
description: "Parse each file for named exports (function/class/const/let)",
|
|
@@ -23,8 +22,7 @@ export default defineCommand({
|
|
|
23
22
|
},
|
|
24
23
|
out: {
|
|
25
24
|
description: "Output aggregator file path (--out <fileName>)",
|
|
26
|
-
type: "string"
|
|
27
|
-
required: true
|
|
25
|
+
type: "string"
|
|
28
26
|
},
|
|
29
27
|
recursive: {
|
|
30
28
|
description: "Recursively scan subdirectories (default true) (false means only scan the files in the current directory and not subdirectories)",
|
|
@@ -72,25 +70,63 @@ export default defineCommand({
|
|
|
72
70
|
typesOut: {
|
|
73
71
|
description: "Output file path for types (used when separateTypesFile is true)",
|
|
74
72
|
type: "string"
|
|
73
|
+
},
|
|
74
|
+
nonInteractive: {
|
|
75
|
+
description: "Disable interactive prompts and require all arguments to be provided via flags",
|
|
76
|
+
type: "boolean",
|
|
77
|
+
default: false
|
|
75
78
|
}
|
|
76
79
|
}),
|
|
77
80
|
async run({ args }) {
|
|
81
|
+
const resolvedArgs = { ...args };
|
|
82
|
+
if (!args.nonInteractive) {
|
|
83
|
+
if (!args.input) {
|
|
84
|
+
resolvedArgs.input = await inputPrompt({
|
|
85
|
+
title: "Enter input directory containing .ts/.js files:",
|
|
86
|
+
defaultValue: ""
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
if (!args.out) {
|
|
90
|
+
resolvedArgs.out = await inputPrompt({
|
|
91
|
+
title: "Enter output aggregator file path:",
|
|
92
|
+
defaultValue: ""
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
if (args.separateTypesFile && !args.typesOut) {
|
|
96
|
+
resolvedArgs.typesOut = await inputPrompt({
|
|
97
|
+
title: "Enter output file path for types:",
|
|
98
|
+
defaultValue: resolvedArgs.out.replace(/\.(ts|js)$/, ".types.$1")
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
} else {
|
|
102
|
+
if (!args.input) {
|
|
103
|
+
throw new Error("Missing required argument: --input");
|
|
104
|
+
}
|
|
105
|
+
if (!args.out) {
|
|
106
|
+
throw new Error("Missing required argument: --out");
|
|
107
|
+
}
|
|
108
|
+
if (args.separateTypesFile && !args.typesOut) {
|
|
109
|
+
throw new Error(
|
|
110
|
+
"Missing required argument: --typesOut (required when --separateTypesFile is true)"
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
78
114
|
await useAggregator({
|
|
79
|
-
inputDir: path.resolve(
|
|
80
|
-
isRecursive: !!
|
|
81
|
-
outFile: path.resolve(
|
|
82
|
-
stripPrefix:
|
|
83
|
-
useImport: !!
|
|
84
|
-
useNamed: !!
|
|
85
|
-
sortLines: !!
|
|
86
|
-
headerComment:
|
|
87
|
-
verbose: !!
|
|
88
|
-
includeInternal: !!
|
|
89
|
-
internalMarker:
|
|
90
|
-
overrideFile: !!
|
|
91
|
-
fileExtensions:
|
|
92
|
-
separateTypesFile: !!
|
|
93
|
-
typesOutFile:
|
|
115
|
+
inputDir: path.resolve(resolvedArgs.input),
|
|
116
|
+
isRecursive: !!resolvedArgs.recursive,
|
|
117
|
+
outFile: path.resolve(resolvedArgs.out),
|
|
118
|
+
stripPrefix: resolvedArgs.strip ? path.resolve(resolvedArgs.strip) : "",
|
|
119
|
+
useImport: !!resolvedArgs.imports,
|
|
120
|
+
useNamed: !!resolvedArgs.named,
|
|
121
|
+
sortLines: !!resolvedArgs.sort,
|
|
122
|
+
headerComment: resolvedArgs.header || "",
|
|
123
|
+
verbose: !!resolvedArgs.verbose,
|
|
124
|
+
includeInternal: !!resolvedArgs.includeInternal,
|
|
125
|
+
internalMarker: resolvedArgs.internalMarker,
|
|
126
|
+
overrideFile: !!resolvedArgs.override,
|
|
127
|
+
fileExtensions: resolvedArgs.extensions.split(",").map((ext) => ext.trim()),
|
|
128
|
+
separateTypesFile: !!resolvedArgs.separateTypesFile,
|
|
129
|
+
typesOutFile: resolvedArgs.typesOut ? path.resolve(resolvedArgs.typesOut) : void 0
|
|
94
130
|
});
|
|
95
131
|
}
|
|
96
132
|
});
|
package/bin/app/agg/impl.js
CHANGED
|
@@ -163,6 +163,7 @@ function buildPathRelative(filePath, inputDir, stripPrefix) {
|
|
|
163
163
|
if (!resolved.startsWith("./") && !resolved.startsWith("../")) {
|
|
164
164
|
resolved = `./${resolved}`;
|
|
165
165
|
}
|
|
166
|
+
resolved = resolved.replace(/\/+/g, "/");
|
|
166
167
|
return resolved;
|
|
167
168
|
}
|
|
168
169
|
async function collectFiles(dir, exts, recursive, ignoreDirs, verbose, includeInternal, internalMarker, outFile) {
|
package/bin/app/build/cmd.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { defineArgs, defineCommand } from "@reliverse/rempts";
|
|
2
|
-
import {
|
|
2
|
+
import { dlerBuild } 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 {
|
|
5
|
+
import { finalizeBuild } from "../../libs/sdk/sdk-mod.js";
|
|
6
6
|
export default defineCommand({
|
|
7
7
|
meta: {
|
|
8
8
|
name: "build",
|
|
9
|
-
description: "Build the project"
|
|
9
|
+
description: "Build the project (without publishing)"
|
|
10
10
|
},
|
|
11
11
|
args: defineArgs({
|
|
12
12
|
dev: {
|
|
@@ -17,12 +17,7 @@ export default defineCommand({
|
|
|
17
17
|
async run({ args }) {
|
|
18
18
|
await ensureDlerConfig(args.dev);
|
|
19
19
|
const config = await getConfigDler();
|
|
20
|
-
await
|
|
21
|
-
|
|
22
|
-
config.distJsrDirName,
|
|
23
|
-
config.libsDirDist,
|
|
24
|
-
config.libsList
|
|
25
|
-
);
|
|
26
|
-
await dlerPub(args.dev, config);
|
|
20
|
+
const { timer } = await dlerBuild(args.dev, config);
|
|
21
|
+
await finalizeBuild(timer, false, "build");
|
|
27
22
|
}
|
|
28
23
|
});
|
package/bin/app/build/impl.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { DlerConfig } from "../../libs/sdk/sdk-impl/config/types.js";
|
|
2
2
|
/**
|
|
3
|
-
* Main entry point for the dler build
|
|
4
|
-
* Handles building
|
|
3
|
+
* Main entry point for the dler build process.
|
|
4
|
+
* Handles building for both main project and libraries.
|
|
5
5
|
* @see `src/app/pub/impl.ts` for pub main function implementation.
|
|
6
6
|
*/
|
|
7
|
-
export declare function dlerBuild(isDev: boolean, config?: DlerConfig): Promise<
|
|
7
|
+
export declare function dlerBuild(isDev: boolean, config?: DlerConfig): Promise<{
|
|
8
|
+
timer: any;
|
|
9
|
+
effectiveConfig: any;
|
|
10
|
+
} | undefined>;
|
package/bin/app/build/impl.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { bumpHandler, isBumpDisabled, setBumpDisabledValueTo } from "@reliverse/bleump";
|
|
2
1
|
import path from "@reliverse/pathkit";
|
|
3
2
|
import fs from "@reliverse/relifso";
|
|
4
3
|
import { getConfigDler } from "../../libs/sdk/sdk-impl/config/load.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { finalizeBuildPub } from "../../libs/sdk/sdk-impl/utils/finalize.js";
|
|
4
|
+
import { library_buildFlow } from "../../libs/sdk/sdk-impl/library-flow.js";
|
|
5
|
+
import { regular_buildFlow } from "../../libs/sdk/sdk-impl/regular-flow.js";
|
|
8
6
|
import { removeDistFolders } from "../../libs/sdk/sdk-impl/utils/utils-clean.js";
|
|
9
7
|
import { PROJECT_ROOT } from "../../libs/sdk/sdk-impl/utils/utils-consts.js";
|
|
10
8
|
import { handleDlerError } from "../../libs/sdk/sdk-impl/utils/utils-error-cwd.js";
|
|
11
9
|
import { createPerfTimer } from "../../libs/sdk/sdk-impl/utils/utils-perf.js";
|
|
10
|
+
import { dlerPostBuild } from "./postbuild.js";
|
|
11
|
+
import { dlerPreBuild } from "./prebuild.js";
|
|
12
12
|
export async function dlerBuild(isDev, config) {
|
|
13
13
|
const timer = createPerfTimer();
|
|
14
14
|
let effectiveConfig = config;
|
|
@@ -25,30 +25,11 @@ export async function dlerBuild(isDev, config) {
|
|
|
25
25
|
effectiveConfig.libsDirDist,
|
|
26
26
|
effectiveConfig.libsList
|
|
27
27
|
);
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
false,
|
|
34
|
-
effectiveConfig.bumpFilter,
|
|
35
|
-
effectiveConfig.bumpSet
|
|
36
|
-
);
|
|
37
|
-
await setBumpDisabledValueTo(true);
|
|
38
|
-
}
|
|
39
|
-
} catch {
|
|
40
|
-
throw new Error("[.config/dler.ts] Failed to set bumpDisable to true");
|
|
41
|
-
}
|
|
42
|
-
await processRegularFlow(timer, isDev, effectiveConfig);
|
|
43
|
-
await processLibraryFlow(timer, isDev, effectiveConfig);
|
|
44
|
-
await finalizeBuildPub(
|
|
45
|
-
timer,
|
|
46
|
-
effectiveConfig.commonPubPause,
|
|
47
|
-
effectiveConfig.libsList,
|
|
48
|
-
effectiveConfig.distNpmDirName,
|
|
49
|
-
effectiveConfig.distJsrDirName,
|
|
50
|
-
effectiveConfig.libsDirDist
|
|
51
|
-
);
|
|
28
|
+
await dlerPreBuild(effectiveConfig);
|
|
29
|
+
await regular_buildFlow(timer, isDev, effectiveConfig);
|
|
30
|
+
await library_buildFlow(timer, isDev, effectiveConfig);
|
|
31
|
+
await dlerPostBuild(isDev);
|
|
32
|
+
return { timer, effectiveConfig };
|
|
52
33
|
} catch (error) {
|
|
53
34
|
handleDlerError(error);
|
|
54
35
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function dlerPostBuild(isDev: boolean): Promise<void>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import path, { convertImportsAliasToRelative } from "@reliverse/pathkit";
|
|
2
|
+
import { relinka } from "@reliverse/relinka";
|
|
3
|
+
import { runCmd } from "@reliverse/rempts";
|
|
4
|
+
import { getCheckCmd } from "../cmds.js";
|
|
5
|
+
import { getConfigDler } from "../../libs/sdk/sdk-impl/config/load.js";
|
|
6
|
+
import { applyMagicSpells } from "../../libs/sdk/sdk-impl/magic/ms-apply.js";
|
|
7
|
+
import { resolveAllCrossLibs } from "../../libs/sdk/sdk-impl/utils/resolve-cross-libs.js";
|
|
8
|
+
import { directoryExists, executeDlerHooks } from "./ppb-utils.js";
|
|
9
|
+
const DIST_DIRECTORIES = ["dist-npm", "dist-jsr"];
|
|
10
|
+
const ALIAS_TO_REPLACE = "~";
|
|
11
|
+
const createPostBuildToolRunner = () => ({
|
|
12
|
+
"dler-check": {
|
|
13
|
+
name: "Dler Check",
|
|
14
|
+
async run() {
|
|
15
|
+
const checkCmd = await getCheckCmd();
|
|
16
|
+
await runCmd(checkCmd, ["--no-exit", "--no-progress"]);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
async function processDistDirectory(dir, alias) {
|
|
21
|
+
try {
|
|
22
|
+
const binDir = path.join(dir, "bin");
|
|
23
|
+
if (await directoryExists(binDir)) {
|
|
24
|
+
await convertImportsAliasToRelative({
|
|
25
|
+
targetDir: binDir,
|
|
26
|
+
aliasToReplace: alias,
|
|
27
|
+
pathExtFilter: "js-ts-none"
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
} catch (error) {
|
|
31
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
32
|
+
throw error;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
async function processDistDirectories() {
|
|
36
|
+
for (const dir of DIST_DIRECTORIES) {
|
|
37
|
+
relinka("log", `[processDistDirectory] ${dir}`);
|
|
38
|
+
await processDistDirectory(dir, ALIAS_TO_REPLACE);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
export async function dlerPostBuild(isDev) {
|
|
42
|
+
await resolveAllCrossLibs();
|
|
43
|
+
if (isDev) {
|
|
44
|
+
await applyMagicSpells(["dist-jsr", "dist-npm", "dist-libs"]);
|
|
45
|
+
}
|
|
46
|
+
await processDistDirectories();
|
|
47
|
+
const config = await getConfigDler();
|
|
48
|
+
await executeDlerHooks(config?.hooksAfterBuild ?? [], "post-build");
|
|
49
|
+
if (config?.runAfterBuild?.length) {
|
|
50
|
+
const tools = createPostBuildToolRunner();
|
|
51
|
+
const availableTools = config.runAfterBuild.filter((toolName) => toolName in tools).map((toolName) => ({ toolName, ...tools[toolName] }));
|
|
52
|
+
for (const { name, run } of availableTools) {
|
|
53
|
+
relinka("log", `Running ${name}...`);
|
|
54
|
+
await run();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type PackageManager = "bun" | "npm" | "yarn" | "pnpm";
|
|
2
|
+
export declare function getPackageManager(): Promise<PackageManager>;
|
|
3
|
+
/**
|
|
4
|
+
* Checks if a command is available in the system or package.json
|
|
5
|
+
* First checks package.json dependencies, then falls back to global command detection
|
|
6
|
+
*/
|
|
7
|
+
export declare function isCommandAvailable(command: string): Promise<boolean>;
|
|
8
|
+
/**
|
|
9
|
+
* Executes a shell command using the appropriate method based on the environment
|
|
10
|
+
*/
|
|
11
|
+
export declare function executeCommand(command: string): Promise<void>;
|
|
12
|
+
export declare function directoryExists(dirPath: string): Promise<boolean>;
|
|
13
|
+
/**
|
|
14
|
+
* Executes hooks with consistent error handling and logging
|
|
15
|
+
*/
|
|
16
|
+
export declare function executeDlerHooks(hooks: (() => Promise<void>)[], phase: "pre-build" | "post-build"): Promise<void>;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import fs from "@reliverse/relifso";
|
|
2
|
+
import { relinka } from "@reliverse/relinka";
|
|
3
|
+
import { selectPrompt } from "@reliverse/rempts";
|
|
4
|
+
import { $ } from "bun";
|
|
5
|
+
import { execa } from "execa";
|
|
6
|
+
import { lookpath } from "lookpath";
|
|
7
|
+
import { readPackageJSON } from "pkg-types";
|
|
8
|
+
const COMMAND_TO_PACKAGE = {
|
|
9
|
+
tsc: "typescript",
|
|
10
|
+
eslint: "eslint",
|
|
11
|
+
biome: "@biomejs/biome",
|
|
12
|
+
knip: "knip"
|
|
13
|
+
};
|
|
14
|
+
let selectedPackageManager = null;
|
|
15
|
+
export async function getPackageManager() {
|
|
16
|
+
if (selectedPackageManager) return selectedPackageManager;
|
|
17
|
+
if (process.versions.bun) {
|
|
18
|
+
selectedPackageManager = "bun";
|
|
19
|
+
return selectedPackageManager;
|
|
20
|
+
}
|
|
21
|
+
const result = await selectPrompt({
|
|
22
|
+
title: "Select package manager to use for running tools:",
|
|
23
|
+
options: [
|
|
24
|
+
{ label: "npm", value: "npm" },
|
|
25
|
+
{ label: "yarn", value: "yarn" },
|
|
26
|
+
{ label: "pnpm", value: "pnpm" }
|
|
27
|
+
]
|
|
28
|
+
});
|
|
29
|
+
selectedPackageManager = result;
|
|
30
|
+
return selectedPackageManager;
|
|
31
|
+
}
|
|
32
|
+
async function isCommandInPackageJson(command) {
|
|
33
|
+
try {
|
|
34
|
+
const packageJson = await readPackageJSON();
|
|
35
|
+
const packageName = COMMAND_TO_PACKAGE[command];
|
|
36
|
+
if (!packageName) return false;
|
|
37
|
+
return packageName in (packageJson.dependencies || {}) || packageName in (packageJson.devDependencies || {});
|
|
38
|
+
} catch (error) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
export async function isCommandAvailable(command) {
|
|
43
|
+
const packageName = COMMAND_TO_PACKAGE[command];
|
|
44
|
+
if (!packageName) return false;
|
|
45
|
+
if (await isCommandInPackageJson(command)) {
|
|
46
|
+
relinka("verbose", `[dlerPreBuild] Package "${packageName}" found in package.json`);
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
relinka(
|
|
50
|
+
"warn",
|
|
51
|
+
`[dlerPreBuild] Package "${packageName}" not found in package.json. Consider installing it as a dependency.`
|
|
52
|
+
);
|
|
53
|
+
return await lookpath(command) !== void 0;
|
|
54
|
+
}
|
|
55
|
+
export async function executeCommand(command) {
|
|
56
|
+
const [firstWord, ...rest] = command.split(" ").filter(Boolean);
|
|
57
|
+
if (!firstWord) return;
|
|
58
|
+
const pkgManagers = ["bun", "yarn", "pnpm", "npm"];
|
|
59
|
+
const isPkgManager = pkgManagers.includes(firstWord);
|
|
60
|
+
const cmd = isPkgManager ? rest[0] : firstWord;
|
|
61
|
+
const args = isPkgManager ? rest.slice(1) : rest;
|
|
62
|
+
if (!cmd) return;
|
|
63
|
+
const packageName = COMMAND_TO_PACKAGE[cmd];
|
|
64
|
+
if (packageName && await isCommandInPackageJson(cmd)) {
|
|
65
|
+
const pkgManager = isPkgManager ? firstWord : await getPackageManager();
|
|
66
|
+
if (process.versions.bun) {
|
|
67
|
+
await $`${pkgManager} ${cmd} ${args.join(" ")}`;
|
|
68
|
+
} else {
|
|
69
|
+
await execa(pkgManager, [cmd, ...args], { stdio: "inherit" });
|
|
70
|
+
}
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
if (process.versions.bun) {
|
|
74
|
+
await $`${cmd} ${args.join(" ")}`;
|
|
75
|
+
} else {
|
|
76
|
+
await execa(cmd, args, { stdio: "inherit" });
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
export async function directoryExists(dirPath) {
|
|
80
|
+
try {
|
|
81
|
+
return (await fs.stat(dirPath)).isDirectory();
|
|
82
|
+
} catch (error) {
|
|
83
|
+
if (error.code === "ENOENT") return false;
|
|
84
|
+
throw error;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
export async function executeDlerHooks(hooks, phase) {
|
|
88
|
+
if (!hooks.length) return;
|
|
89
|
+
relinka("log", `[dlerPreBuild] Running ${phase} hooks...`);
|
|
90
|
+
for (const hook of hooks) {
|
|
91
|
+
try {
|
|
92
|
+
await hook();
|
|
93
|
+
} catch (error) {
|
|
94
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
95
|
+
relinka("error", `[dlerPreBuild] Error in ${phase} hook: ${message}`);
|
|
96
|
+
throw error;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { relinka } from "@reliverse/relinka";
|
|
2
|
+
import { runCmd } from "@reliverse/rempts";
|
|
3
|
+
import { getCheckCmd } from "../cmds.js";
|
|
4
|
+
import { executeCommand, executeDlerHooks, isCommandAvailable } from "./ppb-utils.js";
|
|
5
|
+
const createToolRunner = () => ({
|
|
6
|
+
tsc: {
|
|
7
|
+
name: "TypeScript compiler",
|
|
8
|
+
run: () => executeCommand("tsc --noEmit")
|
|
9
|
+
},
|
|
10
|
+
eslint: {
|
|
11
|
+
name: "ESLint",
|
|
12
|
+
run: () => executeCommand("eslint --cache --fix .")
|
|
13
|
+
},
|
|
14
|
+
biome: {
|
|
15
|
+
name: "Biome",
|
|
16
|
+
run: () => executeCommand("biome check --fix --unsafe .")
|
|
17
|
+
},
|
|
18
|
+
knip: {
|
|
19
|
+
name: "Knip",
|
|
20
|
+
run: () => executeCommand("knip")
|
|
21
|
+
},
|
|
22
|
+
"dler-check": {
|
|
23
|
+
name: "Dler Check",
|
|
24
|
+
async run() {
|
|
25
|
+
const checkCmd = await getCheckCmd();
|
|
26
|
+
await runCmd(checkCmd, ["--no-exit", "--no-progress"]);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
export async function dlerPreBuild(config) {
|
|
31
|
+
await executeDlerHooks(config?.hooksBeforeBuild ?? [], "pre-build");
|
|
32
|
+
if (!config?.runBeforeBuild?.length) return;
|
|
33
|
+
const tools = createToolRunner();
|
|
34
|
+
const availableTools = await Promise.all(
|
|
35
|
+
config.runBeforeBuild.map(async (toolName) => {
|
|
36
|
+
const tool = tools[toolName];
|
|
37
|
+
if (!tool) return null;
|
|
38
|
+
if (toolName === "dler-check") {
|
|
39
|
+
return { toolName, ...tool };
|
|
40
|
+
}
|
|
41
|
+
const isAvailable = await isCommandAvailable(toolName);
|
|
42
|
+
return isAvailable ? { toolName, ...tool } : null;
|
|
43
|
+
})
|
|
44
|
+
);
|
|
45
|
+
const commandsToRun = availableTools.filter(Boolean);
|
|
46
|
+
for (const { name, run } of commandsToRun) {
|
|
47
|
+
relinka("log", `Running ${name}...`);
|
|
48
|
+
await run();
|
|
49
|
+
}
|
|
50
|
+
}
|
package/bin/app/check/cmd.d.ts
CHANGED
|
@@ -15,6 +15,14 @@ declare const _default: import("@reliverse/rempts").Command<{
|
|
|
15
15
|
type: "boolean";
|
|
16
16
|
description: string;
|
|
17
17
|
};
|
|
18
|
+
"no-exit": {
|
|
19
|
+
type: "boolean";
|
|
20
|
+
description: string;
|
|
21
|
+
};
|
|
22
|
+
"no-progress": {
|
|
23
|
+
type: "boolean";
|
|
24
|
+
description: string;
|
|
25
|
+
};
|
|
18
26
|
deps: {
|
|
19
27
|
type: "boolean";
|
|
20
28
|
description: string;
|