@reliverse/dler 1.7.4 → 1.7.6
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/bin/cli.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { re } from "@reliverse/relico";
|
|
1
2
|
import { relinka } from "@reliverse/relinka";
|
|
2
3
|
import {
|
|
3
4
|
runMain,
|
|
@@ -10,6 +11,7 @@ import {
|
|
|
10
11
|
import { promptAggCommand } from "./app/agg/run.js";
|
|
11
12
|
import { getBuildCmd, getPubCmd, getInitCmd, getRenameCmd } from "./app/cmds.js";
|
|
12
13
|
import { showEndPrompt, showStartPrompt } from "./libs/sdk/sdk-impl/cfg/info.js";
|
|
14
|
+
import { ensureDlerConfig } from "./libs/sdk/sdk-impl/cfg/init.js";
|
|
13
15
|
const INTERACTIVE_CMDS = ["agg", "build", "pub"];
|
|
14
16
|
async function runCmd(cmdPromise, args) {
|
|
15
17
|
const cmd = await cmdPromise;
|
|
@@ -39,6 +41,7 @@ Available interactive commands: ${INTERACTIVE_CMDS.join(", ")}`
|
|
|
39
41
|
async run({ args }) {
|
|
40
42
|
const isDev = args.dev;
|
|
41
43
|
relinka("verbose", `Running in ${isDev ? "dev" : "prod"} mode`);
|
|
44
|
+
await ensureDlerConfig(args.dev);
|
|
42
45
|
const isCI = process.env.CI === "true";
|
|
43
46
|
const isNonInteractive = !process.stdout.isTTY;
|
|
44
47
|
if (isCI || isNonInteractive) {
|
|
@@ -53,21 +56,21 @@ Available interactive commands: ${INTERACTIVE_CMDS.join(", ")}`
|
|
|
53
56
|
const cmdToRun = await selectPrompt({
|
|
54
57
|
title: "Select a command to run",
|
|
55
58
|
options: [
|
|
56
|
-
{ value: "
|
|
57
|
-
{ value: "
|
|
58
|
-
{ value: "
|
|
59
|
-
{
|
|
60
|
-
{
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
},
|
|
59
|
+
{ value: "build", label: "build project" },
|
|
60
|
+
{ value: "pub", label: "publish project" },
|
|
61
|
+
{ value: "agg", label: "aggregate files" },
|
|
62
|
+
{ separator: true },
|
|
63
|
+
{ value: "utils", label: re.bold("UTILS"), disabled: true },
|
|
64
|
+
{ separator: true },
|
|
65
|
+
{ value: "copy", label: "copy files" },
|
|
66
|
+
{ value: "init", label: "init files" },
|
|
64
67
|
{
|
|
65
68
|
value: "rename-prepare",
|
|
66
|
-
label: "
|
|
69
|
+
label: "[experimental] my project is a bootstrapper cli (apply rename optimizations)"
|
|
67
70
|
},
|
|
68
71
|
{
|
|
69
72
|
value: "rename-prepare-revert",
|
|
70
|
-
label: "
|
|
73
|
+
label: "[experimental] revert rename cli files optimizations"
|
|
71
74
|
}
|
|
72
75
|
]
|
|
73
76
|
});
|
|
@@ -32,8 +32,8 @@ import {
|
|
|
32
32
|
createJsrJSON,
|
|
33
33
|
renameTsxFiles
|
|
34
34
|
} from "../utils/utils-jsr-json.js";
|
|
35
|
-
import { getElapsedPerfTime } from "../utils/utils-perf.js";
|
|
36
35
|
import { library_createPackageJSON } from "../utils/utils-package-json-libraries.js";
|
|
36
|
+
import { getElapsedPerfTime } from "../utils/utils-perf.js";
|
|
37
37
|
const BIN_DIR_NAME = "bin";
|
|
38
38
|
const REPLACEMENT_MARKER = "// dler-replace-me";
|
|
39
39
|
const TYPES_REPLACEMENT_PATH = "src/types.ts";
|
|
@@ -25,8 +25,8 @@ import {
|
|
|
25
25
|
createJsrJSON,
|
|
26
26
|
renameTsxFiles
|
|
27
27
|
} from "../utils/utils-jsr-json.js";
|
|
28
|
-
import { getElapsedPerfTime } from "../utils/utils-perf.js";
|
|
29
28
|
import { regular_createPackageJSON } from "../utils/utils-package-json-regular.js";
|
|
29
|
+
import { getElapsedPerfTime } from "../utils/utils-perf.js";
|
|
30
30
|
const ALIAS_PREFIX_TO_CONVERT = "~";
|
|
31
31
|
export async function regular_buildJsrDist(isDev, isJsr, coreIsCLI, coreEntrySrcDir, distJsrDirName, distJsrBuilder, coreEntryFile, transpileTarget, transpileFormat, transpileSplitting, transpileMinify, transpileSourcemap, transpilePublicPath, unifiedBundlerOutExt, config, timer, transpileStub, transpileWatch, distJsrGenTsconfig, coreDeclarations) {
|
|
32
32
|
const outDirRoot = path.join(process.cwd(), distJsrDirName);
|
|
@@ -37,14 +37,80 @@ export async function ensureDlerConfig(isDev) {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
function getCoreIsCLI(isDev) {
|
|
40
|
-
return isDev ? `coreIsCLI: {
|
|
41
|
-
enabled: true,
|
|
42
|
-
scripts: { dler: "dler.ts" },
|
|
43
|
-
},` : `// coreIsCLI: {
|
|
40
|
+
return isDev ? `coreIsCLI: { enabled: true, scripts: { dler: "cli.ts" } },` : `// coreIsCLI: {
|
|
44
41
|
// enabled: false,
|
|
45
42
|
// scripts: { mycli: "mycli.ts" },
|
|
46
43
|
// },`;
|
|
47
44
|
}
|
|
45
|
+
function getValue(isDev, devValue, prodValue) {
|
|
46
|
+
return isDev ? devValue : prodValue;
|
|
47
|
+
}
|
|
48
|
+
function getBumpFilter(isDev) {
|
|
49
|
+
return isDev ? `[
|
|
50
|
+
"package.json",
|
|
51
|
+
".config/rse.ts",
|
|
52
|
+
"src/libs/sdk/sdk-impl/cfg/info.ts",
|
|
53
|
+
]` : `["package.json", ".config/rse.ts"]`;
|
|
54
|
+
}
|
|
55
|
+
function getPublishArtifacts(isDev) {
|
|
56
|
+
return isDev ? `{
|
|
57
|
+
global: ["package.json", "README.md", "LICENSE", "LICENSES"],
|
|
58
|
+
"dist-jsr": [],
|
|
59
|
+
"dist-npm": [],
|
|
60
|
+
"dist-libs": {
|
|
61
|
+
"@reliverse/dler-sdk": {
|
|
62
|
+
jsr: [],
|
|
63
|
+
npm: [],
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
}` : `{
|
|
67
|
+
global: ["package.json", "README.md", "LICENSE"],
|
|
68
|
+
"dist-jsr": [],
|
|
69
|
+
"dist-npm": [],
|
|
70
|
+
"dist-libs": {},
|
|
71
|
+
}`;
|
|
72
|
+
}
|
|
73
|
+
function getFilterDepsPatterns(isDev) {
|
|
74
|
+
return isDev ? `{
|
|
75
|
+
global: [
|
|
76
|
+
"bun",
|
|
77
|
+
"@types",
|
|
78
|
+
"biome",
|
|
79
|
+
"eslint",
|
|
80
|
+
"knip",
|
|
81
|
+
"prettier",
|
|
82
|
+
"typescript",
|
|
83
|
+
"@reliverse/rse",
|
|
84
|
+
"@reliverse/dler",
|
|
85
|
+
"!@reliverse/rse-sdk",
|
|
86
|
+
"!@reliverse/dler-sdk",
|
|
87
|
+
],
|
|
88
|
+
"dist-npm": [],
|
|
89
|
+
"dist-jsr": [],
|
|
90
|
+
"dist-libs": {
|
|
91
|
+
"@reliverse/dler-sdk": {
|
|
92
|
+
jsr: ["!bun"],
|
|
93
|
+
npm: [],
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
}` : `{
|
|
97
|
+
global: [
|
|
98
|
+
"@types",
|
|
99
|
+
"biome",
|
|
100
|
+
"eslint",
|
|
101
|
+
"knip",
|
|
102
|
+
"prettier",
|
|
103
|
+
"typescript",
|
|
104
|
+
"@reliverse/rse",
|
|
105
|
+
"@reliverse/dler",
|
|
106
|
+
"!@reliverse/rse-sdk",
|
|
107
|
+
"!@reliverse/dler-sdk",
|
|
108
|
+
],
|
|
109
|
+
"dist-npm": [],
|
|
110
|
+
"dist-jsr": [],
|
|
111
|
+
"dist-libs": {},
|
|
112
|
+
}`;
|
|
113
|
+
}
|
|
48
114
|
function generateConfig(isDev, pkgDescription) {
|
|
49
115
|
const importDefineConfigStatement = isDev ? `import { defineConfig } from "../../../../mod.js";` : `import { defineConfig } from "@reliverse/dler";`;
|
|
50
116
|
const verboseValue = getValue(isDev, true, DEFAULT_CONFIG.commonVerbose);
|
|
@@ -61,7 +127,6 @@ function generateConfig(isDev, pkgDescription) {
|
|
|
61
127
|
);
|
|
62
128
|
const coreDescriptionValue = getValue(
|
|
63
129
|
isDev,
|
|
64
|
-
// TODO: remove `description` from dler's `package.json` when ensured that whole dler's codebase can optionally read dler.ts' `coreDescription`
|
|
65
130
|
"dler (prev. relidler) is a flexible, unified, and fully automated bundler for TypeScript and JavaScript projects, as well as an NPM and JSR publishing tool.",
|
|
66
131
|
pkgDescription || DEFAULT_CONFIG.coreDescription
|
|
67
132
|
);
|
|
@@ -75,20 +140,22 @@ function generateConfig(isDev, pkgDescription) {
|
|
|
75
140
|
libDeclarations: true,
|
|
76
141
|
libDescription: "@reliverse/dler without cli",
|
|
77
142
|
libDirName: "sdk",
|
|
78
|
-
libMainFile: "sdk-mod.ts",
|
|
143
|
+
libMainFile: "sdk/sdk-mod.ts",
|
|
79
144
|
libPkgKeepDeps: true,
|
|
80
145
|
libTranspileMinify: true,
|
|
81
146
|
libPubPause: false,
|
|
147
|
+
libPubRegistry: "npm-jsr",
|
|
82
148
|
},
|
|
83
149
|
}` : `{
|
|
84
150
|
// "@acme/cli-libName": {
|
|
85
151
|
// libDeclarations: true,
|
|
86
152
|
// libDescription: "@acme/cli defineConfig",
|
|
87
153
|
// libDirName: "libName",
|
|
88
|
-
// libMainFile: "libName-mod.ts",
|
|
154
|
+
// libMainFile: "libName/libName-mod.ts",
|
|
89
155
|
// libPkgKeepDeps: true,
|
|
90
156
|
// libTranspileMinify: true,
|
|
91
157
|
// libPubPause: false,
|
|
158
|
+
// libPubRegistry: "npm-jsr",
|
|
92
159
|
// },
|
|
93
160
|
}`;
|
|
94
161
|
const configTemplate = `${importDefineConfigStatement}
|
|
@@ -100,18 +167,18 @@ function generateConfig(isDev, pkgDescription) {
|
|
|
100
167
|
export default defineConfig({
|
|
101
168
|
// Bump configuration
|
|
102
169
|
bumpDisable: ${DEFAULT_CONFIG.bumpDisable},
|
|
103
|
-
bumpFilter: ${
|
|
170
|
+
bumpFilter: ${getBumpFilter(isDev)},
|
|
104
171
|
bumpMode: "${DEFAULT_CONFIG.bumpMode}",
|
|
105
172
|
// Common configuration
|
|
106
173
|
commonPubPause: ${pausePublishValue},
|
|
107
174
|
commonPubRegistry: "${registryValue}",
|
|
108
175
|
commonVerbose: ${verboseValue},
|
|
109
176
|
// Core configuration
|
|
177
|
+
coreBuildOutDir: "${DEFAULT_CONFIG.coreBuildOutDir}",
|
|
110
178
|
coreDeclarations: ${DEFAULT_CONFIG.coreDeclarations},
|
|
111
179
|
coreDescription: ${JSON.stringify(coreDescriptionValue)},
|
|
112
180
|
coreEntryFile: "${DEFAULT_CONFIG.coreEntryFile}",
|
|
113
181
|
coreEntrySrcDir: "${DEFAULT_CONFIG.coreEntrySrcDir}",
|
|
114
|
-
coreBuildOutDir: "${DEFAULT_CONFIG.coreBuildOutDir}",
|
|
115
182
|
${coreIsCLI}
|
|
116
183
|
// JSR-only config
|
|
117
184
|
distJsrAllowDirty: ${DEFAULT_CONFIG.distJsrAllowDirty},
|
|
@@ -137,65 +204,45 @@ export default defineConfig({
|
|
|
137
204
|
// @reliverse/relinka logger setup
|
|
138
205
|
logsFileName: "${DEFAULT_CONFIG.logsFileName}",
|
|
139
206
|
logsFreshFile: ${DEFAULT_CONFIG.logsFreshFile},
|
|
207
|
+
// Specifies what resources to send to npm and jsr registries.
|
|
208
|
+
// coreBuildOutDir (e.g. "bin") dir is automatically included.
|
|
209
|
+
// The following is also included if publishArtifacts is {}:
|
|
210
|
+
// - global: ["package.json", "README.md", "LICENSE"]
|
|
211
|
+
// - dist-jsr,dist-libs/jsr: ["jsr.json"]
|
|
212
|
+
publishArtifacts: ${getPublishArtifacts(isDev)},
|
|
140
213
|
// Dependency filtering
|
|
141
214
|
// Global is always applied
|
|
142
|
-
filterDepsPatterns: {
|
|
143
|
-
global: [
|
|
144
|
-
"@types",
|
|
145
|
-
"biome",
|
|
146
|
-
"eslint",
|
|
147
|
-
"knip",
|
|
148
|
-
"prettier",
|
|
149
|
-
"typescript",
|
|
150
|
-
"@reliverse/rse",
|
|
151
|
-
"@reliverse/dler",
|
|
152
|
-
"!@reliverse/rse-sdk",
|
|
153
|
-
"!@reliverse/dler-sdk",
|
|
154
|
-
],
|
|
155
|
-
"dist-npm": [],
|
|
156
|
-
"dist-jsr": [],
|
|
157
|
-
"dist-libs": {
|
|
158
|
-
"@reliverse/dler-sdk": {
|
|
159
|
-
npm: [],
|
|
160
|
-
jsr: [],
|
|
161
|
-
},
|
|
162
|
-
},
|
|
163
|
-
},
|
|
215
|
+
filterDepsPatterns: ${getFilterDepsPatterns(isDev)},
|
|
164
216
|
// Build setup
|
|
165
|
-
|
|
217
|
+
// transpileAlias: {},
|
|
218
|
+
// transpileClean: true,
|
|
219
|
+
// transpileEntries: [],
|
|
166
220
|
transpileEsbuild: "${DEFAULT_CONFIG.transpileEsbuild}",
|
|
221
|
+
// transpileExternals: [],
|
|
222
|
+
transpileFailOnWarn: ${DEFAULT_CONFIG.transpileFailOnWarn},
|
|
167
223
|
transpileFormat: "${DEFAULT_CONFIG.transpileFormat}",
|
|
168
224
|
transpileMinify: ${DEFAULT_CONFIG.transpileMinify},
|
|
225
|
+
// transpileParallel: false,
|
|
169
226
|
transpilePublicPath: "${DEFAULT_CONFIG.transpilePublicPath}",
|
|
227
|
+
// transpileReplace: {},
|
|
228
|
+
// transpileRollup: {
|
|
229
|
+
// alias: {},
|
|
230
|
+
// commonjs: {},
|
|
231
|
+
// dts: {},
|
|
232
|
+
// esbuild: {},
|
|
233
|
+
// json: {},
|
|
234
|
+
// replace: {},
|
|
235
|
+
// resolve: {},
|
|
236
|
+
// },
|
|
237
|
+
// transpileShowOutLog: false,
|
|
170
238
|
transpileSourcemap: "${DEFAULT_CONFIG.transpileSourcemap}",
|
|
171
239
|
transpileSplitting: ${DEFAULT_CONFIG.transpileSplitting},
|
|
172
240
|
transpileStub: ${DEFAULT_CONFIG.transpileStub},
|
|
241
|
+
// transpileStubOptions: { jiti: {} },
|
|
173
242
|
transpileTarget: "${DEFAULT_CONFIG.transpileTarget}",
|
|
174
243
|
transpileWatch: ${DEFAULT_CONFIG.transpileWatch},
|
|
175
|
-
|
|
176
|
-
transpileEntries: [],
|
|
177
|
-
transpileExternals: [],
|
|
178
|
-
transpileClean: true,
|
|
179
|
-
transpileParallel: false,
|
|
180
|
-
transpileReplace: {},
|
|
181
|
-
transpileRollup: {
|
|
182
|
-
alias: {},
|
|
183
|
-
commonjs: {},
|
|
184
|
-
dts: {},
|
|
185
|
-
esbuild: {},
|
|
186
|
-
json: {},
|
|
187
|
-
replace: {},
|
|
188
|
-
resolve: {},
|
|
189
|
-
},
|
|
190
|
-
transpileShowOutLog: false,
|
|
191
|
-
transpileStubOptions: {
|
|
192
|
-
jiti: {},
|
|
193
|
-
},
|
|
194
|
-
transpileWatchOptions: undefined,
|
|
244
|
+
// transpileWatchOptions: undefined,
|
|
195
245
|
});
|
|
196
246
|
`;
|
|
197
247
|
return configTemplate;
|
|
198
248
|
}
|
|
199
|
-
function getValue(isDev, devValue, prodValue) {
|
|
200
|
-
return isDev ? devValue : prodValue;
|
|
201
|
-
}
|
package/package.json
CHANGED
|
@@ -34,12 +34,12 @@
|
|
|
34
34
|
"ts-morph": "^26.0.0",
|
|
35
35
|
"untyped": "^2.0.0"
|
|
36
36
|
},
|
|
37
|
-
"description": "
|
|
37
|
+
"description": "dler (prev. relidler) is a flexible, unified, and fully automated bundler for TypeScript and JavaScript projects, as well as an NPM and JSR publishing tool.",
|
|
38
38
|
"homepage": "https://docs.reliverse.org",
|
|
39
39
|
"license": "MIT",
|
|
40
40
|
"name": "@reliverse/dler",
|
|
41
41
|
"type": "module",
|
|
42
|
-
"version": "1.7.
|
|
42
|
+
"version": "1.7.6",
|
|
43
43
|
"keywords": [
|
|
44
44
|
"reliverse",
|
|
45
45
|
"cli",
|