@reliverse/dler 1.7.27 โ 1.7.29
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 +48 -20
- package/bin/app/build/impl.js +13 -2
- package/bin/app/build/postbuild.js +53 -1
- package/bin/app/build/prebuild.js +62 -0
- package/bin/app/remdn/cmd.d.ts +2 -10
- package/bin/app/remdn/cmd.js +334 -194
- package/bin/cli.js +1 -1
- package/bin/libs/cfg/cfg-impl/cfg-consts.d.ts +2 -0
- package/bin/libs/cfg/cfg-impl/cfg-consts.js +7 -1
- package/bin/libs/cfg/cfg-impl/cfg-types.d.ts +14 -1
- package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-define.d.ts +10 -10
- package/bin/libs/sdk/sdk-impl/build/build-regular.js +1 -17
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist-impl/make.js +1 -1
- package/bin/libs/sdk/sdk-impl/config/default.js +7 -1
- package/bin/libs/sdk/sdk-impl/config/info.js +1 -1
- package/bin/libs/sdk/sdk-impl/config/init.js +9 -0
- package/bin/libs/sdk/sdk-impl/config/types.d.ts +13 -0
- package/bin/libs/sdk/sdk-impl/library-flow.js +2 -0
- package/bin/libs/sdk/sdk-impl/regular-flow.js +2 -0
- package/bin/libs/sdk/sdk-impl/utils/utils-fs.d.ts +0 -36
- package/bin/libs/sdk/sdk-impl/utils/utils-fs.js +0 -115
- package/bin/libs/sdk/sdk-mod.d.ts +1 -1
- package/bin/libs/sdk/sdk-mod.js +0 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,25 +1,46 @@
|
|
|
1
|
-
# dler (prev. relidler) โข
|
|
1
|
+
# ๐๏ธ dler (prev. relidler) โข build/publish/improve ts/js libs/cli/apps
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[sponsor](https://github.com/sponsors/blefnk) โ [discord](https://discord.gg/pb8ukbwpsj) โ [github](https://github.com/reliverse/dler) โ [npm](https://npmjs.com/@reliverse/dler)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
> @reliverse/dler (`/หdiห.lษr/`, dealer) is a flexible, unified, and fully automated bundler for typescript/javascript projects that doubles as an npm/jsr publishing tool. beyond bundling, dler serves as a comprehensive codemod toolkit for modern typescript/javascript development.
|
|
6
6
|
|
|
7
7
|
## features
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
9
|
+
### ๐ core power
|
|
10
|
+
|
|
11
|
+
- **drop-in replacement** for `unjs/unbuild` โ seamless migration with enhanced capabilities
|
|
12
|
+
- **automated publishing** to npm/jsr registries with intelligent workflow management
|
|
13
|
+
- **reliable builds** with comprehensive typescript/javascript support and error handling
|
|
14
|
+
- **smart versioning** with automatic version bumps and semantic release integration
|
|
15
|
+
- **zero configuration** eliminates `package.json` maintenance headaches forever
|
|
16
|
+
|
|
17
|
+
### โก developer experience
|
|
18
|
+
|
|
19
|
+
- **performance optimized** for speed with modern build pipelines and caching
|
|
20
|
+
- **18 built-in commands** โ comprehensive [dler commands](#dler-commands) for every workflow
|
|
21
|
+
- **path resolution magic** converts typescript aliases to relative imports automatically
|
|
22
|
+
- **highly configurable** via dedicated configuration files with sensible defaults
|
|
23
|
+
- **dual interface** โ cli for everyday use, sdk for advanced programmatic control
|
|
24
|
+
|
|
25
|
+
### ๐ง advanced capabilities
|
|
26
|
+
|
|
27
|
+
- **clean distribution builds** automatically removes internal logs and debug code
|
|
28
|
+
- **monorepo ready** with experimental `libs` feature for multi-library projects
|
|
29
|
+
- **magic spells** โ extensible plugin system for custom build transformations
|
|
30
|
+
- **codemod toolkit** โ powerful code transformation utilities built-in
|
|
31
|
+
|
|
32
|
+
### ๐ฏ perfect for
|
|
33
|
+
|
|
34
|
+
dler excels at managing both build and publish workflows, making it ideal for:
|
|
35
|
+
|
|
36
|
+
- cli tool creators and maintainers
|
|
37
|
+
- project bootstrappers (like [rse](https://github.com/reliverse/rse))
|
|
38
|
+
- library authors seeking streamlined workflows
|
|
39
|
+
- teams wanting consistent build processes
|
|
40
|
+
|
|
41
|
+
### ๐ coming soon
|
|
42
|
+
|
|
43
|
+
**full monorepo system** with advanced dependency management and cross-package optimization.
|
|
23
44
|
|
|
24
45
|
### supported bundlers
|
|
25
46
|
|
|
@@ -40,7 +61,7 @@
|
|
|
40
61
|
|
|
41
62
|
## getting started
|
|
42
63
|
|
|
43
|
-
ensure git, node.js, and bun/pnpm/yarn/npm are installed. then:
|
|
64
|
+
ensure git, node.js, and bun/pnpm/yarn/npm (**[bun](https://bun.sh/get) is highly recommended**) are installed. then:
|
|
44
65
|
|
|
45
66
|
### playground
|
|
46
67
|
|
|
@@ -75,6 +96,9 @@ bun dev # bun src/cli.ts --dev
|
|
|
75
96
|
bun i -g update --latest
|
|
76
97
|
```
|
|
77
98
|
|
|
99
|
+
- **when installed globally**: use `dler` anywhere.
|
|
100
|
+
- **when installed as dev dep**: use with package manager name prefix, e.g. `bun dler`, inside your project directory.
|
|
101
|
+
|
|
78
102
|
2. **prepare your project**:
|
|
79
103
|
|
|
80
104
|
a. **configure `.gitignore`**:
|
|
@@ -117,7 +141,7 @@ bun dev # bun src/cli.ts --dev
|
|
|
117
141
|
dler [build|pub] # if installed globally
|
|
118
142
|
```
|
|
119
143
|
|
|
120
|
-
##
|
|
144
|
+
## dler commands
|
|
121
145
|
|
|
122
146
|
dler ships with a flexible command system (prev. plugins) and **18 built-in commands** (from [reliverse addons](https://reliverse.org/addons) collection).
|
|
123
147
|
|
|
@@ -820,12 +844,16 @@ special thanks to the project that inspired `@reliverse/dler`:
|
|
|
820
844
|
|
|
821
845
|
## contributors
|
|
822
846
|
|
|
823
|
-
### scripts
|
|
847
|
+
### helper scripts
|
|
824
848
|
|
|
825
849
|
- `libs:pack`: Creates two templates, `cfg` and `sdk`, based on dist-libs directory structure (using **dler pack** command).
|
|
826
850
|
- `libs:unpack`: Creates a project structure using all templates from the `cfg` and `sdk` templates (using **dler unpack** command).
|
|
827
851
|
- `libs:example`: Since `libs:unpack`'s serves as a dist-libs mock, then `libs:example` helps easily test dler's features like `resolveAllCrossLibs()`.
|
|
828
852
|
|
|
853
|
+
### notes
|
|
854
|
+
|
|
855
|
+
- `<src | dist-npm | dist-jsr>/libs/<lib-name>/<files live here>` === `dist-libs/<lib-name>/<jsr | npm>/bin/<files live here>`
|
|
856
|
+
|
|
829
857
|
## support
|
|
830
858
|
|
|
831
859
|
- if dler saves you time and effort, please consider supporting its development: [github sponsors](https://github.com/sponsors/blefnk);
|
package/bin/app/build/impl.js
CHANGED
|
@@ -26,9 +26,20 @@ export async function dlerBuild(isDev, config) {
|
|
|
26
26
|
effectiveConfig.libsList
|
|
27
27
|
);
|
|
28
28
|
await dlerPreBuild(effectiveConfig);
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
const tempDirs = {
|
|
30
|
+
npm: "dist-tmp/tmp-npm",
|
|
31
|
+
jsr: "dist-tmp/tmp-jsr",
|
|
32
|
+
libs: "dist-tmp/tmp-libs"
|
|
33
|
+
};
|
|
34
|
+
const tempConfig = {
|
|
35
|
+
...effectiveConfig,
|
|
36
|
+
coreEntrySrcDir: tempDirs.npm,
|
|
37
|
+
libsDirSrc: tempDirs.libs
|
|
38
|
+
};
|
|
39
|
+
await regular_buildFlow(timer, isDev, tempConfig);
|
|
40
|
+
await library_buildFlow(timer, isDev, tempConfig);
|
|
31
41
|
await dlerPostBuild(isDev);
|
|
42
|
+
await fs.remove(path.join(PROJECT_ROOT, "dist-tmp"));
|
|
32
43
|
return { timer, effectiveConfig };
|
|
33
44
|
} catch (error) {
|
|
34
45
|
handleDlerError(error);
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import path, { convertImportsAliasToRelative } from "@reliverse/pathkit";
|
|
2
|
+
import fs from "@reliverse/relifso";
|
|
2
3
|
import { relinka } from "@reliverse/relinka";
|
|
3
4
|
import { runCmd } from "@reliverse/rempts";
|
|
5
|
+
import { glob } from "tinyglobby";
|
|
4
6
|
import { getCheckCmd } from "../cmds.js";
|
|
5
7
|
import { getConfigDler } from "../../libs/sdk/sdk-impl/config/load.js";
|
|
6
8
|
import { applyMagicSpells } from "../../libs/sdk/sdk-impl/magic/ms-apply.js";
|
|
7
9
|
import { resolveAllCrossLibs } from "../../libs/sdk/sdk-impl/utils/resolve-cross-libs.js";
|
|
10
|
+
import { PROJECT_ROOT } from "../../libs/sdk/sdk-impl/utils/utils-consts.js";
|
|
8
11
|
import { directoryExists, executeDlerHooks } from "./ppb-utils.js";
|
|
9
12
|
const DIST_DIRECTORIES = ["dist-npm", "dist-jsr"];
|
|
10
13
|
const ALIAS_TO_REPLACE = "~";
|
|
@@ -38,13 +41,62 @@ async function processDistDirectories() {
|
|
|
38
41
|
await processDistDirectory(dir, ALIAS_TO_REPLACE);
|
|
39
42
|
}
|
|
40
43
|
}
|
|
44
|
+
async function copyNonBuildFiles(srcDir, distDir, preExtensions, templatesDir) {
|
|
45
|
+
try {
|
|
46
|
+
const files = await glob("**/*", {
|
|
47
|
+
cwd: srcDir,
|
|
48
|
+
onlyFiles: true
|
|
49
|
+
});
|
|
50
|
+
for (const file of files) {
|
|
51
|
+
const ext = path.extname(file).slice(1);
|
|
52
|
+
const isInTemplatesDir = file.startsWith(templatesDir);
|
|
53
|
+
if (isInTemplatesDir || !preExtensions.includes(ext)) {
|
|
54
|
+
const srcPath = path.join(srcDir, file);
|
|
55
|
+
const destPath = path.join(distDir, file);
|
|
56
|
+
await fs.ensureDir(path.dirname(destPath));
|
|
57
|
+
await fs.copy(srcPath, destPath);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
} catch (error) {
|
|
61
|
+
relinka(
|
|
62
|
+
"error",
|
|
63
|
+
`Error copying non-build files: ${error instanceof Error ? error.message : String(error)}`
|
|
64
|
+
);
|
|
65
|
+
throw error;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
41
68
|
export async function dlerPostBuild(isDev) {
|
|
69
|
+
relinka("info", "\u2014 \u2014 \u2014 dlerPostBuild \u2014 \u2014 \u2014");
|
|
70
|
+
const config = await getConfigDler();
|
|
42
71
|
await resolveAllCrossLibs();
|
|
72
|
+
if (config.commonPubRegistry === "npm" || config.commonPubRegistry === "npm-jsr") {
|
|
73
|
+
await copyNonBuildFiles(
|
|
74
|
+
path.join(PROJECT_ROOT, config.coreEntrySrcDir),
|
|
75
|
+
path.join(PROJECT_ROOT, config.distNpmDirName),
|
|
76
|
+
config.buildPreExtensions,
|
|
77
|
+
config.buildTemplatesDir
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
if (config.commonPubRegistry === "jsr" || config.commonPubRegistry === "npm-jsr") {
|
|
81
|
+
await copyNonBuildFiles(
|
|
82
|
+
path.join(PROJECT_ROOT, config.coreEntrySrcDir),
|
|
83
|
+
path.join(PROJECT_ROOT, config.distJsrDirName),
|
|
84
|
+
config.buildPreExtensions,
|
|
85
|
+
config.buildTemplatesDir
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
if (config.libsActMode === "libs-only" || config.libsActMode === "main-and-libs") {
|
|
89
|
+
await copyNonBuildFiles(
|
|
90
|
+
path.join(PROJECT_ROOT, config.libsDirSrc),
|
|
91
|
+
path.join(PROJECT_ROOT, config.libsDirDist),
|
|
92
|
+
config.buildPreExtensions,
|
|
93
|
+
config.buildTemplatesDir
|
|
94
|
+
);
|
|
95
|
+
}
|
|
43
96
|
if (isDev) {
|
|
44
97
|
await applyMagicSpells(["dist-jsr", "dist-npm", "dist-libs"]);
|
|
45
98
|
}
|
|
46
99
|
await processDistDirectories();
|
|
47
|
-
const config = await getConfigDler();
|
|
48
100
|
await executeDlerHooks(config?.hooksAfterBuild ?? [], "post-build");
|
|
49
101
|
if (config?.runAfterBuild?.length) {
|
|
50
102
|
const tools = createPostBuildToolRunner();
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import path from "@reliverse/pathkit";
|
|
2
|
+
import fs from "@reliverse/relifso";
|
|
1
3
|
import { relinka } from "@reliverse/relinka";
|
|
2
4
|
import { runCmd } from "@reliverse/rempts";
|
|
5
|
+
import { glob } from "tinyglobby";
|
|
3
6
|
import { getCheckCmd } from "../cmds.js";
|
|
7
|
+
import { PROJECT_ROOT } from "../../libs/sdk/sdk-impl/utils/utils-consts.js";
|
|
4
8
|
import { executeCommand, executeDlerHooks, isCommandAvailable } from "./ppb-utils.js";
|
|
5
9
|
const createToolRunner = () => ({
|
|
6
10
|
tsc: {
|
|
@@ -27,8 +31,66 @@ const createToolRunner = () => ({
|
|
|
27
31
|
}
|
|
28
32
|
}
|
|
29
33
|
});
|
|
34
|
+
async function copyFilesToTempDir(srcDir, tempDir, extensions, excludeDir) {
|
|
35
|
+
try {
|
|
36
|
+
await fs.ensureDir(tempDir);
|
|
37
|
+
const files = await glob("**/*", {
|
|
38
|
+
cwd: srcDir,
|
|
39
|
+
ignore: [`**/${excludeDir}/**`],
|
|
40
|
+
onlyFiles: true
|
|
41
|
+
});
|
|
42
|
+
for (const file of files) {
|
|
43
|
+
const ext = path.extname(file).slice(1);
|
|
44
|
+
if (extensions.includes(ext)) {
|
|
45
|
+
const srcPath = path.join(srcDir, file);
|
|
46
|
+
const destPath = path.join(tempDir, file);
|
|
47
|
+
await fs.ensureDir(path.dirname(destPath));
|
|
48
|
+
await fs.copy(srcPath, destPath);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
} catch (error) {
|
|
52
|
+
relinka(
|
|
53
|
+
"error",
|
|
54
|
+
`Error copying files to temp directory: ${error instanceof Error ? error.message : String(error)}`
|
|
55
|
+
);
|
|
56
|
+
throw error;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
30
59
|
export async function dlerPreBuild(config) {
|
|
60
|
+
relinka("info", "\u2014 \u2014 \u2014 dlerPreBuild \u2014 \u2014 \u2014");
|
|
31
61
|
await executeDlerHooks(config?.hooksBeforeBuild ?? [], "pre-build");
|
|
62
|
+
const tempDirs = {
|
|
63
|
+
npm: path.join(PROJECT_ROOT, "dist-tmp", "tmp-npm"),
|
|
64
|
+
jsr: path.join(PROJECT_ROOT, "dist-tmp", "tmp-jsr"),
|
|
65
|
+
libs: path.join(PROJECT_ROOT, "dist-tmp", "tmp-libs")
|
|
66
|
+
};
|
|
67
|
+
for (const dir of Object.values(tempDirs)) {
|
|
68
|
+
await fs.remove(dir);
|
|
69
|
+
}
|
|
70
|
+
if (config.commonPubRegistry === "npm" || config.commonPubRegistry === "npm-jsr") {
|
|
71
|
+
await copyFilesToTempDir(
|
|
72
|
+
path.join(PROJECT_ROOT, config.coreEntrySrcDir),
|
|
73
|
+
tempDirs.npm,
|
|
74
|
+
config.buildPreExtensions,
|
|
75
|
+
config.buildTemplatesDir
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
if (config.commonPubRegistry === "jsr" || config.commonPubRegistry === "npm-jsr") {
|
|
79
|
+
await copyFilesToTempDir(
|
|
80
|
+
path.join(PROJECT_ROOT, config.coreEntrySrcDir),
|
|
81
|
+
tempDirs.jsr,
|
|
82
|
+
config.buildPreExtensions,
|
|
83
|
+
config.buildTemplatesDir
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
if (config.libsActMode === "libs-only" || config.libsActMode === "main-and-libs") {
|
|
87
|
+
await copyFilesToTempDir(
|
|
88
|
+
path.join(PROJECT_ROOT, config.libsDirSrc),
|
|
89
|
+
tempDirs.libs,
|
|
90
|
+
config.buildPreExtensions,
|
|
91
|
+
config.buildTemplatesDir
|
|
92
|
+
);
|
|
93
|
+
}
|
|
32
94
|
if (!config?.runBeforeBuild?.length) return;
|
|
33
95
|
const tools = createToolRunner();
|
|
34
96
|
const availableTools = await Promise.all(
|
package/bin/app/remdn/cmd.d.ts
CHANGED
|
@@ -6,13 +6,13 @@ interface DirOptions {
|
|
|
6
6
|
}
|
|
7
7
|
type DirConfig = Record<string, DirOptions>;
|
|
8
8
|
type ExtMap = Record<string, [string, string, string]>;
|
|
9
|
-
interface
|
|
9
|
+
export interface ConfigRemdn {
|
|
10
10
|
title?: string;
|
|
11
11
|
output?: string;
|
|
12
12
|
dirs: DirConfig;
|
|
13
13
|
"ext-map"?: ExtMap;
|
|
14
14
|
}
|
|
15
|
-
export declare function scanDirectories(config?:
|
|
15
|
+
export declare function scanDirectories(config?: ConfigRemdn, configPath?: string, outputPath?: string): Promise<void>;
|
|
16
16
|
declare const _default: import("@reliverse/rempts").Command<{
|
|
17
17
|
mode: {
|
|
18
18
|
type: "string";
|
|
@@ -31,13 +31,5 @@ declare const _default: import("@reliverse/rempts").Command<{
|
|
|
31
31
|
type: "string";
|
|
32
32
|
description: string;
|
|
33
33
|
};
|
|
34
|
-
processLibsOnly: {
|
|
35
|
-
type: "boolean";
|
|
36
|
-
description: string;
|
|
37
|
-
};
|
|
38
|
-
preventLibsProcessing: {
|
|
39
|
-
type: "boolean";
|
|
40
|
-
description: string;
|
|
41
|
-
};
|
|
42
34
|
}>;
|
|
43
35
|
export default _default;
|