@reliverse/dler 1.7.114 → 1.7.115
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/app/add/add-local/core/templates.d.ts +3 -3
- package/bin/app/add/add-local/core/templates.js +8 -8
- package/bin/app/add/cmd.js +2 -2
- package/bin/app/ai/ai-impl/ai-chat.d.ts +2 -2
- package/bin/app/ai/ai-impl/ai-types.d.ts +2 -2
- package/bin/app/ai/ai-impl/relinter/relinter.d.ts +2 -2
- package/bin/app/ai/ai-menu.d.ts +2 -2
- package/bin/app/ai/cmd.js +4 -4
- package/bin/app/better/auth/cmd.js +1 -6
- package/bin/app/build/build-library.d.ts +5 -4
- package/bin/app/build/build-regular.d.ts +4 -3
- package/bin/app/build/cmd.d.ts +10 -0
- package/bin/app/build/cmd.js +29 -12
- package/bin/app/build/impl.d.ts +3 -2
- package/bin/app/build/library-flow.d.ts +5 -4
- package/bin/app/build/postbuild.d.ts +2 -2
- package/bin/app/build/postbuild.js +0 -6
- package/bin/app/build/prebuild.d.ts +2 -2
- package/bin/app/build/prebuild.js +0 -6
- package/bin/app/build/regular-flow.d.ts +4 -3
- package/bin/app/check/cmd.js +2 -2
- package/bin/app/config/constants.d.ts +1 -1
- package/bin/app/config/constants.js +1 -1
- package/bin/app/config/content.d.ts +1 -1
- package/bin/app/config/content.js +2 -2
- package/bin/app/config/core-cfg.d.ts +5 -5
- package/bin/app/config/core-cfg.js +27 -16
- package/bin/app/config/create.d.ts +6 -5
- package/bin/app/config/create.js +13 -22
- package/bin/app/config/def-utils.d.ts +3 -3
- package/bin/app/config/def-utils.js +10 -8
- package/bin/app/config/detect.d.ts +4 -2
- package/bin/app/config/detect.js +36 -6
- package/bin/app/config/gen-cfg.js +4 -4
- package/bin/app/config/load.d.ts +2 -2
- package/bin/app/config/load.js +1 -1
- package/bin/app/config/migrate.d.ts +1 -1
- package/bin/app/config/migrate.js +7 -3
- package/bin/app/config/path.d.ts +1 -1
- package/bin/app/config/path.js +3 -3
- package/bin/app/config/prepare.d.ts +1 -1
- package/bin/app/config/prepare.js +83 -81
- package/bin/app/config/prompts.d.ts +1 -1
- package/bin/app/config/prompts.js +1 -1
- package/bin/app/config/read.d.ts +3 -3
- package/bin/app/config/read.js +13 -35
- package/bin/app/config/repair.d.ts +2 -2
- package/bin/app/config/repair.js +12 -12
- package/bin/app/config/unstable.d.ts +3 -3
- package/bin/app/config/unstable.js +2 -14
- package/bin/app/config/update.d.ts +3 -3
- package/bin/app/config/update.js +41 -48
- package/bin/app/env/env-impl.js +2 -2
- package/bin/app/init/cmd-2.js +2 -2
- package/bin/app/init/init-utils/init-utils.js +7 -7
- package/bin/app/init/init-utils/mm-deprecated/editor-menu.d.ts +3 -2
- package/bin/app/init/init-utils/mm-deprecated/editor-menu.js +1 -6
- package/bin/app/init/use-template/cp-impl.d.ts +5 -4
- package/bin/app/init/use-template/cp-mod.d.ts +3 -3
- package/bin/app/init/use-template/cp-mod.js +5 -5
- package/bin/app/init/use-template/cp-modules/cli-main-modules/cli-menu-items/showCloneProjectMenu.d.ts +2 -2
- package/bin/app/init/use-template/cp-modules/compose-env-file/cef-impl.d.ts +2 -2
- package/bin/app/init/use-template/cp-modules/compose-env-file/cef-mod.d.ts +2 -2
- package/bin/app/init/use-template/cp-modules/git-deploy-prompts/deploy.d.ts +4 -3
- package/bin/app/init/use-template/cp-modules/git-deploy-prompts/gdp-mod.d.ts +5 -4
- package/bin/app/init/use-template/cp-modules/git-deploy-prompts/git.d.ts +6 -5
- package/bin/app/init/use-template/cp-modules/git-deploy-prompts/github.d.ts +2 -2
- package/bin/app/init/use-template/cp-modules/git-deploy-prompts/utils-private-repo.d.ts +2 -2
- package/bin/app/init/use-template/cp-modules/git-deploy-prompts/utils-private-repo.js +6 -3
- package/bin/app/init/use-template/cp-modules/git-deploy-prompts/utils-repo-exists.d.ts +3 -2
- package/bin/app/init/use-template/cp-modules/git-deploy-prompts/utils-repo-exists.js +4 -4
- package/bin/app/invoke/cmd.js +2 -2
- package/bin/app/mrse/cmd.js +2 -2
- package/bin/app/mrse/mrse-impl.js +2 -2
- package/bin/app/providers/better-t-stack/types.d.ts +5 -5
- package/bin/app/providers/package.json +3 -0
- package/bin/app/providers/reliverse-stack/reliverse-stack-mod.js +2 -2
- package/bin/app/providers/reliverse-stack/rs-impl.d.ts +4 -4
- package/bin/app/pub/cmd.d.ts +10 -0
- package/bin/app/pub/cmd.js +27 -12
- package/bin/app/pub/impl.d.ts +3 -2
- package/bin/app/rempts/cmd.js +2 -2
- package/bin/app/rules/reliverse/dler-config-health/dler-config-health.d.ts +1 -1
- package/bin/app/rules/reliverse/dler-config-health/dler-config-health.js +1 -1
- package/bin/app/schema/cmd.js +3 -3
- package/bin/app/{config/reltypes-content.js → schema/gen.js} +475 -229
- package/bin/app/schema/mod.d.ts +1224 -0
- package/bin/app/schema/mod.js +329 -0
- package/bin/app/{config/reltypes-utils.js → schema/utils.js} +6 -3
- package/bin/app/toolbox/cmd.js +2 -2
- package/bin/app/toolbox/toolbox-impl.d.ts +3 -2
- package/bin/app/types/mod.d.ts +10 -1518
- package/bin/app/types/mod.js +0 -161
- package/bin/app/update/impl.d.ts +1 -0
- package/bin/app/update/impl.js +102 -1
- package/bin/app/utils/common.d.ts +3 -0
- package/bin/app/utils/common.js +28 -0
- package/bin/app/utils/decideHelper.d.ts +2 -2
- package/bin/app/utils/downloading/downloadRepo.d.ts +2 -2
- package/bin/app/utils/downloading/downloadRepo.js +3 -3
- package/bin/app/utils/downloading/handleDownload.d.ts +2 -2
- package/bin/app/utils/finalize.d.ts +2 -1
- package/bin/app/utils/handlers/handleCleanup.js +2 -2
- package/bin/app/utils/handlers/handleCodemods.d.ts +2 -2
- package/bin/app/utils/projectRepository.d.ts +3 -4
- package/bin/app/utils/prompts/askUsernameFrontend.d.ts +2 -2
- package/bin/app/utils/prompts/askUsernameFrontend.js +3 -3
- package/bin/app/utils/resolve-cross-libs.js +2 -2
- package/bin/app/utils/schemaMemory.d.ts +1 -1
- package/bin/app/utils/startEndPrompts.d.ts +8 -2
- package/bin/app/utils/startEndPrompts.js +43 -12
- package/bin/app/utils/utils-build.d.ts +2 -2
- package/bin/app/utils/utils-clean.d.ts +1 -1
- package/bin/app/utils/utils-deps.d.ts +2 -2
- package/bin/app/utils/utils-determine.d.ts +1 -1
- package/bin/app/utils/utils-jsr-json.d.ts +2 -2
- package/bin/app/utils/utils-package-json-libraries.d.ts +3 -3
- package/bin/app/utils/utils-package-json-regular.d.ts +2 -2
- package/bin/dler.js +2 -92
- package/bin/mod.d.ts +431 -438
- package/bin/mod.js +36 -27
- package/package.json +10 -10
- package/bin/app/agg/cmd.d.ts +0 -72
- package/bin/app/agg/cmd.js +0 -128
- package/bin/app/cli/cmd.d.ts +0 -12
- package/bin/app/cli/cmd.js +0 -56
- package/bin/app/cli/impl.d.ts +0 -3
- package/bin/app/cli/impl.js +0 -88
- package/bin/app/config/default-cfg.d.ts +0 -3
- package/bin/app/config/default-cfg.js +0 -155
- package/bin/app/config/default.d.ts +0 -6
- package/bin/app/config/default.js +0 -159
- package/bin/app/config/schema.d.ts +0 -130
- package/bin/app/config/schema.js +0 -443
- package/bin/app/init/use-template/cp-modules/cli-main-modules/cli-menu-items/getMainMenuOptions.d.ts +0 -12
- package/bin/app/init/use-template/cp-modules/cli-main-modules/cli-menu-items/getMainMenuOptions.js +0 -69
- package/bin/app/init/use-template/cp-modules/cli-main-modules/modules/showStartEndPrompt.d.ts +0 -2
- package/bin/app/init/use-template/cp-modules/cli-main-modules/modules/showStartEndPrompt.js +0 -26
- package/bin/app/schema/schema-impl.d.ts +0 -2
- package/bin/app/schema/schema-impl.js +0 -24
- package/bin/app/update/cmd.d.ts +0 -103
- package/bin/app/update/cmd.js +0 -299
- package/bin/app/utils/native-cli/nc-impl.d.ts +0 -15
- package/bin/app/utils/native-cli/nc-impl.js +0 -154
- package/bin/app/utils/native-cli/nc-mod.d.ts +0 -3
- package/bin/app/utils/native-cli/nc-mod.js +0 -44
- package/bin/app/web/README.md +0 -149
- package/bin/app/web/cmd.d.ts +0 -2
- package/bin/app/web/cmd.js +0 -11
- package/bin/dler-go +0 -4
- package/bin/dler-rust +0 -4
- /package/bin/app/{config/reltypes-content.d.ts → schema/gen.d.ts} +0 -0
- /package/bin/app/{config/reltypes-utils.d.ts → schema/utils.d.ts} +0 -0
- /package/bin/app/utils/{hasOnlyRseConfig.d.ts → hasOnlyReliverseConfig.d.ts} +0 -0
- /package/bin/app/utils/{hasOnlyRseConfig.js → hasOnlyReliverseConfig.js} +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import path from "@reliverse/pathkit";
|
|
2
|
-
import fs from "@reliverse/relifso";
|
|
2
|
+
import fs, { ensuredir } from "@reliverse/relifso";
|
|
3
3
|
import { relinka } from "@reliverse/relinka";
|
|
4
4
|
import { readPackageJSON } from "pkg-types";
|
|
5
|
-
import {
|
|
5
|
+
import { DEFAULT_CONFIG_RELIVERSE } from "../schema/mod.js";
|
|
6
|
+
import { ensureReltypesFile } from "../schema/utils.js";
|
|
6
7
|
import { cliConfigJsonc, cliConfigTs, rseOrg, UNKNOWN_STRING } from "./constants.js";
|
|
7
|
-
import { ensureReltypesFile } from "./reltypes-utils.js";
|
|
8
8
|
const DEFAULT_CONFIG_KIND = "ts";
|
|
9
9
|
export async function ensureReliverseConfig(isDev, configKind = DEFAULT_CONFIG_KIND) {
|
|
10
10
|
const configFilename = configKind === "ts" ? cliConfigTs : cliConfigJsonc;
|
|
@@ -41,9 +41,11 @@ export async function ensureReliverseConfig(isDev, configKind = DEFAULT_CONFIG_K
|
|
|
41
41
|
process.exit(1);
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
export async function prepareReliverseEnvironment(isDev, configKind = DEFAULT_CONFIG_KIND) {
|
|
44
|
+
export async function prepareReliverseEnvironment(cwd, isDev, configKind = DEFAULT_CONFIG_KIND) {
|
|
45
|
+
if (!await fs.pathExists(cwd)) {
|
|
46
|
+
await ensuredir(cwd);
|
|
47
|
+
}
|
|
45
48
|
await ensureReliverseConfig(isDev, configKind);
|
|
46
|
-
const cwd = process.cwd();
|
|
47
49
|
const gitDir = path.resolve(cwd, ".git");
|
|
48
50
|
if (await fs.pathExists(gitDir)) {
|
|
49
51
|
await ensureGitignoreEntries(cwd);
|
|
@@ -105,15 +107,15 @@ function getLibsObject(isDev) {
|
|
|
105
107
|
}
|
|
106
108
|
function generateJsoncConfig(isDev, pkgDescription) {
|
|
107
109
|
const schemaUrl = `${rseOrg}/schema.json`;
|
|
108
|
-
const verboseValue = getValue(isDev, true,
|
|
109
|
-
const registryValue = getValue(isDev, "npm-jsr",
|
|
110
|
-
const pausePublishValue = getValue(isDev, false,
|
|
110
|
+
const verboseValue = getValue(isDev, true, DEFAULT_CONFIG_RELIVERSE.commonVerbose);
|
|
111
|
+
const registryValue = getValue(isDev, "npm-jsr", DEFAULT_CONFIG_RELIVERSE.commonPubRegistry);
|
|
112
|
+
const pausePublishValue = getValue(isDev, false, DEFAULT_CONFIG_RELIVERSE.commonPubPause);
|
|
111
113
|
const coreDescriptionValue = getValue(
|
|
112
114
|
isDev,
|
|
113
115
|
"reliverse (prev. dler) is a flexible, unified, and fully automated bundler for TypeScript and JavaScript projects, as well as an NPM and JSR publishing tool.",
|
|
114
|
-
pkgDescription ||
|
|
116
|
+
pkgDescription || DEFAULT_CONFIG_RELIVERSE.coreDescription
|
|
115
117
|
);
|
|
116
|
-
const libsActModeValue = getValue(isDev, "main-and-libs",
|
|
118
|
+
const libsActModeValue = getValue(isDev, "main-and-libs", DEFAULT_CONFIG_RELIVERSE.libsActMode);
|
|
117
119
|
return `// @reliverse/* libraries & rse configuration
|
|
118
120
|
// Hover over the fields to learn more details
|
|
119
121
|
// @see https://docs.reliverse.org/libraries
|
|
@@ -241,46 +243,46 @@ function generateJsoncConfig(isDev, pkgDescription) {
|
|
|
241
243
|
"existingRepoBehavior": ${UNKNOWN_STRING},
|
|
242
244
|
"relinterConfirm": ${UNKNOWN_STRING},
|
|
243
245
|
// Bump configuration
|
|
244
|
-
"bumpDisable": ${
|
|
246
|
+
"bumpDisable": ${DEFAULT_CONFIG_RELIVERSE.bumpDisable},
|
|
245
247
|
"bumpFilter": ${JSON.stringify(getBumpFilter(isDev))},
|
|
246
|
-
"bumpMode": "${
|
|
247
|
-
"bumpSet": "${
|
|
248
|
+
"bumpMode": "${DEFAULT_CONFIG_RELIVERSE.bumpMode}",
|
|
249
|
+
"bumpSet": "${DEFAULT_CONFIG_RELIVERSE.bumpSet}",
|
|
248
250
|
// Common configuration
|
|
249
251
|
"commonPubPause": ${pausePublishValue},
|
|
250
252
|
"commonPubRegistry": "${registryValue}",
|
|
251
253
|
"commonVerbose": ${verboseValue},
|
|
252
|
-
"displayBuildPubLogs": ${
|
|
254
|
+
"displayBuildPubLogs": ${DEFAULT_CONFIG_RELIVERSE.displayBuildPubLogs},
|
|
253
255
|
// Core configuration
|
|
254
|
-
"coreBuildOutDir": "${
|
|
255
|
-
"coreDeclarations": ${
|
|
256
|
+
"coreBuildOutDir": "${DEFAULT_CONFIG_RELIVERSE.coreBuildOutDir}",
|
|
257
|
+
"coreDeclarations": ${DEFAULT_CONFIG_RELIVERSE.coreDeclarations},
|
|
256
258
|
"coreDescription": ${JSON.stringify(coreDescriptionValue)},
|
|
257
|
-
"coreEntryFile": "${
|
|
258
|
-
"coreEntrySrcDir": "${
|
|
259
|
+
"coreEntryFile": "${DEFAULT_CONFIG_RELIVERSE.coreEntryFile}",
|
|
260
|
+
"coreEntrySrcDir": "${DEFAULT_CONFIG_RELIVERSE.coreEntrySrcDir}",
|
|
259
261
|
"coreIsCLI": {
|
|
260
262
|
"enabled": false,
|
|
261
263
|
"scripts": {}
|
|
262
264
|
},
|
|
263
265
|
// JSR-only config
|
|
264
|
-
"distJsrAllowDirty": ${
|
|
265
|
-
"distJsrBuilder": "${
|
|
266
|
-
"distJsrDirName": "${
|
|
267
|
-
"distJsrDryRun": ${
|
|
268
|
-
"distJsrFailOnWarn": ${
|
|
269
|
-
"distJsrGenTsconfig": ${
|
|
270
|
-
"distJsrOutFilesExt": "${
|
|
271
|
-
"distJsrSlowTypes": ${
|
|
266
|
+
"distJsrAllowDirty": ${DEFAULT_CONFIG_RELIVERSE.distJsrAllowDirty},
|
|
267
|
+
"distJsrBuilder": "${DEFAULT_CONFIG_RELIVERSE.distJsrBuilder}",
|
|
268
|
+
"distJsrDirName": "${DEFAULT_CONFIG_RELIVERSE.distJsrDirName}",
|
|
269
|
+
"distJsrDryRun": ${DEFAULT_CONFIG_RELIVERSE.distJsrDryRun},
|
|
270
|
+
"distJsrFailOnWarn": ${DEFAULT_CONFIG_RELIVERSE.distJsrFailOnWarn},
|
|
271
|
+
"distJsrGenTsconfig": ${DEFAULT_CONFIG_RELIVERSE.distJsrGenTsconfig},
|
|
272
|
+
"distJsrOutFilesExt": "${DEFAULT_CONFIG_RELIVERSE.distJsrOutFilesExt}",
|
|
273
|
+
"distJsrSlowTypes": ${DEFAULT_CONFIG_RELIVERSE.distJsrSlowTypes},
|
|
272
274
|
// NPM-only config
|
|
273
|
-
"distNpmBuilder": "${
|
|
274
|
-
"distNpmDirName": "${
|
|
275
|
-
"distNpmOutFilesExt": "${
|
|
275
|
+
"distNpmBuilder": "${DEFAULT_CONFIG_RELIVERSE.distNpmBuilder}",
|
|
276
|
+
"distNpmDirName": "${DEFAULT_CONFIG_RELIVERSE.distNpmDirName}",
|
|
277
|
+
"distNpmOutFilesExt": "${DEFAULT_CONFIG_RELIVERSE.distNpmOutFilesExt}",
|
|
276
278
|
// Libraries Reliverse Plugin
|
|
277
279
|
"libsActMode": "${libsActModeValue}",
|
|
278
|
-
"libsDirDist": "${
|
|
279
|
-
"libsDirSrc": "${
|
|
280
|
+
"libsDirDist": "${DEFAULT_CONFIG_RELIVERSE.libsDirDist}",
|
|
281
|
+
"libsDirSrc": "${DEFAULT_CONFIG_RELIVERSE.libsDirSrc}",
|
|
280
282
|
"libsList": ${JSON.stringify(getLibsObject(isDev), null, 2)},
|
|
281
283
|
// Logger setup
|
|
282
|
-
"logsFileName": "${
|
|
283
|
-
"logsFreshFile": ${
|
|
284
|
+
"logsFileName": "${DEFAULT_CONFIG_RELIVERSE.logsFileName}",
|
|
285
|
+
"logsFreshFile": ${DEFAULT_CONFIG_RELIVERSE.logsFreshFile},
|
|
284
286
|
// Dependency filtering
|
|
285
287
|
"filterDepsPatterns": ${JSON.stringify(getFilterDepsPatterns(isDev), null, 2)},
|
|
286
288
|
// Code quality tools
|
|
@@ -294,16 +296,16 @@ function generateJsoncConfig(isDev, pkgDescription) {
|
|
|
294
296
|
"deleteDistTmpAfterBuild": true
|
|
295
297
|
},
|
|
296
298
|
// Build setup
|
|
297
|
-
"transpileFailOnWarn": ${
|
|
298
|
-
"transpileEsbuild": "${
|
|
299
|
-
"transpileFormat": "${
|
|
300
|
-
"transpileMinify": ${
|
|
301
|
-
"transpilePublicPath": "${
|
|
302
|
-
"transpileSourcemap": "${
|
|
303
|
-
"transpileSplitting": ${
|
|
304
|
-
"transpileStub": ${
|
|
305
|
-
"transpileTarget": "${
|
|
306
|
-
"transpileWatch": ${
|
|
299
|
+
"transpileFailOnWarn": ${DEFAULT_CONFIG_RELIVERSE.transpileFailOnWarn},
|
|
300
|
+
"transpileEsbuild": "${DEFAULT_CONFIG_RELIVERSE.transpileEsbuild}",
|
|
301
|
+
"transpileFormat": "${DEFAULT_CONFIG_RELIVERSE.transpileFormat}",
|
|
302
|
+
"transpileMinify": ${DEFAULT_CONFIG_RELIVERSE.transpileMinify},
|
|
303
|
+
"transpilePublicPath": "${DEFAULT_CONFIG_RELIVERSE.transpilePublicPath}",
|
|
304
|
+
"transpileSourcemap": "${DEFAULT_CONFIG_RELIVERSE.transpileSourcemap}",
|
|
305
|
+
"transpileSplitting": ${DEFAULT_CONFIG_RELIVERSE.transpileSplitting},
|
|
306
|
+
"transpileStub": ${DEFAULT_CONFIG_RELIVERSE.transpileStub},
|
|
307
|
+
"transpileTarget": "${DEFAULT_CONFIG_RELIVERSE.transpileTarget}",
|
|
308
|
+
"transpileWatch": ${DEFAULT_CONFIG_RELIVERSE.transpileWatch},
|
|
307
309
|
// Publish artifacts configuration
|
|
308
310
|
"publishArtifacts": ${JSON.stringify(getPublishArtifacts(isDev), null, 2)},
|
|
309
311
|
// Build extensions
|
|
@@ -404,16 +406,16 @@ function generateJsoncConfig(isDev, pkgDescription) {
|
|
|
404
406
|
}
|
|
405
407
|
function generateConfig(isDev, pkgDescription, configKind = "ts") {
|
|
406
408
|
const importdefineConfigStatement = `import { defineConfig } from "./reltypes";`;
|
|
407
|
-
const verboseValue = getValue(isDev, true,
|
|
409
|
+
const verboseValue = getValue(isDev, true, DEFAULT_CONFIG_RELIVERSE.commonVerbose);
|
|
408
410
|
const coreIsCLI = getCoreIsCLI(isDev);
|
|
409
|
-
const registryValue = getValue(isDev, "npm-jsr",
|
|
410
|
-
const pausePublishValue = getValue(isDev, false,
|
|
411
|
+
const registryValue = getValue(isDev, "npm-jsr", DEFAULT_CONFIG_RELIVERSE.commonPubRegistry);
|
|
412
|
+
const pausePublishValue = getValue(isDev, false, DEFAULT_CONFIG_RELIVERSE.commonPubPause);
|
|
411
413
|
const coreDescriptionValue = getValue(
|
|
412
414
|
isDev,
|
|
413
415
|
"reliverse (prev. dler) is a flexible, unified, and fully automated bundler for TypeScript and JavaScript projects, as well as an NPM and JSR publishing tool.",
|
|
414
|
-
pkgDescription ||
|
|
416
|
+
pkgDescription || DEFAULT_CONFIG_RELIVERSE.coreDescription
|
|
415
417
|
);
|
|
416
|
-
const libsActModeValue = getValue(isDev, "main-and-libs",
|
|
418
|
+
const libsActModeValue = getValue(isDev, "main-and-libs", DEFAULT_CONFIG_RELIVERSE.libsActMode);
|
|
417
419
|
if (configKind === "jsonc") {
|
|
418
420
|
return generateJsoncConfig(isDev, pkgDescription);
|
|
419
421
|
}
|
|
@@ -548,52 +550,52 @@ function generateConfig(isDev, pkgDescription, configKind = "ts") {
|
|
|
548
550
|
` relinterConfirm: ${UNKNOWN_STRING},`,
|
|
549
551
|
"",
|
|
550
552
|
" // Bump configuration",
|
|
551
|
-
" bumpDisable: " +
|
|
553
|
+
" bumpDisable: " + DEFAULT_CONFIG_RELIVERSE.bumpDisable + ",",
|
|
552
554
|
" bumpFilter: " + getBumpFilter(isDev) + ",",
|
|
553
|
-
' bumpMode: "' +
|
|
554
|
-
' bumpSet: "' +
|
|
555
|
+
' bumpMode: "' + DEFAULT_CONFIG_RELIVERSE.bumpMode + '",',
|
|
556
|
+
' bumpSet: "' + DEFAULT_CONFIG_RELIVERSE.bumpSet + '",',
|
|
555
557
|
"",
|
|
556
558
|
" // Common configuration",
|
|
557
559
|
" commonPubPause: " + pausePublishValue + ",",
|
|
558
560
|
' commonPubRegistry: "' + registryValue + '",',
|
|
559
561
|
" commonVerbose: " + verboseValue + ",",
|
|
560
|
-
" displayBuildPubLogs: " +
|
|
562
|
+
" displayBuildPubLogs: " + DEFAULT_CONFIG_RELIVERSE.displayBuildPubLogs + ",",
|
|
561
563
|
"",
|
|
562
564
|
" // Core configuration",
|
|
563
|
-
' coreBuildOutDir: "' +
|
|
564
|
-
" coreDeclarations: " +
|
|
565
|
+
' coreBuildOutDir: "' + DEFAULT_CONFIG_RELIVERSE.coreBuildOutDir + '",',
|
|
566
|
+
" coreDeclarations: " + DEFAULT_CONFIG_RELIVERSE.coreDeclarations + ",",
|
|
565
567
|
" coreDescription: " + JSON.stringify(coreDescriptionValue) + ",",
|
|
566
|
-
' coreEntryFile: "' +
|
|
567
|
-
' coreEntrySrcDir: "' +
|
|
568
|
+
' coreEntryFile: "' + DEFAULT_CONFIG_RELIVERSE.coreEntryFile + '",',
|
|
569
|
+
' coreEntrySrcDir: "' + DEFAULT_CONFIG_RELIVERSE.coreEntrySrcDir + '",',
|
|
568
570
|
" " + coreIsCLI,
|
|
569
571
|
"",
|
|
570
572
|
" // JSR-only config",
|
|
571
|
-
" distJsrAllowDirty: " +
|
|
572
|
-
' distJsrBuilder: "' +
|
|
573
|
-
' distJsrDirName: "' +
|
|
574
|
-
" distJsrDryRun: " +
|
|
575
|
-
" distJsrFailOnWarn: " +
|
|
576
|
-
" distJsrGenTsconfig: " +
|
|
577
|
-
' distJsrOutFilesExt: "' +
|
|
578
|
-
" distJsrSlowTypes: " +
|
|
573
|
+
" distJsrAllowDirty: " + DEFAULT_CONFIG_RELIVERSE.distJsrAllowDirty + ",",
|
|
574
|
+
' distJsrBuilder: "' + DEFAULT_CONFIG_RELIVERSE.distJsrBuilder + '",',
|
|
575
|
+
' distJsrDirName: "' + DEFAULT_CONFIG_RELIVERSE.distJsrDirName + '",',
|
|
576
|
+
" distJsrDryRun: " + DEFAULT_CONFIG_RELIVERSE.distJsrDryRun + ",",
|
|
577
|
+
" distJsrFailOnWarn: " + DEFAULT_CONFIG_RELIVERSE.distJsrFailOnWarn + ",",
|
|
578
|
+
" distJsrGenTsconfig: " + DEFAULT_CONFIG_RELIVERSE.distJsrGenTsconfig + ",",
|
|
579
|
+
' distJsrOutFilesExt: "' + DEFAULT_CONFIG_RELIVERSE.distJsrOutFilesExt + '",',
|
|
580
|
+
" distJsrSlowTypes: " + DEFAULT_CONFIG_RELIVERSE.distJsrSlowTypes + ",",
|
|
579
581
|
"",
|
|
580
582
|
" // NPM-only config",
|
|
581
|
-
' distNpmBuilder: "' +
|
|
582
|
-
' distNpmDirName: "' +
|
|
583
|
-
' distNpmOutFilesExt: "' +
|
|
583
|
+
' distNpmBuilder: "' + DEFAULT_CONFIG_RELIVERSE.distNpmBuilder + '",',
|
|
584
|
+
' distNpmDirName: "' + DEFAULT_CONFIG_RELIVERSE.distNpmDirName + '",',
|
|
585
|
+
' distNpmOutFilesExt: "' + DEFAULT_CONFIG_RELIVERSE.distNpmOutFilesExt + '",',
|
|
584
586
|
"",
|
|
585
587
|
" // Libraries Reliverse Plugin",
|
|
586
588
|
" // Publish specific dirs as separate packages",
|
|
587
589
|
" // This feature is experimental at the moment",
|
|
588
590
|
" // Please commit your changes before using it",
|
|
589
591
|
' libsActMode: "' + libsActModeValue + '",',
|
|
590
|
-
' libsDirDist: "' +
|
|
591
|
-
' libsDirSrc: "' +
|
|
592
|
+
' libsDirDist: "' + DEFAULT_CONFIG_RELIVERSE.libsDirDist + '",',
|
|
593
|
+
' libsDirSrc: "' + DEFAULT_CONFIG_RELIVERSE.libsDirSrc + '",',
|
|
592
594
|
" libsList: " + JSON.stringify(getLibsObject(isDev), null, 2) + ",",
|
|
593
595
|
"",
|
|
594
596
|
" // @reliverse/relinka logger setup",
|
|
595
|
-
' logsFileName: "' +
|
|
596
|
-
" logsFreshFile: " +
|
|
597
|
+
' logsFileName: "' + DEFAULT_CONFIG_RELIVERSE.logsFileName + '",',
|
|
598
|
+
" logsFreshFile: " + DEFAULT_CONFIG_RELIVERSE.logsFreshFile + ",",
|
|
597
599
|
"",
|
|
598
600
|
" // Dependency filtering",
|
|
599
601
|
" // Global is always applied",
|
|
@@ -625,13 +627,13 @@ function generateConfig(isDev, pkgDescription, configKind = "ts") {
|
|
|
625
627
|
" // transpileAlias: {},",
|
|
626
628
|
" // transpileClean: true,",
|
|
627
629
|
" // transpileEntries: [],",
|
|
628
|
-
' transpileEsbuild: "' +
|
|
630
|
+
' transpileEsbuild: "' + DEFAULT_CONFIG_RELIVERSE.transpileEsbuild + '",',
|
|
629
631
|
" // transpileExternals: [],",
|
|
630
|
-
" transpileFailOnWarn: " +
|
|
631
|
-
' transpileFormat: "' +
|
|
632
|
-
" transpileMinify: " +
|
|
632
|
+
" transpileFailOnWarn: " + DEFAULT_CONFIG_RELIVERSE.transpileFailOnWarn + ",",
|
|
633
|
+
' transpileFormat: "' + DEFAULT_CONFIG_RELIVERSE.transpileFormat + '",',
|
|
634
|
+
" transpileMinify: " + DEFAULT_CONFIG_RELIVERSE.transpileMinify + ",",
|
|
633
635
|
" // transpileParallel: false,",
|
|
634
|
-
' transpilePublicPath: "' +
|
|
636
|
+
' transpilePublicPath: "' + DEFAULT_CONFIG_RELIVERSE.transpilePublicPath + '",',
|
|
635
637
|
" // transpileReplace: {},",
|
|
636
638
|
" // transpileRollup: {",
|
|
637
639
|
" // alias: {},",
|
|
@@ -643,12 +645,12 @@ function generateConfig(isDev, pkgDescription, configKind = "ts") {
|
|
|
643
645
|
" // resolve: {},",
|
|
644
646
|
" // },",
|
|
645
647
|
" // transpileShowOutLog: false,",
|
|
646
|
-
' transpileSourcemap: "' +
|
|
647
|
-
" transpileSplitting: " +
|
|
648
|
-
" transpileStub: " +
|
|
648
|
+
' transpileSourcemap: "' + DEFAULT_CONFIG_RELIVERSE.transpileSourcemap + '",',
|
|
649
|
+
" transpileSplitting: " + DEFAULT_CONFIG_RELIVERSE.transpileSplitting + ",",
|
|
650
|
+
" transpileStub: " + DEFAULT_CONFIG_RELIVERSE.transpileStub + ",",
|
|
649
651
|
" // transpileStubOptions: { jiti: {} },",
|
|
650
|
-
' transpileTarget: "' +
|
|
651
|
-
" transpileWatch: " +
|
|
652
|
+
' transpileTarget: "' + DEFAULT_CONFIG_RELIVERSE.transpileTarget + '",',
|
|
653
|
+
" transpileWatch: " + DEFAULT_CONFIG_RELIVERSE.transpileWatch + ",",
|
|
652
654
|
" // transpileWatchOptions: undefined,",
|
|
653
655
|
"",
|
|
654
656
|
" // Specifies what resources to send to npm and jsr registries.",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { selectPrompt } from "@reliverse/rempts";
|
|
2
|
-
export async function
|
|
2
|
+
export async function askReliverseConfigType() {
|
|
3
3
|
return await selectPrompt({
|
|
4
4
|
title: "Please select a rseonfiguration file type. JSONC is recommended for most projects.",
|
|
5
5
|
content: "A tsconfig.json file was detected. You can use the TypeScript config type for this project; however, it requires @reliverse/rse to be installed (as a dev dependency); without it, the rse CLI may not run correctly when using the TS config type.",
|
package/bin/app/config/read.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ReliverseConfig } from "../schema/mod.js";
|
|
2
2
|
/**
|
|
3
3
|
* Helper for TS config reading.
|
|
4
4
|
* Uses jiti for TypeScript module loading.
|
|
5
5
|
*/
|
|
6
|
-
export declare function readRseTs(configPath: string): Promise<
|
|
6
|
+
export declare function readRseTs(configPath: string): Promise<ReliverseConfig | null>;
|
|
7
7
|
/**
|
|
8
8
|
* Reads and validates the config file.
|
|
9
9
|
* If errors are detected, it attempts to merge missing or invalid fields with defaults.
|
|
10
10
|
*/
|
|
11
|
-
export declare function
|
|
11
|
+
export declare function readReliverseConfig(configPath: string, isDev: boolean): Promise<ReliverseConfig | null>;
|
package/bin/app/config/read.js
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import fs from "@reliverse/relifso";
|
|
2
2
|
import { relinka } from "@reliverse/relinka";
|
|
3
|
-
import { Value } from "@sinclair/typebox/value";
|
|
4
3
|
import { parseJSONC } from "confbox";
|
|
5
4
|
import { createJiti } from "jiti";
|
|
6
|
-
import {
|
|
5
|
+
import { writeReliverseConfig } from "./create.js";
|
|
7
6
|
import { repairAndParseJSON } from "./repair.js";
|
|
8
|
-
import { rseSchema } from "./schema.js";
|
|
9
7
|
import { mergeWithDefaults } from "./update.js";
|
|
10
|
-
import {
|
|
8
|
+
import { DEFAULT_CONFIG_RELIVERSE } from "../schema/mod.js";
|
|
11
9
|
const jiti = createJiti(import.meta.url);
|
|
12
|
-
async function
|
|
10
|
+
async function parseReliverseConfig(configPath) {
|
|
13
11
|
try {
|
|
14
12
|
const content = (await fs.readFile(configPath, "utf-8")).trim();
|
|
15
13
|
if (!content || content === "{}") return null;
|
|
@@ -21,17 +19,15 @@ async function parseRseConfig(configPath) {
|
|
|
21
19
|
relinka("info", "Config JSON was repaired.");
|
|
22
20
|
relinka("verbose", "Used tool: jsonrepair.");
|
|
23
21
|
}
|
|
24
|
-
const schemaProperties = Object.keys(
|
|
22
|
+
const schemaProperties = Object.keys(
|
|
23
|
+
DEFAULT_CONFIG_RELIVERSE
|
|
24
|
+
);
|
|
25
25
|
const filteredParsed = Object.fromEntries(
|
|
26
26
|
Object.entries(parsed).filter(
|
|
27
27
|
([key]) => schemaProperties.includes(key)
|
|
28
28
|
)
|
|
29
29
|
);
|
|
30
|
-
|
|
31
|
-
return isValid ? { parsed: filteredParsed, errors: null } : {
|
|
32
|
-
parsed: filteredParsed,
|
|
33
|
-
errors: Value.Errors(rseSchema, filteredParsed)
|
|
34
|
-
};
|
|
30
|
+
return { parsed: filteredParsed, errors: null };
|
|
35
31
|
} catch {
|
|
36
32
|
return null;
|
|
37
33
|
}
|
|
@@ -39,11 +35,7 @@ async function parseRseConfig(configPath) {
|
|
|
39
35
|
export async function readRseTs(configPath) {
|
|
40
36
|
try {
|
|
41
37
|
const config = await jiti.import(configPath, { default: true });
|
|
42
|
-
|
|
43
|
-
return config;
|
|
44
|
-
}
|
|
45
|
-
relinka("warn", "TS config does not match the schema.");
|
|
46
|
-
return null;
|
|
38
|
+
return config;
|
|
47
39
|
} catch (error) {
|
|
48
40
|
relinka(
|
|
49
41
|
"error",
|
|
@@ -53,32 +45,18 @@ export async function readRseTs(configPath) {
|
|
|
53
45
|
return null;
|
|
54
46
|
}
|
|
55
47
|
}
|
|
56
|
-
export async function
|
|
48
|
+
export async function readReliverseConfig(configPath, isDev) {
|
|
57
49
|
if (configPath.endsWith(".ts")) {
|
|
58
50
|
return await readRseTs(configPath);
|
|
59
51
|
}
|
|
60
52
|
if (!await fs.pathExists(configPath)) return null;
|
|
61
|
-
const
|
|
62
|
-
const parseResult = await parseRseConfig(configPath);
|
|
53
|
+
const parseResult = await parseReliverseConfig(configPath);
|
|
63
54
|
if (!parseResult) return null;
|
|
64
55
|
if (!parseResult.errors) return parseResult.parsed;
|
|
65
56
|
const errors = [...parseResult.errors].map((err) => `Path "${err.path}": ${err.message}`);
|
|
66
57
|
relinka("verbose", "Detected invalid fields in config:", errors.join("; "));
|
|
67
58
|
const merged = mergeWithDefaults(parseResult.parsed);
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
return merged;
|
|
72
|
-
}
|
|
73
|
-
if (await fs.pathExists(backupPath)) {
|
|
74
|
-
const backupResult = await parseRseConfig(backupPath);
|
|
75
|
-
if (backupResult && !backupResult.errors) {
|
|
76
|
-
await fs.copy(backupPath, configPath);
|
|
77
|
-
relinka("info", "Restored config from backup");
|
|
78
|
-
return backupResult.parsed;
|
|
79
|
-
}
|
|
80
|
-
relinka("warn", "Backup also invalid. Returning null.");
|
|
81
|
-
return null;
|
|
82
|
-
}
|
|
83
|
-
return null;
|
|
59
|
+
await writeReliverseConfig(configPath, merged, isDev);
|
|
60
|
+
relinka("info", "Merged missing or invalid fields into config");
|
|
61
|
+
return merged;
|
|
84
62
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TSchema } from "@sinclair/typebox";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ReliverseConfig } from "../schema/mod.js";
|
|
3
3
|
export declare function repairAndParseJSON(raw: string): any;
|
|
4
4
|
/**
|
|
5
5
|
* Recursively fixes each property in the object. Returns the fixed config and
|
|
@@ -13,4 +13,4 @@ export declare function fixLineByLine(userConfig: unknown, defaultConfig: unknow
|
|
|
13
13
|
* Reads the config file, fixes invalid lines based on the schema,
|
|
14
14
|
* writes back the fixed config, and returns the fixed config.
|
|
15
15
|
*/
|
|
16
|
-
export declare function
|
|
16
|
+
export declare function parseAndFixReliverseConfig(configPath: string, isDev: boolean): Promise<ReliverseConfig | null>;
|
package/bin/app/config/repair.js
CHANGED
|
@@ -4,10 +4,9 @@ import { Type } from "@sinclair/typebox";
|
|
|
4
4
|
import { Value } from "@sinclair/typebox/value";
|
|
5
5
|
import { parseJSONC } from "confbox";
|
|
6
6
|
import { jsonrepair } from "jsonrepair";
|
|
7
|
-
import {
|
|
8
|
-
import { DEFAULT_CONFIG_RSE } from "./default-cfg.js";
|
|
9
|
-
import { rseSchema } from "./schema.js";
|
|
7
|
+
import { writeReliverseConfig } from "./create.js";
|
|
10
8
|
import { cleanGitHubUrl } from "./utils.js";
|
|
9
|
+
import { DEFAULT_CONFIG_RELIVERSE } from "../schema/mod.js";
|
|
11
10
|
export function repairAndParseJSON(raw) {
|
|
12
11
|
try {
|
|
13
12
|
const repaired = jsonrepair(raw);
|
|
@@ -90,7 +89,7 @@ export function fixLineByLine(userConfig, defaultConfig, schema) {
|
|
|
90
89
|
}
|
|
91
90
|
return { fixedConfig: result, changedKeys };
|
|
92
91
|
}
|
|
93
|
-
export async function
|
|
92
|
+
export async function parseAndFixReliverseConfig(configPath, isDev) {
|
|
94
93
|
try {
|
|
95
94
|
const raw = await fs.readFile(configPath, "utf-8");
|
|
96
95
|
let parsed = parseJSONC(raw);
|
|
@@ -103,11 +102,15 @@ export async function parseAndFixRseConfig(configPath, isDev) {
|
|
|
103
102
|
parsed = repaired;
|
|
104
103
|
}
|
|
105
104
|
if (parsed && typeof parsed === "object") {
|
|
106
|
-
const originalErrors = [
|
|
105
|
+
const originalErrors = [];
|
|
107
106
|
if (originalErrors.length === 0) return parsed;
|
|
108
|
-
const { fixedConfig, changedKeys } = fixLineByLine(
|
|
109
|
-
|
|
110
|
-
|
|
107
|
+
const { fixedConfig, changedKeys } = fixLineByLine(
|
|
108
|
+
parsed,
|
|
109
|
+
DEFAULT_CONFIG_RELIVERSE,
|
|
110
|
+
Type.Any()
|
|
111
|
+
);
|
|
112
|
+
if (fixedConfig && typeof fixedConfig === "object") {
|
|
113
|
+
await writeReliverseConfig(configPath, fixedConfig, isDev);
|
|
111
114
|
const originalInvalidPaths = originalErrors.map((err) => err.path);
|
|
112
115
|
relinka(
|
|
113
116
|
"info",
|
|
@@ -120,10 +123,7 @@ export async function parseAndFixRseConfig(configPath, isDev) {
|
|
|
120
123
|
);
|
|
121
124
|
return fixedConfig;
|
|
122
125
|
}
|
|
123
|
-
|
|
124
|
-
(e) => `Path "${e.path}": ${e.message}`
|
|
125
|
-
);
|
|
126
|
-
relinka("warn", "Could not fix all invalid config lines:", newErrs.join("; "));
|
|
126
|
+
relinka("warn", "Could not validate all config lines. Applied best-effort fixes.");
|
|
127
127
|
return null;
|
|
128
128
|
}
|
|
129
129
|
} catch (error) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ReliverseConfig } from "../schema/mod.js";
|
|
2
2
|
/**
|
|
3
3
|
* Loads the rse config using c12. Merges:
|
|
4
4
|
* 1) File named `rse.*`
|
|
5
5
|
* 2) Optional overrides
|
|
6
6
|
*/
|
|
7
|
-
export declare function loadrse(projectPath: string): Promise<
|
|
7
|
+
export declare function loadrse(projectPath: string): Promise<ReliverseConfig>;
|
|
8
8
|
/**
|
|
9
9
|
* Watches the rse config for changes and reloads on each update.
|
|
10
10
|
*/
|
|
11
|
-
export declare function watchrse(projectPath: string, onUpdate: (newconfig:
|
|
11
|
+
export declare function watchrse(projectPath: string, onUpdate: (newconfig: ReliverseConfig) => void): Promise<void>;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { Value } from "@sinclair/typebox/value";
|
|
2
1
|
import { loadConfig, watchConfig } from "c12";
|
|
3
|
-
import {
|
|
4
|
-
import { rseSchema } from "./schema.js";
|
|
2
|
+
import { DEFAULT_CONFIG_RELIVERSE } from "../schema/mod.js";
|
|
5
3
|
export async function loadrse(projectPath) {
|
|
6
4
|
const { config } = await loadConfig({
|
|
7
5
|
cwd: projectPath,
|
|
@@ -12,17 +10,10 @@ export async function loadrse(projectPath) {
|
|
|
12
10
|
packageJson: false,
|
|
13
11
|
dotenv: false,
|
|
14
12
|
// disable loading .env
|
|
15
|
-
defaults:
|
|
13
|
+
defaults: DEFAULT_CONFIG_RELIVERSE
|
|
16
14
|
// merged first
|
|
17
15
|
// overrides: overrides || {}, // highest priority
|
|
18
16
|
});
|
|
19
|
-
if (!Value.Check(rseSchema, config)) {
|
|
20
|
-
const errors = [...Value.Errors(rseSchema, config)].map(
|
|
21
|
-
(err) => `Path "${err.path}": ${err.message}`
|
|
22
|
-
);
|
|
23
|
-
throw new Error(`Invalid rse config:
|
|
24
|
-
${errors.join("\n")}`);
|
|
25
|
-
}
|
|
26
17
|
return config;
|
|
27
18
|
}
|
|
28
19
|
export async function watchrse(projectPath, onUpdate) {
|
|
@@ -30,9 +21,6 @@ export async function watchrse(projectPath, onUpdate) {
|
|
|
30
21
|
cwd: projectPath,
|
|
31
22
|
name: "reliverse",
|
|
32
23
|
onUpdate({ newConfig, getDiff }) {
|
|
33
|
-
if (!Value.Check(rseSchema, newConfig)) {
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
24
|
onUpdate(newConfig);
|
|
37
25
|
console.log("Diff:", getDiff());
|
|
38
26
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ReliverseConfig } from "../schema/mod.js";
|
|
2
2
|
/**
|
|
3
3
|
* Updates project configuration by merging new updates with the existing config.
|
|
4
4
|
* Creates a backup before overwriting and attempts to restore from backup on error.
|
|
5
5
|
*/
|
|
6
|
-
export declare function
|
|
6
|
+
export declare function updateReliverseConfig(projectPath: string, updates: Partial<ReliverseConfig>, isDev: boolean): Promise<boolean>;
|
|
7
7
|
/**
|
|
8
8
|
* Merges a partial config with the default config.
|
|
9
9
|
*/
|
|
10
|
-
export declare function mergeWithDefaults(partial: Partial<
|
|
10
|
+
export declare function mergeWithDefaults(partial: Partial<ReliverseConfig>): ReliverseConfig;
|