@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
package/bin/cli.js
CHANGED
|
@@ -10,7 +10,107 @@ import { handleDlerError } from "./libs/sdk/sdk-impl/utils/utils-error.js";
|
|
|
10
10
|
import { finalizeBuild } from "./libs/sdk/sdk-impl/utils/utils-info.js";
|
|
11
11
|
import { createPerfTimer } from "./libs/sdk/sdk-impl/utils/utils-perf.js";
|
|
12
12
|
import { loadConfig } from "./load.js";
|
|
13
|
-
export async function
|
|
13
|
+
export async function dlerBuild(isDev) {
|
|
14
|
+
const timer = createPerfTimer();
|
|
15
|
+
try {
|
|
16
|
+
const config = await loadConfig();
|
|
17
|
+
if (isDev) {
|
|
18
|
+
config.commonPubPause = true;
|
|
19
|
+
config.bumpDisable = true;
|
|
20
|
+
relinka(
|
|
21
|
+
"log",
|
|
22
|
+
"Development mode: Publishing paused and version bumping disabled."
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
if (config.logsFreshFile) {
|
|
26
|
+
await fs.remove(path.join(PROJECT_ROOT, config.logsFileName));
|
|
27
|
+
}
|
|
28
|
+
await removeDistFolders(
|
|
29
|
+
config.distNpmDirName,
|
|
30
|
+
config.distJsrDirName,
|
|
31
|
+
config.libsDirDist,
|
|
32
|
+
config.libsList
|
|
33
|
+
);
|
|
34
|
+
if (!config.bumpDisable) {
|
|
35
|
+
await bumpHandler(
|
|
36
|
+
config.bumpMode,
|
|
37
|
+
config.bumpDisable,
|
|
38
|
+
config.commonPubPause,
|
|
39
|
+
config.bumpFilter
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
await processRegularFlow(
|
|
43
|
+
timer,
|
|
44
|
+
isDev,
|
|
45
|
+
config.coreIsCLI,
|
|
46
|
+
config.libsActMode,
|
|
47
|
+
config.commonPubRegistry,
|
|
48
|
+
config.coreEntrySrcDir,
|
|
49
|
+
config.distNpmDirName,
|
|
50
|
+
config.distNpmBuilder,
|
|
51
|
+
config.coreEntryFile,
|
|
52
|
+
config.distJsrDryRun,
|
|
53
|
+
config.distJsrFailOnWarn,
|
|
54
|
+
config.commonPubPause,
|
|
55
|
+
config.distJsrDirName,
|
|
56
|
+
config.distJsrBuilder,
|
|
57
|
+
config.transpileTarget,
|
|
58
|
+
config.transpileFormat,
|
|
59
|
+
config.transpileSplitting,
|
|
60
|
+
config.transpileMinify,
|
|
61
|
+
config.transpileSourcemap,
|
|
62
|
+
config.transpilePublicPath,
|
|
63
|
+
config.distJsrAllowDirty,
|
|
64
|
+
config.distJsrSlowTypes,
|
|
65
|
+
config.distNpmOutFilesExt,
|
|
66
|
+
config.rmDepsMode,
|
|
67
|
+
config.transpileStub,
|
|
68
|
+
config.transpileWatch,
|
|
69
|
+
config.distJsrGenTsconfig,
|
|
70
|
+
config.coreDeclarations,
|
|
71
|
+
{ coreDescription: config.coreDescription }
|
|
72
|
+
);
|
|
73
|
+
await processLibraryFlow(
|
|
74
|
+
timer,
|
|
75
|
+
isDev,
|
|
76
|
+
config.libsActMode,
|
|
77
|
+
config.libsList,
|
|
78
|
+
config.distJsrDryRun,
|
|
79
|
+
config.distJsrFailOnWarn,
|
|
80
|
+
config.libsDirDist,
|
|
81
|
+
config.libsDirSrc,
|
|
82
|
+
config.commonPubPause,
|
|
83
|
+
config.commonPubRegistry,
|
|
84
|
+
config.distNpmOutFilesExt,
|
|
85
|
+
config.distNpmBuilder,
|
|
86
|
+
config.coreEntrySrcDir,
|
|
87
|
+
config.rmDepsMode,
|
|
88
|
+
config.rmDepsPatterns,
|
|
89
|
+
config.transpileEsbuild,
|
|
90
|
+
config.transpileTarget,
|
|
91
|
+
config.transpileFormat,
|
|
92
|
+
config.transpileSplitting,
|
|
93
|
+
config.transpileSourcemap,
|
|
94
|
+
config.transpilePublicPath,
|
|
95
|
+
config.distJsrBuilder,
|
|
96
|
+
config.transpileStub,
|
|
97
|
+
config.transpileWatch,
|
|
98
|
+
config.distJsrOutFilesExt
|
|
99
|
+
);
|
|
100
|
+
await finalizeBuild(
|
|
101
|
+
timer,
|
|
102
|
+
config.commonPubPause,
|
|
103
|
+
config.libsList,
|
|
104
|
+
config.distNpmDirName,
|
|
105
|
+
config.distJsrDirName,
|
|
106
|
+
config.libsDirDist,
|
|
107
|
+
isDev
|
|
108
|
+
);
|
|
109
|
+
} catch (error) {
|
|
110
|
+
handleDlerError(error, timer);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
export async function dlerPub(isDev) {
|
|
14
114
|
const timer = createPerfTimer();
|
|
15
115
|
try {
|
|
16
116
|
const config = await loadConfig();
|
package/bin/init.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { relinka } from "@reliverse/relinka";
|
|
2
2
|
import fs from "fs-extra";
|
|
3
3
|
import path from "pathe";
|
|
4
|
+
import { readPackageJSON } from "pkg-types";
|
|
4
5
|
import { DEFAULT_CONFIG } from "./libs/cfg/cfg-default.js";
|
|
5
6
|
const CONFIG_FILENAME = ".config/dler.ts";
|
|
6
7
|
export async function initDlerConfig(isDev) {
|
|
@@ -10,7 +11,15 @@ export async function initDlerConfig(isDev) {
|
|
|
10
11
|
return;
|
|
11
12
|
}
|
|
12
13
|
try {
|
|
13
|
-
|
|
14
|
+
let pkgDescription = void 0;
|
|
15
|
+
try {
|
|
16
|
+
const pkg = await readPackageJSON();
|
|
17
|
+
if (pkg && typeof pkg.description === "string" && pkg.description.trim()) {
|
|
18
|
+
pkgDescription = pkg.description.trim();
|
|
19
|
+
}
|
|
20
|
+
} catch {
|
|
21
|
+
}
|
|
22
|
+
const configContent = generateConfig(isDev, pkgDescription);
|
|
14
23
|
await fs.outputFile(configPath, configContent, "utf-8");
|
|
15
24
|
relinka("success", `Config was created at ${configPath}`);
|
|
16
25
|
relinka("log", "Edit this file to customize build and publish settings");
|
|
@@ -29,7 +38,7 @@ export async function initDlerConfig(isDev) {
|
|
|
29
38
|
process.exit(1);
|
|
30
39
|
}
|
|
31
40
|
}
|
|
32
|
-
function generateConfig(isDev) {
|
|
41
|
+
function generateConfig(isDev, pkgDescription) {
|
|
33
42
|
const importDefineConfigStatement = isDev ? `import { defineConfig } from "./libs/cfg/cfg-mod.js";` : `import { defineConfig } from "@reliverse/dler-cfg";`;
|
|
34
43
|
const verboseValue = getValue(isDev, true, DEFAULT_CONFIG.commonVerbose);
|
|
35
44
|
const isCLIValue = getValue(isDev, true, DEFAULT_CONFIG.coreIsCLI);
|
|
@@ -48,6 +57,12 @@ function generateConfig(isDev) {
|
|
|
48
57
|
false,
|
|
49
58
|
DEFAULT_CONFIG.coreDeclarations
|
|
50
59
|
);
|
|
60
|
+
const coreDescriptionValue = getValue(
|
|
61
|
+
isDev,
|
|
62
|
+
// TODO: remove `description` from dler's `package.json` when ensured that whole dler's codebase can optionally read dler.ts' `coreDescription`
|
|
63
|
+
"dler (prev. relidler) is a flexible, unified, and fully automated bundler for TypeScript and JavaScript projects, as well as an NPM and JSR publishing tool.",
|
|
64
|
+
pkgDescription || DEFAULT_CONFIG.coreDescription
|
|
65
|
+
);
|
|
51
66
|
const libsActModeValue = getValue(
|
|
52
67
|
isDev,
|
|
53
68
|
"main-and-libs",
|
|
@@ -100,6 +115,7 @@ export default defineConfig({
|
|
|
100
115
|
|
|
101
116
|
// Core configuration
|
|
102
117
|
coreDeclarations: ${coreDeclarationsValue},
|
|
118
|
+
coreDescription: ${JSON.stringify(coreDescriptionValue)},
|
|
103
119
|
coreEntryFile: "${DEFAULT_CONFIG.coreEntryFile}",
|
|
104
120
|
coreEntrySrcDir: "${DEFAULT_CONFIG.coreEntrySrcDir}",
|
|
105
121
|
coreIsCLI: ${isCLIValue},
|
|
@@ -148,6 +164,10 @@ export default defineConfig({
|
|
|
148
164
|
transpileStub: ${DEFAULT_CONFIG.transpileStub},
|
|
149
165
|
transpileTarget: "${DEFAULT_CONFIG.transpileTarget}",
|
|
150
166
|
transpileWatch: ${DEFAULT_CONFIG.transpileWatch},
|
|
167
|
+
|
|
168
|
+
// Additionals
|
|
169
|
+
injectComment: "${DEFAULT_CONFIG.injectComment}",
|
|
170
|
+
tscCommand: "${DEFAULT_CONFIG.tscCommand}",
|
|
151
171
|
});
|
|
152
172
|
`;
|
|
153
173
|
return configTemplate;
|
|
@@ -6,6 +6,7 @@ export const DEFAULT_CONFIG = {
|
|
|
6
6
|
commonPubRegistry: "npm",
|
|
7
7
|
commonVerbose: false,
|
|
8
8
|
coreDeclarations: true,
|
|
9
|
+
coreDescription: "",
|
|
9
10
|
coreEntryFile: "mod.ts",
|
|
10
11
|
coreEntrySrcDir: "src",
|
|
11
12
|
coreIsCLI: false,
|
|
@@ -46,5 +47,7 @@ export const DEFAULT_CONFIG = {
|
|
|
46
47
|
transpileSplitting: false,
|
|
47
48
|
transpileStub: false,
|
|
48
49
|
transpileTarget: "node",
|
|
49
|
-
transpileWatch: false
|
|
50
|
+
transpileWatch: false,
|
|
51
|
+
injectComment: "// @ts-expect-error TODO: fix ts",
|
|
52
|
+
tscCommand: "tsc --project ./tsconfig.json --noEmit"
|
|
50
53
|
};
|
|
@@ -145,20 +145,28 @@ async function library_buildJsrDist(options) {
|
|
|
145
145
|
outputDirRootResolved,
|
|
146
146
|
BIN_DIR_NAME
|
|
147
147
|
);
|
|
148
|
-
const
|
|
148
|
+
const { libSpecificSrcDir, libDirName } = await determineNpmSourceDirectory(
|
|
149
|
+
libName,
|
|
150
|
+
libMainFile,
|
|
151
|
+
libSourceDirResolved,
|
|
152
|
+
libsList,
|
|
153
|
+
"jsr"
|
|
154
|
+
);
|
|
155
|
+
const bundlerEntryPoint = distJsrBuilder === "jsr" ? libSpecificSrcDir : entryFilePathResolved;
|
|
149
156
|
const libConfig = libsList[libName];
|
|
150
157
|
const libDeclarations = libConfig?.libDeclarations ?? false;
|
|
151
158
|
const buildParams = {
|
|
152
159
|
targetType,
|
|
153
160
|
builder: distJsrBuilder,
|
|
154
|
-
libSourceDir:
|
|
161
|
+
libSourceDir: libSpecificSrcDir,
|
|
155
162
|
entryFilePath: bundlerEntryPoint,
|
|
156
163
|
outputDirRoot: outputDirRootResolved,
|
|
157
164
|
outputDirBin: outputDirBinResolved,
|
|
158
165
|
libDeclarations,
|
|
159
166
|
distJsrOutFilesExt,
|
|
160
|
-
options
|
|
161
|
-
|
|
167
|
+
options,
|
|
168
|
+
libDirName
|
|
169
|
+
// Pass determined libDirName
|
|
162
170
|
};
|
|
163
171
|
await buildDistributionTarget(buildParams);
|
|
164
172
|
relinka(
|
|
@@ -304,21 +312,36 @@ async function buildDistributionTarget(params) {
|
|
|
304
312
|
unifiedBundlerOutExt
|
|
305
313
|
};
|
|
306
314
|
await library_bundleWithBuilder(bundleRequest);
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
315
|
+
if (await fs.pathExists(outputDirBin)) {
|
|
316
|
+
const files = await fs.readdir(outputDirBin);
|
|
317
|
+
if (files.length > 0) {
|
|
318
|
+
await library_performCommonBuildSteps({
|
|
319
|
+
coreEntryFileName: path.basename(libMainFile),
|
|
320
|
+
outDirRoot: outputDirRoot,
|
|
321
|
+
outDirBin: outputDirBin,
|
|
322
|
+
isJsr,
|
|
323
|
+
libName,
|
|
324
|
+
libsList,
|
|
325
|
+
rmDepsMode,
|
|
326
|
+
rmDepsPatterns,
|
|
327
|
+
unifiedBundlerOutExt,
|
|
328
|
+
distJsrOutFilesExt,
|
|
329
|
+
deleteFiles: isJsr,
|
|
330
|
+
// Only delete files for JSR builds
|
|
331
|
+
libDirName
|
|
332
|
+
});
|
|
333
|
+
} else {
|
|
334
|
+
relinka(
|
|
335
|
+
"warn",
|
|
336
|
+
`${logPrefix} No files found in ${outputDirBin} after bundling`
|
|
337
|
+
);
|
|
338
|
+
}
|
|
339
|
+
} else {
|
|
340
|
+
relinka(
|
|
341
|
+
"warn",
|
|
342
|
+
`${logPrefix} Output directory ${outputDirBin} does not exist after bundling`
|
|
343
|
+
);
|
|
344
|
+
}
|
|
322
345
|
relinka("log", `${logPrefix} Completed build target processing.`);
|
|
323
346
|
}
|
|
324
347
|
async function library_bundleWithBuilder(params) {
|
|
@@ -494,19 +517,26 @@ async function library_bundleUsingUnified(entryPoint, outDirBin, builder, source
|
|
|
494
517
|
);
|
|
495
518
|
validatedExt = "js";
|
|
496
519
|
}
|
|
497
|
-
|
|
498
|
-
const outDirRelative = path.relative(rootDir, outDirBin);
|
|
520
|
+
await ensuredir(outDirBin);
|
|
499
521
|
const unifiedBuildConfig = {
|
|
500
522
|
clean: false,
|
|
501
523
|
declaration: libDeclarations ? "compatible" : false,
|
|
502
524
|
entries: [
|
|
503
525
|
{
|
|
504
526
|
builder,
|
|
505
|
-
input:
|
|
506
|
-
outDir:
|
|
507
|
-
|
|
527
|
+
input: entryPoint,
|
|
528
|
+
outDir: outDirBin,
|
|
529
|
+
// Explicitly set the output directory
|
|
530
|
+
rootDir: sourceDirContext,
|
|
531
|
+
ext: validatedExt,
|
|
532
|
+
...builder === "mkdist" && {
|
|
533
|
+
cleanDist: true
|
|
534
|
+
// Clean the output directory before building
|
|
535
|
+
}
|
|
508
536
|
}
|
|
509
537
|
],
|
|
538
|
+
outDir: outDirBin,
|
|
539
|
+
rootDir: sourceDirContext,
|
|
510
540
|
rollup: {
|
|
511
541
|
emitCJS: false,
|
|
512
542
|
esbuild: {
|
|
@@ -519,7 +549,9 @@ async function library_bundleUsingUnified(entryPoint, outDirBin, builder, source
|
|
|
519
549
|
}
|
|
520
550
|
},
|
|
521
551
|
hooks: {},
|
|
522
|
-
stub: transpileStub
|
|
552
|
+
stub: transpileStub,
|
|
553
|
+
transpileWatch: false
|
|
554
|
+
// Not supported by mkdist
|
|
523
555
|
};
|
|
524
556
|
try {
|
|
525
557
|
await unifiedBuild(rootDir, unifiedBuildConfig, outDirBin);
|
|
@@ -2,6 +2,7 @@ import { relinka } from "@reliverse/relinka";
|
|
|
2
2
|
import { mkdist } from "mkdist";
|
|
3
3
|
import { relative } from "pathe";
|
|
4
4
|
import {
|
|
5
|
+
ensuredir,
|
|
5
6
|
rmdir,
|
|
6
7
|
symlink,
|
|
7
8
|
warn
|
|
@@ -13,12 +14,13 @@ export async function mkdistBuild(ctx) {
|
|
|
13
14
|
await ctx.hooks.callHook("mkdist:entries", ctx, entries);
|
|
14
15
|
for (const entry of entries) {
|
|
15
16
|
const distDir = entry.outDir || entry.input;
|
|
17
|
+
await ensuredir(distDir);
|
|
16
18
|
if (ctx.options.transpileStub) {
|
|
17
19
|
await rmdir(distDir);
|
|
18
20
|
await symlink(entry.input, distDir);
|
|
19
21
|
} else {
|
|
20
22
|
const mkdistOptions = {
|
|
21
|
-
cleanDist:
|
|
23
|
+
cleanDist: true,
|
|
22
24
|
distDir,
|
|
23
25
|
rootDir: ctx.options.rootDir,
|
|
24
26
|
srcDir: entry.input,
|
package/bin/mod.js
CHANGED
|
@@ -1,46 +1,14 @@
|
|
|
1
|
-
import { defineCommand,
|
|
2
|
-
import { dler } from "./cli.js";
|
|
1
|
+
import { runMain, defineCommand, defineArgs } from "@reliverse/rempts";
|
|
3
2
|
import { initDlerConfig } from "./init.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
meta: {
|
|
7
|
-
name: "dler",
|
|
8
|
-
version: "1.2.0",
|
|
9
|
-
description: "dler CLI https://docs.reliverse.org"
|
|
10
|
-
},
|
|
11
|
-
args: {
|
|
3
|
+
const main = defineCommand({
|
|
4
|
+
args: defineArgs({
|
|
12
5
|
dev: {
|
|
13
6
|
type: "boolean",
|
|
14
7
|
description: "Runs the CLI in dev mode"
|
|
15
8
|
}
|
|
16
|
-
},
|
|
17
|
-
async
|
|
18
|
-
|
|
19
|
-
await validateDevCwd(isDev, ["dler"], "dler", "reliverse");
|
|
20
|
-
await initDlerConfig(isDev);
|
|
21
|
-
await dler(isDev);
|
|
9
|
+
}),
|
|
10
|
+
async onCmdInit({ args }) {
|
|
11
|
+
await initDlerConfig(args.dev);
|
|
22
12
|
}
|
|
23
13
|
});
|
|
24
|
-
await runMain(
|
|
25
|
-
fileBasedCmds: {
|
|
26
|
-
enable: true,
|
|
27
|
-
// Enables file-based subcommand detection.
|
|
28
|
-
cmdsRootPath: "src/cli/args"
|
|
29
|
-
// Directory to scan for subcommands.
|
|
30
|
-
},
|
|
31
|
-
alias: {
|
|
32
|
-
v: "verbose"
|
|
33
|
-
// Maps shorthand flag -v to --verbose.
|
|
34
|
-
},
|
|
35
|
-
strict: false,
|
|
36
|
-
// Do not throw errors for unknown flags.
|
|
37
|
-
warnOnUnknown: false,
|
|
38
|
-
// Warn when encountering unknown flags.
|
|
39
|
-
negatedBoolean: true
|
|
40
|
-
// Support for negated booleans (e.g., --no-verbose).
|
|
41
|
-
// unknown: (flagName) => {
|
|
42
|
-
// relinka("warn", "Unknown flag encountered:", flagName);
|
|
43
|
-
// return false;
|
|
44
|
-
// },
|
|
45
|
-
// TODO: unknownErrorMsg: "An unhandled error occurred, please report it at https://github.com/reliverse/dler"
|
|
46
|
-
});
|
|
14
|
+
await runMain(main);
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"dependencies": {
|
|
3
|
-
"@reliverse/relico": "^1.1.
|
|
4
|
-
"@reliverse/relinka": "^1.4.
|
|
5
|
-
"@reliverse/rempts": "^1.
|
|
3
|
+
"@reliverse/relico": "^1.1.2",
|
|
4
|
+
"@reliverse/relinka": "^1.4.5",
|
|
5
|
+
"@reliverse/rempts": "^1.7.8",
|
|
6
6
|
"@rollup/plugin-alias": "^5.1.1",
|
|
7
7
|
"@rollup/plugin-commonjs": "^28.0.3",
|
|
8
8
|
"@rollup/plugin-json": "^6.1.0",
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
"@rollup/pluginutils": "^5.1.4",
|
|
12
12
|
"bun": "^1.2.13",
|
|
13
13
|
"chalk": "^5.4.1",
|
|
14
|
-
"commander": "^13.1.0",
|
|
15
14
|
"defu": "^6.1.4",
|
|
16
15
|
"esbuild": "^0.25.4",
|
|
17
16
|
"execa": "^9.5.3",
|
|
@@ -41,7 +40,7 @@
|
|
|
41
40
|
"license": "MIT",
|
|
42
41
|
"name": "@reliverse/dler",
|
|
43
42
|
"type": "module",
|
|
44
|
-
"version": "1.2.
|
|
43
|
+
"version": "1.2.4",
|
|
45
44
|
"keywords": [
|
|
46
45
|
"reliverse",
|
|
47
46
|
"cli",
|
|
@@ -67,12 +66,12 @@
|
|
|
67
66
|
"@total-typescript/ts-reset": "^0.6.1",
|
|
68
67
|
"@types/bun": "^1.2.13",
|
|
69
68
|
"@types/fs-extra": "^11.0.4",
|
|
70
|
-
"@types/node": "^22.15.
|
|
69
|
+
"@types/node": "^22.15.18",
|
|
71
70
|
"@types/semver": "^7.7.0",
|
|
72
71
|
"eslint": "^9.26.0",
|
|
73
72
|
"eslint-plugin-no-relative-import-paths": "^1.6.1",
|
|
74
73
|
"eslint-plugin-perfectionist": "^4.13.0",
|
|
75
|
-
"knip": "^5.
|
|
74
|
+
"knip": "^5.56.0",
|
|
76
75
|
"typescript": "^5.8.3",
|
|
77
76
|
"typescript-eslint": "^8.32.1"
|
|
78
77
|
},
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { re } from "@reliverse/relico";
|
|
2
|
-
import { Command } from "commander";
|
|
3
|
-
import path from "node:path";
|
|
4
|
-
import { analyzeDependencies } from "./analyzer.js";
|
|
5
|
-
import { formatOutput } from "./formatter.js";
|
|
6
|
-
export const createCli = () => {
|
|
7
|
-
const program = new Command();
|
|
8
|
-
program.name("deps").description("Find dependencies used but not listed in package.json").version("1.0.0").option(
|
|
9
|
-
"-d, --directory <path>",
|
|
10
|
-
"directory to scan (defaults to current directory)",
|
|
11
|
-
"."
|
|
12
|
-
).option(
|
|
13
|
-
"-a, --all",
|
|
14
|
-
"show all dependencies (both listed and not listed)",
|
|
15
|
-
false
|
|
16
|
-
).option("-i, --ignore <patterns>", "comma-separated patterns to ignore", "").option("-j, --json", "output in JSON format", false).option(
|
|
17
|
-
"-b, --include-builtins",
|
|
18
|
-
"include Node.js built-in modules in the output",
|
|
19
|
-
false
|
|
20
|
-
).action(async (cmdOptions) => {
|
|
21
|
-
try {
|
|
22
|
-
const directory = path.resolve(cmdOptions.directory);
|
|
23
|
-
const ignorePatterns = cmdOptions.ignore ? cmdOptions.ignore.split(",") : [];
|
|
24
|
-
const options = {
|
|
25
|
-
directory,
|
|
26
|
-
showAll: cmdOptions.all,
|
|
27
|
-
ignorePatterns,
|
|
28
|
-
json: cmdOptions.json,
|
|
29
|
-
includeBuiltins: cmdOptions.includeBuiltins
|
|
30
|
-
};
|
|
31
|
-
console.log(re.gray(`Scanning directory: ${directory}`));
|
|
32
|
-
const result = await analyzeDependencies(options);
|
|
33
|
-
const output = formatOutput(result, options);
|
|
34
|
-
console.log(output);
|
|
35
|
-
if (result.missingDependencies.length > 0) {
|
|
36
|
-
process.exit(1);
|
|
37
|
-
}
|
|
38
|
-
} catch (error) {
|
|
39
|
-
console.error("Error:", error);
|
|
40
|
-
process.exit(1);
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
return program;
|
|
44
|
-
};
|
|
45
|
-
const cli = createCli();
|
|
46
|
-
if (require.main === module) {
|
|
47
|
-
cli.parse(process.argv);
|
|
48
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { FILE_TYPES } from "./reint-impl/const.js";
|
|
2
|
-
export { gitignoreTemplate } from "./reint-impl/templates/t-gitignore.js";
|
|
3
|
-
export { licenseTemplate } from "./reint-impl/templates/t-license.js";
|
|
4
|
-
export { readmeTemplate } from "./reint-impl/templates/t-readme.js";
|
|
5
|
-
export { escapeMarkdownCodeBlocks } from "./reint-impl/utils.js";
|