@reliverse/dler 1.7.111 → 1.7.112
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/ai/ai-impl/ai-auth.js +0 -2
- package/bin/app/ai/ai-impl/mcp/mcp-mod.js +0 -2
- package/bin/app/better/auth/(utils)/get-config.js +2 -1
- package/bin/app/better/auth/init/cmd.js +4 -3
- package/bin/app/config/constants.d.ts +1 -1
- package/bin/app/config/constants.js +1 -1
- package/bin/app/login/login-impl.d.ts +0 -1
- package/bin/app/login/login-impl.js +1 -2
- package/bin/app/migrate/cmd.d.ts +12 -0
- package/bin/app/migrate/cmd.js +87 -1
- package/bin/app/migrate/codemods/monorepo-catalog.d.ts +96 -0
- package/bin/app/{update/migrate/cmd.js → migrate/codemods/monorepo-catalog.js} +16 -104
- package/bin/app/providers/better-t-stack/types.d.ts +9 -9
- package/bin/app/update/cmd.d.ts +10 -0
- package/bin/app/update/cmd.js +155 -901
- package/bin/app/update/impl.d.ts +42 -0
- package/bin/app/update/impl.js +260 -0
- package/bin/app/update/utils.d.ts +134 -0
- package/bin/app/update/utils.js +899 -0
- package/bin/dler.js +1 -6
- package/bin/mod.d.ts +167 -19
- package/bin/mod.js +300 -60
- package/package.json +1 -2
- package/bin/app/update/cmd-2.d.ts +0 -2
- package/bin/app/update/cmd-2.js +0 -50
- package/bin/app/update/migrate/cmd.d.ts +0 -23
- package/bin/app/update/update-impl.d.ts +0 -2
- package/bin/app/update/update-impl.js +0 -50
- package/bin/app/upgrade/cmd.d.ts +0 -8
- package/bin/app/upgrade/cmd.js +0 -302
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { relinka } from "@reliverse/relinka";
|
|
2
2
|
import { inputPrompt } from "@reliverse/rempts";
|
|
3
|
-
import dotenv from "dotenv";
|
|
4
3
|
import { ofetch } from "ofetch";
|
|
5
4
|
import { updateReliverseMemory } from "../../utils/reliverseMemory.js";
|
|
6
|
-
dotenv.config();
|
|
7
5
|
export async function ensureOpenAIKey(memory) {
|
|
8
6
|
let envKeyInvalid = false;
|
|
9
7
|
let memoryKeyInvalid = false;
|
|
@@ -84,7 +84,7 @@ export async function getConfig({
|
|
|
84
84
|
if (await pathExists(configPath)) resolvedPath = configPath;
|
|
85
85
|
const { config } = await loadConfig({
|
|
86
86
|
configFile: resolvedPath,
|
|
87
|
-
dotenv:
|
|
87
|
+
dotenv: false,
|
|
88
88
|
jitiOptions: await jitiOptions(cwd)
|
|
89
89
|
});
|
|
90
90
|
if (!config.auth && !config.default) {
|
|
@@ -104,6 +104,7 @@ export async function getConfig({
|
|
|
104
104
|
for (const possiblePath of possiblePaths) {
|
|
105
105
|
try {
|
|
106
106
|
const { config } = await loadConfig({
|
|
107
|
+
dotenv: false,
|
|
107
108
|
configFile: possiblePath,
|
|
108
109
|
jitiOptions: await jitiOptions(cwd)
|
|
109
110
|
});
|
|
@@ -14,7 +14,6 @@ import {
|
|
|
14
14
|
spinner,
|
|
15
15
|
text
|
|
16
16
|
} from "@reliverse/rempts";
|
|
17
|
-
import { parse } from "dotenv";
|
|
18
17
|
import { execaCommand } from "execa";
|
|
19
18
|
import fs from "fs/promises";
|
|
20
19
|
import path from "path";
|
|
@@ -791,8 +790,10 @@ export const init = defineCommand({
|
|
|
791
790
|
}
|
|
792
791
|
if (targetEnvFile !== "none") {
|
|
793
792
|
try {
|
|
794
|
-
const
|
|
795
|
-
|
|
793
|
+
const parsed = {
|
|
794
|
+
BETTER_AUTH_SECRET: "some_value",
|
|
795
|
+
BETTER_AUTH_URL: "http://localhost:3000"
|
|
796
|
+
};
|
|
796
797
|
let isMissingSecret = false;
|
|
797
798
|
let isMissingUrl = false;
|
|
798
799
|
if (parsed.BETTER_AUTH_SECRET === void 0) isMissingSecret = true;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const PROJECT_ROOT: string;
|
|
2
|
-
export declare const cliVersion = "1.7.
|
|
2
|
+
export declare const cliVersion = "1.7.112";
|
|
3
3
|
export declare const cliName = "@reliverse/rse";
|
|
4
4
|
export declare const rseName = "@reliverse/rse";
|
|
5
5
|
export declare const dlerName = "@reliverse/dler";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import os from "node:os";
|
|
2
2
|
import path from "@reliverse/pathkit";
|
|
3
3
|
export const PROJECT_ROOT = path.resolve(process.cwd());
|
|
4
|
-
const version = "1.7.
|
|
4
|
+
const version = "1.7.112";
|
|
5
5
|
export const cliVersion = version;
|
|
6
6
|
export const cliName = "@reliverse/rse";
|
|
7
7
|
export const rseName = "@reliverse/rse";
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
+
import { setTimeout } from "node:timers";
|
|
1
2
|
import { re } from "@reliverse/relico";
|
|
2
3
|
import { relinka } from "@reliverse/relinka";
|
|
3
4
|
import { useSpinner } from "@reliverse/rempts";
|
|
4
5
|
import { listen } from "async-listen";
|
|
5
6
|
import http from "http";
|
|
6
7
|
import { customAlphabet } from "nanoid";
|
|
7
|
-
import "dotenv/config";
|
|
8
|
-
import { setTimeout } from "node:timers";
|
|
9
8
|
import open from "open";
|
|
10
9
|
import url from "url";
|
|
11
10
|
import { cliDomainDocs, memoryPath } from "../config/constants.js";
|
package/bin/app/migrate/cmd.d.ts
CHANGED
|
@@ -39,5 +39,17 @@ declare const _default: import("@reliverse/rempts").Command<{
|
|
|
39
39
|
type: "string";
|
|
40
40
|
description: string;
|
|
41
41
|
};
|
|
42
|
+
"to-catalog": {
|
|
43
|
+
type: "boolean";
|
|
44
|
+
description: string;
|
|
45
|
+
};
|
|
46
|
+
"from-catalog": {
|
|
47
|
+
type: "boolean";
|
|
48
|
+
description: string;
|
|
49
|
+
};
|
|
50
|
+
"remove-catalog": {
|
|
51
|
+
type: "boolean";
|
|
52
|
+
description: string;
|
|
53
|
+
};
|
|
42
54
|
}>;
|
|
43
55
|
export default _default;
|
package/bin/app/migrate/cmd.js
CHANGED
|
@@ -1,8 +1,18 @@
|
|
|
1
|
+
import path from "@reliverse/pathkit";
|
|
2
|
+
import fs from "@reliverse/relifso";
|
|
1
3
|
import { relinka } from "@reliverse/relinka";
|
|
2
4
|
import { confirmPrompt, defineArgs, defineCommand } from "@reliverse/rempts";
|
|
5
|
+
import { isMonorepo } from "../update/utils.js";
|
|
6
|
+
import { isCatalogSupported } from "../utils/pm/pm-catalog.js";
|
|
7
|
+
import { detectPackageManager } from "../utils/pm/pm-detect.js";
|
|
3
8
|
import { migrateAnythingToBun } from "./codemods/anything-bun.js";
|
|
4
9
|
import { consoleToRelinka } from "./codemods/console-relinka.js";
|
|
5
10
|
import { migrateFsToRelifso } from "./codemods/fs-relifso.js";
|
|
11
|
+
import {
|
|
12
|
+
displayMigrationResults,
|
|
13
|
+
migrateFromCatalog,
|
|
14
|
+
migrateToCatalog
|
|
15
|
+
} from "./codemods/monorepo-catalog.js";
|
|
6
16
|
import { migrateModuleResolution } from "./codemods/nodenext-bundler.js";
|
|
7
17
|
import { migratePathToPathkit } from "./codemods/path-pathkit.js";
|
|
8
18
|
import { migrateReaddirToGlob } from "./codemods/readdir-glob.js";
|
|
@@ -20,7 +30,7 @@ export default defineCommand({
|
|
|
20
30
|
},
|
|
21
31
|
codemod: {
|
|
22
32
|
type: "string",
|
|
23
|
-
description: "The migration to perform (anything-bun | path-pathkit | fs-relifso | nodenext-bundler | readdir-glob | console-relinka)"
|
|
33
|
+
description: "The migration to perform (anything-bun | path-pathkit | fs-relifso | nodenext-bundler | readdir-glob | console-relinka | catalog-migration)"
|
|
24
34
|
},
|
|
25
35
|
project: {
|
|
26
36
|
type: "string",
|
|
@@ -52,6 +62,19 @@ export default defineCommand({
|
|
|
52
62
|
consoleRelinkaTo: {
|
|
53
63
|
type: "string",
|
|
54
64
|
description: "Target format (console, consolaMethod, consolaObject, relinkaFunction, relinkaMethod, relinkaObject)"
|
|
65
|
+
},
|
|
66
|
+
// Catalog migration specific arguments
|
|
67
|
+
"to-catalog": {
|
|
68
|
+
type: "boolean",
|
|
69
|
+
description: "Migrate workspace dependencies to workspaces.catalog and replace with catalog references (use with codemod: catalog-migration)"
|
|
70
|
+
},
|
|
71
|
+
"from-catalog": {
|
|
72
|
+
type: "boolean",
|
|
73
|
+
description: "Restore catalog references to actual versions from workspaces.catalog (use with codemod: catalog-migration)"
|
|
74
|
+
},
|
|
75
|
+
"remove-catalog": {
|
|
76
|
+
type: "boolean",
|
|
77
|
+
description: "Remove workspaces.catalog from root package.json after restoring (only with --from-catalog)"
|
|
55
78
|
}
|
|
56
79
|
}),
|
|
57
80
|
async run({ args }) {
|
|
@@ -84,6 +107,10 @@ Are you sure you want to migrate files in ${args.project}?`,
|
|
|
84
107
|
}
|
|
85
108
|
return;
|
|
86
109
|
}
|
|
110
|
+
if (args.codemod === "catalog-migration") {
|
|
111
|
+
await handleCatalogMigration(args);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
87
114
|
let results = [];
|
|
88
115
|
if (args.codemod === "path-pathkit") {
|
|
89
116
|
relinka("verbose", "Migrating from node:path and/or pathe to @reliverse/pathkit...");
|
|
@@ -121,6 +148,7 @@ Are you sure you want to migrate files in ${args.project}?`,
|
|
|
121
148
|
relinka("verbose", " - nodenext-bundler");
|
|
122
149
|
relinka("verbose", " - readdir-glob");
|
|
123
150
|
relinka("verbose", " - console-relinka");
|
|
151
|
+
relinka("verbose", " - catalog-migration");
|
|
124
152
|
return;
|
|
125
153
|
}
|
|
126
154
|
relinka("info", "\nMigration Results:");
|
|
@@ -186,3 +214,61 @@ Summary: ${successCount} files updated, ${errorCount} errors, ${warningCount} wa
|
|
|
186
214
|
}
|
|
187
215
|
}
|
|
188
216
|
});
|
|
217
|
+
async function handleCatalogMigration(args) {
|
|
218
|
+
try {
|
|
219
|
+
if (!args["to-catalog"] && !args["from-catalog"]) {
|
|
220
|
+
relinka("error", "Must specify either --to-catalog or --from-catalog");
|
|
221
|
+
return process.exit(1);
|
|
222
|
+
}
|
|
223
|
+
if (args["to-catalog"] && args["from-catalog"]) {
|
|
224
|
+
relinka("error", "Cannot specify both --to-catalog and --from-catalog");
|
|
225
|
+
return process.exit(1);
|
|
226
|
+
}
|
|
227
|
+
if (args["remove-catalog"] && !args["from-catalog"]) {
|
|
228
|
+
relinka("error", "--remove-catalog can only be used with --from-catalog");
|
|
229
|
+
return process.exit(1);
|
|
230
|
+
}
|
|
231
|
+
const cwd = process.cwd();
|
|
232
|
+
const packageJsonPath = path.resolve(cwd, "package.json");
|
|
233
|
+
if (!await fs.pathExists(packageJsonPath)) {
|
|
234
|
+
relinka("error", "No package.json found in current directory");
|
|
235
|
+
return process.exit(1);
|
|
236
|
+
}
|
|
237
|
+
if (!await isMonorepo(cwd)) {
|
|
238
|
+
relinka("error", "This command requires a monorepo with workspace configuration");
|
|
239
|
+
return process.exit(1);
|
|
240
|
+
}
|
|
241
|
+
const packageManager = await detectPackageManager(cwd);
|
|
242
|
+
if (!packageManager) {
|
|
243
|
+
relinka("warn", "Could not detect package manager");
|
|
244
|
+
} else if (!isCatalogSupported(packageManager)) {
|
|
245
|
+
relinka(
|
|
246
|
+
"warn",
|
|
247
|
+
`Catalogs may not be fully supported by ${packageManager.name}. Only Bun has full catalog support.`
|
|
248
|
+
);
|
|
249
|
+
}
|
|
250
|
+
let results = [];
|
|
251
|
+
if (args["to-catalog"]) {
|
|
252
|
+
relinka("log", "Migrating workspace dependencies to catalog...");
|
|
253
|
+
results = await migrateToCatalog(cwd, !!args.dryRun, !!args.interactive);
|
|
254
|
+
} else if (args["from-catalog"]) {
|
|
255
|
+
relinka("log", "Restoring dependencies from catalog...");
|
|
256
|
+
results = await migrateFromCatalog(
|
|
257
|
+
cwd,
|
|
258
|
+
!!args["remove-catalog"],
|
|
259
|
+
!!args.dryRun,
|
|
260
|
+
!!args.interactive
|
|
261
|
+
);
|
|
262
|
+
}
|
|
263
|
+
displayMigrationResults(results);
|
|
264
|
+
if (args.dryRun) {
|
|
265
|
+
relinka("info", "This was a dry run - no actual changes were made");
|
|
266
|
+
}
|
|
267
|
+
} catch (error) {
|
|
268
|
+
relinka(
|
|
269
|
+
"error",
|
|
270
|
+
`Catalog migration failed: ${error instanceof Error ? error.message : String(error)}`
|
|
271
|
+
);
|
|
272
|
+
process.exit(1);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
export interface MigrationResult {
|
|
2
|
+
package: string;
|
|
3
|
+
action: "added-to-catalog" | "replaced-with-catalog" | "restored-from-catalog" | "version-bumped";
|
|
4
|
+
oldVersion?: string;
|
|
5
|
+
newVersion?: string;
|
|
6
|
+
location: string;
|
|
7
|
+
packageJsonPath?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface DependencyEntry {
|
|
10
|
+
name: string;
|
|
11
|
+
version: string;
|
|
12
|
+
locations: Set<string>;
|
|
13
|
+
packageJsonPath: string;
|
|
14
|
+
oldVersion?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface CatalogMergeResult {
|
|
17
|
+
added: DependencyEntry[];
|
|
18
|
+
bumped: DependencyEntry[];
|
|
19
|
+
skipped: DependencyEntry[];
|
|
20
|
+
}
|
|
21
|
+
export interface PackageJson {
|
|
22
|
+
name?: string;
|
|
23
|
+
version?: string;
|
|
24
|
+
dependencies?: Record<string, string>;
|
|
25
|
+
devDependencies?: Record<string, string>;
|
|
26
|
+
peerDependencies?: Record<string, string>;
|
|
27
|
+
optionalDependencies?: Record<string, string>;
|
|
28
|
+
workspaces?: {
|
|
29
|
+
packages?: string[];
|
|
30
|
+
catalog?: Record<string, string>;
|
|
31
|
+
catalogs?: Record<string, Record<string, string>>;
|
|
32
|
+
} | string[];
|
|
33
|
+
catalog?: Record<string, string>;
|
|
34
|
+
catalogs?: Record<string, Record<string, string>>;
|
|
35
|
+
scripts?: Record<string, string>;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Check if a dependency is a catalog reference (e.g., "catalog:", "catalog:foo")
|
|
39
|
+
*/
|
|
40
|
+
export declare function isCatalogReference(versionSpec: string): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Check if a dependency is a workspace dependency (e.g., "workspace:*")
|
|
43
|
+
*/
|
|
44
|
+
export declare function isWorkspaceDependency(versionSpec: string): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Check if a dependency is an npm alias (e.g., "npm:package-name@version")
|
|
47
|
+
*/
|
|
48
|
+
export declare function isNpmAlias(versionSpec: string): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Check if a dependency should be skipped (non-semver or special specifier)
|
|
51
|
+
*/
|
|
52
|
+
export declare function shouldSkipDependency(versionSpec: string): boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Find all workspace package.json paths from root cwd. Supports workspaces array or { packages: [] }.
|
|
55
|
+
*/
|
|
56
|
+
export declare function findWorkspacePackageJsons(cwd: string): Promise<string[]>;
|
|
57
|
+
/**
|
|
58
|
+
* Check if we're in a monorepo by detecting workspace configuration
|
|
59
|
+
*/
|
|
60
|
+
export declare function isMonorepo(cwd: string): Promise<boolean>;
|
|
61
|
+
/**
|
|
62
|
+
* Extract dependencies from package.json (dependencies and devDependencies)
|
|
63
|
+
*/
|
|
64
|
+
export declare function extractDependencies(packageJson: PackageJson, packageJsonPath: string): DependencyEntry[];
|
|
65
|
+
/**
|
|
66
|
+
* Merge dependencies into catalog, handling version conflicts intelligently
|
|
67
|
+
*/
|
|
68
|
+
export declare function mergeToCatalog(existingCatalog: Record<string, string>, newDependencies: DependencyEntry[]): CatalogMergeResult;
|
|
69
|
+
/**
|
|
70
|
+
* Replace dependencies with catalog references in package.json
|
|
71
|
+
*/
|
|
72
|
+
export declare function replaceDependenciesWithCatalogRefs(packageJsonPath: string, dependenciesToReplace: DependencyEntry[]): Promise<number>;
|
|
73
|
+
/**
|
|
74
|
+
* Restore catalog references to actual versions
|
|
75
|
+
*/
|
|
76
|
+
export declare function restoreCatalogReferences(packageJsonPath: string, catalog: Record<string, string>): Promise<number>;
|
|
77
|
+
/**
|
|
78
|
+
* Update root package.json with catalog
|
|
79
|
+
*/
|
|
80
|
+
export declare function updateRootWithCatalog(rootPackageJsonPath: string, catalog: Record<string, string>): Promise<void>;
|
|
81
|
+
/**
|
|
82
|
+
* Remove catalog from root package.json
|
|
83
|
+
*/
|
|
84
|
+
export declare function removeCatalogFromRoot(rootPackageJsonPath: string): Promise<void>;
|
|
85
|
+
/**
|
|
86
|
+
* Migrate TO catalog: centralize dependencies to workspaces.catalog
|
|
87
|
+
*/
|
|
88
|
+
export declare function migrateToCatalog(rootPath: string, dryRun?: boolean, interactive?: boolean): Promise<MigrationResult[]>;
|
|
89
|
+
/**
|
|
90
|
+
* Migrate FROM catalog: restore catalog references to actual versions
|
|
91
|
+
*/
|
|
92
|
+
export declare function migrateFromCatalog(rootPath: string, removeCatalog?: boolean, dryRun?: boolean, interactive?: boolean): Promise<MigrationResult[]>;
|
|
93
|
+
/**
|
|
94
|
+
* Display migration results
|
|
95
|
+
*/
|
|
96
|
+
export declare function displayMigrationResults(results: MigrationResult[]): void;
|
|
@@ -1,25 +1,23 @@
|
|
|
1
1
|
import path from "@reliverse/pathkit";
|
|
2
2
|
import fs from "@reliverse/relifso";
|
|
3
3
|
import { relinka } from "@reliverse/relinka";
|
|
4
|
-
import {
|
|
4
|
+
import { multiselectPrompt } from "@reliverse/rempts";
|
|
5
5
|
import { readPackageJSON } from "pkg-types";
|
|
6
6
|
import semver from "semver";
|
|
7
7
|
import { glob } from "tinyglobby";
|
|
8
|
-
|
|
9
|
-
import { detectPackageManager } from "../../utils/pm/pm-detect.js";
|
|
10
|
-
function isCatalogReference(versionSpec) {
|
|
8
|
+
export function isCatalogReference(versionSpec) {
|
|
11
9
|
return versionSpec.startsWith("catalog:");
|
|
12
10
|
}
|
|
13
|
-
function isWorkspaceDependency(versionSpec) {
|
|
11
|
+
export function isWorkspaceDependency(versionSpec) {
|
|
14
12
|
return versionSpec.startsWith("workspace:");
|
|
15
13
|
}
|
|
16
|
-
function isNpmAlias(versionSpec) {
|
|
14
|
+
export function isNpmAlias(versionSpec) {
|
|
17
15
|
return versionSpec.startsWith("npm:");
|
|
18
16
|
}
|
|
19
|
-
function shouldSkipDependency(versionSpec) {
|
|
17
|
+
export function shouldSkipDependency(versionSpec) {
|
|
20
18
|
return isNpmAlias(versionSpec) || isWorkspaceDependency(versionSpec) || isCatalogReference(versionSpec) || versionSpec.startsWith("git+") || versionSpec.startsWith("file:") || versionSpec.startsWith("link:") || versionSpec.startsWith("http:") || versionSpec.startsWith("https:");
|
|
21
19
|
}
|
|
22
|
-
async function findWorkspacePackageJsons(cwd) {
|
|
20
|
+
export async function findWorkspacePackageJsons(cwd) {
|
|
23
21
|
const root = await readPackageJSON(cwd);
|
|
24
22
|
const ws = root.workspaces;
|
|
25
23
|
let patterns = [];
|
|
@@ -42,7 +40,7 @@ async function findWorkspacePackageJsons(cwd) {
|
|
|
42
40
|
}
|
|
43
41
|
return pkgJsonPaths;
|
|
44
42
|
}
|
|
45
|
-
async function isMonorepo(cwd) {
|
|
43
|
+
export async function isMonorepo(cwd) {
|
|
46
44
|
try {
|
|
47
45
|
const root = await readPackageJSON(cwd);
|
|
48
46
|
const ws = root.workspaces;
|
|
@@ -57,7 +55,7 @@ async function isMonorepo(cwd) {
|
|
|
57
55
|
return false;
|
|
58
56
|
}
|
|
59
57
|
}
|
|
60
|
-
function extractDependencies(packageJson, packageJsonPath) {
|
|
58
|
+
export function extractDependencies(packageJson, packageJsonPath) {
|
|
61
59
|
const dependencies = [];
|
|
62
60
|
const deps = packageJson.dependencies || {};
|
|
63
61
|
for (const [name, version] of Object.entries(deps)) {
|
|
@@ -91,7 +89,7 @@ function extractDependencies(packageJson, packageJsonPath) {
|
|
|
91
89
|
}
|
|
92
90
|
return dependencies;
|
|
93
91
|
}
|
|
94
|
-
function mergeToCatalog(existingCatalog, newDependencies) {
|
|
92
|
+
export function mergeToCatalog(existingCatalog, newDependencies) {
|
|
95
93
|
const result = {
|
|
96
94
|
added: [],
|
|
97
95
|
bumped: [],
|
|
@@ -123,7 +121,7 @@ function mergeToCatalog(existingCatalog, newDependencies) {
|
|
|
123
121
|
}
|
|
124
122
|
return result;
|
|
125
123
|
}
|
|
126
|
-
async function replaceDependenciesWithCatalogRefs(packageJsonPath, dependenciesToReplace) {
|
|
124
|
+
export async function replaceDependenciesWithCatalogRefs(packageJsonPath, dependenciesToReplace) {
|
|
127
125
|
try {
|
|
128
126
|
const packageJsonContent = await fs.readFile(packageJsonPath, "utf8");
|
|
129
127
|
const packageJson = JSON.parse(packageJsonContent);
|
|
@@ -151,7 +149,7 @@ async function replaceDependenciesWithCatalogRefs(packageJsonPath, dependenciesT
|
|
|
151
149
|
return 0;
|
|
152
150
|
}
|
|
153
151
|
}
|
|
154
|
-
async function restoreCatalogReferences(packageJsonPath, catalog) {
|
|
152
|
+
export async function restoreCatalogReferences(packageJsonPath, catalog) {
|
|
155
153
|
try {
|
|
156
154
|
const packageJsonContent = await fs.readFile(packageJsonPath, "utf8");
|
|
157
155
|
const packageJson = JSON.parse(packageJsonContent);
|
|
@@ -195,7 +193,7 @@ async function restoreCatalogReferences(packageJsonPath, catalog) {
|
|
|
195
193
|
return 0;
|
|
196
194
|
}
|
|
197
195
|
}
|
|
198
|
-
async function updateRootWithCatalog(rootPackageJsonPath, catalog) {
|
|
196
|
+
export async function updateRootWithCatalog(rootPackageJsonPath, catalog) {
|
|
199
197
|
try {
|
|
200
198
|
const packageJsonContent = await fs.readFile(rootPackageJsonPath, "utf8");
|
|
201
199
|
const packageJson = JSON.parse(packageJsonContent);
|
|
@@ -213,7 +211,7 @@ async function updateRootWithCatalog(rootPackageJsonPath, catalog) {
|
|
|
213
211
|
);
|
|
214
212
|
}
|
|
215
213
|
}
|
|
216
|
-
async function removeCatalogFromRoot(rootPackageJsonPath) {
|
|
214
|
+
export async function removeCatalogFromRoot(rootPackageJsonPath) {
|
|
217
215
|
try {
|
|
218
216
|
const packageJsonContent = await fs.readFile(rootPackageJsonPath, "utf8");
|
|
219
217
|
const packageJson = JSON.parse(packageJsonContent);
|
|
@@ -235,7 +233,7 @@ async function removeCatalogFromRoot(rootPackageJsonPath) {
|
|
|
235
233
|
);
|
|
236
234
|
}
|
|
237
235
|
}
|
|
238
|
-
async function migrateToCatalog(rootPath, dryRun = false, interactive = false) {
|
|
236
|
+
export async function migrateToCatalog(rootPath, dryRun = false, interactive = false) {
|
|
239
237
|
const results = [];
|
|
240
238
|
const workspacePaths = await findWorkspacePackageJsons(rootPath);
|
|
241
239
|
if (workspacePaths.length === 0) {
|
|
@@ -354,7 +352,7 @@ async function migrateToCatalog(rootPath, dryRun = false, interactive = false) {
|
|
|
354
352
|
}
|
|
355
353
|
return results;
|
|
356
354
|
}
|
|
357
|
-
async function migrateFromCatalog(rootPath, removeCatalog = false, dryRun = false, interactive = false) {
|
|
355
|
+
export async function migrateFromCatalog(rootPath, removeCatalog = false, dryRun = false, interactive = false) {
|
|
358
356
|
const results = [];
|
|
359
357
|
const rootPackageJson = await readPackageJSON(rootPath);
|
|
360
358
|
const catalog = rootPackageJson.workspaces?.catalog || {};
|
|
@@ -485,7 +483,7 @@ async function migrateFromCatalog(rootPath, removeCatalog = false, dryRun = fals
|
|
|
485
483
|
}
|
|
486
484
|
return results;
|
|
487
485
|
}
|
|
488
|
-
function displayMigrationResults(results) {
|
|
486
|
+
export function displayMigrationResults(results) {
|
|
489
487
|
if (results.length === 0) {
|
|
490
488
|
relinka("log", "No changes were made");
|
|
491
489
|
return;
|
|
@@ -517,89 +515,3 @@ ${action.replace(/-/g, " ")} (${actionResults.length}):`);
|
|
|
517
515
|
relinka("success", `Migration completed: ${results.length} changes made`);
|
|
518
516
|
relinka("log", "Run your package manager install command to apply the changes");
|
|
519
517
|
}
|
|
520
|
-
export default defineCommand({
|
|
521
|
-
meta: {
|
|
522
|
-
name: "migrate",
|
|
523
|
-
description: "Migrate dependencies between workspace packages and workspaces.catalog"
|
|
524
|
-
},
|
|
525
|
-
args: defineArgs({
|
|
526
|
-
"to-catalog": {
|
|
527
|
-
type: "boolean",
|
|
528
|
-
description: "Migrate workspace dependencies to workspaces.catalog and replace with catalog references"
|
|
529
|
-
},
|
|
530
|
-
"from-catalog": {
|
|
531
|
-
type: "boolean",
|
|
532
|
-
description: "Restore catalog references to actual versions from workspaces.catalog"
|
|
533
|
-
},
|
|
534
|
-
"remove-catalog": {
|
|
535
|
-
type: "boolean",
|
|
536
|
-
description: "Remove workspaces.catalog from root package.json after restoring (only with --from-catalog)"
|
|
537
|
-
},
|
|
538
|
-
"dry-run": {
|
|
539
|
-
type: "boolean",
|
|
540
|
-
description: "Preview changes without making modifications"
|
|
541
|
-
},
|
|
542
|
-
interactive: {
|
|
543
|
-
type: "boolean",
|
|
544
|
-
description: "Interactively select dependencies to migrate"
|
|
545
|
-
}
|
|
546
|
-
}),
|
|
547
|
-
async run({ args }) {
|
|
548
|
-
try {
|
|
549
|
-
if (!args["to-catalog"] && !args["from-catalog"]) {
|
|
550
|
-
relinka("error", "Must specify either --to-catalog or --from-catalog");
|
|
551
|
-
return process.exit(1);
|
|
552
|
-
}
|
|
553
|
-
if (args["to-catalog"] && args["from-catalog"]) {
|
|
554
|
-
relinka("error", "Cannot specify both --to-catalog and --from-catalog");
|
|
555
|
-
return process.exit(1);
|
|
556
|
-
}
|
|
557
|
-
if (args["remove-catalog"] && !args["from-catalog"]) {
|
|
558
|
-
relinka("error", "--remove-catalog can only be used with --from-catalog");
|
|
559
|
-
return process.exit(1);
|
|
560
|
-
}
|
|
561
|
-
const cwd = process.cwd();
|
|
562
|
-
const packageJsonPath = path.resolve(cwd, "package.json");
|
|
563
|
-
if (!await fs.pathExists(packageJsonPath)) {
|
|
564
|
-
relinka("error", "No package.json found in current directory");
|
|
565
|
-
return process.exit(1);
|
|
566
|
-
}
|
|
567
|
-
if (!await isMonorepo(cwd)) {
|
|
568
|
-
relinka("error", "This command requires a monorepo with workspace configuration");
|
|
569
|
-
return process.exit(1);
|
|
570
|
-
}
|
|
571
|
-
const packageManager = await detectPackageManager(cwd);
|
|
572
|
-
if (!packageManager) {
|
|
573
|
-
relinka("warn", "Could not detect package manager");
|
|
574
|
-
} else if (!isCatalogSupported(packageManager)) {
|
|
575
|
-
relinka(
|
|
576
|
-
"warn",
|
|
577
|
-
`Catalogs may not be fully supported by ${packageManager.name}. Only Bun has full catalog support.`
|
|
578
|
-
);
|
|
579
|
-
}
|
|
580
|
-
let results = [];
|
|
581
|
-
if (args["to-catalog"]) {
|
|
582
|
-
relinka("log", "Migrating workspace dependencies to catalog...");
|
|
583
|
-
results = await migrateToCatalog(cwd, !!args["dry-run"], !!args.interactive);
|
|
584
|
-
} else if (args["from-catalog"]) {
|
|
585
|
-
relinka("log", "Restoring dependencies from catalog...");
|
|
586
|
-
results = await migrateFromCatalog(
|
|
587
|
-
cwd,
|
|
588
|
-
!!args["remove-catalog"],
|
|
589
|
-
!!args["dry-run"],
|
|
590
|
-
!!args.interactive
|
|
591
|
-
);
|
|
592
|
-
}
|
|
593
|
-
displayMigrationResults(results);
|
|
594
|
-
if (args["dry-run"]) {
|
|
595
|
-
relinka("info", "This was a dry run - no actual changes were made");
|
|
596
|
-
}
|
|
597
|
-
} catch (error) {
|
|
598
|
-
relinka(
|
|
599
|
-
"error",
|
|
600
|
-
`Migration failed: ${error instanceof Error ? error.message : String(error)}`
|
|
601
|
-
);
|
|
602
|
-
process.exit(1);
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
});
|
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export declare const DatabaseSchema: z.ZodEnum<{
|
|
3
3
|
none: "none";
|
|
4
|
-
sqlite: "sqlite";
|
|
5
4
|
postgres: "postgres";
|
|
5
|
+
sqlite: "sqlite";
|
|
6
6
|
mysql: "mysql";
|
|
7
7
|
mongodb: "mongodb";
|
|
8
8
|
}>;
|
|
9
9
|
export type Database = z.infer<typeof DatabaseSchema>;
|
|
10
10
|
export declare const ORMSchema: z.ZodEnum<{
|
|
11
11
|
none: "none";
|
|
12
|
-
drizzle: "drizzle";
|
|
13
|
-
mongoose: "mongoose";
|
|
14
12
|
prisma: "prisma";
|
|
13
|
+
mongoose: "mongoose";
|
|
14
|
+
drizzle: "drizzle";
|
|
15
15
|
}>;
|
|
16
16
|
export type ORM = z.infer<typeof ORMSchema>;
|
|
17
17
|
export declare const BackendSchema: z.ZodEnum<{
|
|
18
18
|
none: "none";
|
|
19
19
|
hono: "hono";
|
|
20
|
+
next: "next";
|
|
20
21
|
express: "express";
|
|
21
22
|
fastify: "fastify";
|
|
22
|
-
next: "next";
|
|
23
23
|
elysia: "elysia";
|
|
24
24
|
convex: "convex";
|
|
25
25
|
}>;
|
|
26
26
|
export type Backend = z.infer<typeof BackendSchema>;
|
|
27
27
|
export declare const RuntimeSchema: z.ZodEnum<{
|
|
28
|
-
bun: "bun";
|
|
29
28
|
none: "none";
|
|
30
29
|
node: "node";
|
|
30
|
+
bun: "bun";
|
|
31
31
|
workers: "workers";
|
|
32
32
|
}>;
|
|
33
33
|
export type Runtime = z.infer<typeof RuntimeSchema>;
|
|
@@ -47,10 +47,10 @@ export type Frontend = z.infer<typeof FrontendSchema>;
|
|
|
47
47
|
export declare const AddonsSchema: z.ZodEnum<{
|
|
48
48
|
biome: "biome";
|
|
49
49
|
none: "none";
|
|
50
|
-
tauri: "tauri";
|
|
51
50
|
turborepo: "turborepo";
|
|
52
|
-
|
|
51
|
+
tauri: "tauri";
|
|
53
52
|
starlight: "starlight";
|
|
53
|
+
pwa: "pwa";
|
|
54
54
|
husky: "husky";
|
|
55
55
|
}>;
|
|
56
56
|
export type Addons = z.infer<typeof AddonsSchema>;
|
|
@@ -61,16 +61,16 @@ export declare const ExamplesSchema: z.ZodEnum<{
|
|
|
61
61
|
}>;
|
|
62
62
|
export type Examples = z.infer<typeof ExamplesSchema>;
|
|
63
63
|
export declare const PackageManagerSchema: z.ZodEnum<{
|
|
64
|
-
bun: "bun";
|
|
65
64
|
npm: "npm";
|
|
65
|
+
bun: "bun";
|
|
66
66
|
pnpm: "pnpm";
|
|
67
67
|
}>;
|
|
68
68
|
export type PackageManager = z.infer<typeof PackageManagerSchema>;
|
|
69
69
|
export declare const DatabaseSetupSchema: z.ZodEnum<{
|
|
70
70
|
none: "none";
|
|
71
71
|
neon: "neon";
|
|
72
|
-
supabase: "supabase";
|
|
73
72
|
turso: "turso";
|
|
73
|
+
supabase: "supabase";
|
|
74
74
|
"prisma-postgres": "prisma-postgres";
|
|
75
75
|
"mongodb-atlas": "mongodb-atlas";
|
|
76
76
|
}>;
|
package/bin/app/update/cmd.d.ts
CHANGED
|
@@ -89,5 +89,15 @@ declare const _default: import("@reliverse/rempts").Command<{
|
|
|
89
89
|
description: string;
|
|
90
90
|
default: true;
|
|
91
91
|
};
|
|
92
|
+
"upgrade-tools": {
|
|
93
|
+
type: "boolean";
|
|
94
|
+
description: string;
|
|
95
|
+
alias: string;
|
|
96
|
+
};
|
|
97
|
+
"upgrade-interactive": {
|
|
98
|
+
type: "boolean";
|
|
99
|
+
description: string;
|
|
100
|
+
default: true;
|
|
101
|
+
};
|
|
92
102
|
}>;
|
|
93
103
|
export default _default;
|