@reliverse/dler 1.4.7 → 1.5.1
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 +8 -8
- package/bin/{addons.js → app/agg/run.js} +1 -1
- package/bin/app/build/cmd.js +2 -2
- package/bin/app/build/impl.js +97 -0
- package/bin/app/cmds.d.ts +41 -0
- package/bin/app/cmds.js +3 -0
- package/bin/app/pub/cmd.js +2 -2
- package/bin/app/relifso/cmd.js +13 -1
- package/bin/app/relifso/rename/cmd.d.ts +27 -0
- package/bin/app/relifso/rename/cmd.js +126 -0
- package/bin/{dler.js → cli.js} +2 -2
- package/bin/{init.js → init/init.js} +22 -4
- package/bin/{load.d.ts → init/load.d.ts} +1 -1
- package/bin/{load.js → init/load.js} +1 -1
- package/bin/{default.d.ts → libs/sdk/default.d.ts} +1 -1
- package/bin/{default.js → libs/sdk/default.js} +21 -10
- package/bin/libs/sdk/sdk-impl/build/build-library.d.ts +20 -28
- package/bin/libs/sdk/sdk-impl/build/build-library.js +12 -21
- package/bin/libs/sdk/sdk-impl/build/build-regular.d.ts +4 -11
- package/bin/libs/sdk/sdk-impl/build/build-regular.js +161 -118
- package/bin/libs/sdk/sdk-impl/library-flow.d.ts +11 -4
- package/bin/libs/sdk/sdk-impl/library-flow.js +29 -29
- package/bin/libs/sdk/sdk-impl/pub/pub-library.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/pub/pub-regular.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/regular-flow.d.ts +2 -9
- package/bin/libs/sdk/sdk-impl/regular-flow.js +91 -142
- package/bin/libs/sdk/sdk-impl/utils/finalize.d.ts +1 -2
- package/bin/libs/sdk/sdk-impl/utils/finalize.js +1 -3
- package/bin/libs/sdk/sdk-impl/utils/utils-build.js +8 -5
- package/bin/libs/sdk/sdk-impl/utils/utils-deps.d.ts +2 -2
- package/bin/libs/sdk/sdk-impl/utils/utils-deps.js +31 -7
- package/bin/libs/sdk/sdk-impl/utils/utils-error.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/utils/utils-perf.d.ts +1 -5
- package/bin/libs/sdk/sdk-impl/utils/utils-pkg-json-libs.d.ts +2 -2
- package/bin/libs/sdk/sdk-impl/utils/utils-pkg-json-libs.js +72 -91
- package/bin/libs/sdk/sdk-impl/utils/utils-pkg-json-reg.d.ts +2 -2
- package/bin/libs/sdk/sdk-impl/utils/utils-pkg-json-reg.js +19 -44
- package/bin/libs/sdk/sdk-mod.d.ts +0 -1
- package/bin/libs/sdk/sdk-types.d.ts +41 -20
- package/bin/mod.js +1 -1
- package/package.json +5 -19
- package/bin/impl.js +0 -219
- /package/bin/{addons.d.ts → app/agg/run.d.ts} +0 -0
- /package/bin/{impl.d.ts → app/build/impl.d.ts} +0 -0
- /package/bin/{dler.d.ts → cli.d.ts} +0 -0
- /package/bin/{info.d.ts → init/info.d.ts} +0 -0
- /package/bin/{info.js → init/info.js} +0 -0
- /package/bin/{init.d.ts → init/init.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
- 🎯 optimized for speed and modern workflows
|
|
16
16
|
- ✨ packed with powerful features under the hood
|
|
17
17
|
- 🛠️ converts typescript aliases to relative paths
|
|
18
|
-
- 🔌 plugin system with
|
|
18
|
+
- 🔌 plugin system with 14 built-in plugins included
|
|
19
19
|
- 📝 highly configurable flow via a configuration file
|
|
20
20
|
- 🔜 `libraries` plugin —> dler monorepo implementation
|
|
21
21
|
- 🧼 cleans up your internal logs from the build dist
|
|
@@ -52,7 +52,7 @@ ensure git, node.js, and bun/pnpm/yarn/npm are installed. then:
|
|
|
52
52
|
git clone https://github.com/reliverse/dler.git
|
|
53
53
|
cd dler
|
|
54
54
|
bun i
|
|
55
|
-
bun dev # bun src/
|
|
55
|
+
bun dev # bun src/cli.ts --dev
|
|
56
56
|
```
|
|
57
57
|
|
|
58
58
|
### installation
|
|
@@ -117,15 +117,15 @@ bun dev # bun src/dler.ts --dev
|
|
|
117
117
|
dler [build|pub] # if installed globally
|
|
118
118
|
```
|
|
119
119
|
|
|
120
|
-
## 🔌
|
|
120
|
+
## 🔌 plugins
|
|
121
121
|
|
|
122
|
-
dler ships with a flexible
|
|
122
|
+
dler ships with a flexible plugin system (aka plugins) and **14 built-in plugins** (from [reliverse addons](https://reliverse.org/addons) collection).
|
|
123
123
|
|
|
124
|
-
feel free to create your own
|
|
124
|
+
feel free to create your own plugins. plugins can be implemented as built-in directly in `src/app/<plugin>/impl/*` and then imported from `src/app/<plugin>/cmd.ts`; or implemented in your own library and then imported from `src/app/<plugin>/cmd.ts`.
|
|
125
125
|
|
|
126
|
-
if you run just `dler` — it will display a list of
|
|
126
|
+
if you run just `dler` — it will display a list of plugins which you can launch interactively.
|
|
127
127
|
|
|
128
|
-
## **available
|
|
128
|
+
## **available plugins**
|
|
129
129
|
|
|
130
130
|
[agg](#1-agg), [build](#2-build), [conv](#3-conv), [deps](#4-deps), [inject](#5-inject), [libs](#6-libs), [merge](#7-merge), [mono](#8-mono), [pub](#9-pub), [relifso](#10-relifso), [relinka](#11-relinka), [rempts](#12-rempts), [spell](#13-spell), [split](#14-split).
|
|
131
131
|
|
|
@@ -147,7 +147,7 @@ dler agg --input <dir> --out <file> [options]
|
|
|
147
147
|
|
|
148
148
|
```bash
|
|
149
149
|
bun tools:agg # shortcut for:
|
|
150
|
-
bun src/
|
|
150
|
+
bun src/cli.ts tools --dev --tool agg --input src/libs/sdk/sdk-impl --out src/libs/sdk/sdk-mod.ts --recursive --named --strip src/libs/sdk
|
|
151
151
|
```
|
|
152
152
|
|
|
153
153
|
### 2. `build`
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
} from "@reliverse/rempts";
|
|
7
7
|
import { existsSync } from "node:fs";
|
|
8
8
|
import { resolve } from "node:path";
|
|
9
|
-
import { cmdAgg } from "
|
|
9
|
+
import { cmdAgg } from "../cmds.js";
|
|
10
10
|
async function loadConfig() {
|
|
11
11
|
const configPath = resolve(".config/dler.ts");
|
|
12
12
|
if (!existsSync(configPath)) return null;
|
package/bin/app/build/cmd.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineArgs, defineCommand } from "@reliverse/rempts";
|
|
2
|
-
import { dlerBuild } from "
|
|
3
|
-
import { ensureDlerConfig } from "../../init.js";
|
|
2
|
+
import { dlerBuild } from "./impl.js";
|
|
3
|
+
import { ensureDlerConfig } from "../../init/init.js";
|
|
4
4
|
export default defineCommand({
|
|
5
5
|
meta: {
|
|
6
6
|
name: "build",
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import {
|
|
2
|
+
bumpHandler,
|
|
3
|
+
isBumpDisabled,
|
|
4
|
+
setBumpDisabledValueTo
|
|
5
|
+
} from "@reliverse/bleump";
|
|
6
|
+
import path from "@reliverse/pathkit";
|
|
7
|
+
import fs from "@reliverse/relifso";
|
|
8
|
+
import { loadConfig } from "../../init/load.js";
|
|
9
|
+
import { processLibraryFlow } from "../../libs/sdk/sdk-impl/library-flow.js";
|
|
10
|
+
import { processRegularFlow } from "../../libs/sdk/sdk-impl/regular-flow.js";
|
|
11
|
+
import { finalizeBuildPub } from "../../libs/sdk/sdk-impl/utils/finalize.js";
|
|
12
|
+
import { removeDistFolders } from "../../libs/sdk/sdk-impl/utils/utils-clean.js";
|
|
13
|
+
import { PROJECT_ROOT } from "../../libs/sdk/sdk-impl/utils/utils-consts.js";
|
|
14
|
+
import { handleDlerError } from "../../libs/sdk/sdk-impl/utils/utils-error.js";
|
|
15
|
+
import { createPerfTimer } from "../../libs/sdk/sdk-impl/utils/utils-perf.js";
|
|
16
|
+
export async function dlerBuild(isDev) {
|
|
17
|
+
const timer = createPerfTimer();
|
|
18
|
+
try {
|
|
19
|
+
const config = await loadConfig();
|
|
20
|
+
if (config.logsFreshFile) {
|
|
21
|
+
await fs.remove(path.join(PROJECT_ROOT, config.logsFileName));
|
|
22
|
+
}
|
|
23
|
+
await removeDistFolders(
|
|
24
|
+
config.distNpmDirName,
|
|
25
|
+
config.distJsrDirName,
|
|
26
|
+
config.libsDirDist,
|
|
27
|
+
config.libsList
|
|
28
|
+
);
|
|
29
|
+
try {
|
|
30
|
+
const bumpIsDisabled = await isBumpDisabled();
|
|
31
|
+
if (!bumpIsDisabled && !config.commonPubPause) {
|
|
32
|
+
await bumpHandler(
|
|
33
|
+
config.bumpMode,
|
|
34
|
+
false,
|
|
35
|
+
config.bumpFilter,
|
|
36
|
+
config.bumpSet
|
|
37
|
+
);
|
|
38
|
+
await setBumpDisabledValueTo(true);
|
|
39
|
+
}
|
|
40
|
+
} catch {
|
|
41
|
+
throw new Error("[.config/dler.ts] Failed to set bumpDisable to true");
|
|
42
|
+
}
|
|
43
|
+
await processRegularFlow(timer, isDev, config);
|
|
44
|
+
await processLibraryFlow(timer, isDev, config);
|
|
45
|
+
await finalizeBuildPub(
|
|
46
|
+
timer,
|
|
47
|
+
config.commonPubPause,
|
|
48
|
+
config.libsList,
|
|
49
|
+
config.distNpmDirName,
|
|
50
|
+
config.distJsrDirName,
|
|
51
|
+
config.libsDirDist
|
|
52
|
+
);
|
|
53
|
+
} catch (error) {
|
|
54
|
+
handleDlerError(error, timer);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
export async function dlerPub(isDev) {
|
|
58
|
+
const timer = createPerfTimer();
|
|
59
|
+
try {
|
|
60
|
+
const config = await loadConfig();
|
|
61
|
+
if (config.logsFreshFile) {
|
|
62
|
+
await fs.remove(path.join(PROJECT_ROOT, config.logsFileName));
|
|
63
|
+
}
|
|
64
|
+
await removeDistFolders(
|
|
65
|
+
config.distNpmDirName,
|
|
66
|
+
config.distJsrDirName,
|
|
67
|
+
config.libsDirDist,
|
|
68
|
+
config.libsList
|
|
69
|
+
);
|
|
70
|
+
const bumpIsDisabled = await isBumpDisabled();
|
|
71
|
+
if (!bumpIsDisabled && !config.commonPubPause) {
|
|
72
|
+
try {
|
|
73
|
+
await bumpHandler(
|
|
74
|
+
config.bumpMode,
|
|
75
|
+
false,
|
|
76
|
+
config.bumpFilter,
|
|
77
|
+
config.bumpSet
|
|
78
|
+
);
|
|
79
|
+
await setBumpDisabledValueTo(true);
|
|
80
|
+
} catch {
|
|
81
|
+
throw new Error("[.config/dler.ts] Failed to set bumpDisable to true");
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
await processRegularFlow(timer, isDev, config);
|
|
85
|
+
await processLibraryFlow(timer, isDev, config);
|
|
86
|
+
await finalizeBuildPub(
|
|
87
|
+
timer,
|
|
88
|
+
config.commonPubPause,
|
|
89
|
+
config.libsList,
|
|
90
|
+
config.distNpmDirName,
|
|
91
|
+
config.distJsrDirName,
|
|
92
|
+
config.libsDirDist
|
|
93
|
+
);
|
|
94
|
+
} catch (error) {
|
|
95
|
+
handleDlerError(error, timer);
|
|
96
|
+
}
|
|
97
|
+
}
|
package/bin/app/cmds.d.ts
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 👉 `dler rempts init --cmds`
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* import { cmdAgg } from "./cmds.js";
|
|
7
|
+
* await runCmd(await cmdAgg(), [
|
|
8
|
+
* `--imports=${imports}`,
|
|
9
|
+
* `--input=${input}`,
|
|
10
|
+
* `--named=${named}`,
|
|
11
|
+
* `--out=${out}`,
|
|
12
|
+
* `--recursive=${recursive}`,
|
|
13
|
+
* `--strip=${strip}`,
|
|
14
|
+
* ]);
|
|
15
|
+
*/
|
|
1
16
|
export declare function cmdRelifsoInit(): Promise<import("@reliverse/rempts").Command<{
|
|
2
17
|
dev: {
|
|
3
18
|
type: "boolean";
|
|
@@ -132,3 +147,29 @@ export declare function cmdPub(): Promise<import("@reliverse/rempts").Command<{
|
|
|
132
147
|
description: string;
|
|
133
148
|
};
|
|
134
149
|
}>>;
|
|
150
|
+
export declare function cmdRelifsoRename(): Promise<import("@reliverse/rempts").Command<{
|
|
151
|
+
dev: {
|
|
152
|
+
type: "boolean";
|
|
153
|
+
description: string;
|
|
154
|
+
};
|
|
155
|
+
prepareMyCLI: {
|
|
156
|
+
type: "boolean";
|
|
157
|
+
description: string;
|
|
158
|
+
required: false;
|
|
159
|
+
};
|
|
160
|
+
revert: {
|
|
161
|
+
type: "boolean";
|
|
162
|
+
description: string;
|
|
163
|
+
required: false;
|
|
164
|
+
};
|
|
165
|
+
source: {
|
|
166
|
+
type: "string";
|
|
167
|
+
description: string;
|
|
168
|
+
required: false;
|
|
169
|
+
};
|
|
170
|
+
destination: {
|
|
171
|
+
type: "string";
|
|
172
|
+
description: string;
|
|
173
|
+
required: false;
|
|
174
|
+
};
|
|
175
|
+
}>>;
|
package/bin/app/cmds.js
CHANGED
package/bin/app/pub/cmd.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineArgs, defineCommand } from "@reliverse/rempts";
|
|
2
|
-
import { dlerPub } from "
|
|
3
|
-
import { ensureDlerConfig } from "../../init.js";
|
|
2
|
+
import { dlerPub } from "../build/impl.js";
|
|
3
|
+
import { ensureDlerConfig } from "../../init/init.js";
|
|
4
4
|
export default defineCommand({
|
|
5
5
|
meta: {
|
|
6
6
|
name: "build",
|
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 { cmdRelifsoInit } from "../cmds.js";
|
|
3
|
+
import { cmdRelifsoInit, cmdRelifsoRename } from "../cmds.js";
|
|
4
4
|
export default defineCommand({
|
|
5
5
|
meta: {
|
|
6
6
|
name: "relifso",
|
|
@@ -26,11 +26,23 @@ export default defineCommand({
|
|
|
26
26
|
{
|
|
27
27
|
value: "init",
|
|
28
28
|
label: "Initialize files"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
value: "rename-prepare",
|
|
32
|
+
label: "Rename files (prepare CLI)"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
value: "rename-prepare-revert",
|
|
36
|
+
label: "Rename files (prepare CLI)"
|
|
29
37
|
}
|
|
30
38
|
]
|
|
31
39
|
});
|
|
32
40
|
if (cmd === "init") {
|
|
33
41
|
await runCmd(await cmdRelifsoInit(), []);
|
|
42
|
+
} else if (cmd === "rename-prepare") {
|
|
43
|
+
await runCmd(await cmdRelifsoRename(), ["--prepareMyCLI"]);
|
|
44
|
+
} else if (cmd === "rename-prepare-revert") {
|
|
45
|
+
await runCmd(await cmdRelifsoRename(), ["--prepareMyCLI", "--revert"]);
|
|
34
46
|
}
|
|
35
47
|
}
|
|
36
48
|
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
declare const _default: import("@reliverse/rempts").Command<{
|
|
2
|
+
dev: {
|
|
3
|
+
type: "boolean";
|
|
4
|
+
description: string;
|
|
5
|
+
};
|
|
6
|
+
prepareMyCLI: {
|
|
7
|
+
type: "boolean";
|
|
8
|
+
description: string;
|
|
9
|
+
required: false;
|
|
10
|
+
};
|
|
11
|
+
revert: {
|
|
12
|
+
type: "boolean";
|
|
13
|
+
description: string;
|
|
14
|
+
required: false;
|
|
15
|
+
};
|
|
16
|
+
source: {
|
|
17
|
+
type: "string";
|
|
18
|
+
description: string;
|
|
19
|
+
required: false;
|
|
20
|
+
};
|
|
21
|
+
destination: {
|
|
22
|
+
type: "string";
|
|
23
|
+
description: string;
|
|
24
|
+
required: false;
|
|
25
|
+
};
|
|
26
|
+
}>;
|
|
27
|
+
export default _default;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { relinka } from "@reliverse/relinka";
|
|
2
|
+
import { defineCommand } from "@reliverse/rempts";
|
|
3
|
+
import { existsSync, readdirSync } from "node:fs";
|
|
4
|
+
import { readFileSync } from "node:fs";
|
|
5
|
+
import { rename, access } from "node:fs/promises";
|
|
6
|
+
import { join, dirname, basename, extname } from "node:path";
|
|
7
|
+
async function fileExists(path) {
|
|
8
|
+
try {
|
|
9
|
+
await access(path);
|
|
10
|
+
return true;
|
|
11
|
+
} catch {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
async function safeRename(source, destination) {
|
|
16
|
+
if (await fileExists(destination)) {
|
|
17
|
+
throw new Error(`Destination file already exists: ${destination}`);
|
|
18
|
+
}
|
|
19
|
+
await rename(source, destination);
|
|
20
|
+
}
|
|
21
|
+
function isCommonJSFile(content) {
|
|
22
|
+
return content.includes("module.exports") || content.includes("require(");
|
|
23
|
+
}
|
|
24
|
+
async function prepareCLIFiles(revert = false) {
|
|
25
|
+
const configPath = ".config/dler.ts";
|
|
26
|
+
let srcDir = "src";
|
|
27
|
+
if (existsSync(configPath)) {
|
|
28
|
+
const configContent = readFileSync(configPath, "utf-8");
|
|
29
|
+
const configMatch = configContent.match(
|
|
30
|
+
/coreEntrySrcDir:\s*["']([^"']+)["']/
|
|
31
|
+
);
|
|
32
|
+
srcDir = configMatch?.[1] ?? srcDir;
|
|
33
|
+
}
|
|
34
|
+
if (!existsSync(srcDir)) {
|
|
35
|
+
throw new Error(`Source directory not found: ${srcDir}`);
|
|
36
|
+
}
|
|
37
|
+
const files = readdirSync(srcDir, { recursive: true, encoding: "utf-8" });
|
|
38
|
+
for (const file of files) {
|
|
39
|
+
const fullPath = join(srcDir, file);
|
|
40
|
+
if (!existsSync(fullPath)) continue;
|
|
41
|
+
const ext = extname(file);
|
|
42
|
+
const baseName = basename(file, ext);
|
|
43
|
+
const dir = dirname(fullPath);
|
|
44
|
+
if (revert) {
|
|
45
|
+
if (file.endsWith(".json.json")) {
|
|
46
|
+
await safeRename(fullPath, join(dir, baseName));
|
|
47
|
+
} else if (file.endsWith(".d.ts.txt")) {
|
|
48
|
+
await safeRename(fullPath, join(dir, `${baseName}.d.ts`));
|
|
49
|
+
} else if (file.endsWith(".cjs")) {
|
|
50
|
+
await safeRename(fullPath, join(dir, `${baseName}.js`));
|
|
51
|
+
}
|
|
52
|
+
} else {
|
|
53
|
+
if (file === "tsconfig.json" && !file.endsWith(".json.json")) {
|
|
54
|
+
await safeRename(fullPath, join(dir, "tsconfig.json.json"));
|
|
55
|
+
} else if (file === "package.json" && !file.endsWith(".json.json")) {
|
|
56
|
+
await safeRename(fullPath, join(dir, "package.json.json"));
|
|
57
|
+
} else if (file.endsWith(".d.ts") && !file.endsWith(".d.ts.txt")) {
|
|
58
|
+
await safeRename(fullPath, join(dir, `${baseName}.d.ts.txt`));
|
|
59
|
+
} else if (file.endsWith(".js") && !file.endsWith(".cjs")) {
|
|
60
|
+
const content = readFileSync(fullPath, "utf-8");
|
|
61
|
+
if (isCommonJSFile(content)) {
|
|
62
|
+
await safeRename(fullPath, join(dir, `${baseName}.cjs`));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
export default defineCommand({
|
|
69
|
+
meta: {
|
|
70
|
+
name: "rename",
|
|
71
|
+
version: "1.0.0",
|
|
72
|
+
description: "Rename files for CLI preparation"
|
|
73
|
+
},
|
|
74
|
+
args: {
|
|
75
|
+
dev: {
|
|
76
|
+
type: "boolean",
|
|
77
|
+
description: "Runs the CLI in dev mode"
|
|
78
|
+
},
|
|
79
|
+
prepareMyCLI: {
|
|
80
|
+
type: "boolean",
|
|
81
|
+
description: "Prepare CLI by renaming files",
|
|
82
|
+
required: false
|
|
83
|
+
},
|
|
84
|
+
revert: {
|
|
85
|
+
type: "boolean",
|
|
86
|
+
description: "Revert renamed files back to original names",
|
|
87
|
+
required: false
|
|
88
|
+
},
|
|
89
|
+
source: {
|
|
90
|
+
type: "string",
|
|
91
|
+
description: "Source file or directory to rename",
|
|
92
|
+
required: false
|
|
93
|
+
},
|
|
94
|
+
destination: {
|
|
95
|
+
type: "string",
|
|
96
|
+
description: "Destination name for the rename operation",
|
|
97
|
+
required: false
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
async run({ args }) {
|
|
101
|
+
const { prepareMyCLI, revert, source, destination } = args;
|
|
102
|
+
if (prepareMyCLI === true) {
|
|
103
|
+
try {
|
|
104
|
+
await prepareCLIFiles(revert === true);
|
|
105
|
+
relinka("log", "Successfully prepared CLI files");
|
|
106
|
+
} catch (error) {
|
|
107
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
108
|
+
relinka("error", `Error preparing CLI: ${errorMessage}`);
|
|
109
|
+
process.exit(1);
|
|
110
|
+
}
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
if (!source || !destination) {
|
|
114
|
+
relinka("error", "Usage: dler relifso rename <source> <destination>");
|
|
115
|
+
process.exit(1);
|
|
116
|
+
}
|
|
117
|
+
try {
|
|
118
|
+
await safeRename(source, destination);
|
|
119
|
+
relinka("log", `Successfully renamed '${source}' to '${destination}'`);
|
|
120
|
+
} catch (error) {
|
|
121
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
122
|
+
relinka("error", `Error renaming: ${errorMessage}`);
|
|
123
|
+
process.exit(1);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
});
|
package/bin/{dler.js → cli.js}
RENAMED
|
@@ -7,9 +7,9 @@ import {
|
|
|
7
7
|
showUsage,
|
|
8
8
|
runCmd
|
|
9
9
|
} from "@reliverse/rempts";
|
|
10
|
-
import { promptAggCommand } from "./
|
|
10
|
+
import { promptAggCommand } from "./app/agg/run.js";
|
|
11
11
|
import { cmdBuild, cmdPub } from "./app/cmds.js";
|
|
12
|
-
import { showEndPrompt, showStartPrompt } from "./info.js";
|
|
12
|
+
import { showEndPrompt, showStartPrompt } from "./init/info.js";
|
|
13
13
|
const INTERACTIVE_CMDS = ["agg", "build", "pub"];
|
|
14
14
|
const main = defineCommand({
|
|
15
15
|
meta: {
|
|
@@ -2,7 +2,7 @@ import path from "@reliverse/pathkit";
|
|
|
2
2
|
import fs from "@reliverse/relifso";
|
|
3
3
|
import { relinka } from "@reliverse/relinka";
|
|
4
4
|
import { readPackageJSON } from "pkg-types";
|
|
5
|
-
import { DEFAULT_CONFIG } from "
|
|
5
|
+
import { DEFAULT_CONFIG } from "../libs/sdk/default.js";
|
|
6
6
|
const CONFIG_FILENAME = ".config/dler.ts";
|
|
7
7
|
export async function ensureDlerConfig(isDev) {
|
|
8
8
|
const configPath = path.resolve(process.cwd(), CONFIG_FILENAME);
|
|
@@ -46,7 +46,7 @@ function getCoreIsCLI(isDev) {
|
|
|
46
46
|
// },`;
|
|
47
47
|
}
|
|
48
48
|
function generateConfig(isDev, pkgDescription) {
|
|
49
|
-
const importDefineConfigStatement = isDev ? `import { defineConfig } from "
|
|
49
|
+
const importDefineConfigStatement = isDev ? `import { defineConfig } from "../mod.js";` : `import { defineConfig } from "@reliverse/dler";`;
|
|
50
50
|
const verboseValue = getValue(isDev, true, DEFAULT_CONFIG.commonVerbose);
|
|
51
51
|
const coreIsCLI = getCoreIsCLI(isDev);
|
|
52
52
|
const registryValue = getValue(
|
|
@@ -140,8 +140,26 @@ export default defineConfig({
|
|
|
140
140
|
logsFileName: "${DEFAULT_CONFIG.logsFileName}",
|
|
141
141
|
logsFreshFile: ${DEFAULT_CONFIG.logsFreshFile},
|
|
142
142
|
// Dependency filtering
|
|
143
|
-
|
|
144
|
-
|
|
143
|
+
// Global is always applied
|
|
144
|
+
removeDepsPatterns: {
|
|
145
|
+
global: [
|
|
146
|
+
"@types",
|
|
147
|
+
"biome",
|
|
148
|
+
"eslint",
|
|
149
|
+
"knip",
|
|
150
|
+
"prettier",
|
|
151
|
+
"typescript",
|
|
152
|
+
"@reliverse/dler",
|
|
153
|
+
],
|
|
154
|
+
"dist-npm": [],
|
|
155
|
+
"dist-jsr": [],
|
|
156
|
+
"dist-libs": {
|
|
157
|
+
"@reliverse/dler-sdk": {
|
|
158
|
+
npm: [],
|
|
159
|
+
jsr: [],
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
},
|
|
145
163
|
// Build setup
|
|
146
164
|
transpileEsbuild: "${DEFAULT_CONFIG.transpileEsbuild}",
|
|
147
165
|
transpileFormat: "${DEFAULT_CONFIG.transpileFormat}",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BuildPublishConfig } from "
|
|
1
|
+
import type { BuildPublishConfig } from "../libs/sdk/sdk-types.js";
|
|
2
2
|
/**
|
|
3
3
|
* Searches for and loads the configuration file `.config/dler.ts`.
|
|
4
4
|
* Falls back to default configuration if the file is not found.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from "@reliverse/relifso";
|
|
2
2
|
import { relinka } from "@reliverse/relinka";
|
|
3
3
|
import { resolve } from "node:path";
|
|
4
|
-
import { defineConfig } from "
|
|
4
|
+
import { defineConfig } from "../mod.js";
|
|
5
5
|
const CONFIG_FILENAME = ".config/dler.ts";
|
|
6
6
|
export async function loadConfig() {
|
|
7
7
|
const cwd = process.cwd();
|
|
@@ -34,16 +34,27 @@ export const DEFAULT_CONFIG = {
|
|
|
34
34
|
libsList: {},
|
|
35
35
|
logsFileName: "logs/relinka.log",
|
|
36
36
|
logsFreshFile: true,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
37
|
+
// Dependency filtering
|
|
38
|
+
removeDepsPatterns: {
|
|
39
|
+
global: [
|
|
40
|
+
"@types",
|
|
41
|
+
"biome",
|
|
42
|
+
"eslint",
|
|
43
|
+
"knip",
|
|
44
|
+
"prettier",
|
|
45
|
+
"typescript",
|
|
46
|
+
"@reliverse/dler"
|
|
47
|
+
],
|
|
48
|
+
"dist-npm": [],
|
|
49
|
+
"dist-jsr": [],
|
|
50
|
+
"dist-libs": {
|
|
51
|
+
"@reliverse/dler-sdk": {
|
|
52
|
+
npm: [],
|
|
53
|
+
jsr: []
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
// Build setup
|
|
47
58
|
transpileEsbuild: "es2023",
|
|
48
59
|
transpileFormat: "esm",
|
|
49
60
|
transpileMinify: true,
|
|
@@ -1,29 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import {
|
|
3
|
-
/** Options common to both NPM and JSR build targets */
|
|
4
|
-
type BaseLibBuildOptions = {
|
|
5
|
-
libName: string;
|
|
6
|
-
mainDir: string;
|
|
7
|
-
libMainFile: string;
|
|
8
|
-
isDev: boolean;
|
|
9
|
-
libsList: Record<string, LibConfig>;
|
|
10
|
-
rmDepsMode: ExcludeMode;
|
|
11
|
-
rmDepsPatterns: string[];
|
|
12
|
-
timer: PerfTimer;
|
|
13
|
-
};
|
|
14
|
-
/** Options specific to the transpilation/bundling process */
|
|
15
|
-
type TranspileOptions = {
|
|
16
|
-
transpileTarget: transpileTarget;
|
|
17
|
-
transpileFormat: transpileFormat;
|
|
18
|
-
transpileSplitting: boolean;
|
|
19
|
-
libTranspileMinify: boolean;
|
|
20
|
-
transpileSourcemap: Sourcemap;
|
|
21
|
-
transpilePublicPath: string;
|
|
22
|
-
transpileEsbuild: Esbuild;
|
|
23
|
-
transpileStub: boolean;
|
|
24
|
-
transpileWatch: boolean;
|
|
25
|
-
unifiedBundlerOutExt: NpmOutExt;
|
|
26
|
-
};
|
|
1
|
+
import type { PerfTimer } from "../../sdk-types.js";
|
|
2
|
+
import type { BundlerName, BuildPublishConfig, Esbuild, LibConfig, NpmOutExt, Sourcemap, transpileFormat, transpileTarget } from "../../sdk-types.js";
|
|
27
3
|
/** Options specific to the NPM build target */
|
|
28
4
|
type NpmBuildOptions = {
|
|
29
5
|
npmOutDir: string;
|
|
@@ -37,11 +13,27 @@ type JsrBuildOptions = {
|
|
|
37
13
|
distJsrOutFilesExt: NpmOutExt;
|
|
38
14
|
};
|
|
39
15
|
/** Consolidated options for the main library build function */
|
|
40
|
-
export type LibraryBuildOptions = {
|
|
16
|
+
export type LibraryBuildOptions = BuildPublishConfig & {
|
|
41
17
|
effectivePubRegistry: "npm" | "jsr" | "npm-jsr" | undefined;
|
|
42
18
|
npm?: NpmBuildOptions;
|
|
43
19
|
jsr?: JsrBuildOptions;
|
|
44
|
-
|
|
20
|
+
libName: string;
|
|
21
|
+
mainDir: string;
|
|
22
|
+
libMainFile: string;
|
|
23
|
+
isDev: boolean;
|
|
24
|
+
libsList: Record<string, LibConfig>;
|
|
25
|
+
timer: PerfTimer;
|
|
26
|
+
libTranspileMinify: boolean;
|
|
27
|
+
transpileTarget: transpileTarget;
|
|
28
|
+
transpileFormat: transpileFormat;
|
|
29
|
+
transpileSplitting: boolean;
|
|
30
|
+
transpileSourcemap: Sourcemap;
|
|
31
|
+
transpilePublicPath: string;
|
|
32
|
+
transpileEsbuild: Esbuild;
|
|
33
|
+
transpileStub: boolean;
|
|
34
|
+
transpileWatch: boolean;
|
|
35
|
+
unifiedBundlerOutExt: NpmOutExt;
|
|
36
|
+
};
|
|
45
37
|
/**
|
|
46
38
|
* Main entry point to build a library based on the provided options.
|
|
47
39
|
* Manages pre-build source modifications, orchestrates target builds, and ensures post-build cleanup.
|
|
@@ -33,9 +33,7 @@ import {
|
|
|
33
33
|
createJsrJSON,
|
|
34
34
|
renameTsxFiles
|
|
35
35
|
} from "../utils/utils-jsr-json.js";
|
|
36
|
-
import {
|
|
37
|
-
getElapsedPerfTime
|
|
38
|
-
} from "../utils/utils-perf.js";
|
|
36
|
+
import { getElapsedPerfTime } from "../utils/utils-perf.js";
|
|
39
37
|
import { library_createPackageJSON } from "../utils/utils-pkg-json-libs.js";
|
|
40
38
|
const BIN_DIR_NAME = "bin";
|
|
41
39
|
const REPLACEMENT_MARKER = "// dler-replace-me";
|
|
@@ -267,8 +265,6 @@ async function library_buildDistributionTarget(params) {
|
|
|
267
265
|
timer,
|
|
268
266
|
libMainFile,
|
|
269
267
|
libsList,
|
|
270
|
-
rmDepsMode,
|
|
271
|
-
rmDepsPatterns,
|
|
272
268
|
// Transpile/Bundle Options from `options`
|
|
273
269
|
libTranspileMinify,
|
|
274
270
|
transpileTarget,
|
|
@@ -313,8 +309,7 @@ async function library_buildDistributionTarget(params) {
|
|
|
313
309
|
isJsr,
|
|
314
310
|
libName,
|
|
315
311
|
libsList,
|
|
316
|
-
|
|
317
|
-
rmDepsPatterns,
|
|
312
|
+
config: options,
|
|
318
313
|
unifiedBundlerOutExt,
|
|
319
314
|
distJsrOutFilesExt,
|
|
320
315
|
deleteFiles: isJsr,
|
|
@@ -550,8 +545,7 @@ async function library_performCommonBuildSteps(params) {
|
|
|
550
545
|
isJsr,
|
|
551
546
|
libName,
|
|
552
547
|
libsList,
|
|
553
|
-
|
|
554
|
-
rmDepsPatterns,
|
|
548
|
+
config,
|
|
555
549
|
unifiedBundlerOutExt,
|
|
556
550
|
distJsrOutFilesExt,
|
|
557
551
|
deleteFiles = false,
|
|
@@ -566,18 +560,15 @@ async function library_performCommonBuildSteps(params) {
|
|
|
566
560
|
"verbose",
|
|
567
561
|
`${logPrefix} Performing common steps in ${outputDirRoot}`
|
|
568
562
|
);
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
unifiedBundlerOutExt
|
|
579
|
-
);
|
|
580
|
-
}
|
|
563
|
+
await library_createPackageJSON(
|
|
564
|
+
libName,
|
|
565
|
+
npmOutputDirRoot || outputDirRoot,
|
|
566
|
+
jsrOutputDirRoot || outputDirRoot,
|
|
567
|
+
effectivePubRegistry,
|
|
568
|
+
libsList,
|
|
569
|
+
config,
|
|
570
|
+
unifiedBundlerOutExt
|
|
571
|
+
);
|
|
581
572
|
relinka("verbose", `${logPrefix} Created package.json.`);
|
|
582
573
|
await removeLogInternalCalls(outDirBin);
|
|
583
574
|
if (deleteFiles) {
|