@reliverse/dler 1.2.5 → 1.3.0
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 +36 -41
- package/bin/addons.d.ts +1 -0
- package/bin/addons.js +83 -0
- package/bin/app/agg/cmd.d.ts +35 -0
- package/bin/app/agg/cmd.js +49 -0
- package/bin/app/agg/impl.d.ts +36 -0
- package/bin/app/{tools → agg}/impl.js +1 -2
- package/bin/app/build/cmd.d.ts +7 -0
- package/bin/app/build/cmd.js +3 -1
- package/bin/app/cmds.d.ts +100 -0
- package/bin/app/cmds.js +11 -2
- package/bin/app/conv/cmd.d.ts +0 -0
- package/bin/app/deps/cmd.d.ts +28 -0
- package/bin/app/deps/cmd.js +62 -0
- package/bin/app/deps/impl/analyzer.d.ts +2 -0
- package/bin/app/deps/impl/analyzer.js +1 -1
- package/bin/app/deps/impl/filesystem.d.ts +4 -0
- package/bin/app/deps/impl/filesystem.js +2 -4
- package/bin/app/deps/impl/formatter.d.ts +2 -0
- package/bin/app/deps/impl/formatter.js +2 -2
- package/bin/app/deps/impl/parser.d.ts +5 -0
- package/bin/app/deps/impl/types.d.ts +21 -0
- package/bin/app/inject/README.md +3 -12
- package/bin/app/inject/cmd.d.ts +12 -0
- package/bin/app/inject/cmd.js +2 -2
- package/bin/app/inject/expect/cmd.d.ts +20 -0
- package/bin/app/inject/expect/impl.d.ts +5 -0
- package/bin/app/libs/cmd.d.ts +0 -0
- package/bin/app/merge/cmd.txt +1 -1
- package/bin/app/mono/cmd.d.ts +0 -0
- package/bin/app/pub/cmd.d.ts +7 -0
- package/bin/app/pub/cmd.js +3 -1
- package/bin/app/relifso/cmd.d.ts +12 -0
- package/bin/app/relifso/cmd.js +2 -2
- package/bin/app/relifso/init/cmd.d.ts +36 -0
- package/bin/app/relifso/init/impl/const.d.ts +34 -0
- package/bin/app/relifso/init/impl/const.js +1 -1
- package/bin/app/relifso/init/impl/mod.d.ts +17 -0
- package/bin/app/relifso/init/impl/templates/t-gitignore.d.ts +1 -0
- package/bin/app/relifso/init/impl/templates/t-license.d.ts +1 -0
- package/bin/app/relifso/init/impl/templates/t-readme.d.ts +1 -0
- package/bin/app/relifso/init/impl/types.d.ts +41 -0
- package/bin/app/relifso/init/impl/utils.d.ts +5 -0
- package/bin/app/relinka/cmd.d.ts +0 -0
- package/bin/app/rempts/init/cmd/cmd.d.ts +14 -0
- package/bin/app/rempts/init/cmd/cmd.js +3 -1
- package/bin/app/rempts/init/cmds/cmd.d.ts +19 -0
- package/bin/app/rempts/migrate/cmd.d.ts +14 -0
- package/bin/app/rempts/migrate/impl/commander.d.ts +4 -0
- package/bin/app/spell/cmd.d.ts +18 -0
- package/bin/app/spell/cmd.js +51 -0
- package/bin/app/split/cmd.d.ts +11 -0
- package/bin/app/split/impl.d.ts +25 -0
- package/bin/default.d.ts +5 -0
- package/bin/{libs/cfg/cfg-default.js → default.js} +6 -4
- package/bin/dler.d.ts +1 -0
- package/bin/dler.js +60 -0
- package/bin/impl.d.ts +10 -0
- package/bin/{cli.js → impl.js} +15 -27
- package/bin/info.d.ts +2 -0
- package/bin/info.js +21 -0
- package/bin/init.d.ts +1 -0
- package/bin/init.js +20 -27
- package/bin/libs/sdk/sdk-impl/build/build-library.d.ts +51 -0
- package/bin/libs/sdk/sdk-impl/build/build-library.js +45 -66
- package/bin/libs/sdk/sdk-impl/build/build-regular.d.ts +26 -0
- package/bin/libs/sdk/sdk-impl/build/build-regular.js +28 -18
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/auto.d.ts +2 -0
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/auto.js +8 -3
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/build.d.ts +5 -0
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/build.js +12 -7
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/copy/copy.d.ts +2 -0
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/copy/copy.js +2 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/copy/types.d.ts +9 -0
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist.d.ts +2 -0
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist.js +22 -6
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/types.d.ts +15 -0
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/build.d.ts +2 -0
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/build.js +2 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/config.d.ts +2 -0
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/plugins/cjs.d.ts +4 -0
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/plugins/esbuild.d.ts +13 -0
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/plugins/json.d.ts +3 -0
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/plugins/raw.d.ts +8 -0
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/plugins/shebang.d.ts +5 -0
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/stub.d.ts +2 -0
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/types.d.ts +95 -0
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/utils.d.ts +5 -0
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/watch.d.ts +2 -0
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/types.d.ts +176 -0
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/untyped/index.d.ts +2 -0
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/untyped/index.js +2 -2
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/untyped/types.d.ts +23 -0
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/utils.d.ts +20 -0
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/validate.d.ts +4 -0
- package/bin/libs/sdk/sdk-impl/library-flow.d.ts +11 -0
- package/bin/libs/sdk/sdk-impl/library-flow.js +6 -1
- package/bin/libs/sdk/sdk-impl/pub/pub-library.d.ts +5 -0
- package/bin/libs/sdk/sdk-impl/pub/pub-library.js +6 -16
- package/bin/libs/sdk/sdk-impl/pub/pub-regular.d.ts +9 -0
- package/bin/libs/sdk/sdk-impl/pub/pub-regular.js +12 -10
- package/bin/libs/sdk/sdk-impl/regular-flow.d.ts +12 -0
- package/bin/libs/sdk/sdk-impl/regular-flow.js +45 -51
- package/bin/libs/sdk/sdk-impl/spell/spell-executors.d.ts +10 -0
- package/bin/libs/sdk/sdk-impl/spell/spell-filesystem.d.ts +7 -0
- package/bin/libs/sdk/sdk-impl/spell/spell-mod.d.ts +4 -0
- package/bin/libs/sdk/sdk-impl/spell/spell-parser.d.ts +4 -0
- package/bin/libs/sdk/sdk-impl/spell/spell-types.d.ts +34 -0
- package/bin/libs/sdk/sdk-impl/utils/tools/tools-agg.d.ts +14 -0
- package/bin/libs/sdk/sdk-impl/utils/tools/tools-agg.js +8 -6
- package/bin/libs/sdk/sdk-impl/utils/tools/tools-impl.d.ts +4 -0
- package/bin/libs/sdk/sdk-impl/utils/utils-build.d.ts +28 -0
- package/bin/libs/sdk/sdk-impl/utils/utils-build.js +3 -3
- package/bin/libs/sdk/sdk-impl/utils/utils-bump.d.ts +9 -0
- package/bin/libs/sdk/sdk-impl/utils/utils-bump.js +5 -7
- package/bin/libs/sdk/sdk-impl/utils/utils-clean.d.ts +5 -0
- package/bin/libs/sdk/sdk-impl/utils/utils-consts.d.ts +9 -0
- package/bin/libs/sdk/sdk-impl/utils/utils-cwd.d.ts +10 -0
- package/bin/libs/sdk/sdk-impl/utils/utils-deps.d.ts +5 -0
- package/bin/libs/sdk/sdk-impl/utils/utils-determine.d.ts +12 -0
- package/bin/libs/sdk/sdk-impl/utils/utils-error.d.ts +5 -0
- package/bin/libs/sdk/sdk-impl/utils/utils-fs.d.ts +24 -0
- package/bin/libs/sdk/sdk-impl/utils/utils-fs.js +4 -1
- package/bin/libs/sdk/sdk-impl/utils/utils-info.d.ts +6 -0
- package/bin/libs/sdk/sdk-impl/utils/utils-info.js +7 -14
- package/bin/libs/sdk/sdk-impl/utils/utils-jsr-json.d.ts +8 -0
- package/bin/libs/sdk/sdk-impl/utils/utils-jsr-json.js +2 -4
- package/bin/libs/sdk/sdk-impl/utils/utils-paths.d.ts +55 -0
- package/bin/libs/sdk/sdk-impl/utils/utils-paths.js +33 -24
- package/bin/libs/sdk/sdk-impl/utils/utils-perf.d.ts +9 -0
- package/bin/libs/sdk/sdk-impl/utils/utils-pkg-json-libs.d.ts +5 -0
- package/bin/libs/sdk/sdk-impl/utils/utils-pkg-json-reg.d.ts +8 -0
- package/bin/libs/sdk/sdk-impl/utils/utils-pkg-json-reg.js +36 -27
- package/bin/libs/sdk/sdk-impl/utils/utils-tsconfig.d.ts +4 -0
- package/bin/libs/sdk/sdk-mod.d.ts +56 -0
- package/bin/libs/sdk/sdk-mod.js +42 -9
- package/bin/libs/sdk/sdk-types.d.ts +469 -0
- package/bin/libs/sdk/sdk-types.js +0 -1
- package/bin/load.d.ts +6 -0
- package/bin/load.js +1 -1
- package/bin/mod.d.ts +48 -0
- package/bin/mod.js +4 -14
- package/bin/types.d.ts +469 -0
- package/package.json +6 -5
- package/bin/app/tools/cmd.js +0 -81
- package/bin/app/tools/tools.txt +0 -92
- package/bin/libs/cfg/cfg-mod.js +0 -4
- package/bin/libs/cfg/cfg-types.js +0 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type FileType = ".js" | ".jsx" | ".ts" | ".tsx";
|
|
2
|
+
export type PackageJson = {
|
|
3
|
+
name?: string;
|
|
4
|
+
dependencies?: Record<string, string>;
|
|
5
|
+
devDependencies?: Record<string, string>;
|
|
6
|
+
peerDependencies?: Record<string, string>;
|
|
7
|
+
optionalDependencies?: Record<string, string>;
|
|
8
|
+
};
|
|
9
|
+
export type FinderOptions = {
|
|
10
|
+
directory: string;
|
|
11
|
+
showAll: boolean;
|
|
12
|
+
ignorePatterns: string[];
|
|
13
|
+
json: boolean;
|
|
14
|
+
builtins: boolean;
|
|
15
|
+
};
|
|
16
|
+
export type DependencyResult = {
|
|
17
|
+
missingDependencies: string[];
|
|
18
|
+
allDependencies: string[];
|
|
19
|
+
listedDependencies: string[];
|
|
20
|
+
builtinModules: string[];
|
|
21
|
+
};
|
package/bin/app/inject/README.md
CHANGED
|
@@ -34,28 +34,19 @@ bun x @reliverse/inject
|
|
|
34
34
|
|
|
35
35
|
### Basic Usage
|
|
36
36
|
|
|
37
|
-
**User config** in `inject.config.ts`:
|
|
38
|
-
|
|
39
|
-
```ts
|
|
40
|
-
export default {
|
|
41
|
-
injectComment: "// @ts-expect-error TODO: fix ts",
|
|
42
|
-
tscCommand: "tsc --project ./tsconfig.json --noEmit"
|
|
43
|
-
}
|
|
44
|
-
```
|
|
45
|
-
|
|
46
37
|
**Running**:
|
|
47
38
|
|
|
48
39
|
```bash
|
|
49
40
|
# 1) Automatic mode:
|
|
50
|
-
inject
|
|
41
|
+
bun dler inject expect auto
|
|
51
42
|
# => runs `tsc`, finds errors, injects comment above them.
|
|
52
43
|
|
|
53
44
|
# 2) Lines-file mode:
|
|
54
|
-
inject
|
|
45
|
+
bun dler inject expect linesA.txt linesB.txt
|
|
55
46
|
# => no TSC, just parses references from lines files
|
|
56
47
|
|
|
57
48
|
# 3) Mixed:
|
|
58
|
-
inject
|
|
49
|
+
bun dler inject expect auto lines.txt
|
|
59
50
|
# => merges TSC errors with references in lines.txt
|
|
60
51
|
```
|
|
61
52
|
|
package/bin/app/inject/cmd.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { relinka } from "@reliverse/relinka";
|
|
2
2
|
import { defineCommand, runCmd, selectPrompt } from "@reliverse/rempts";
|
|
3
|
-
import {
|
|
3
|
+
import { cmdInjectExpect } from "../cmds.js";
|
|
4
4
|
export default defineCommand({
|
|
5
5
|
meta: {
|
|
6
6
|
name: "cli",
|
|
@@ -30,7 +30,7 @@ export default defineCommand({
|
|
|
30
30
|
]
|
|
31
31
|
});
|
|
32
32
|
if (cmd === "ts-expect-error") {
|
|
33
|
-
await runCmd(await
|
|
33
|
+
await runCmd(await cmdInjectExpect(), []);
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
declare const _default: import("@reliverse/rempts").Command<{
|
|
2
|
+
dev: {
|
|
3
|
+
type: "boolean";
|
|
4
|
+
description: string;
|
|
5
|
+
};
|
|
6
|
+
files: {
|
|
7
|
+
type: "positional";
|
|
8
|
+
description: string;
|
|
9
|
+
default: string;
|
|
10
|
+
};
|
|
11
|
+
comment: {
|
|
12
|
+
type: "string";
|
|
13
|
+
description: string;
|
|
14
|
+
};
|
|
15
|
+
tscPaths: {
|
|
16
|
+
type: "string";
|
|
17
|
+
description: string;
|
|
18
|
+
};
|
|
19
|
+
}>;
|
|
20
|
+
export default _default;
|
|
File without changes
|
package/bin/app/merge/cmd.txt
CHANGED
|
File without changes
|
package/bin/app/pub/cmd.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { defineArgs, defineCommand } from "@reliverse/rempts";
|
|
2
|
-
import { dlerPub } from "../../
|
|
2
|
+
import { dlerPub } from "../../impl.js";
|
|
3
|
+
import { ensureDlerConfig } from "../../init.js";
|
|
3
4
|
export default defineCommand({
|
|
4
5
|
meta: {
|
|
5
6
|
name: "build",
|
|
@@ -12,6 +13,7 @@ export default defineCommand({
|
|
|
12
13
|
}
|
|
13
14
|
}),
|
|
14
15
|
async run({ args }) {
|
|
16
|
+
await ensureDlerConfig(args.dev);
|
|
15
17
|
await dlerPub(args.dev);
|
|
16
18
|
}
|
|
17
19
|
});
|
package/bin/app/relifso/cmd.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { relinka } from "@reliverse/relinka";
|
|
2
2
|
import { defineCommand, runCmd, selectPrompt } from "@reliverse/rempts";
|
|
3
|
-
import {
|
|
3
|
+
import { cmdRelifsoInit } from "../cmds.js";
|
|
4
4
|
export default defineCommand({
|
|
5
5
|
meta: {
|
|
6
6
|
name: "cli",
|
|
@@ -30,7 +30,7 @@ export default defineCommand({
|
|
|
30
30
|
]
|
|
31
31
|
});
|
|
32
32
|
if (cmd === "init") {
|
|
33
|
-
await runCmd(await
|
|
33
|
+
await runCmd(await cmdRelifsoInit(), []);
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
declare const _default: import("@reliverse/rempts").Command<{
|
|
2
|
+
dev: {
|
|
3
|
+
type: "boolean";
|
|
4
|
+
description: string;
|
|
5
|
+
};
|
|
6
|
+
fileType: {
|
|
7
|
+
type: "string";
|
|
8
|
+
description: string;
|
|
9
|
+
required: false;
|
|
10
|
+
};
|
|
11
|
+
destDir: {
|
|
12
|
+
type: "string";
|
|
13
|
+
description: string;
|
|
14
|
+
default: string;
|
|
15
|
+
required: false;
|
|
16
|
+
};
|
|
17
|
+
multiple: {
|
|
18
|
+
type: "boolean";
|
|
19
|
+
description: string;
|
|
20
|
+
required: false;
|
|
21
|
+
default: false;
|
|
22
|
+
};
|
|
23
|
+
parallel: {
|
|
24
|
+
type: "boolean";
|
|
25
|
+
description: string;
|
|
26
|
+
required: false;
|
|
27
|
+
default: false;
|
|
28
|
+
};
|
|
29
|
+
concurrency: {
|
|
30
|
+
type: "string";
|
|
31
|
+
description: string;
|
|
32
|
+
required: false;
|
|
33
|
+
default: string;
|
|
34
|
+
};
|
|
35
|
+
}>;
|
|
36
|
+
export default _default;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Known file types with possible variations.
|
|
3
|
+
*/
|
|
4
|
+
export declare const FILE_TYPES: readonly [{
|
|
5
|
+
readonly type: "cfg:eslint";
|
|
6
|
+
readonly variations: readonly ["eslint.config.js"];
|
|
7
|
+
}, {
|
|
8
|
+
readonly type: "cfg:knip";
|
|
9
|
+
readonly variations: readonly ["knip.json"];
|
|
10
|
+
}, {
|
|
11
|
+
readonly type: "cfg:reliverse";
|
|
12
|
+
readonly variations: readonly [".config/rse.jsonc", ".config/rse.ts"];
|
|
13
|
+
}, {
|
|
14
|
+
readonly type: "cfg:package.json";
|
|
15
|
+
readonly variations: readonly ["package.json"];
|
|
16
|
+
}, {
|
|
17
|
+
readonly type: "cfg:tsconfig.json";
|
|
18
|
+
readonly variations: readonly ["tsconfig.json"];
|
|
19
|
+
}, {
|
|
20
|
+
readonly type: "git:gitattributes";
|
|
21
|
+
readonly variations: readonly [".gitattributes"];
|
|
22
|
+
}, {
|
|
23
|
+
readonly type: "git:gitignore";
|
|
24
|
+
readonly variations: readonly [".gitignore"];
|
|
25
|
+
}, {
|
|
26
|
+
readonly type: "md:LICENSE";
|
|
27
|
+
readonly variations: readonly ["LICENSE.md", "LICENSE"];
|
|
28
|
+
}, {
|
|
29
|
+
readonly type: "md:README";
|
|
30
|
+
readonly variations: readonly ["README.md", "README"];
|
|
31
|
+
}];
|
|
32
|
+
export declare const INIT_BEHAVIOURS: readonly ["create", "copy", "create-if-copy-failed"];
|
|
33
|
+
export declare const DEST_FILE_EXISTS_BEHAVIOURS: readonly ["rewrite", "skip", "attach-index", "prompt"];
|
|
34
|
+
export declare const CONTENT_CREATE_MODES: string[];
|
|
@@ -10,7 +10,7 @@ export const FILE_TYPES = [
|
|
|
10
10
|
{ type: "git:gitattributes", variations: [".gitattributes"] },
|
|
11
11
|
{ type: "git:gitignore", variations: [".gitignore"] },
|
|
12
12
|
{ type: "md:LICENSE", variations: ["LICENSE.md", "LICENSE"] },
|
|
13
|
-
{ type: "md:README", variations: ["README.md"] }
|
|
13
|
+
{ type: "md:README", variations: ["README.md", "README"] }
|
|
14
14
|
];
|
|
15
15
|
export const INIT_BEHAVIOURS = [
|
|
16
16
|
"create",
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { FileType, InitFileRequest, InitFileResult, ReinitUserConfig } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Creates a file from scratch, including parent directories,
|
|
4
|
+
* basing the file content on the fileType.
|
|
5
|
+
*/
|
|
6
|
+
export declare function createFileFromScratch(destPath: string, fileType: FileType, contentCreateMode?: string): Promise<void>;
|
|
7
|
+
/**
|
|
8
|
+
* Single-file initialization using the merged config.
|
|
9
|
+
*/
|
|
10
|
+
export declare function initFile(req: InitFileRequest, userCfg?: Partial<ReinitUserConfig>): Promise<InitFileResult>;
|
|
11
|
+
/**
|
|
12
|
+
* Multi-file version with parallel processing support.
|
|
13
|
+
*/
|
|
14
|
+
export declare function initFiles(items: InitFileRequest[], options?: {
|
|
15
|
+
parallel?: boolean;
|
|
16
|
+
concurrency?: number;
|
|
17
|
+
}, userCfg?: Partial<ReinitUserConfig>): Promise<InitFileResult[]>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const gitignoreTemplate = "*.log\n.env\n.DS_Store\n.eslintcache\nnode_modules\ndist-jsr\ndist-libs\ndist-npm\n";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const licenseTemplate = "# MIT License\n\nCopyright (c) Nazar Kornienko (blefnk), Reliverse\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const readmeTemplate = "# \uD83D\uDE80 Project Name\n\nWelcome! This project was bootstrapped with [@reliverse/reinit](https://www.npmjs.com/package/@reliverse/reinit). \nIt's already got the basics \u2014 now it's your turn to make it awesome \u2728\n\n## \uD83D\uDD27 Tech Stack\n\n- \u2699\uFE0F Framework: _<Add your framework here>_\n- \uD83D\uDEE0\uFE0F Tools: _<Add your tooling, CLIs, etc>_\n- \uD83E\uDDEA Tests: _<Vitest, Jest, or something else?>_\n- \uD83E\uDDE0 Linting: _ESLint, Biome, etc_\n- \uD83C\uDF10 Deployment: _<Vercel, Netlify, Railway?>_\n\n## \uD83D\uDE80 Getting Started\n\nClone the repo and install dependencies:\n\n'''bash\nbun install\nbun dev\n'''\n\nOr if you're using another package manager:\n\n'''bash\nnpm install && npm run dev\n# or\npnpm i && pnpm dev\n'''\n\n## \uD83D\uDDC2\uFE0F Project Structure\n\n'''bash\nsrc/\n\u251C\u2500\u2500 components/\n\u251C\u2500\u2500 pages/\n\u251C\u2500\u2500 lib/\n\u2514\u2500\u2500 styles/\n'''\n\nFeel free to tweak the structure to your liking.\n\n## \uD83E\uDDE9 Customize it\n\nThis project is just a starting point. You can add:\n\n- \uD83E\uDDD9\u200D\u2642\uFE0F Your own components and UI\n- \uD83D\uDCE6 APIs, auth, i18n, analytics, whatever you need\n- \uD83E\uDD16 AI integrations using [Reliverse CLI](https://www.npmjs.com/package/@reliverse/rse)\n\n## \uD83E\uDEF6 Credits\n\nMade with \u2764\uFE0F using [@reliverse/reinit](https://reliverse.org) \nNeed help? [Join the Discord](https://discord.gg/Pb8uKbwpsJ)\n\n## \uD83D\uDCC4 License\n\nMIT \u00A9 YourNameHere\n";
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { DEST_FILE_EXISTS_BEHAVIOURS, FILE_TYPES, INIT_BEHAVIOURS } from "./const.js";
|
|
2
|
+
export type FileType = (typeof FILE_TYPES)[number]["type"];
|
|
3
|
+
export type InitBehaviour = (typeof INIT_BEHAVIOURS)[number];
|
|
4
|
+
export type DestFileExistsBehaviour = (typeof DEST_FILE_EXISTS_BEHAVIOURS)[number];
|
|
5
|
+
/** Library-level interface for hooking into the file init process. */
|
|
6
|
+
export type ReinitUserConfig = {
|
|
7
|
+
/** The default approach for copying vs. creating. */
|
|
8
|
+
defaultInitBehaviour?: InitBehaviour;
|
|
9
|
+
/** Default approach if a file already exists. */
|
|
10
|
+
defaultDestFileExistsBehaviour?: DestFileExistsBehaviour;
|
|
11
|
+
/** Whether `initFiles` should run in parallel by default. */
|
|
12
|
+
parallelByDefault?: boolean;
|
|
13
|
+
/** Concurrency limit for parallel tasks. If omitted, 4 is used. */
|
|
14
|
+
parallelConcurrency?: number;
|
|
15
|
+
/** Called before each file operation. */
|
|
16
|
+
onFileStart?: (req: InitFileRequest) => void;
|
|
17
|
+
/** Called after each file operation. */
|
|
18
|
+
onFileComplete?: (res: InitFileResult) => void;
|
|
19
|
+
};
|
|
20
|
+
/** Data describing a single request to initFile. */
|
|
21
|
+
export type InitFileRequest = {
|
|
22
|
+
fileType: FileType;
|
|
23
|
+
destDir: string;
|
|
24
|
+
initBehaviour?: InitBehaviour;
|
|
25
|
+
destFileExistsBehaviour?: DestFileExistsBehaviour;
|
|
26
|
+
options?: InitFileOptions;
|
|
27
|
+
};
|
|
28
|
+
/** Extended per-file options. */
|
|
29
|
+
export type InitFileOptions = {
|
|
30
|
+
destFileName?: string;
|
|
31
|
+
srcCopyMode?: string;
|
|
32
|
+
contentCreateMode?: string;
|
|
33
|
+
fallbackSource?: string;
|
|
34
|
+
};
|
|
35
|
+
/** The result of a single initFile operation. */
|
|
36
|
+
export type InitFileResult = {
|
|
37
|
+
requested: InitFileRequest;
|
|
38
|
+
finalPath?: string;
|
|
39
|
+
status: "created" | "copied" | "skipped" | "error";
|
|
40
|
+
error?: any;
|
|
41
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare const _default: import("@reliverse/rempts").Command<{
|
|
2
|
+
cmd: {
|
|
3
|
+
type: "array";
|
|
4
|
+
required: true;
|
|
5
|
+
description: string;
|
|
6
|
+
options: string[];
|
|
7
|
+
};
|
|
8
|
+
force: {
|
|
9
|
+
type: "boolean";
|
|
10
|
+
default: false;
|
|
11
|
+
description: string;
|
|
12
|
+
};
|
|
13
|
+
}>;
|
|
14
|
+
export default _default;
|
|
@@ -33,7 +33,9 @@ export default defineCommand({
|
|
|
33
33
|
);
|
|
34
34
|
continue;
|
|
35
35
|
}
|
|
36
|
-
fs.mkdirSync(dirPath, {
|
|
36
|
+
fs.mkdirSync(dirPath, {
|
|
37
|
+
recursive: true
|
|
38
|
+
});
|
|
37
39
|
const content = generateCommandTemplate(cmdName);
|
|
38
40
|
fs.writeFileSync(filePath, content, "utf-8");
|
|
39
41
|
relinka("log", `\u2705 Created new command: ${filePath}`);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
declare const _default: import("@reliverse/rempts").Command<{
|
|
2
|
+
outFile: {
|
|
3
|
+
type: "string";
|
|
4
|
+
description: string;
|
|
5
|
+
default: string;
|
|
6
|
+
};
|
|
7
|
+
cmdDirs: {
|
|
8
|
+
type: "array";
|
|
9
|
+
description: string;
|
|
10
|
+
default: never[];
|
|
11
|
+
options: string[];
|
|
12
|
+
};
|
|
13
|
+
force: {
|
|
14
|
+
type: "boolean";
|
|
15
|
+
default: false;
|
|
16
|
+
description: string;
|
|
17
|
+
};
|
|
18
|
+
}>;
|
|
19
|
+
export default _default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare const _default: import("@reliverse/rempts").Command<{
|
|
2
|
+
provider: {
|
|
3
|
+
type: "string";
|
|
4
|
+
description: string;
|
|
5
|
+
required: true;
|
|
6
|
+
allowed: string[];
|
|
7
|
+
};
|
|
8
|
+
input: {
|
|
9
|
+
type: "string";
|
|
10
|
+
description: string;
|
|
11
|
+
required: true;
|
|
12
|
+
};
|
|
13
|
+
}>;
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
declare const _default: import("@reliverse/rempts").Command<{
|
|
2
|
+
spells: {
|
|
3
|
+
type: "string";
|
|
4
|
+
description: string;
|
|
5
|
+
default: string;
|
|
6
|
+
};
|
|
7
|
+
files: {
|
|
8
|
+
type: "string";
|
|
9
|
+
description: string;
|
|
10
|
+
default: string;
|
|
11
|
+
};
|
|
12
|
+
dryRun: {
|
|
13
|
+
type: "boolean";
|
|
14
|
+
description: string;
|
|
15
|
+
default: false;
|
|
16
|
+
};
|
|
17
|
+
}>;
|
|
18
|
+
export default _default;
|
package/bin/app/spell/cmd.js
CHANGED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { defineArgs, defineCommand } from "@reliverse/rempts";
|
|
2
|
+
import { spells } from "../../libs/sdk/sdk-impl/spell/spell-mod.js";
|
|
3
|
+
export default defineCommand({
|
|
4
|
+
meta: {
|
|
5
|
+
name: "spells",
|
|
6
|
+
version: "1.0.0",
|
|
7
|
+
description: "Execute magic spells in your codebase"
|
|
8
|
+
},
|
|
9
|
+
args: defineArgs({
|
|
10
|
+
spells: {
|
|
11
|
+
type: "string",
|
|
12
|
+
description: "Comma-separated list of spells to execute (or 'all')",
|
|
13
|
+
default: "all"
|
|
14
|
+
},
|
|
15
|
+
files: {
|
|
16
|
+
type: "string",
|
|
17
|
+
description: "Comma-separated list of files to process (or all if not specified)",
|
|
18
|
+
default: ""
|
|
19
|
+
},
|
|
20
|
+
dryRun: {
|
|
21
|
+
type: "boolean",
|
|
22
|
+
description: "Preview changes without applying them",
|
|
23
|
+
default: false
|
|
24
|
+
}
|
|
25
|
+
}),
|
|
26
|
+
async run({ args }) {
|
|
27
|
+
const requestedSpells = args.spells ? args.spells.split(",") : ["all"];
|
|
28
|
+
const files = args.files ? args.files.split(",") : [];
|
|
29
|
+
console.log(`Triggering spells: ${requestedSpells.join(", ")}`);
|
|
30
|
+
if (files.length) {
|
|
31
|
+
console.log(`On files: ${files.join(", ")}`);
|
|
32
|
+
} else {
|
|
33
|
+
console.log("On all files");
|
|
34
|
+
}
|
|
35
|
+
if (args.dryRun) {
|
|
36
|
+
console.log("DRY RUN - No changes will be applied");
|
|
37
|
+
}
|
|
38
|
+
const results = await spells({
|
|
39
|
+
spells: requestedSpells,
|
|
40
|
+
files,
|
|
41
|
+
dryRun: args.dryRun
|
|
42
|
+
});
|
|
43
|
+
console.log("\nResults:");
|
|
44
|
+
for (const result of results) {
|
|
45
|
+
const status = result.success ? "\u2713" : "\u2717";
|
|
46
|
+
console.log(
|
|
47
|
+
`${status} ${result.file}: ${result.spell.type} - ${result.message}`
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This script:
|
|
3
|
+
* 1) Reads all *.ts or *.js files from a directory.
|
|
4
|
+
* 2) Splits files larger than a specified line threshold.
|
|
5
|
+
* 3) Splits functions larger than a specified line threshold into smaller helpers.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* bun src/split-large-files.ts --dir ./example --file-threshold 30 --func-threshold 20
|
|
9
|
+
*
|
|
10
|
+
* Warning: This script is experimental and might break code. A more stable version will be available in the future.
|
|
11
|
+
*/
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
type SplitOptions = {
|
|
2
|
+
directory: string;
|
|
3
|
+
fileLineThreshold: number;
|
|
4
|
+
funcLineThreshold: number;
|
|
5
|
+
};
|
|
6
|
+
export declare function parseCommandLineArgs(): SplitOptions;
|
|
7
|
+
/**
|
|
8
|
+
* 1) Reads all *.ts or *.js files from the given directory (recursively).
|
|
9
|
+
* 2) Returns their file paths.
|
|
10
|
+
*/
|
|
11
|
+
export declare function getAllSourceFiles(dir: string): string[];
|
|
12
|
+
/**
|
|
13
|
+
* Splits a file by line threshold. For instance, if a file has 1000 lines and threshold=300,
|
|
14
|
+
* it will generate multiple chunks (e.g., 300 lines, 300 lines, 300 lines, 100 lines).
|
|
15
|
+
* Returns the new file paths after splitting.
|
|
16
|
+
*/
|
|
17
|
+
export declare function splitLargeFileByLines(filePath: string, threshold: number): string[];
|
|
18
|
+
/**
|
|
19
|
+
* Splits large functions found in the source file into smaller helper functions.
|
|
20
|
+
* - Parse the file with TypeScript to find function declarations and line counts.
|
|
21
|
+
* - If a function is over a threshold, attempt to break it into two smaller functions.
|
|
22
|
+
* - Currently this is naive. It basically splits the function body roughly in the middle.
|
|
23
|
+
*/
|
|
24
|
+
export declare function splitLargeFunctions(filePath: string, funcLineThreshold: number): void;
|
|
25
|
+
export {};
|
package/bin/default.d.ts
ADDED
|
@@ -9,7 +9,11 @@ export const DEFAULT_CONFIG = {
|
|
|
9
9
|
coreDescription: "",
|
|
10
10
|
coreEntryFile: "mod.ts",
|
|
11
11
|
coreEntrySrcDir: "src",
|
|
12
|
-
|
|
12
|
+
coreBuildOutDir: "bin",
|
|
13
|
+
coreIsCLI: {
|
|
14
|
+
enabled: false,
|
|
15
|
+
scripts: {}
|
|
16
|
+
},
|
|
13
17
|
distJsrAllowDirty: true,
|
|
14
18
|
distJsrBuilder: "jsr",
|
|
15
19
|
distJsrCopyRootFiles: ["README.md", "LICENSE"],
|
|
@@ -47,7 +51,5 @@ export const DEFAULT_CONFIG = {
|
|
|
47
51
|
transpileSplitting: false,
|
|
48
52
|
transpileStub: false,
|
|
49
53
|
transpileTarget: "node",
|
|
50
|
-
transpileWatch: false
|
|
51
|
-
injectComment: "// @ts-expect-error TODO: fix ts",
|
|
52
|
-
tscCommand: "tsc --project ./tsconfig.json --noEmit"
|
|
54
|
+
transpileWatch: false
|
|
53
55
|
};
|
package/bin/dler.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/bin/dler.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { relinka } from "@reliverse/relinka";
|
|
2
|
+
import {
|
|
3
|
+
runMain,
|
|
4
|
+
defineCommand,
|
|
5
|
+
defineArgs,
|
|
6
|
+
selectPrompt,
|
|
7
|
+
showUsage,
|
|
8
|
+
runCmd
|
|
9
|
+
} from "@reliverse/rempts";
|
|
10
|
+
import { promptAggCommand } from "./addons.js";
|
|
11
|
+
import { cmdBuild, cmdPub } from "./app/cmds.js";
|
|
12
|
+
import { showEndPrompt, showStartPrompt } from "./info.js";
|
|
13
|
+
const INTERACTIVE_CMDS = ["agg", "build", "pub"];
|
|
14
|
+
const main = defineCommand({
|
|
15
|
+
meta: {
|
|
16
|
+
name: "dler",
|
|
17
|
+
description: `Interactively runs selected dler's command.
|
|
18
|
+
However, NI (non-interactive) mode is more powerful, to see NI mode available commands and arguments: 'dler --help' (or 'dler <command> --help')
|
|
19
|
+
Available interactive commands: ${INTERACTIVE_CMDS.join(", ")}`
|
|
20
|
+
},
|
|
21
|
+
args: defineArgs({
|
|
22
|
+
dev: {
|
|
23
|
+
type: "boolean",
|
|
24
|
+
description: "Runs the CLI in dev mode"
|
|
25
|
+
}
|
|
26
|
+
}),
|
|
27
|
+
async run({ args }) {
|
|
28
|
+
const isCI = process.env.CI === "true";
|
|
29
|
+
const isNonInteractive = !process.stdout.isTTY;
|
|
30
|
+
if (isCI || isNonInteractive) {
|
|
31
|
+
relinka(
|
|
32
|
+
"error",
|
|
33
|
+
"Non-interactive mode was detected. Please use `dler --help` to see available non-interactive commands and options."
|
|
34
|
+
);
|
|
35
|
+
showUsage(main);
|
|
36
|
+
process.exit(0);
|
|
37
|
+
}
|
|
38
|
+
await showStartPrompt(args.dev);
|
|
39
|
+
const cmdToRun = await selectPrompt({
|
|
40
|
+
title: "Select a command to run",
|
|
41
|
+
options: [
|
|
42
|
+
{ value: "agg", label: "agg" },
|
|
43
|
+
{ value: "build", label: "build" },
|
|
44
|
+
{ value: "pub", label: "pub" }
|
|
45
|
+
]
|
|
46
|
+
});
|
|
47
|
+
if (cmdToRun === "agg") {
|
|
48
|
+
await promptAggCommand();
|
|
49
|
+
}
|
|
50
|
+
if (cmdToRun === "build") {
|
|
51
|
+
await runCmd(await cmdBuild(), [`--dev=${args.dev}`]);
|
|
52
|
+
}
|
|
53
|
+
if (cmdToRun === "pub") {
|
|
54
|
+
await runCmd(await cmdPub(), [`--dev=${args.dev}`]);
|
|
55
|
+
}
|
|
56
|
+
relinka("log", " ");
|
|
57
|
+
await showEndPrompt();
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
await runMain(main);
|
package/bin/impl.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Main entry point for the dler build and publish process.
|
|
3
|
+
* Handles building and publishing for both main project and libraries.
|
|
4
|
+
*/
|
|
5
|
+
export declare function dlerBuild(isDev: boolean): Promise<void>;
|
|
6
|
+
/**
|
|
7
|
+
* Main entry point for the dler build and publish process.
|
|
8
|
+
* Handles building and publishing for both main project and libraries.
|
|
9
|
+
*/
|
|
10
|
+
export declare function dlerPub(isDev: boolean): Promise<void>;
|