@reliverse/dler 1.2.1 → 1.2.3
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 -61
- package/bin/app/build/cmd.js +17 -0
- package/bin/app/deps/impl/types.js +0 -0
- package/bin/{cli/args/inject → app/inject/impl}/ts-expect-error.txt +3 -3
- 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 +5 -0
- package/bin/{cli/args/init/libs/reinit/reint-impl → app/relifso/impl}/reinit-mod.txt +5 -5
- package/bin/{cli/args/init/libs/reinit/reint-impl → app/relifso/impl}/templates/t-license.js +1 -1
- package/bin/app/relifso/impl/types.js +0 -0
- package/bin/app/relinka/cmd.js +0 -0
- package/bin/{cli/args/init/init-mod.txt → app/rempts/cmd.txt} +1 -1
- package/bin/{cli/args/init/cmd → app/rempts/impl}/index.js +5 -4
- 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} +2 -2
- package/bin/{cli/args/tools/tools-impl.js → app/tools/impl.js} +15 -15
- package/bin/{tools.txt → app/tools/tools.txt} +1 -1
- package/bin/cli.js +104 -3
- package/bin/init.js +22 -6
- package/bin/libs/cfg/cfg-default.js +1 -0
- package/bin/libs/sdk/sdk-impl/build/build-library.js +68 -36
- package/bin/libs/sdk/sdk-impl/build/build-regular.js +22 -12
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/auto.js +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/build.js +4 -7
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist.js +3 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/watch.js +3 -3
- package/bin/libs/sdk/sdk-impl/library-flow.js +1 -1
- package/bin/libs/sdk/sdk-impl/pub/pub-library.js +9 -9
- package/bin/libs/sdk/sdk-impl/pub/pub-regular.js +4 -4
- package/bin/libs/sdk/sdk-impl/regular-flow.js +17 -11
- package/bin/libs/sdk/sdk-impl/utils/tools/tools-impl.js +6 -6
- package/bin/libs/sdk/sdk-impl/utils/utils-build.js +2 -2
- package/bin/libs/sdk/sdk-impl/utils/utils-bump.js +4 -4
- package/bin/libs/sdk/sdk-impl/utils/utils-fs.js +2 -5
- package/bin/libs/sdk/sdk-impl/utils/utils-info.js +4 -4
- package/bin/libs/sdk/sdk-impl/utils/utils-jsr-json.js +3 -1
- package/bin/libs/sdk/sdk-impl/utils/utils-paths.js +6 -6
- package/bin/libs/sdk/sdk-impl/utils/utils-pkg-json-libs.js +2 -2
- package/bin/libs/sdk/sdk-impl/utils/utils-pkg-json-reg.js +8 -5
- package/bin/load.js +1 -1
- package/bin/mod.js +7 -39
- package/package.json +7 -8
- 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/types.js +0 -1
- 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/deps/types.js → app/cmds.js} +0 -0
- /package/bin/{cli/args → app}/conv/README.md +0 -0
- /package/bin/{cli/args/init/libs/reinit/reint-impl/types.js → app/conv/cmd.js} +0 -0
- /package/bin/{cli/args/mono/mono-mod.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 → app}/inject/README.md +0 -0
- /package/bin/{cli/args/inject/inject-mod.js → app/inject/cmd.js} +0 -0
- /package/bin/{cli/args/inject → app/inject/impl}/arg-ts-expect-error.txt +0 -0
- /package/bin/{cli/args/inject → app/inject/impl}/inject-mod.txt +0 -0
- /package/bin/{cli/args/inject → app/inject/impl}/reinject.config.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/impl}/const.js +0 -0
- /package/bin/{cli/args/init/libs/reinit/reint-impl → app/relifso/impl}/templates/t-gitignore.js +0 -0
- /package/bin/{cli/args/init/libs/reinit/reint-impl → app/relifso/impl}/templates/t-readme.js +0 -0
- /package/bin/{cli/args/init/libs/reinit/reint-impl → app/relifso/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/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# dler (prev. relidler) • reliverse bundler
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> @reliverse/dler (`/ˈdiː.lər/`, dealer) is a flexible, unified, and fully automated bundler for typescript and javascript projects, as well as an npm and jsr publishing tool. dler is not only a bundler, it also tries to serve as the most powerful codemod toolkit for js/ts.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
[sponsor](https://github.com/sponsors/blefnk) — [discord](https://discord.gg/pb8ukbwpsj) — [repo](https://github.com/reliverse/dler) — [npm](https://npmjs.com/@reliverse/dler) — [docs](https://docs.reliverse.org/reliverse/dler)
|
|
6
6
|
|
|
7
7
|
## features
|
|
8
8
|
|
|
9
|
-
- 😘 replacement for `unbuild`
|
|
9
|
+
- 😘 replacement for `unjs/unbuild`
|
|
10
10
|
- ⚡ `dler` works via cli and sdk
|
|
11
11
|
- 📦 automated npm/jsr publishing
|
|
12
12
|
- ✅ ensures reliable js/ts builds
|
|
@@ -122,77 +122,41 @@ bun dev # bun src/mod.ts --dev
|
|
|
122
122
|
dler [build|pub] # if installed globally
|
|
123
123
|
```
|
|
124
124
|
|
|
125
|
-
absolutely! here’s your improved section, now listing all available spell types:
|
|
126
|
-
|
|
127
|
-
---
|
|
128
|
-
|
|
129
125
|
## 🔌 plugins
|
|
130
126
|
|
|
131
|
-
dler ships with a flexible plugin system and **
|
|
132
|
-
|
|
133
|
-
### 1. `magic-spells-dler-plugin`
|
|
134
|
-
|
|
135
|
-
**available spell types:**
|
|
136
|
-
|
|
137
|
-
- `replace-line` — injects contents from one file into another
|
|
138
|
-
- `rename-file` — renames the current file
|
|
139
|
-
- `remove-comment` — removes a specific comment from code
|
|
140
|
-
- `remove-line` — removes a specific line from code
|
|
141
|
-
- `remove-file` — deletes the current file
|
|
142
|
-
- `transform-content` — applies a transformation to the file content
|
|
143
|
-
- `copy-file` — copies the current file to a new location
|
|
144
|
-
- `move-file` — moves the current file to a new location
|
|
145
|
-
- `insert-at` — inserts content at a specific position in the file
|
|
146
|
-
|
|
147
|
-
**params:**
|
|
148
|
-
|
|
149
|
-
params are optional and comma-separated.
|
|
127
|
+
dler ships with a flexible plugin system and **15 built-in plugins** (from [@reliverse/addons](https://reliverse.org/addons)).
|
|
150
128
|
|
|
151
|
-
|
|
129
|
+
feel free to create your own plugins. plugins can be implemented as built-in directly in `src/app/plugin-name/impl/*` and then imported from `src/app/plugin-name/cmd.ts`; or implemented in your own library and then imported from `src/app/plugin-name/cmd.ts`.
|
|
152
130
|
|
|
153
|
-
|
|
154
|
-
- `false`: dler handles the spell automatically at postbuild
|
|
155
|
-
- `true`: disables default behavior, so you can trigger the spell yourself (e.g. from your own cli function)
|
|
156
|
-
|
|
157
|
-
more params coming soon...
|
|
131
|
+
### 1. `agg`
|
|
158
132
|
|
|
159
|
-
|
|
133
|
+
generates aggregator file with content like `import { getsomething } from "./utils.js"`.
|
|
160
134
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
- `// <dler-remove-file-{hooked=false}>` — deletes this file
|
|
165
|
-
- `// <dler-rename-file-"tsconfig.json"-{hooked=false}>` — renames this file (runs at postbuild because `hooked=false`)
|
|
166
|
-
|
|
167
|
-
**using `hooked=true`:**
|
|
135
|
+
```bash
|
|
136
|
+
dler agg ...
|
|
137
|
+
```
|
|
168
138
|
|
|
169
|
-
|
|
139
|
+
### 2. `auth`
|
|
170
140
|
|
|
171
|
-
|
|
141
|
+
best friend of auth+db libs like [better-auth](https://better-auth.com) and [drizzle-orm](https://orm.drizzle.team).
|
|
172
142
|
|
|
173
|
-
|
|
143
|
+
```bash
|
|
144
|
+
dler auth better-auth generate
|
|
145
|
+
```
|
|
174
146
|
|
|
175
|
-
|
|
176
|
-
- `dler spell --trigger all`
|
|
177
|
-
- `dler spell`
|
|
147
|
+
### 3. `build`
|
|
178
148
|
|
|
179
|
-
|
|
149
|
+
since dler is fully modular, build command is separated for its own build-in plugin as well.
|
|
180
150
|
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
// await dler.spell({}) // means all spells and all files
|
|
184
|
-
// spell: ["all"] // means all spells
|
|
185
|
-
// spell: [] // means all spells
|
|
186
|
-
// files: [] // means all files
|
|
151
|
+
```bash
|
|
152
|
+
dler build ...
|
|
187
153
|
```
|
|
188
154
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
here’s an extended and improved section for your readme, keeping your lowercase style and adding clarity, options, and a bit more detail:
|
|
155
|
+
### 4. `conv`
|
|
192
156
|
|
|
193
|
-
|
|
157
|
+
not yet documented.
|
|
194
158
|
|
|
195
|
-
###
|
|
159
|
+
### 5. `deps`
|
|
196
160
|
|
|
197
161
|
finds missing dependencies in your project by scanning your code for imports and comparing them to your `package.json`.
|
|
198
162
|
|
|
@@ -239,7 +203,11 @@ dler deps --all --directory ./src --include-builtins
|
|
|
239
203
|
missing dependencies are shown only once, even if used in multiple files.
|
|
240
204
|
deep imports like `dep/some/file` or `@org/dep/some/thing` are always resolved to their root package.
|
|
241
205
|
|
|
242
|
-
###
|
|
206
|
+
### 6. `inject`
|
|
207
|
+
|
|
208
|
+
not yet documented.
|
|
209
|
+
|
|
210
|
+
### 7. `libs`
|
|
243
211
|
|
|
244
212
|
builds and publishes specific subdirectories of your main project as standalone packages.
|
|
245
213
|
|
|
@@ -275,9 +243,106 @@ libslist: {
|
|
|
275
243
|
|
|
276
244
|
- more magic commands coming soon...
|
|
277
245
|
|
|
278
|
-
|
|
246
|
+
### 8. `merge`
|
|
247
|
+
|
|
248
|
+
not yet documented.
|
|
249
|
+
|
|
250
|
+
### 9. `mono`
|
|
251
|
+
|
|
252
|
+
not yet documented.
|
|
253
|
+
|
|
254
|
+
### 10. `pub`
|
|
255
|
+
|
|
256
|
+
pub command is separated for its own build-in plugin as well.
|
|
257
|
+
|
|
258
|
+
it already calls build command by itself, so you don't need to run `dler build` separately.
|
|
259
|
+
|
|
260
|
+
```bash
|
|
261
|
+
dler pub ...
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
### 11. `relifso`
|
|
265
|
+
|
|
266
|
+
```bash
|
|
267
|
+
dler relifso init ...
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
### 12. `relinka`
|
|
271
|
+
|
|
272
|
+
@reliverse/relinka's best friend. learn more in its [docs](https://github.com/reliverse/relinka).
|
|
273
|
+
|
|
274
|
+
```bash
|
|
275
|
+
dler relinka --console-to-relinka
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
### 13. `rempts`
|
|
279
|
+
|
|
280
|
+
@reliverse/rempts's best friend. learn more in its [docs](https://github.com/reliverse/rempts).
|
|
281
|
+
|
|
282
|
+
```bash
|
|
283
|
+
dler rempts init --cmd my-cmd-1
|
|
284
|
+
dler rempts init --cmds
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
### 14. `spell`
|
|
288
|
+
|
|
289
|
+
**available spell types:**
|
|
290
|
+
|
|
291
|
+
- `replace-line` — injects contents from one file into another
|
|
292
|
+
- `rename-file` — renames the current file
|
|
293
|
+
- `remove-comment` — removes a specific comment from code
|
|
294
|
+
- `remove-line` — removes a specific line from code
|
|
295
|
+
- `remove-file` — deletes the current file
|
|
296
|
+
- `transform-content` — applies a transformation to the file content
|
|
297
|
+
- `copy-file` — copies the current file to a new location
|
|
298
|
+
- `move-file` — moves the current file to a new location
|
|
299
|
+
- `insert-at` — inserts content at a specific position in the file
|
|
300
|
+
|
|
301
|
+
**params:**
|
|
302
|
+
|
|
303
|
+
params are optional and comma-separated.
|
|
304
|
+
|
|
305
|
+
currently, only the first param is supported:
|
|
306
|
+
|
|
307
|
+
- `hooked` (boolean, default: `false`)
|
|
308
|
+
- `false`: dler handles the spell automatically at postbuild
|
|
309
|
+
- `true`: disables default behavior, so you can trigger the spell yourself (e.g. from your own cli function)
|
|
310
|
+
|
|
311
|
+
more params coming soon...
|
|
312
|
+
|
|
313
|
+
**usage examples:**
|
|
314
|
+
|
|
315
|
+
- `export * from "../../types.js"; // <dler-replace-line-{hooked=false}>` — injects file contents at this line
|
|
316
|
+
- `// @ts-expect-error <dler-remove-comment-{hooked=false}>` — removes just this comment
|
|
317
|
+
- `// <dler-remove-line-{hooked=false}>` — removes this line
|
|
318
|
+
- `// <dler-remove-file-{hooked=false}>` — deletes this file
|
|
319
|
+
- `// <dler-rename-file-"tsconfig.json"-{hooked=false}>` — renames this file (runs at postbuild because `hooked=false`)
|
|
320
|
+
|
|
321
|
+
**using `hooked=true`:**
|
|
322
|
+
|
|
323
|
+
- `// <dler-rename-file-"tsconfig.json"-{hooked=true}>` — renames the file, but only when you trigger it yourself (hooked from your side)
|
|
324
|
+
|
|
325
|
+
**triggering spells:**
|
|
326
|
+
|
|
327
|
+
from dler’s cli:
|
|
328
|
+
|
|
329
|
+
- `dler spell --trigger rename-file,... --files tsconfig.json,...`
|
|
330
|
+
- `dler spell --trigger all`
|
|
331
|
+
- `dler spell`
|
|
332
|
+
|
|
333
|
+
from your own code:
|
|
334
|
+
|
|
335
|
+
```ts
|
|
336
|
+
await dler.spell({ spells: ["rename-file"], files: [] });
|
|
337
|
+
// await dler.spell({}) // means all spells and all files
|
|
338
|
+
// spell: ["all"] // means all spells
|
|
339
|
+
// spell: [] // means all spells
|
|
340
|
+
// files: [] // means all files
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
p.s. [see how rse cli uses hooked=true](https://github.com/reliverse/rse/blob/main/src/postbuild.ts)
|
|
279
344
|
|
|
280
|
-
###
|
|
345
|
+
### 15. `tools`
|
|
281
346
|
|
|
282
347
|
lets you run standalone dler features directly from the cli:
|
|
283
348
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { defineArgs, defineCommand } from "@reliverse/rempts";
|
|
2
|
+
import { dlerBuild } from "../../cli.js";
|
|
3
|
+
export default defineCommand({
|
|
4
|
+
meta: {
|
|
5
|
+
name: "build",
|
|
6
|
+
description: "Build the project"
|
|
7
|
+
},
|
|
8
|
+
args: defineArgs({
|
|
9
|
+
dev: {
|
|
10
|
+
type: "boolean",
|
|
11
|
+
description: "Runs the CLI in dev mode"
|
|
12
|
+
}
|
|
13
|
+
}),
|
|
14
|
+
async run({ args }) {
|
|
15
|
+
await dlerBuild(args.dev);
|
|
16
|
+
}
|
|
17
|
+
});
|
|
File without changes
|
|
@@ -129,7 +129,7 @@ async function runTscAndParseErrors(
|
|
|
129
129
|
// In case of error, try to extract the output.
|
|
130
130
|
const combined = (error.all as string) || "";
|
|
131
131
|
if (!combined) {
|
|
132
|
-
relinka("
|
|
132
|
+
relinka("log", `TSC returned no error lines. Possibly no TS errors?`);
|
|
133
133
|
return [];
|
|
134
134
|
}
|
|
135
135
|
|
|
@@ -191,7 +191,7 @@ async function injectCommentIntoFiles(
|
|
|
191
191
|
lineNums.sort((a, b) => b - a);
|
|
192
192
|
const absPath = path.resolve(filePath);
|
|
193
193
|
relinka(
|
|
194
|
-
"
|
|
194
|
+
"log",
|
|
195
195
|
`Injecting into ${absPath} at lines: ${lineNums.join(", ")}`,
|
|
196
196
|
);
|
|
197
197
|
|
|
@@ -235,7 +235,7 @@ export async function useTsExpectError(args: {
|
|
|
235
235
|
}
|
|
236
236
|
|
|
237
237
|
if (usedAuto) {
|
|
238
|
-
relinka("
|
|
238
|
+
relinka("log", "Running TSC to discover error lines...");
|
|
239
239
|
const tscCommand = userConfig.tscCommand!;
|
|
240
240
|
try {
|
|
241
241
|
const discovered = await runTscAndParseErrors(tscCommand, args.tscPaths);
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { defineArgs, defineCommand } from "@reliverse/rempts";
|
|
2
|
+
import { dlerPub } from "../../cli.js";
|
|
3
|
+
export default defineCommand({
|
|
4
|
+
meta: {
|
|
5
|
+
name: "build",
|
|
6
|
+
description: "Build the project"
|
|
7
|
+
},
|
|
8
|
+
args: defineArgs({
|
|
9
|
+
dev: {
|
|
10
|
+
type: "boolean",
|
|
11
|
+
description: "Runs the CLI in dev mode"
|
|
12
|
+
}
|
|
13
|
+
}),
|
|
14
|
+
async run({ args }) {
|
|
15
|
+
await dlerPub(args.dev);
|
|
16
|
+
}
|
|
17
|
+
});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { FILE_TYPES } from "./impl/const.js";
|
|
2
|
+
export { gitignoreTemplate } from "./impl/templates/t-gitignore.js";
|
|
3
|
+
export { licenseTemplate } from "./impl/templates/t-license.js";
|
|
4
|
+
export { readmeTemplate } from "./impl/templates/t-readme.js";
|
|
5
|
+
export { escapeMarkdownCodeBlocks } from "./impl/utils.js";
|
|
@@ -197,7 +197,7 @@ async function doInitFile(
|
|
|
197
197
|
}
|
|
198
198
|
if (maybeNewDest !== resolvedDestPath) {
|
|
199
199
|
// e.g., attach-index was chosen
|
|
200
|
-
relinka("
|
|
200
|
+
relinka("log", `attach-index or rename => ${maybeNewDest}`);
|
|
201
201
|
return await finalizeInit(
|
|
202
202
|
req,
|
|
203
203
|
initBehaviour,
|
|
@@ -268,7 +268,7 @@ async function runCopy(
|
|
|
268
268
|
}
|
|
269
269
|
|
|
270
270
|
relinka(
|
|
271
|
-
"
|
|
271
|
+
"log",
|
|
272
272
|
`Attempting copy:
|
|
273
273
|
- Source Dir: ${resolvedSrcDir}
|
|
274
274
|
- Source Path: ${sourcePath}
|
|
@@ -283,7 +283,7 @@ async function runCopy(
|
|
|
283
283
|
throw new Error(`Source file not found: ${sourcePath}`);
|
|
284
284
|
}
|
|
285
285
|
await fs.copy(sourcePath, resolvedDestPath, { overwrite: true });
|
|
286
|
-
relinka("
|
|
286
|
+
relinka("log", `Copied file: ${chosenVariation} -> ${resolvedDestPath}`);
|
|
287
287
|
return {
|
|
288
288
|
requested: req,
|
|
289
289
|
finalPath: resolvedDestPath,
|
|
@@ -305,7 +305,7 @@ async function runCopy(
|
|
|
305
305
|
}
|
|
306
306
|
await fs.copy(fallbackFullPath, resolvedDestPath, { overwrite: true });
|
|
307
307
|
relinka(
|
|
308
|
-
"
|
|
308
|
+
"log",
|
|
309
309
|
`Fallback copy: ${fallbackSource} -> ${resolvedDestPath}`,
|
|
310
310
|
);
|
|
311
311
|
return {
|
|
@@ -390,6 +390,6 @@ async function attachIndex(originalPath: string) {
|
|
|
390
390
|
newPath = path.join(dir, `${base}.${counter}${ext}`);
|
|
391
391
|
counter++;
|
|
392
392
|
}
|
|
393
|
-
relinka("
|
|
393
|
+
relinka("log", `Attaching index => ${newPath}`);
|
|
394
394
|
return newPath;
|
|
395
395
|
}
|
package/bin/{cli/args/init/libs/reinit/reint-impl → app/relifso/impl}/templates/t-license.js
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const licenseTemplate = `# MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) Nazar Kornienko (blefnk), Reliverse
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
|
File without changes
|
|
File without changes
|
|
@@ -12,7 +12,8 @@ export default defineCommand({
|
|
|
12
12
|
cmd: {
|
|
13
13
|
type: "array",
|
|
14
14
|
required: true,
|
|
15
|
-
description: "Names of commands to initialize"
|
|
15
|
+
description: "Names of commands to initialize",
|
|
16
|
+
options: ["cmd1", "cmd2", "cmd3"]
|
|
16
17
|
},
|
|
17
18
|
force: {
|
|
18
19
|
type: "boolean",
|
|
@@ -35,7 +36,7 @@ export default defineCommand({
|
|
|
35
36
|
fs.mkdirSync(dirPath, { recursive: true });
|
|
36
37
|
const content = generateCommandTemplate(cmdName);
|
|
37
38
|
fs.writeFileSync(filePath, content, "utf-8");
|
|
38
|
-
relinka("
|
|
39
|
+
relinka("log", `\u2705 Created new command: ${filePath}`);
|
|
39
40
|
}
|
|
40
41
|
}
|
|
41
42
|
});
|
|
@@ -58,8 +59,8 @@ export default defineCommand({
|
|
|
58
59
|
},
|
|
59
60
|
},
|
|
60
61
|
async run({ args }) {
|
|
61
|
-
relinka("
|
|
62
|
-
relinka("
|
|
62
|
+
relinka("log", "Command '${cmdName}' executed.");
|
|
63
|
+
relinka("log", "Received args:", args);
|
|
63
64
|
},
|
|
64
65
|
});
|
|
65
66
|
`;
|
|
File without changes
|
|
File without changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { relinka } from "@reliverse/relinka";
|
|
2
2
|
import { defineCommand } from "@reliverse/rempts";
|
|
3
3
|
import path from "pathe";
|
|
4
|
-
import { printUsage, useAggregator } from "./
|
|
4
|
+
import { printUsage, useAggregator } from "./impl.js";
|
|
5
5
|
const TOOLS = ["agg"];
|
|
6
6
|
export default defineCommand({
|
|
7
7
|
meta: {
|
|
@@ -52,7 +52,7 @@ export default defineCommand({
|
|
|
52
52
|
}
|
|
53
53
|
if (!TOOLS.includes(args.tool)) {
|
|
54
54
|
relinka("error", `Error: Invalid tool: ${args.tool}`);
|
|
55
|
-
relinka("
|
|
55
|
+
relinka("log", `Available tools: ${TOOLS.join(", ")}`);
|
|
56
56
|
printUsage(isDev);
|
|
57
57
|
process.exit(1);
|
|
58
58
|
}
|
|
@@ -28,7 +28,7 @@ export async function useAggregator({
|
|
|
28
28
|
const exts = [".ts", ".js"];
|
|
29
29
|
if (verbose)
|
|
30
30
|
relinka(
|
|
31
|
-
"
|
|
31
|
+
"log",
|
|
32
32
|
`Scanning directory ${inputDir} for files with extensions: ${exts.join(
|
|
33
33
|
", "
|
|
34
34
|
)}`
|
|
@@ -61,7 +61,7 @@ export async function useAggregator({
|
|
|
61
61
|
const allLines = aggregatorLinesArrays.flat();
|
|
62
62
|
if (sortLines) {
|
|
63
63
|
allLines.sort();
|
|
64
|
-
if (verbose) relinka("
|
|
64
|
+
if (verbose) relinka("log", "Sorted aggregator lines alphabetically.");
|
|
65
65
|
}
|
|
66
66
|
if (outFile.startsWith(inputDir)) {
|
|
67
67
|
relinka(
|
|
@@ -83,7 +83,7 @@ ${AGGREGATOR_END}
|
|
|
83
83
|
if (overrideFile) {
|
|
84
84
|
finalText = aggregatorBlock;
|
|
85
85
|
if (verbose) {
|
|
86
|
-
relinka("
|
|
86
|
+
relinka("log", "Override mode: rewriting entire file.");
|
|
87
87
|
}
|
|
88
88
|
} else {
|
|
89
89
|
let existingContent = "";
|
|
@@ -91,12 +91,12 @@ ${AGGREGATOR_END}
|
|
|
91
91
|
existingContent = await fs.readFile(outFile, "utf8");
|
|
92
92
|
} catch {
|
|
93
93
|
if (verbose)
|
|
94
|
-
relinka("
|
|
94
|
+
relinka("log", "Aggregator file does not exist. Creating new one.");
|
|
95
95
|
}
|
|
96
96
|
if (existingContent?.includes(AGGREGATOR_START) && existingContent.includes(AGGREGATOR_END)) {
|
|
97
97
|
if (verbose) {
|
|
98
98
|
relinka(
|
|
99
|
-
"
|
|
99
|
+
"log",
|
|
100
100
|
"Existing aggregator block found. Updating auto-generated section."
|
|
101
101
|
);
|
|
102
102
|
}
|
|
@@ -109,7 +109,7 @@ ${AGGREGATOR_END}
|
|
|
109
109
|
if (existingContent) {
|
|
110
110
|
if (verbose)
|
|
111
111
|
relinka(
|
|
112
|
-
"
|
|
112
|
+
"log",
|
|
113
113
|
"No aggregator block found. Appending auto-generated section."
|
|
114
114
|
);
|
|
115
115
|
finalText = `${existingContent.trim()}
|
|
@@ -160,7 +160,7 @@ async function collectFiles(dir, exts, recursive, ignoreDirs, verbose, includeIn
|
|
|
160
160
|
if (entry.isDirectory()) {
|
|
161
161
|
if (ignoreDirs.includes(entry.name)) {
|
|
162
162
|
if (verbose) {
|
|
163
|
-
relinka("
|
|
163
|
+
relinka("log", `Skipping ignored directory: ${fullPath}`);
|
|
164
164
|
}
|
|
165
165
|
continue;
|
|
166
166
|
}
|
|
@@ -179,13 +179,13 @@ async function collectFiles(dir, exts, recursive, ignoreDirs, verbose, includeIn
|
|
|
179
179
|
} else if (entry.isFile()) {
|
|
180
180
|
if (!includeInternal && path.basename(fullPath).startsWith(internalMarker)) {
|
|
181
181
|
if (verbose) {
|
|
182
|
-
relinka("
|
|
182
|
+
relinka("log", `Skipping internal file: ${fullPath}`);
|
|
183
183
|
}
|
|
184
184
|
continue;
|
|
185
185
|
}
|
|
186
186
|
if (exts.some((ext) => entry.name.toLowerCase().endsWith(ext))) {
|
|
187
187
|
if (verbose) {
|
|
188
|
-
relinka("
|
|
188
|
+
relinka("log", `Found file: ${fullPath}`);
|
|
189
189
|
}
|
|
190
190
|
found.push(fullPath);
|
|
191
191
|
}
|
|
@@ -275,21 +275,21 @@ function guessStarImportIdentifier(filePath) {
|
|
|
275
275
|
return identifier || "file";
|
|
276
276
|
}
|
|
277
277
|
export function printUsage(isDev) {
|
|
278
|
-
relinka("
|
|
279
|
-
relinka("
|
|
280
|
-
relinka("
|
|
278
|
+
relinka("log", "====================");
|
|
279
|
+
relinka("log", "TOOLS USAGE EXAMPLES");
|
|
280
|
+
relinka("log", "====================");
|
|
281
281
|
relinka(
|
|
282
|
-
"
|
|
282
|
+
"log",
|
|
283
283
|
`${isDev ? "bun dev:agg" : "dler tools"} --tool agg --input <dir> --out <file> [options]`
|
|
284
284
|
);
|
|
285
285
|
if (isDev) {
|
|
286
286
|
relinka(
|
|
287
|
-
"
|
|
287
|
+
"log",
|
|
288
288
|
"bun dev:tools agg --input src/libs/sdk/sdk-impl --out src/libs/sdk/sdk-mod.ts --recursive --named --strip src/libs/sdk"
|
|
289
289
|
);
|
|
290
290
|
} else {
|
|
291
291
|
relinka(
|
|
292
|
-
"
|
|
292
|
+
"log",
|
|
293
293
|
"dler tools --tool agg --input src/libs --out aggregator.ts --recursive --named"
|
|
294
294
|
);
|
|
295
295
|
}
|
|
@@ -60,7 +60,7 @@ const tools = defineCommand()
|
|
|
60
60
|
}
|
|
61
61
|
if (!TOOLS.includes(args.tool as string)) {
|
|
62
62
|
relinka("error", `Error: Invalid tool: ${args.tool}`);
|
|
63
|
-
relinka("
|
|
63
|
+
relinka("log", `Available tools: ${TOOLS.join(", ")}`);
|
|
64
64
|
printUsage(isDev);
|
|
65
65
|
process.exit(1);
|
|
66
66
|
}
|
package/bin/cli.js
CHANGED
|
@@ -10,7 +10,7 @@ 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
14
|
const timer = createPerfTimer();
|
|
15
15
|
try {
|
|
16
16
|
const config = await loadConfig();
|
|
@@ -18,7 +18,7 @@ export async function dler(isDev) {
|
|
|
18
18
|
config.commonPubPause = true;
|
|
19
19
|
config.bumpDisable = true;
|
|
20
20
|
relinka(
|
|
21
|
-
"
|
|
21
|
+
"log",
|
|
22
22
|
"Development mode: Publishing paused and version bumping disabled."
|
|
23
23
|
);
|
|
24
24
|
}
|
|
@@ -67,7 +67,108 @@ export async function dler(isDev) {
|
|
|
67
67
|
config.transpileStub,
|
|
68
68
|
config.transpileWatch,
|
|
69
69
|
config.distJsrGenTsconfig,
|
|
70
|
-
config.coreDeclarations
|
|
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) {
|
|
114
|
+
const timer = createPerfTimer();
|
|
115
|
+
try {
|
|
116
|
+
const config = await loadConfig();
|
|
117
|
+
if (isDev) {
|
|
118
|
+
config.commonPubPause = true;
|
|
119
|
+
config.bumpDisable = true;
|
|
120
|
+
relinka(
|
|
121
|
+
"log",
|
|
122
|
+
"Development mode: Publishing paused and version bumping disabled."
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
if (config.logsFreshFile) {
|
|
126
|
+
await fs.remove(path.join(PROJECT_ROOT, config.logsFileName));
|
|
127
|
+
}
|
|
128
|
+
await removeDistFolders(
|
|
129
|
+
config.distNpmDirName,
|
|
130
|
+
config.distJsrDirName,
|
|
131
|
+
config.libsDirDist,
|
|
132
|
+
config.libsList
|
|
133
|
+
);
|
|
134
|
+
if (!config.bumpDisable) {
|
|
135
|
+
await bumpHandler(
|
|
136
|
+
config.bumpMode,
|
|
137
|
+
config.bumpDisable,
|
|
138
|
+
config.commonPubPause,
|
|
139
|
+
config.bumpFilter
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
await processRegularFlow(
|
|
143
|
+
timer,
|
|
144
|
+
isDev,
|
|
145
|
+
config.coreIsCLI,
|
|
146
|
+
config.libsActMode,
|
|
147
|
+
config.commonPubRegistry,
|
|
148
|
+
config.coreEntrySrcDir,
|
|
149
|
+
config.distNpmDirName,
|
|
150
|
+
config.distNpmBuilder,
|
|
151
|
+
config.coreEntryFile,
|
|
152
|
+
config.distJsrDryRun,
|
|
153
|
+
config.distJsrFailOnWarn,
|
|
154
|
+
config.commonPubPause,
|
|
155
|
+
config.distJsrDirName,
|
|
156
|
+
config.distJsrBuilder,
|
|
157
|
+
config.transpileTarget,
|
|
158
|
+
config.transpileFormat,
|
|
159
|
+
config.transpileSplitting,
|
|
160
|
+
config.transpileMinify,
|
|
161
|
+
config.transpileSourcemap,
|
|
162
|
+
config.transpilePublicPath,
|
|
163
|
+
config.distJsrAllowDirty,
|
|
164
|
+
config.distJsrSlowTypes,
|
|
165
|
+
config.distNpmOutFilesExt,
|
|
166
|
+
config.rmDepsMode,
|
|
167
|
+
config.transpileStub,
|
|
168
|
+
config.transpileWatch,
|
|
169
|
+
config.distJsrGenTsconfig,
|
|
170
|
+
config.coreDeclarations,
|
|
171
|
+
{ coreDescription: config.coreDescription }
|
|
71
172
|
);
|
|
72
173
|
await processLibraryFlow(
|
|
73
174
|
timer,
|