@reliverse/dler 1.2.2 → 1.2.4
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 +126 -69
- package/bin/app/build/cmd.js +17 -0
- package/bin/app/cmds.js +6 -0
- package/bin/{cli/args → app}/inject/README.md +20 -20
- package/bin/{cli/args/inject/inject-mod.js → app/inject/cmd.js} +7 -3
- package/bin/app/inject/expect/cmd.js +43 -0
- package/bin/app/inject/expect/impl.js +162 -0
- package/bin/app/libs/cmd.js +0 -0
- package/bin/app/mono/cmd.js +0 -0
- package/bin/app/pub/cmd.js +17 -0
- package/bin/app/relifso/cmd.js +36 -0
- package/bin/{cli/args/init/init-mod.txt → app/relifso/init/cmd.js} +93 -121
- package/bin/app/relifso/init/impl/mod.js +248 -0
- package/bin/app/relifso/init/impl/types.js +0 -0
- package/bin/app/relinka/cmd.js +0 -0
- package/bin/{cli/args/init/cmd/index.js → app/rempts/init/cmd/cmd.js} +3 -2
- package/bin/app/rempts/init/cmds/cmd.js +80 -0
- package/bin/app/spell/cmd.js +0 -0
- package/bin/app/split/cmd.js +0 -0
- package/bin/{cli/args/tools/index.js → app/tools/cmd.js} +1 -1
- package/bin/cli.js +101 -1
- package/bin/init.js +22 -2
- package/bin/libs/cfg/cfg-default.js +4 -1
- package/bin/libs/sdk/sdk-impl/build/build-library.js +57 -25
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist.js +3 -1
- package/bin/mod.js +7 -39
- package/package.json +6 -7
- package/bin/cli/args/deps/deps-mod.js +0 -48
- package/bin/cli/args/init/libs/reinit/reinit-mod.js +0 -5
- package/bin/cli/args/init/libs/reinit/reint-impl/reinit-mod.txt +0 -395
- package/bin/cli/args/init/types.js +0 -1
- package/bin/cli/args/inject/arg-ts-expect-error.txt +0 -49
- package/bin/cli/args/inject/inject-mod.txt +0 -28
- package/bin/cli/args/inject/reinject.config.js +0 -4
- package/bin/cli/args/inject/ts-expect-error.txt +0 -277
- package/bin/cli/args/spell/spell-mod.js +0 -44
- package/bin/cli/args/split/split-mod.js +0 -26
- /package/bin/{cli/args/agg/agg-mod.js → app/agg/cmd.js} +0 -0
- /package/bin/{cli/args/conv/conv-mod.js → app/auth/cmd.js} +0 -0
- /package/bin/{cli/args → app}/conv/README.md +0 -0
- /package/bin/{cli/args/deps/types.js → app/conv/cmd.js} +0 -0
- /package/bin/{cli/args/init/libs/reinit/reint-impl/types.js → app/deps/cmd.js} +0 -0
- /package/bin/{cli/args/deps → app/deps/impl}/analyzer.js +0 -0
- /package/bin/{cli/args/deps → app/deps/impl}/filesystem.js +0 -0
- /package/bin/{cli/args/deps → app/deps/impl}/formatter.js +0 -0
- /package/bin/{cli/args/deps → app/deps/impl}/parser.js +0 -0
- /package/bin/{cli/args/mono/mono-mod.js → app/deps/impl/types.js} +0 -0
- /package/bin/{cli/args/merger → app/merge}/README.md +0 -0
- /package/bin/{cli/args/merger/merger-mod.txt → app/merge/cmd.txt} +0 -0
- /package/bin/{cli/args/init/libs/reinit/reint-impl → app/relifso/init/impl}/const.js +0 -0
- /package/bin/{cli/args/init/libs/reinit/reint-impl → app/relifso/init/impl}/templates/t-gitignore.js +0 -0
- /package/bin/{cli/args/init/libs/reinit/reint-impl → app/relifso/init/impl}/templates/t-license.js +0 -0
- /package/bin/{cli/args/init/libs/reinit/reint-impl → app/relifso/init/impl}/templates/t-readme.js +0 -0
- /package/bin/{cli/args/init/libs/reinit/reint-impl → app/relifso/init/impl}/utils.js +0 -0
- /package/bin/{cli/args/init → app/rempts}/README.md +0 -0
- /package/bin/{cli/args → app}/split/README.md +0 -0
- /package/bin/{cli/args/split/split-impl.js → app/split/impl.js} +0 -0
- /package/bin/{cli/args/tools/tools-impl.js → app/tools/impl.js} +0 -0
- /package/bin/{tools.txt → app/tools/tools.txt} +0 -0
|
@@ -1,395 +0,0 @@
|
|
|
1
|
-
import { relinka, selectPrompt } from "@reliverse/rempts";
|
|
2
|
-
import { loadConfig } from "c12";
|
|
3
|
-
import fs from "fs-extra";
|
|
4
|
-
import pMap from "p-map";
|
|
5
|
-
import path from "pathe";
|
|
6
|
-
|
|
7
|
-
import type {
|
|
8
|
-
DestFileExistsBehaviour,
|
|
9
|
-
FileType,
|
|
10
|
-
InitBehaviour,
|
|
11
|
-
InitFileRequest,
|
|
12
|
-
InitFileResult,
|
|
13
|
-
ReinitUserConfig,
|
|
14
|
-
} from "./types.js";
|
|
15
|
-
|
|
16
|
-
import { FILE_TYPES } from "./const.js";
|
|
17
|
-
import { gitignoreTemplate } from "./templates/t-gitignore.js";
|
|
18
|
-
import { licenseTemplate } from "./templates/t-license.js";
|
|
19
|
-
import { readmeTemplate } from "./templates/t-readme.js";
|
|
20
|
-
import { escapeMarkdownCodeBlocks } from "./utils.js";
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Creates a file from scratch, including parent directories,
|
|
24
|
-
* basing the file content on the fileType.
|
|
25
|
-
*/
|
|
26
|
-
export async function createFileFromScratch(
|
|
27
|
-
destPath: string,
|
|
28
|
-
fileType: FileType, // e.g. "cfg:eslint", "md:LICENSE", "md:README", ...
|
|
29
|
-
contentCreateMode?: string,
|
|
30
|
-
) {
|
|
31
|
-
// Ensure parent directory
|
|
32
|
-
await fs.ensureDir(path.dirname(destPath));
|
|
33
|
-
|
|
34
|
-
let content = "";
|
|
35
|
-
switch (fileType) {
|
|
36
|
-
case "md:LICENSE":
|
|
37
|
-
content = licenseTemplate;
|
|
38
|
-
break;
|
|
39
|
-
case "md:README":
|
|
40
|
-
content = escapeMarkdownCodeBlocks(readmeTemplate);
|
|
41
|
-
break;
|
|
42
|
-
case "git:gitignore":
|
|
43
|
-
content = gitignoreTemplate;
|
|
44
|
-
break;
|
|
45
|
-
default:
|
|
46
|
-
content = `// Auto-generated file for type: ${fileType}`;
|
|
47
|
-
break;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
if (contentCreateMode) {
|
|
51
|
-
content = contentCreateMode;
|
|
52
|
-
relinka("verbose", `Using custom content for file ${destPath}`);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
await fs.outputFile(destPath, content, { encoding: "utf-8" });
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Loads user config from `reinit.config.(ts|js|json...)` using c12
|
|
60
|
-
* and merges with fallback defaults.
|
|
61
|
-
*/
|
|
62
|
-
async function loadReinitConfig(): Promise<ReinitUserConfig> {
|
|
63
|
-
const { config } = await loadConfig<ReinitUserConfig>({
|
|
64
|
-
name: "reinit",
|
|
65
|
-
defaults: {},
|
|
66
|
-
overrides: {},
|
|
67
|
-
dotenv: false,
|
|
68
|
-
packageJson: false,
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
const merged: ReinitUserConfig = {
|
|
72
|
-
defaultInitBehaviour: config.defaultInitBehaviour ?? "create",
|
|
73
|
-
defaultDestFileExistsBehaviour:
|
|
74
|
-
config.defaultDestFileExistsBehaviour ?? "prompt",
|
|
75
|
-
parallelByDefault: config.parallelByDefault ?? false,
|
|
76
|
-
parallelConcurrency: config.parallelConcurrency ?? 4,
|
|
77
|
-
onFileStart: config.onFileStart,
|
|
78
|
-
onFileComplete: config.onFileComplete,
|
|
79
|
-
};
|
|
80
|
-
return merged;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Single-file initialization using the merged config.
|
|
85
|
-
*/
|
|
86
|
-
export async function initFile(
|
|
87
|
-
req: InitFileRequest,
|
|
88
|
-
userCfg?: ReinitUserConfig,
|
|
89
|
-
): Promise<InitFileResult> {
|
|
90
|
-
const config = userCfg ?? (await loadReinitConfig());
|
|
91
|
-
const initBehaviour = req.initBehaviour ?? config.defaultInitBehaviour!;
|
|
92
|
-
const existsBehaviour =
|
|
93
|
-
req.destFileExistsBehaviour ?? config.defaultDestFileExistsBehaviour!;
|
|
94
|
-
|
|
95
|
-
config.onFileStart?.(req);
|
|
96
|
-
|
|
97
|
-
let result: InitFileResult;
|
|
98
|
-
try {
|
|
99
|
-
result = await doInitFile(req, initBehaviour, existsBehaviour);
|
|
100
|
-
} catch (error) {
|
|
101
|
-
result = {
|
|
102
|
-
requested: req,
|
|
103
|
-
status: "error",
|
|
104
|
-
error,
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
config.onFileComplete?.(result);
|
|
109
|
-
return result;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Multi-file version. By default, uses the "parallelByDefault" from config.
|
|
114
|
-
* If parallel is true, uses p-map with concurrency from "parallelConcurrency".
|
|
115
|
-
*/
|
|
116
|
-
export async function initFiles(
|
|
117
|
-
items: InitFileRequest[],
|
|
118
|
-
options?: { parallel?: boolean; concurrency?: number },
|
|
119
|
-
userCfg?: ReinitUserConfig,
|
|
120
|
-
): Promise<InitFileResult[]> {
|
|
121
|
-
const config = userCfg ?? (await loadReinitConfig());
|
|
122
|
-
|
|
123
|
-
const parallel =
|
|
124
|
-
typeof options?.parallel === "boolean"
|
|
125
|
-
? options.parallel
|
|
126
|
-
: config.parallelByDefault;
|
|
127
|
-
|
|
128
|
-
const concurrency = options?.concurrency ?? config.parallelConcurrency ?? 4;
|
|
129
|
-
|
|
130
|
-
if (parallel) {
|
|
131
|
-
return pMap(items, (item) => initFile(item, config), { concurrency });
|
|
132
|
-
} else {
|
|
133
|
-
const results: InitFileResult[] = [];
|
|
134
|
-
for (const item of items) {
|
|
135
|
-
results.push(await initFile(item, config));
|
|
136
|
-
}
|
|
137
|
-
return results;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* The main logic for creating or copying a file.
|
|
143
|
-
*/
|
|
144
|
-
async function doInitFile(
|
|
145
|
-
req: InitFileRequest,
|
|
146
|
-
initBehaviour: InitBehaviour,
|
|
147
|
-
destFileExistsBehaviour: DestFileExistsBehaviour,
|
|
148
|
-
): Promise<InitFileResult> {
|
|
149
|
-
const { fileType, destDir, options } = req;
|
|
150
|
-
const { destFileName, srcCopyMode, fallbackSource } = options ?? {};
|
|
151
|
-
|
|
152
|
-
// Look up known variations for the fileType
|
|
153
|
-
const knownType = FILE_TYPES.find(
|
|
154
|
-
(f) => f.type.toLowerCase() === fileType.toLowerCase(),
|
|
155
|
-
);
|
|
156
|
-
const variations = knownType ? knownType.variations : [fileType];
|
|
157
|
-
|
|
158
|
-
// Possibly prompt if multiple variations exist
|
|
159
|
-
let chosenVariation: string;
|
|
160
|
-
if (variations.length === 1) {
|
|
161
|
-
chosenVariation = variations[0];
|
|
162
|
-
} else {
|
|
163
|
-
chosenVariation = await selectPrompt({
|
|
164
|
-
title: `Select variation for ${fileType}`,
|
|
165
|
-
options: variations.map((v) => ({ label: v, value: v })),
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
const finalName = destFileName ?? chosenVariation;
|
|
170
|
-
|
|
171
|
-
// Convert destDir to absolute path
|
|
172
|
-
const absoluteDestDir = path.resolve(process.cwd(), destDir || "");
|
|
173
|
-
const resolvedDestPath = path.join(absoluteDestDir, finalName);
|
|
174
|
-
|
|
175
|
-
relinka(
|
|
176
|
-
"verbose",
|
|
177
|
-
`Preparing to init file:
|
|
178
|
-
- File Type: ${fileType}
|
|
179
|
-
- Variation: ${chosenVariation}
|
|
180
|
-
- Destination Dir: ${absoluteDestDir}
|
|
181
|
-
- Final Path: ${resolvedDestPath}
|
|
182
|
-
`,
|
|
183
|
-
);
|
|
184
|
-
|
|
185
|
-
// If file already exists
|
|
186
|
-
const alreadyExists = await fs.pathExists(resolvedDestPath);
|
|
187
|
-
if (alreadyExists) {
|
|
188
|
-
const maybeNewDest = await handleExistingFile(
|
|
189
|
-
resolvedDestPath,
|
|
190
|
-
destFileExistsBehaviour,
|
|
191
|
-
);
|
|
192
|
-
if (!maybeNewDest) {
|
|
193
|
-
return {
|
|
194
|
-
requested: req,
|
|
195
|
-
status: "skipped",
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
if (maybeNewDest !== resolvedDestPath) {
|
|
199
|
-
// e.g., attach-index was chosen
|
|
200
|
-
relinka("log", `attach-index or rename => ${maybeNewDest}`);
|
|
201
|
-
return await finalizeInit(
|
|
202
|
-
req,
|
|
203
|
-
initBehaviour,
|
|
204
|
-
chosenVariation,
|
|
205
|
-
maybeNewDest,
|
|
206
|
-
);
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
return await finalizeInit(
|
|
211
|
-
req,
|
|
212
|
-
initBehaviour,
|
|
213
|
-
chosenVariation,
|
|
214
|
-
resolvedDestPath,
|
|
215
|
-
);
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
/** Reusable helper to finalize creation or copy after we pick a path. */
|
|
219
|
-
async function finalizeInit(
|
|
220
|
-
req: InitFileRequest,
|
|
221
|
-
initBehaviour: InitBehaviour,
|
|
222
|
-
chosenVariation: string,
|
|
223
|
-
resolvedDestPath: string,
|
|
224
|
-
): Promise<InitFileResult> {
|
|
225
|
-
try {
|
|
226
|
-
switch (initBehaviour) {
|
|
227
|
-
case "copy":
|
|
228
|
-
return await runCopy(req, chosenVariation, resolvedDestPath);
|
|
229
|
-
case "create":
|
|
230
|
-
return await runCreate(req, resolvedDestPath);
|
|
231
|
-
// If user or config explicitly sets "create-if-copy-failed" or something else
|
|
232
|
-
case "create-if-copy-failed":
|
|
233
|
-
default:
|
|
234
|
-
try {
|
|
235
|
-
return await runCopy(req, chosenVariation, resolvedDestPath);
|
|
236
|
-
} catch (err) {
|
|
237
|
-
relinka(
|
|
238
|
-
"warn",
|
|
239
|
-
`Copy failed for ${chosenVariation}, fallback to create...`,
|
|
240
|
-
);
|
|
241
|
-
return await runCreate(req, resolvedDestPath);
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
} catch (error) {
|
|
245
|
-
throw error;
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
async function runCopy(
|
|
250
|
-
req: InitFileRequest,
|
|
251
|
-
chosenVariation: string,
|
|
252
|
-
resolvedDestPath: string,
|
|
253
|
-
): Promise<InitFileResult> {
|
|
254
|
-
const { srcCopyMode, fallbackSource } = req.options ?? {};
|
|
255
|
-
const resolvedSrcDir = path.resolve(process.cwd(), srcCopyMode || "");
|
|
256
|
-
const sourcePath = path.join(resolvedSrcDir, chosenVariation);
|
|
257
|
-
|
|
258
|
-
if (sourcePath === resolvedDestPath) {
|
|
259
|
-
relinka(
|
|
260
|
-
"warn",
|
|
261
|
-
`Source path equals destination => doing a no-op: ${sourcePath}`,
|
|
262
|
-
);
|
|
263
|
-
return {
|
|
264
|
-
requested: req,
|
|
265
|
-
finalPath: resolvedDestPath,
|
|
266
|
-
status: "copied",
|
|
267
|
-
};
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
relinka(
|
|
271
|
-
"log",
|
|
272
|
-
`Attempting copy:
|
|
273
|
-
- Source Dir: ${resolvedSrcDir}
|
|
274
|
-
- Source Path: ${sourcePath}
|
|
275
|
-
- Destination Path: ${resolvedDestPath}
|
|
276
|
-
`,
|
|
277
|
-
);
|
|
278
|
-
|
|
279
|
-
try {
|
|
280
|
-
await fs.ensureDir(path.dirname(resolvedDestPath));
|
|
281
|
-
|
|
282
|
-
if (!(await fs.pathExists(sourcePath))) {
|
|
283
|
-
throw new Error(`Source file not found: ${sourcePath}`);
|
|
284
|
-
}
|
|
285
|
-
await fs.copy(sourcePath, resolvedDestPath, { overwrite: true });
|
|
286
|
-
relinka("log", `Copied file: ${chosenVariation} -> ${resolvedDestPath}`);
|
|
287
|
-
return {
|
|
288
|
-
requested: req,
|
|
289
|
-
finalPath: resolvedDestPath,
|
|
290
|
-
status: "copied",
|
|
291
|
-
};
|
|
292
|
-
} catch (primaryErr) {
|
|
293
|
-
if (fallbackSource) {
|
|
294
|
-
relinka(
|
|
295
|
-
"warn",
|
|
296
|
-
`Primary copy failed, trying fallback: ${fallbackSource}`,
|
|
297
|
-
);
|
|
298
|
-
const fallbackFullPath = path.join(resolvedSrcDir, fallbackSource);
|
|
299
|
-
try {
|
|
300
|
-
await fs.ensureDir(path.dirname(resolvedDestPath));
|
|
301
|
-
if (!(await fs.pathExists(fallbackFullPath))) {
|
|
302
|
-
throw new Error(
|
|
303
|
-
`Fallback source file not found: ${fallbackFullPath}`,
|
|
304
|
-
);
|
|
305
|
-
}
|
|
306
|
-
await fs.copy(fallbackFullPath, resolvedDestPath, { overwrite: true });
|
|
307
|
-
relinka(
|
|
308
|
-
"log",
|
|
309
|
-
`Fallback copy: ${fallbackSource} -> ${resolvedDestPath}`,
|
|
310
|
-
);
|
|
311
|
-
return {
|
|
312
|
-
requested: req,
|
|
313
|
-
finalPath: resolvedDestPath,
|
|
314
|
-
status: "copied",
|
|
315
|
-
};
|
|
316
|
-
} catch (fallbackErr) {
|
|
317
|
-
throw new Error(
|
|
318
|
-
`Primary copy error: ${String(primaryErr)}\nFallback copy error: ${String(
|
|
319
|
-
fallbackErr,
|
|
320
|
-
)}`,
|
|
321
|
-
);
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
throw primaryErr;
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
async function runCreate(
|
|
329
|
-
req: InitFileRequest,
|
|
330
|
-
resolvedDestPath: string,
|
|
331
|
-
): Promise<InitFileResult> {
|
|
332
|
-
relinka("verbose", `Creating file from scratch at: ${resolvedDestPath}`);
|
|
333
|
-
|
|
334
|
-
// The "fileType" is used to decide how to create content inside `createFileFromScratch`
|
|
335
|
-
const { fileType } = req;
|
|
336
|
-
|
|
337
|
-
await createFileFromScratch(resolvedDestPath, fileType);
|
|
338
|
-
relinka("verbose", `Created file from scratch: ${resolvedDestPath}`);
|
|
339
|
-
return {
|
|
340
|
-
requested: req,
|
|
341
|
-
finalPath: resolvedDestPath,
|
|
342
|
-
status: "created",
|
|
343
|
-
};
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
/** If file exists, handle rewrite, skip, attach-index, or prompt. */
|
|
347
|
-
async function handleExistingFile(
|
|
348
|
-
destPath: string,
|
|
349
|
-
behaviour: DestFileExistsBehaviour,
|
|
350
|
-
): Promise<string | null> {
|
|
351
|
-
switch (behaviour) {
|
|
352
|
-
case "rewrite":
|
|
353
|
-
relinka("warn", `File exists, rewriting in-place: ${destPath}`);
|
|
354
|
-
return destPath;
|
|
355
|
-
|
|
356
|
-
case "skip":
|
|
357
|
-
relinka("warn", `File exists, skipping: ${destPath}`);
|
|
358
|
-
return null;
|
|
359
|
-
|
|
360
|
-
case "attach-index":
|
|
361
|
-
return attachIndex(destPath);
|
|
362
|
-
|
|
363
|
-
case "prompt":
|
|
364
|
-
const choice = await selectPrompt({
|
|
365
|
-
title: `File exists: ${path.basename(destPath)}. How to handle?`,
|
|
366
|
-
options: [
|
|
367
|
-
{ label: "Overwrite", value: "overwrite" },
|
|
368
|
-
{ label: "Skip", value: "skip" },
|
|
369
|
-
{ label: "Attach Index", value: "attachIndex" },
|
|
370
|
-
],
|
|
371
|
-
});
|
|
372
|
-
if (choice === "skip") return null;
|
|
373
|
-
if (choice === "attachIndex") {
|
|
374
|
-
return attachIndex(destPath);
|
|
375
|
-
}
|
|
376
|
-
relinka("warn", `Overwriting in-place: ${destPath}`);
|
|
377
|
-
return destPath;
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
/** For attach-index, do file.1.ext, file.2.ext, etc. */
|
|
382
|
-
async function attachIndex(originalPath: string) {
|
|
383
|
-
const ext = path.extname(originalPath);
|
|
384
|
-
const base = path.basename(originalPath, ext);
|
|
385
|
-
const dir = path.dirname(originalPath);
|
|
386
|
-
|
|
387
|
-
let counter = 1;
|
|
388
|
-
let newPath = originalPath;
|
|
389
|
-
while (await fs.pathExists(newPath)) {
|
|
390
|
-
newPath = path.join(dir, `${base}.${counter}${ext}`);
|
|
391
|
-
counter++;
|
|
392
|
-
}
|
|
393
|
-
relinka("log", `Attaching index => ${newPath}`);
|
|
394
|
-
return newPath;
|
|
395
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./libs/reinit/reint-impl/types.js";
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { relinka } from "@reliverse/relinka";
|
|
2
|
-
import { defineCommand } from "@reliverse/rempts";
|
|
3
|
-
|
|
4
|
-
import { useTsExpectError } from "./ts-expect-error.js";
|
|
5
|
-
|
|
6
|
-
export default defineCommand({
|
|
7
|
-
meta: {
|
|
8
|
-
name: "tee",
|
|
9
|
-
description: "Inject `@ts-expect-error` above lines where TS errors occur",
|
|
10
|
-
},
|
|
11
|
-
args: {
|
|
12
|
-
dev: {
|
|
13
|
-
type: "boolean",
|
|
14
|
-
description: "Run the CLI in dev mode",
|
|
15
|
-
},
|
|
16
|
-
files: {
|
|
17
|
-
type: "positional",
|
|
18
|
-
// array: true, // TODO: implement in dler
|
|
19
|
-
required: true,
|
|
20
|
-
description: `'auto' or path(s) to line references file(s)`,
|
|
21
|
-
},
|
|
22
|
-
comment: {
|
|
23
|
-
type: "string",
|
|
24
|
-
required: false,
|
|
25
|
-
description:
|
|
26
|
-
"Override the comment line to insert. Default is `// @ts-expect-error TODO: fix ts`",
|
|
27
|
-
},
|
|
28
|
-
tscPaths: {
|
|
29
|
-
type: "string",
|
|
30
|
-
// array: true,
|
|
31
|
-
required: false,
|
|
32
|
-
description:
|
|
33
|
-
"Optional: specify path(s) to restrict TSC processing (only effective when using 'auto')",
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
run: async ({ args }) => {
|
|
37
|
-
if (args.dev) {
|
|
38
|
-
relinka("verbose", "Using dev mode");
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
await useTsExpectError({
|
|
42
|
-
files: [args.files],
|
|
43
|
-
comment: args.comment,
|
|
44
|
-
tscPaths: [args.tscPaths],
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
process.exit(0);
|
|
48
|
-
},
|
|
49
|
-
});
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
// todo: implement
|
|
2
|
-
import { defineCommand, errorHandler, runMain } from "@reliverse/rempts";
|
|
3
|
-
|
|
4
|
-
const main = defineCommand({
|
|
5
|
-
meta: {
|
|
6
|
-
name: "reinject",
|
|
7
|
-
version: "1.0.0",
|
|
8
|
-
description: "@reliverse/reinject-cli",
|
|
9
|
-
},
|
|
10
|
-
args: {
|
|
11
|
-
dev: {
|
|
12
|
-
type: "boolean",
|
|
13
|
-
description: "Runs the CLI in dev mode",
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
subCommands: {
|
|
17
|
-
cli: () => import("./cli/cli-mod.js").then((r) => r.default),
|
|
18
|
-
tee: () =>
|
|
19
|
-
import("./cli/args/arg-ts-expect-error.js").then((r) => r.default),
|
|
20
|
-
},
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
await runMain(main).catch((error: unknown) => {
|
|
24
|
-
errorHandler(
|
|
25
|
-
error instanceof Error ? error : new Error(String(error)),
|
|
26
|
-
"An unhandled error occurred, please report it at https://github.com/reliverse/reinject",
|
|
27
|
-
);
|
|
28
|
-
});
|