@reliverse/dler 1.7.73 → 1.7.75
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.js +2 -2
- package/bin/app/build/postbuild.js +1 -0
- package/bin/app/cmds.d.ts +230 -4
- package/bin/app/cmds.js +36 -19
- package/bin/app/config/cmd.d.ts +18 -0
- package/bin/app/config/cmd.js +43 -0
- package/bin/app/config/impl/typebox.d.ts +8 -0
- package/bin/app/config/impl/typebox.js +82 -0
- package/bin/app/mkdist/cmd.js +1 -1
- package/bin/app/pub/cmd.js +1 -1
- package/bin/app/rempts/cmd.js +146 -8
- package/bin/cli.js +14 -20
- package/bin/libs/cfg/cfg-impl/{cfg-types.d.ts → cfg-dler.d.ts} +76 -0
- package/bin/libs/cfg/cfg-mod.d.ts +2 -2
- package/bin/libs/cfg/cfg-mod.js +1 -1
- package/bin/libs/get/get-impl/get-core.d.ts +3 -0
- package/bin/libs/get/get-impl/get-core.js +450 -0
- package/bin/libs/get/get-mod.d.ts +0 -6
- package/bin/libs/get/get-mod.js +38 -459
- package/bin/libs/sdk/sdk-impl/build/providers/bun/single-file.d.ts +2 -2
- package/bin/libs/sdk/sdk-impl/config/core.d.ts +8 -0
- package/bin/libs/sdk/sdk-impl/config/core.js +231 -0
- package/bin/libs/sdk/sdk-impl/config/info.js +1 -1
- package/bin/libs/sdk/sdk-impl/config/{init.js → prepare.js} +3 -1
- package/bin/libs/sdk/sdk-impl/magic/magic-spells.js +2 -1
- package/bin/{app/agg/impl.d.ts → libs/sdk/sdk-impl/utils/agg/agg.d.ts} +1 -0
- package/bin/libs/sdk/sdk-impl/utils/agg/agg.js +800 -0
- package/bin/libs/sdk/sdk-impl/utils/exec/exec-mod.js +0 -1
- package/bin/libs/sdk/sdk-impl/utils/pm/pm-meta.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/utils/pm/pm-meta.js +2 -2
- package/bin/libs/sdk/sdk-impl/utils/resolve-cross-libs.d.ts +1 -3
- package/bin/libs/sdk/sdk-impl/utils/resolve-cross-libs.js +432 -9
- package/bin/libs/sdk/sdk-mod.d.ts +48 -45
- package/bin/libs/sdk/sdk-mod.js +36 -215
- package/bin/mod.js +4 -1
- package/package.json +5 -5
- package/bin/app/agg/impl.js +0 -341
- package/bin/app/agg/run.d.ts +0 -1
- package/bin/app/agg/run.js +0 -136
- package/bin/libs/cfg/cfg-impl/cfg-consts.d.ts +0 -77
- package/bin/libs/cfg/cfg-impl/cfg-types.js +0 -0
- package/bin/libs/sdk/sdk-impl/utils/tools-agg.d.ts +0 -14
- package/bin/libs/sdk/sdk-impl/utils/tools-agg.js +0 -140
- package/bin/libs/sdk/sdk-impl/utils/tools-impl.d.ts +0 -4
- package/bin/libs/sdk/sdk-impl/utils/tools-impl.js +0 -21
- /package/bin/libs/cfg/cfg-impl/{cfg-consts.js → cfg-dler.js} +0 -0
- /package/bin/libs/sdk/sdk-impl/config/{init.d.ts → prepare.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# 🧬 dler •
|
|
1
|
+
# 🧬 dler • extend your bun/pnpm/yarn/npm usage
|
|
2
2
|
|
|
3
3
|
[sponsor](https://github.com/sponsors/blefnk) — [discord](https://discord.gg/pb8ukbwpsj) — [github](https://github.com/reliverse/dler) — [npm](https://npmjs.com/@reliverse/dler)
|
|
4
4
|
|
|
@@ -53,7 +53,7 @@ it is recommended to install dler both globally and as a dev dependency:
|
|
|
53
53
|
- **global install** — `bun add -g @reliverse/dler` — lets you use dler anywhere, like a system-level cli.
|
|
54
54
|
- **dev dependency** — `bun add -D @reliverse/dler` — pins the version per project, so all contributors use the same version.
|
|
55
55
|
|
|
56
|
-
instead of global install, you can alternatively install dler as a standalone binary: `bunx @reliverse/dler
|
|
56
|
+
instead of global install, you can alternatively install dler as a standalone binary: `bunx @reliverse/dler`
|
|
57
57
|
|
|
58
58
|
> usage depends on how dler is installed:
|
|
59
59
|
>
|
package/bin/app/agg/cmd.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from "@reliverse/pathkit";
|
|
2
|
-
import { defineArgs, defineCommand
|
|
3
|
-
import { useAggregator } from "
|
|
2
|
+
import { inputPrompt, defineArgs, defineCommand } from "@reliverse/rempts";
|
|
3
|
+
import { useAggregator } from "../../libs/sdk/sdk-impl/utils/agg/agg.js";
|
|
4
4
|
export default defineCommand({
|
|
5
5
|
args: defineArgs({
|
|
6
6
|
imports: {
|
|
@@ -14,6 +14,7 @@ export async function dlerPostBuild(isDev, debugDontCopyNonBuildFiles) {
|
|
|
14
14
|
relinka("info", "\u2014 \u2014 \u2014 dlerPostBuild \u2014 \u2014 \u2014");
|
|
15
15
|
const config = await getConfigDler();
|
|
16
16
|
await resolveAllCrossLibs(
|
|
17
|
+
"package",
|
|
17
18
|
ALIAS_TO_REPLACE,
|
|
18
19
|
["npm", "jsr"],
|
|
19
20
|
config.buildPreExtensions,
|
package/bin/app/cmds.d.ts
CHANGED
|
@@ -1,19 +1,245 @@
|
|
|
1
1
|
import type { Command } from "@reliverse/rempts";
|
|
2
|
+
interface CommandArgsMap {
|
|
3
|
+
agg: {
|
|
4
|
+
imports?: boolean;
|
|
5
|
+
input?: string;
|
|
6
|
+
named?: boolean;
|
|
7
|
+
out?: string;
|
|
8
|
+
recursive?: boolean;
|
|
9
|
+
strip?: string;
|
|
10
|
+
sort?: boolean;
|
|
11
|
+
header?: string;
|
|
12
|
+
verbose?: boolean;
|
|
13
|
+
includeInternal?: boolean;
|
|
14
|
+
internalMarker?: string;
|
|
15
|
+
override?: boolean;
|
|
16
|
+
extensions?: string;
|
|
17
|
+
separateTypesFile?: boolean;
|
|
18
|
+
typesOut?: string;
|
|
19
|
+
nonInteractive?: boolean;
|
|
20
|
+
};
|
|
21
|
+
build: {
|
|
22
|
+
dev?: boolean;
|
|
23
|
+
debugOnlyCopyNonBuildFiles?: boolean;
|
|
24
|
+
debugDontCopyNonBuildFiles?: boolean;
|
|
25
|
+
};
|
|
26
|
+
build_binary: {
|
|
27
|
+
input?: string;
|
|
28
|
+
targets?: string;
|
|
29
|
+
outdir?: string;
|
|
30
|
+
minify?: boolean;
|
|
31
|
+
sourcemap?: boolean;
|
|
32
|
+
bytecode?: boolean;
|
|
33
|
+
clean?: boolean;
|
|
34
|
+
parallel?: boolean;
|
|
35
|
+
external?: string[];
|
|
36
|
+
};
|
|
37
|
+
check: {
|
|
38
|
+
dev?: boolean;
|
|
39
|
+
directory?: string;
|
|
40
|
+
checks?: string;
|
|
41
|
+
strict?: boolean;
|
|
42
|
+
json?: boolean;
|
|
43
|
+
deps?: boolean;
|
|
44
|
+
all?: boolean;
|
|
45
|
+
ignore?: string;
|
|
46
|
+
builtins?: boolean;
|
|
47
|
+
peer?: boolean;
|
|
48
|
+
optional?: boolean;
|
|
49
|
+
fix?: boolean;
|
|
50
|
+
depth?: number;
|
|
51
|
+
};
|
|
52
|
+
conv: {};
|
|
53
|
+
create: {
|
|
54
|
+
template?: string;
|
|
55
|
+
mode?: "template" | "files";
|
|
56
|
+
fileType?: string;
|
|
57
|
+
destDir?: string;
|
|
58
|
+
multiple?: boolean;
|
|
59
|
+
parallel?: boolean;
|
|
60
|
+
concurrency?: string;
|
|
61
|
+
cwd?: string;
|
|
62
|
+
};
|
|
63
|
+
fs: {
|
|
64
|
+
mode: "copy" | "rm" | "rename";
|
|
65
|
+
target: string;
|
|
66
|
+
nonInteractive?: boolean;
|
|
67
|
+
source?: string;
|
|
68
|
+
destination?: string;
|
|
69
|
+
recursive?: boolean;
|
|
70
|
+
preserveStructure?: boolean;
|
|
71
|
+
increment?: boolean;
|
|
72
|
+
concurrency?: number;
|
|
73
|
+
gitignore?: boolean;
|
|
74
|
+
prepareMyCLI?: boolean;
|
|
75
|
+
revert?: boolean;
|
|
76
|
+
useDtsTxtForPrepareMyCLI?: boolean;
|
|
77
|
+
};
|
|
78
|
+
get: {};
|
|
79
|
+
init: {};
|
|
80
|
+
inject: {};
|
|
81
|
+
install: {
|
|
82
|
+
action?: string;
|
|
83
|
+
name?: string;
|
|
84
|
+
global?: boolean;
|
|
85
|
+
cwd?: string;
|
|
86
|
+
workspace?: boolean;
|
|
87
|
+
silent?: boolean;
|
|
88
|
+
recreateLockFile?: boolean;
|
|
89
|
+
linter?: boolean;
|
|
90
|
+
};
|
|
91
|
+
libs: {
|
|
92
|
+
init: string;
|
|
93
|
+
overwrite?: boolean;
|
|
94
|
+
};
|
|
95
|
+
magic: {
|
|
96
|
+
targets: string[];
|
|
97
|
+
lib?: string;
|
|
98
|
+
concurrency?: number;
|
|
99
|
+
batchSize?: number;
|
|
100
|
+
stopOnError?: boolean;
|
|
101
|
+
about?: boolean;
|
|
102
|
+
};
|
|
103
|
+
merge: {
|
|
104
|
+
s?: string[];
|
|
105
|
+
d?: string;
|
|
106
|
+
ignore?: string[];
|
|
107
|
+
format?: string;
|
|
108
|
+
stdout?: boolean;
|
|
109
|
+
noPath?: boolean;
|
|
110
|
+
pathAbove?: boolean;
|
|
111
|
+
};
|
|
112
|
+
migrate: {
|
|
113
|
+
interactive?: boolean;
|
|
114
|
+
codemod?: string;
|
|
115
|
+
project?: string;
|
|
116
|
+
mrTarget?: string;
|
|
117
|
+
dryRun?: boolean;
|
|
118
|
+
noBackup?: boolean;
|
|
119
|
+
consoleRelinkaInput?: string;
|
|
120
|
+
consoleRelinkaFrom?: string;
|
|
121
|
+
consoleRelinkaTo?: string;
|
|
122
|
+
};
|
|
123
|
+
mkdist: {
|
|
124
|
+
mkdistOnly?: boolean;
|
|
125
|
+
dev?: boolean;
|
|
126
|
+
dir?: string;
|
|
127
|
+
cwd?: string;
|
|
128
|
+
src?: string;
|
|
129
|
+
dist?: string;
|
|
130
|
+
clean?: boolean;
|
|
131
|
+
pattern?: string;
|
|
132
|
+
format?: string;
|
|
133
|
+
declaration?: boolean;
|
|
134
|
+
ext?: string;
|
|
135
|
+
jsx?: string;
|
|
136
|
+
jsxFactory?: string;
|
|
137
|
+
jsxFragment?: string;
|
|
138
|
+
loaders?: string;
|
|
139
|
+
minify?: boolean;
|
|
140
|
+
target?: string;
|
|
141
|
+
};
|
|
142
|
+
pack: {
|
|
143
|
+
input: string;
|
|
144
|
+
output?: string;
|
|
145
|
+
whitelabel?: string;
|
|
146
|
+
cdn?: string;
|
|
147
|
+
force?: boolean;
|
|
148
|
+
update?: boolean;
|
|
149
|
+
files?: string;
|
|
150
|
+
lastUpdate?: string;
|
|
151
|
+
unpack?: boolean;
|
|
152
|
+
};
|
|
153
|
+
pub: {
|
|
154
|
+
dev?: boolean;
|
|
155
|
+
};
|
|
156
|
+
remdn: {
|
|
157
|
+
mode?: "dirs-scan-only" | "dirs-scan-compare";
|
|
158
|
+
configPath?: string;
|
|
159
|
+
outputFilePath?: string;
|
|
160
|
+
initConfig?: string;
|
|
161
|
+
};
|
|
162
|
+
remove: {
|
|
163
|
+
action?: string;
|
|
164
|
+
name: string;
|
|
165
|
+
global?: boolean;
|
|
166
|
+
cwd?: string;
|
|
167
|
+
workspace?: boolean;
|
|
168
|
+
silent?: boolean;
|
|
169
|
+
linter?: boolean;
|
|
170
|
+
standalone?: boolean;
|
|
171
|
+
};
|
|
172
|
+
rempts: {
|
|
173
|
+
init?: string;
|
|
174
|
+
overwrite?: boolean;
|
|
175
|
+
customCmdsRoot?: string;
|
|
176
|
+
outFile?: string;
|
|
177
|
+
cmdDirs?: string[];
|
|
178
|
+
};
|
|
179
|
+
split: {
|
|
180
|
+
directory: string;
|
|
181
|
+
fileLineThreshold: number;
|
|
182
|
+
funcLineThreshold: number;
|
|
183
|
+
};
|
|
184
|
+
transform: {};
|
|
185
|
+
update: {
|
|
186
|
+
name?: string[];
|
|
187
|
+
ignore?: string[];
|
|
188
|
+
concurrency?: number;
|
|
189
|
+
linker?: "isolated" | "hoisted";
|
|
190
|
+
global?: boolean;
|
|
191
|
+
interactive?: boolean;
|
|
192
|
+
};
|
|
193
|
+
upgrade: {
|
|
194
|
+
interactive?: boolean;
|
|
195
|
+
};
|
|
196
|
+
x: {
|
|
197
|
+
action: string;
|
|
198
|
+
name?: string;
|
|
199
|
+
cwd?: string;
|
|
200
|
+
silent?: boolean;
|
|
201
|
+
target?: string;
|
|
202
|
+
timeout?: number;
|
|
203
|
+
throwOnError?: boolean;
|
|
204
|
+
args?: string;
|
|
205
|
+
global?: boolean;
|
|
206
|
+
yes?: boolean;
|
|
207
|
+
bun?: boolean;
|
|
208
|
+
npm?: boolean;
|
|
209
|
+
pnpm?: boolean;
|
|
210
|
+
yarn?: boolean;
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
export declare function loadTypedCommand<T extends keyof CommandArgsMap>(cmdName: T): Promise<Command>;
|
|
2
214
|
export declare const getAggCmd: () => Promise<Command>;
|
|
3
215
|
export declare const getBuildCmd: () => Promise<Command>;
|
|
216
|
+
export declare const getBuildBinaryCmd: () => Promise<Command>;
|
|
4
217
|
export declare const getCheckCmd: () => Promise<Command>;
|
|
5
218
|
export declare const getConvCmd: () => Promise<Command>;
|
|
6
|
-
export declare const
|
|
219
|
+
export declare const getCreateCmd: () => Promise<Command>;
|
|
220
|
+
export declare const getFsCmd: () => Promise<Command>;
|
|
221
|
+
export declare const getGetCmd: () => Promise<Command>;
|
|
7
222
|
export declare const getInitCmd: () => Promise<Command>;
|
|
8
223
|
export declare const getInjectCmd: () => Promise<Command>;
|
|
224
|
+
export declare const getInstallCmd: () => Promise<Command>;
|
|
9
225
|
export declare const getLibsCmd: () => Promise<Command>;
|
|
226
|
+
export declare const getMagicCmd: () => Promise<Command>;
|
|
10
227
|
export declare const getMergeCmd: () => Promise<Command>;
|
|
11
228
|
export declare const getMigrateCmd: () => Promise<Command>;
|
|
229
|
+
export declare const getMkdistCmd: () => Promise<Command>;
|
|
230
|
+
export declare const getPackCmd: () => Promise<Command>;
|
|
12
231
|
export declare const getPubCmd: () => Promise<Command>;
|
|
232
|
+
export declare const getRemdnCmd: () => Promise<Command>;
|
|
233
|
+
export declare const getRemoveCmd: () => Promise<Command>;
|
|
13
234
|
export declare const getRemptsCmd: () => Promise<Command>;
|
|
14
|
-
export declare const getRenameCmd: () => Promise<Command>;
|
|
15
|
-
export declare const getMagicCmd: () => Promise<Command>;
|
|
16
235
|
export declare const getSplitCmd: () => Promise<Command>;
|
|
17
|
-
export declare const
|
|
236
|
+
export declare const getTransformCmd: () => Promise<Command>;
|
|
18
237
|
export declare const getUpdateCmd: () => Promise<Command>;
|
|
19
238
|
export declare const getUpgradeCmd: () => Promise<Command>;
|
|
239
|
+
export declare const getXCmd: () => Promise<Command>;
|
|
240
|
+
export declare function callCmd<T extends keyof CommandArgsMap>(cmdName: T, args?: CommandArgsMap[T]): Promise<void>;
|
|
241
|
+
export declare function getTypedCmd<T extends keyof CommandArgsMap>(cmdName: T): Promise<{
|
|
242
|
+
command: Command;
|
|
243
|
+
run: (args?: CommandArgsMap[T]) => Promise<void>;
|
|
244
|
+
}>;
|
|
245
|
+
export type { CommandArgsMap };
|
package/bin/app/cmds.js
CHANGED
|
@@ -1,19 +1,36 @@
|
|
|
1
|
-
import { loadCommand } from "@reliverse/rempts";
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export const
|
|
6
|
-
export const
|
|
7
|
-
export const
|
|
8
|
-
export const
|
|
9
|
-
export const
|
|
10
|
-
export const
|
|
11
|
-
export const
|
|
12
|
-
export const
|
|
13
|
-
export const
|
|
14
|
-
export const
|
|
15
|
-
export const
|
|
16
|
-
export const
|
|
17
|
-
export const
|
|
18
|
-
export const
|
|
19
|
-
export const
|
|
1
|
+
import { loadCommand, callCmdImpl, getTypedCmdImpl } from "@reliverse/rempts";
|
|
2
|
+
export async function loadTypedCommand(cmdName) {
|
|
3
|
+
return await loadCommand(cmdName);
|
|
4
|
+
}
|
|
5
|
+
export const getAggCmd = async () => loadTypedCommand("agg");
|
|
6
|
+
export const getBuildCmd = async () => loadTypedCommand("build");
|
|
7
|
+
export const getBuildBinaryCmd = async () => loadTypedCommand("build_binary");
|
|
8
|
+
export const getCheckCmd = async () => loadTypedCommand("check");
|
|
9
|
+
export const getConvCmd = async () => loadTypedCommand("conv");
|
|
10
|
+
export const getCreateCmd = async () => loadTypedCommand("create");
|
|
11
|
+
export const getFsCmd = async () => loadTypedCommand("fs");
|
|
12
|
+
export const getGetCmd = async () => loadTypedCommand("get");
|
|
13
|
+
export const getInitCmd = async () => loadTypedCommand("init");
|
|
14
|
+
export const getInjectCmd = async () => loadTypedCommand("inject");
|
|
15
|
+
export const getInstallCmd = async () => loadTypedCommand("install");
|
|
16
|
+
export const getLibsCmd = async () => loadTypedCommand("libs");
|
|
17
|
+
export const getMagicCmd = async () => loadTypedCommand("magic");
|
|
18
|
+
export const getMergeCmd = async () => loadTypedCommand("merge");
|
|
19
|
+
export const getMigrateCmd = async () => loadTypedCommand("migrate");
|
|
20
|
+
export const getMkdistCmd = async () => loadTypedCommand("mkdist");
|
|
21
|
+
export const getPackCmd = async () => loadTypedCommand("pack");
|
|
22
|
+
export const getPubCmd = async () => loadTypedCommand("pub");
|
|
23
|
+
export const getRemdnCmd = async () => loadTypedCommand("remdn");
|
|
24
|
+
export const getRemoveCmd = async () => loadTypedCommand("remove");
|
|
25
|
+
export const getRemptsCmd = async () => loadTypedCommand("rempts");
|
|
26
|
+
export const getSplitCmd = async () => loadTypedCommand("split");
|
|
27
|
+
export const getTransformCmd = async () => loadTypedCommand("transform");
|
|
28
|
+
export const getUpdateCmd = async () => loadTypedCommand("update");
|
|
29
|
+
export const getUpgradeCmd = async () => loadTypedCommand("upgrade");
|
|
30
|
+
export const getXCmd = async () => loadTypedCommand("x");
|
|
31
|
+
export async function callCmd(cmdName, args) {
|
|
32
|
+
await callCmdImpl(cmdName, args);
|
|
33
|
+
}
|
|
34
|
+
export async function getTypedCmd(cmdName) {
|
|
35
|
+
return await getTypedCmdImpl(cmdName);
|
|
36
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
declare const _default: import("@reliverse/rempts").Command<{
|
|
2
|
+
mode: {
|
|
3
|
+
type: "string";
|
|
4
|
+
description: string;
|
|
5
|
+
default: string;
|
|
6
|
+
};
|
|
7
|
+
tool: {
|
|
8
|
+
type: "string";
|
|
9
|
+
description: string;
|
|
10
|
+
default: string;
|
|
11
|
+
};
|
|
12
|
+
update: {
|
|
13
|
+
type: "boolean";
|
|
14
|
+
description: string;
|
|
15
|
+
default: false;
|
|
16
|
+
};
|
|
17
|
+
}>;
|
|
18
|
+
export default _default;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { relinka } from "@reliverse/relinka";
|
|
2
|
+
import { defineArgs, defineCommand } from "@reliverse/rempts";
|
|
3
|
+
import { ensureConfigMod } from "../../libs/sdk/sdk-impl/config/core.js";
|
|
4
|
+
export default defineCommand({
|
|
5
|
+
meta: {
|
|
6
|
+
name: "config",
|
|
7
|
+
description: "Manage project-level and device-global configurations"
|
|
8
|
+
},
|
|
9
|
+
args: defineArgs({
|
|
10
|
+
mode: {
|
|
11
|
+
type: "string",
|
|
12
|
+
description: "Config mode: copy-remote, copy-internal",
|
|
13
|
+
default: "copy-remote"
|
|
14
|
+
},
|
|
15
|
+
tool: {
|
|
16
|
+
type: "string",
|
|
17
|
+
description: "Tool name (e.g., dler, rse)",
|
|
18
|
+
default: "dler"
|
|
19
|
+
},
|
|
20
|
+
update: {
|
|
21
|
+
type: "boolean",
|
|
22
|
+
description: "Force update existing configuration",
|
|
23
|
+
default: false
|
|
24
|
+
}
|
|
25
|
+
}),
|
|
26
|
+
run: async ({ args }) => {
|
|
27
|
+
const { mode, tool, update } = args;
|
|
28
|
+
try {
|
|
29
|
+
await ensureConfigMod({
|
|
30
|
+
tool,
|
|
31
|
+
mode,
|
|
32
|
+
forceUpdate: update
|
|
33
|
+
});
|
|
34
|
+
relinka("success", `Configuration for ${tool} has been ${update ? "updated" : "created"}`);
|
|
35
|
+
} catch (error) {
|
|
36
|
+
relinka(
|
|
37
|
+
"error",
|
|
38
|
+
`Failed to manage config: ${error instanceof Error ? error.message : String(error)}`
|
|
39
|
+
);
|
|
40
|
+
process.exit(1);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates a JSON schema file from the TypeBox schema
|
|
3
|
+
*/
|
|
4
|
+
export declare function generateJsonSchema(typeboxSchema: any, outputPath: string): Promise<void>;
|
|
5
|
+
/**
|
|
6
|
+
* Generates the schema.json in the project root
|
|
7
|
+
*/
|
|
8
|
+
export declare function generateSchemaFile(schema: any): Promise<void>;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import path from "@reliverse/pathkit";
|
|
2
|
+
import fs from "@reliverse/relifso";
|
|
3
|
+
function convertTypeBoxToJsonSchema(schema) {
|
|
4
|
+
if (!schema || typeof schema !== "object") return schema;
|
|
5
|
+
if (schema.type === "string" && schema.enum) {
|
|
6
|
+
return {
|
|
7
|
+
type: "string",
|
|
8
|
+
enum: schema.enum
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
if (schema.anyOf || schema.allOf || schema.oneOf) {
|
|
12
|
+
const variants = schema.anyOf || schema.allOf || schema.oneOf;
|
|
13
|
+
const allLiterals = variants.every((v) => v.const !== void 0);
|
|
14
|
+
if (allLiterals) {
|
|
15
|
+
return {
|
|
16
|
+
type: "string",
|
|
17
|
+
enum: variants.map((v) => v.const)
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
if (schema.type === "object") {
|
|
22
|
+
const result = {
|
|
23
|
+
type: "object",
|
|
24
|
+
properties: {}
|
|
25
|
+
};
|
|
26
|
+
if (schema.required) {
|
|
27
|
+
result.required = schema.required;
|
|
28
|
+
}
|
|
29
|
+
if (schema.properties) {
|
|
30
|
+
for (const [key, value] of Object.entries(schema.properties)) {
|
|
31
|
+
result.properties[key] = convertTypeBoxToJsonSchema(value);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
if (schema.additionalProperties) {
|
|
35
|
+
result.additionalProperties = convertTypeBoxToJsonSchema(schema.additionalProperties);
|
|
36
|
+
}
|
|
37
|
+
if (schema.patternProperties) {
|
|
38
|
+
result.patternProperties = {};
|
|
39
|
+
for (const [pattern, value] of Object.entries(schema.patternProperties)) {
|
|
40
|
+
result.patternProperties[pattern] = convertTypeBoxToJsonSchema(value);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return result;
|
|
44
|
+
}
|
|
45
|
+
if (schema.type === "array") {
|
|
46
|
+
return {
|
|
47
|
+
type: "array",
|
|
48
|
+
items: convertTypeBoxToJsonSchema(schema.items)
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
if (schema.type) {
|
|
52
|
+
const result = { type: schema.type };
|
|
53
|
+
if (schema.minimum !== void 0) result.minimum = schema.minimum;
|
|
54
|
+
if (schema.maximum !== void 0) result.maximum = schema.maximum;
|
|
55
|
+
if (schema.minLength !== void 0) result.minLength = schema.minLength;
|
|
56
|
+
if (schema.maxLength !== void 0) result.maxLength = schema.maxLength;
|
|
57
|
+
if (schema.pattern !== void 0) result.pattern = schema.pattern;
|
|
58
|
+
if (schema.format !== void 0) result.format = schema.format;
|
|
59
|
+
if (schema.default !== void 0) result.default = schema.default;
|
|
60
|
+
return result;
|
|
61
|
+
}
|
|
62
|
+
return schema;
|
|
63
|
+
}
|
|
64
|
+
export async function generateJsonSchema(typeboxSchema, outputPath) {
|
|
65
|
+
const converted = convertTypeBoxToJsonSchema(typeboxSchema);
|
|
66
|
+
const schema = {
|
|
67
|
+
$schema: "http://json-schema.org/draft-07/schema#",
|
|
68
|
+
title: "rse configuration schema",
|
|
69
|
+
description: "https://docs.reliverse.org",
|
|
70
|
+
type: "object",
|
|
71
|
+
properties: converted.properties,
|
|
72
|
+
required: converted.required
|
|
73
|
+
};
|
|
74
|
+
await fs.writeFile(outputPath, JSON.stringify(schema, null, 2));
|
|
75
|
+
}
|
|
76
|
+
export async function generateSchemaFile(schema) {
|
|
77
|
+
const schemaPath = path.join(process.cwd(), "schema.json");
|
|
78
|
+
if (fs.existsSync(schemaPath)) {
|
|
79
|
+
await fs.remove(schemaPath);
|
|
80
|
+
}
|
|
81
|
+
await generateJsonSchema(schema, schemaPath);
|
|
82
|
+
}
|
package/bin/app/mkdist/cmd.js
CHANGED
|
@@ -2,7 +2,7 @@ import { resolve } from "@reliverse/pathkit";
|
|
|
2
2
|
import { defineArgs, defineCommand } from "@reliverse/rempts";
|
|
3
3
|
import { dlerBuild } from "../build/impl.js";
|
|
4
4
|
import { mkdist } from "../../libs/sdk/sdk-impl/build/providers/mkdist/mkdist-impl/make.js";
|
|
5
|
-
import { ensureDlerConfig } from "../../libs/sdk/sdk-impl/config/
|
|
5
|
+
import { ensureDlerConfig } from "../../libs/sdk/sdk-impl/config/prepare.js";
|
|
6
6
|
export default defineCommand({
|
|
7
7
|
meta: {
|
|
8
8
|
name: "mkdist",
|
package/bin/app/pub/cmd.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineArgs, defineCommand } from "@reliverse/rempts";
|
|
2
2
|
import { dlerPub } from "./impl.js";
|
|
3
|
-
import { ensureDlerConfig } from "../../libs/sdk/sdk-impl/config/init.js";
|
|
4
3
|
import { getConfigDler } from "../../libs/sdk/sdk-impl/config/load.js";
|
|
4
|
+
import { ensureDlerConfig } from "../../libs/sdk/sdk-impl/config/prepare.js";
|
|
5
5
|
export default defineCommand({
|
|
6
6
|
meta: {
|
|
7
7
|
name: "pub",
|