@reliverse/dler 1.7.151 → 1.7.153
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/impl/auth/impl/init.d.ts +1 -1
- package/bin/impl/build/impl.d.ts +7 -1
- package/bin/impl/build/impl.js +161 -1
- package/bin/impl/config/constants.d.ts +1 -1
- package/bin/impl/config/constants.js +1 -1
- package/bin/impl/providers/better-t-stack/types.d.ts +2 -2
- package/bin/impl/pub/impl.d.ts +6 -1
- package/bin/impl/pub/impl.js +176 -2
- package/bin/impl/schema/mod.d.ts +140 -0
- package/bin/impl/schema/mod.js +22 -0
- package/bin/impl/update/impl.d.ts +3 -5
- package/bin/impl/update/impl.js +44 -64
- package/bin/impl/utils/workspace-prompt.d.ts +9 -0
- package/bin/impl/utils/workspace-prompt.js +46 -0
- package/bin/impl/utils/workspace-utils.d.ts +28 -0
- package/bin/impl/utils/workspace-utils.js +127 -0
- package/bin/mod.d.ts +3 -10
- package/bin/mod.js +11 -25
- package/package.json +2 -1
- package/bin/impl/migrate/codemods/anything-bun.d.ts +0 -5
- package/bin/impl/migrate/codemods/anything-bun.js +0 -577
- package/bin/impl/migrate/codemods/commander-rempts.d.ts +0 -4
- package/bin/impl/migrate/codemods/commander-rempts.js +0 -250
- package/bin/impl/migrate/codemods/console-relinka.d.ts +0 -3
- package/bin/impl/migrate/codemods/console-relinka.js +0 -142
- package/bin/impl/migrate/codemods/fs-relifso.d.ts +0 -8
- package/bin/impl/migrate/codemods/fs-relifso.js +0 -156
- package/bin/impl/migrate/codemods/monorepo-catalog.d.ts +0 -96
- package/bin/impl/migrate/codemods/monorepo-catalog.js +0 -517
- package/bin/impl/migrate/codemods/nodenext-bundler.d.ts +0 -10
- package/bin/impl/migrate/codemods/nodenext-bundler.js +0 -222
- package/bin/impl/migrate/codemods/path-pathkit.d.ts +0 -8
- package/bin/impl/migrate/codemods/path-pathkit.js +0 -143
- package/bin/impl/migrate/codemods/readdir-glob.d.ts +0 -8
- package/bin/impl/migrate/codemods/readdir-glob.js +0 -133
|
@@ -11,13 +11,11 @@ interface UpdateArgs {
|
|
|
11
11
|
ignoreFields?: string[];
|
|
12
12
|
}
|
|
13
13
|
export declare function validatePackageJson(): Promise<string>;
|
|
14
|
-
export declare function prepareAllUpdateCandidates(
|
|
15
|
-
candidates: string[];
|
|
16
|
-
allDepsMap: Record<string, any>;
|
|
14
|
+
export declare function prepareAllUpdateCandidates(): Promise<{
|
|
17
15
|
packageJsonFiles: string[];
|
|
18
16
|
fileDepsMap: Map<string, Record<string, any>>;
|
|
19
17
|
}>;
|
|
20
|
-
export declare function
|
|
21
|
-
export declare function
|
|
18
|
+
export declare function checkPackageUpdatesForFile(fileDepsMap: Record<string, any>, args: UpdateArgs): Promise<UpdateResult[]>;
|
|
19
|
+
export declare function updatePackageJsonFileDirectly(packageJsonPath: string, fileDepsMap: Record<string, any>, updatesToApply: UpdateResult[], savePrefix: string, fieldsToIgnore?: string[]): Promise<number>;
|
|
22
20
|
export declare function handleInstallation(): Promise<void>;
|
|
23
21
|
export {};
|
package/bin/impl/update/impl.js
CHANGED
|
@@ -5,12 +5,11 @@ import pMap from "p-map";
|
|
|
5
5
|
import { glob } from "tinyglobby";
|
|
6
6
|
import { detectPackageManager } from "../utils/pm/pm-detect.js";
|
|
7
7
|
import {
|
|
8
|
+
applyVersionUpdate,
|
|
8
9
|
checkPackageUpdate,
|
|
9
10
|
collectTargetDependencies,
|
|
10
|
-
isNonSemverSpecifier,
|
|
11
11
|
prepareDependenciesForUpdate,
|
|
12
|
-
runInstallCommand
|
|
13
|
-
updatePackageJsonFile
|
|
12
|
+
runInstallCommand
|
|
14
13
|
} from "./utils.js";
|
|
15
14
|
export async function validatePackageJson() {
|
|
16
15
|
const packageJsonPath = path.resolve(process.cwd(), "package.json");
|
|
@@ -20,7 +19,7 @@ export async function validatePackageJson() {
|
|
|
20
19
|
}
|
|
21
20
|
return packageJsonPath;
|
|
22
21
|
}
|
|
23
|
-
export async function prepareAllUpdateCandidates(
|
|
22
|
+
export async function prepareAllUpdateCandidates() {
|
|
24
23
|
const packageJsonFiles = await glob("**/package.json", {
|
|
25
24
|
cwd: process.cwd(),
|
|
26
25
|
absolute: true,
|
|
@@ -39,31 +38,15 @@ export async function prepareAllUpdateCandidates(args) {
|
|
|
39
38
|
});
|
|
40
39
|
if (packageJsonFiles.length === 0) {
|
|
41
40
|
relinka("warn", "No package.json files found");
|
|
42
|
-
return {
|
|
41
|
+
return { packageJsonFiles: [], fileDepsMap: /* @__PURE__ */ new Map() };
|
|
43
42
|
}
|
|
44
43
|
relinka("verbose", `Found ${packageJsonFiles.length} package.json files`);
|
|
45
|
-
const allDepsMap = {};
|
|
46
|
-
const allCandidates = /* @__PURE__ */ new Set();
|
|
47
44
|
const fileDepsMap = /* @__PURE__ */ new Map();
|
|
48
45
|
for (const packageJsonPath of packageJsonFiles) {
|
|
49
46
|
try {
|
|
50
47
|
const packageJson = JSON.parse(await fs.readFile(packageJsonPath, "utf8"));
|
|
51
48
|
const { map } = collectTargetDependencies(packageJson);
|
|
52
|
-
const candidates2 = prepareDependenciesForUpdate(map, args);
|
|
53
49
|
fileDepsMap.set(packageJsonPath, map);
|
|
54
|
-
for (const [dep, info] of Object.entries(map)) {
|
|
55
|
-
if (!allDepsMap[dep]) {
|
|
56
|
-
allDepsMap[dep] = { ...info, locations: new Set(info.locations) };
|
|
57
|
-
} else {
|
|
58
|
-
for (const location of info.locations) {
|
|
59
|
-
allDepsMap[dep].locations.add(location);
|
|
60
|
-
}
|
|
61
|
-
allDepsMap[dep].versionSpec = info.versionSpec;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
for (const candidate of candidates2) {
|
|
65
|
-
allCandidates.add(candidate);
|
|
66
|
-
}
|
|
67
50
|
} catch (error) {
|
|
68
51
|
relinka(
|
|
69
52
|
"warn",
|
|
@@ -71,25 +54,24 @@ export async function prepareAllUpdateCandidates(args) {
|
|
|
71
54
|
);
|
|
72
55
|
}
|
|
73
56
|
}
|
|
74
|
-
const candidates = Array.from(allCandidates);
|
|
75
|
-
if (candidates.length === 0) {
|
|
76
|
-
relinka("warn", "No dependencies to update");
|
|
77
|
-
return { candidates: [], allDepsMap: {}, packageJsonFiles, fileDepsMap };
|
|
78
|
-
}
|
|
79
57
|
relinka("verbose", `Processing ${packageJsonFiles.length} package.json files`);
|
|
80
|
-
return {
|
|
58
|
+
return { packageJsonFiles, fileDepsMap };
|
|
81
59
|
}
|
|
82
|
-
export async function
|
|
60
|
+
export async function checkPackageUpdatesForFile(fileDepsMap, args) {
|
|
83
61
|
const options = {
|
|
84
62
|
allowMajor: !!args.allowMajor,
|
|
85
63
|
savePrefix: "^",
|
|
86
64
|
// Use default prefix
|
|
87
65
|
concurrency: args.concurrency || 5
|
|
88
66
|
};
|
|
67
|
+
const candidates = prepareDependenciesForUpdate(fileDepsMap, args);
|
|
68
|
+
if (candidates.length === 0) {
|
|
69
|
+
return [];
|
|
70
|
+
}
|
|
89
71
|
return await pMap(
|
|
90
72
|
candidates,
|
|
91
73
|
async (dep) => {
|
|
92
|
-
const depInfo =
|
|
74
|
+
const depInfo = fileDepsMap[dep];
|
|
93
75
|
if (!depInfo?.versionSpec) {
|
|
94
76
|
return {
|
|
95
77
|
package: dep,
|
|
@@ -106,45 +88,43 @@ export async function checkPackageUpdates(candidates, allDepsMap, args) {
|
|
|
106
88
|
{ concurrency: args.concurrency || 5 }
|
|
107
89
|
);
|
|
108
90
|
}
|
|
109
|
-
export async function
|
|
110
|
-
if (
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
const
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
savePrefix,
|
|
132
|
-
fieldsToIgnore
|
|
133
|
-
);
|
|
134
|
-
totalUpdated += updated;
|
|
135
|
-
if (updated > 0) {
|
|
136
|
-
const relativePath = path.relative(process.cwd(), packageJsonPath);
|
|
137
|
-
relinka("verbose", `Updated ${updated} dependencies in ${relativePath}`);
|
|
91
|
+
export async function updatePackageJsonFileDirectly(packageJsonPath, fileDepsMap, updatesToApply, savePrefix, fieldsToIgnore = []) {
|
|
92
|
+
if (updatesToApply.length === 0) return 0;
|
|
93
|
+
try {
|
|
94
|
+
const packageJson = JSON.parse(await fs.readFile(packageJsonPath, "utf8"));
|
|
95
|
+
const updatedPackageJson = { ...packageJson };
|
|
96
|
+
for (const update of updatesToApply) {
|
|
97
|
+
const depInfo = fileDepsMap[update.package];
|
|
98
|
+
if (!depInfo) continue;
|
|
99
|
+
const locations = depInfo.locations || /* @__PURE__ */ new Set();
|
|
100
|
+
const shouldIgnore = Array.from(locations).some(
|
|
101
|
+
(location) => fieldsToIgnore.includes(String(location))
|
|
102
|
+
);
|
|
103
|
+
if (shouldIgnore) {
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
let newVersion;
|
|
107
|
+
if (locations.has("peerDependencies")) {
|
|
108
|
+
const currentVersion = String(fileDepsMap[update.package]?.versionSpec || "");
|
|
109
|
+
if (currentVersion.startsWith(">=")) {
|
|
110
|
+
newVersion = `>=${update.latestVersion}`;
|
|
111
|
+
} else {
|
|
112
|
+
newVersion = savePrefix === "none" ? update.latestVersion : `${savePrefix}${update.latestVersion}`;
|
|
138
113
|
}
|
|
114
|
+
} else {
|
|
115
|
+
newVersion = savePrefix === "none" ? update.latestVersion : `${savePrefix}${update.latestVersion}`;
|
|
139
116
|
}
|
|
140
|
-
|
|
141
|
-
relinka(
|
|
142
|
-
"warn",
|
|
143
|
-
`Failed to process ${packageJsonPath}: ${error instanceof Error ? error.message : String(error)}`
|
|
144
|
-
);
|
|
117
|
+
applyVersionUpdate(updatedPackageJson, update.package, newVersion, locations);
|
|
145
118
|
}
|
|
119
|
+
await fs.writeFile(packageJsonPath, JSON.stringify(updatedPackageJson, null, 2) + "\n", "utf8");
|
|
120
|
+
return updatesToApply.length;
|
|
121
|
+
} catch (error) {
|
|
122
|
+
relinka(
|
|
123
|
+
"warn",
|
|
124
|
+
`Failed to update ${packageJsonPath}: ${error instanceof Error ? error.message : String(error)}`
|
|
125
|
+
);
|
|
126
|
+
return 0;
|
|
146
127
|
}
|
|
147
|
-
return totalUpdated;
|
|
148
128
|
}
|
|
149
129
|
export async function handleInstallation() {
|
|
150
130
|
const packageManager = await detectPackageManager(process.cwd());
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { WorkspacePackage } from "./workspace-utils";
|
|
2
|
+
/**
|
|
3
|
+
* Prompts user to select workspace packages for build or publish operations
|
|
4
|
+
*/
|
|
5
|
+
export declare function promptWorkspacePackages(packages: WorkspacePackage[], command: "build" | "publish", skipPrompt?: boolean): Promise<WorkspacePackage[]>;
|
|
6
|
+
/**
|
|
7
|
+
* Shows a summary of selected packages and their dependency order
|
|
8
|
+
*/
|
|
9
|
+
export declare function showPackageSummary(packages: WorkspacePackage[], command: "build" | "publish"): void;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { re } from "@reliverse/relico";
|
|
2
|
+
import { cancel, isCancel, multiselectPrompt } from "@reliverse/rempts";
|
|
3
|
+
export async function promptWorkspacePackages(packages, command, skipPrompt = false) {
|
|
4
|
+
if (packages.length === 0) {
|
|
5
|
+
return [];
|
|
6
|
+
}
|
|
7
|
+
const sortedPackages = packages.sort((a, b) => {
|
|
8
|
+
if (a.workspaceDependencies.includes(b.name)) return 1;
|
|
9
|
+
if (b.workspaceDependencies.includes(a.name)) return -1;
|
|
10
|
+
return a.name.localeCompare(b.name);
|
|
11
|
+
});
|
|
12
|
+
if (skipPrompt) {
|
|
13
|
+
return sortedPackages;
|
|
14
|
+
}
|
|
15
|
+
const options = sortedPackages.map((pkg) => ({
|
|
16
|
+
label: `${pkg.name} ${re.dim(`(${pkg.version})`)}`,
|
|
17
|
+
value: pkg.name,
|
|
18
|
+
hint: pkg.workspaceDependencies.length > 0 ? `Depends on: ${pkg.workspaceDependencies.join(", ")}` : "No workspace dependencies"
|
|
19
|
+
}));
|
|
20
|
+
const title = command === "build" ? "Select packages to build" : "Select packages to publish";
|
|
21
|
+
const content = command === "build" ? "Choose which workspace packages to build. Packages will be built in dependency order." : "Choose which workspace packages to publish. Packages will be built and published in dependency order.";
|
|
22
|
+
const selectedPackageNames = await multiselectPrompt({
|
|
23
|
+
title,
|
|
24
|
+
content,
|
|
25
|
+
options,
|
|
26
|
+
defaultValue: packages.map((pkg) => pkg.name),
|
|
27
|
+
// Select all by default
|
|
28
|
+
displayInstructions: true
|
|
29
|
+
});
|
|
30
|
+
if (isCancel(selectedPackageNames)) {
|
|
31
|
+
cancel(re.red("Operation cancelled"));
|
|
32
|
+
process.exit(0);
|
|
33
|
+
}
|
|
34
|
+
const selectedPackages = selectedPackageNames.map((name) => packages.find((pkg) => pkg.name === name)).filter((pkg) => pkg !== void 0);
|
|
35
|
+
return selectedPackages;
|
|
36
|
+
}
|
|
37
|
+
export function showPackageSummary(packages, command) {
|
|
38
|
+
const action = command === "build" ? "Building" : "Publishing";
|
|
39
|
+
console.log(`
|
|
40
|
+
${re.cyan(`${action} ${packages.length} package(s) in dependency order:`)}`);
|
|
41
|
+
packages.forEach((pkg, index) => {
|
|
42
|
+
const deps = pkg.workspaceDependencies.length > 0 ? ` ${re.dim(`(depends on: ${pkg.workspaceDependencies.join(", ")})`)}` : "";
|
|
43
|
+
console.log(` ${index + 1}. ${re.green(pkg.name)} ${re.dim(`v${pkg.version}`)}${deps}`);
|
|
44
|
+
});
|
|
45
|
+
console.log();
|
|
46
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface WorkspacePackage {
|
|
2
|
+
name: string;
|
|
3
|
+
path: string;
|
|
4
|
+
packageJsonPath: string;
|
|
5
|
+
version: string;
|
|
6
|
+
private: boolean;
|
|
7
|
+
dependencies: string[];
|
|
8
|
+
workspaceDependencies: string[];
|
|
9
|
+
}
|
|
10
|
+
export interface WorkspaceConfig {
|
|
11
|
+
enabled: boolean;
|
|
12
|
+
autoDiscoverPackages: boolean;
|
|
13
|
+
buildOrder: "dependency" | "parallel";
|
|
14
|
+
includePatterns: string[];
|
|
15
|
+
excludePatterns: string[];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Detects if the current directory has workspace configuration and returns publishable packages
|
|
19
|
+
*/
|
|
20
|
+
export declare function detectWorkspaces(cwd: string): Promise<WorkspacePackage[] | null>;
|
|
21
|
+
/**
|
|
22
|
+
* Sorts packages by their dependencies to ensure correct build/publish order
|
|
23
|
+
*/
|
|
24
|
+
export declare function sortPackagesByDependencies(packages: WorkspacePackage[]): WorkspacePackage[];
|
|
25
|
+
/**
|
|
26
|
+
* Filters packages based on include/exclude patterns
|
|
27
|
+
*/
|
|
28
|
+
export declare function filterPackagesByPatterns(packages: WorkspacePackage[], includePatterns: string[], excludePatterns: string[]): WorkspacePackage[];
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import path from "@reliverse/pathkit";
|
|
2
|
+
import fs from "@reliverse/relifso";
|
|
3
|
+
import { relinka } from "@reliverse/relinka";
|
|
4
|
+
import { glob } from "glob";
|
|
5
|
+
import { readPackageJson } from "../monorepo/monorepo-mod.js";
|
|
6
|
+
export async function detectWorkspaces(cwd) {
|
|
7
|
+
const packageJsonPath = path.join(cwd, "package.json");
|
|
8
|
+
if (!await fs.pathExists(packageJsonPath)) {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
try {
|
|
12
|
+
const packageJsonContent = await fs.readFile(packageJsonPath, "utf-8");
|
|
13
|
+
const packageJson = JSON.parse(packageJsonContent);
|
|
14
|
+
let workspaceGlobs = [];
|
|
15
|
+
if (packageJson.workspaces) {
|
|
16
|
+
if (Array.isArray(packageJson.workspaces)) {
|
|
17
|
+
workspaceGlobs = packageJson.workspaces;
|
|
18
|
+
} else if (typeof packageJson.workspaces === "object" && packageJson.workspaces.packages) {
|
|
19
|
+
workspaceGlobs = Array.isArray(packageJson.workspaces.packages) ? packageJson.workspaces.packages : [];
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
if (workspaceGlobs.length === 0) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
relinka("verbose", `Found workspace configuration with patterns: ${workspaceGlobs.join(", ")}`);
|
|
26
|
+
const packageJsonPaths = [];
|
|
27
|
+
for (const pattern of workspaceGlobs) {
|
|
28
|
+
const searchPattern = path.join(cwd, pattern, "package.json");
|
|
29
|
+
const matches = await glob(searchPattern, { cwd });
|
|
30
|
+
packageJsonPaths.push(...matches.map((match) => path.resolve(cwd, match)));
|
|
31
|
+
}
|
|
32
|
+
const uniquePackageJsonPaths = [...new Set(packageJsonPaths)];
|
|
33
|
+
relinka("verbose", `Found ${uniquePackageJsonPaths.length} package.json files in workspace`);
|
|
34
|
+
const packages = [];
|
|
35
|
+
for (const packageJsonPath2 of uniquePackageJsonPaths) {
|
|
36
|
+
const pkg = await readPackageJson(packageJsonPath2);
|
|
37
|
+
if (!pkg) {
|
|
38
|
+
relinka("verbose", `Skipping invalid package.json at ${packageJsonPath2}`);
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
try {
|
|
42
|
+
const rawContent = await fs.readFile(packageJsonPath2, "utf-8");
|
|
43
|
+
const rawPkg = JSON.parse(rawContent);
|
|
44
|
+
if (!rawPkg.name || rawPkg.private === true) {
|
|
45
|
+
relinka(
|
|
46
|
+
"verbose",
|
|
47
|
+
`Skipping package ${rawPkg.name || "unnamed"} (${rawPkg.private ? "private" : "no name"})`
|
|
48
|
+
);
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
const workspaceDependencies = [];
|
|
52
|
+
const allDeps = { ...rawPkg.dependencies, ...rawPkg.devDependencies };
|
|
53
|
+
for (const [depName, version] of Object.entries(allDeps)) {
|
|
54
|
+
if (typeof version === "string" && version.startsWith("workspace:")) {
|
|
55
|
+
workspaceDependencies.push(depName);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
packages.push({
|
|
59
|
+
name: rawPkg.name,
|
|
60
|
+
path: path.dirname(packageJsonPath2),
|
|
61
|
+
packageJsonPath: packageJsonPath2,
|
|
62
|
+
version: rawPkg.version || "0.0.0",
|
|
63
|
+
private: rawPkg.private === true,
|
|
64
|
+
dependencies: Object.keys(allDeps),
|
|
65
|
+
workspaceDependencies
|
|
66
|
+
});
|
|
67
|
+
relinka("verbose", `Added package: ${rawPkg.name} (${rawPkg.version})`);
|
|
68
|
+
} catch (error) {
|
|
69
|
+
relinka("warn", `Failed to read package.json at ${packageJsonPath2}: ${error}`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
relinka("verbose", `Found ${packages.length} publishable packages in workspace`);
|
|
73
|
+
return packages.length > 0 ? packages : null;
|
|
74
|
+
} catch (error) {
|
|
75
|
+
relinka("warn", `Failed to detect workspaces: ${error}`);
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
export function sortPackagesByDependencies(packages) {
|
|
80
|
+
const sorted = [];
|
|
81
|
+
const visited = /* @__PURE__ */ new Set();
|
|
82
|
+
const visiting = /* @__PURE__ */ new Set();
|
|
83
|
+
function visit(pkg) {
|
|
84
|
+
if (visiting.has(pkg.name)) {
|
|
85
|
+
relinka("warn", `Circular dependency detected involving package: ${pkg.name}`);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (visited.has(pkg.name)) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
visiting.add(pkg.name);
|
|
92
|
+
for (const depName of pkg.workspaceDependencies) {
|
|
93
|
+
const depPkg = packages.find((p) => p.name === depName);
|
|
94
|
+
if (depPkg) {
|
|
95
|
+
visit(depPkg);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
visiting.delete(pkg.name);
|
|
99
|
+
visited.add(pkg.name);
|
|
100
|
+
sorted.push(pkg);
|
|
101
|
+
}
|
|
102
|
+
for (const pkg of packages) {
|
|
103
|
+
visit(pkg);
|
|
104
|
+
}
|
|
105
|
+
relinka("verbose", `Sorted packages by dependencies: ${sorted.map((p) => p.name).join(" -> ")}`);
|
|
106
|
+
return sorted;
|
|
107
|
+
}
|
|
108
|
+
export function filterPackagesByPatterns(packages, includePatterns, excludePatterns) {
|
|
109
|
+
let filtered = packages;
|
|
110
|
+
if (includePatterns.length > 0) {
|
|
111
|
+
filtered = filtered.filter(
|
|
112
|
+
(pkg) => includePatterns.some((pattern) => {
|
|
113
|
+
const regex = new RegExp(pattern.replace(/\*/g, ".*"));
|
|
114
|
+
return regex.test(pkg.name) || regex.test(pkg.path);
|
|
115
|
+
})
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
if (excludePatterns.length > 0) {
|
|
119
|
+
filtered = filtered.filter(
|
|
120
|
+
(pkg) => !excludePatterns.some((pattern) => {
|
|
121
|
+
const regex = new RegExp(pattern.replace(/\*/g, ".*"));
|
|
122
|
+
return regex.test(pkg.name) || regex.test(pkg.path);
|
|
123
|
+
})
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
return filtered;
|
|
127
|
+
}
|
package/bin/mod.d.ts
CHANGED
|
@@ -191,15 +191,6 @@ export { applyMagicSpells, getAllAvailableRegistries, getFilesWithMagicSpells, p
|
|
|
191
191
|
export type { SpellDirective, SpellEvaluationContext, SpellInfo, SpellOutcome, } from "./impl/magic/magic-spells";
|
|
192
192
|
export { evaluateMagicDirective, getAvailableSpells } from "./impl/magic/magic-spells";
|
|
193
193
|
export { DEFAULT_IGNORES, DEFAULT_SEPARATOR_RAW, normalizeGlobPattern, parseCSV, processSection, unescape, writeFilesPreserveStructure, writeResult, } from "./impl/merge/mod";
|
|
194
|
-
export { migrateAnythingToBun } from "./impl/migrate/codemods/anything-bun";
|
|
195
|
-
export { commanderToRempts } from "./impl/migrate/codemods/commander-rempts";
|
|
196
|
-
export { consoleToRelinka } from "./impl/migrate/codemods/console-relinka";
|
|
197
|
-
export { migrateFsToRelifso } from "./impl/migrate/codemods/fs-relifso";
|
|
198
|
-
export type { CatalogMergeResult, DependencyEntry, MigrationResult, } from "./impl/migrate/codemods/monorepo-catalog";
|
|
199
|
-
export { displayMigrationResults, extractDependencies, mergeToCatalog, migrateFromCatalog, migrateToCatalog, removeCatalogFromRoot, replaceDependenciesWithCatalogRefs, restoreCatalogReferences, shouldSkipDependency, updateRootWithCatalog, } from "./impl/migrate/codemods/monorepo-catalog";
|
|
200
|
-
export { migrateModuleResolution, migrateToBundler, migrateToNodeNext, } from "./impl/migrate/codemods/nodenext-bundler";
|
|
201
|
-
export { migratePathToPathkit } from "./impl/migrate/codemods/path-pathkit";
|
|
202
|
-
export { migrateReaddirToGlob } from "./impl/migrate/codemods/readdir-glob";
|
|
203
194
|
export { type CacheResult, cachePackageOutput, cleanCache, hashPackage, isPackageCached, restorePackageCache, } from "./impl/monorepo/cache-mod";
|
|
204
195
|
export { allCommand, buildCommand, cleanCommand, depsCommand, graphCommand, type MonorepoContext, } from "./impl/monorepo/commands-mod";
|
|
205
196
|
export { DependencyGraph } from "./impl/monorepo/graph-mod";
|
|
@@ -312,7 +303,7 @@ export { openVercelTools } from "./impl/toolbox/toolbox-vercel";
|
|
|
312
303
|
export type { BundleSource, IndentOptions, MagicStringOptions, OverwriteOptions, StringTransformer, TransformResult, UpdateOptions, } from "./impl/transform/transform-impl-mod";
|
|
313
304
|
export { append, compose, createBundle, createTransformer, createTransformerFromMagicString, indent, insertAt, overwrite, pipe, prepend, readAndTransform, remove, replace, replaceAll, slice, template, transformAndWrite, transformMultiple, trim, update, wrapWith, } from "./impl/transform/transform-impl-mod";
|
|
314
305
|
export type { AppParams, ArgTypeShared, BaseBuildEntry, BaseConfig, Behavior, BiomeConfig, BiomeConfigResult, BuildContext, BuildEntry, BuildHooks, BuildOptions, BuildPreset, CamelCase, CheckIssue, CheckResult, ColumnType, CommonCliArgs, CopyBuildEntry, CopyHooks, CreateLoaderOptions, DatabasePostgresProvider, DatabaseProvider, DeploymentService, DetectedProject, DirectoryType, DistDirs, DistDirsAll, EsbuildOptions, GitModParams, HyphenatedStringToCamelCase, IconName, InputFile, IntegrationCategory, IntegrationConfig, IntegrationOption, IntegrationOptions, IterableError, Loader, LoaderContext, LoaderResult, LoadFile, MkdistBuildEntry, MkdistHooks, MkdistOptions, ModernReplacement, MonorepoType, NavItem, NavItemWithChildren, NavigationEntry, OutputFile, ParamsOmitReli, ParamsOmitSkipPN, PerfTimer, PrismaField, PrismaModel, ProjectConfigReturn, ProjectSelectionResult, RemovalConfig, RollupBuildEntry, RollupBuildOptions, RollupHooks, RollupOptions, RulesCheckOptions, ShadcnConfig, SubOption, TableSchema, Theme, UnifiedBuildConfig, UntypedBuildEntry, UntypedHooks, UntypedOutput, UntypedOutputs, VSCodeSettings, } from "./impl/types/mod";
|
|
315
|
-
export {
|
|
306
|
+
export { checkPackageUpdatesForFile, handleInstallation, prepareAllUpdateCandidates, updatePackageJsonFileDirectly, validatePackageJson, } from "./impl/update/impl";
|
|
316
307
|
export type { DependencyInfo, PackageCheckOptions, UpdateResult, } from "./impl/update/utils";
|
|
317
308
|
export { applyVersionUpdate, checkPackageUpdate, collectTargetDependencies, displayStructuredUpdateResults, fetchVersionFromRegistry, getLatestVersion, getPmOptions, isCatalogReference, isNonSemverSpecifier, isNpmAlias, isSemverCompatible, isWorkspaceDependency, prepareDependenciesForUpdate, runInstallCommand, updatePackageJsonFile, } from "./impl/update/utils";
|
|
318
309
|
export type { UploadFile, UploadResult } from "./impl/upload/providers/providers-mod";
|
|
@@ -435,3 +426,5 @@ export { regular_createPackageJSON } from "./impl/utils/utils-package-json-regul
|
|
|
435
426
|
export { createPerfTimer, getElapsedPerfTime, pausePerfTimer, resumePerfTimer, } from "./impl/utils/utils-perf";
|
|
436
427
|
export { ALLOWED_FILE_TYPES, checkFileSize, checkPermissions, handleCtxError, sanitizeInput, setFileSizeLimits, validateContent, validateFileExists, validateFileType, validateMergeOperation, validatePath, validateTemplate, } from "./impl/utils/utils-security";
|
|
437
428
|
export { createProjectTSConfig, createTSConfig } from "./impl/utils/utils-tsconfig";
|
|
429
|
+
export { promptWorkspacePackages, showPackageSummary, } from "./impl/utils/workspace-prompt";
|
|
430
|
+
export { detectWorkspaces, filterPackagesByPatterns, sortPackagesByDependencies, type WorkspaceConfig, type WorkspacePackage, } from "./impl/utils/workspace-utils";
|
package/bin/mod.js
CHANGED
|
@@ -476,29 +476,6 @@ export {
|
|
|
476
476
|
writeFilesPreserveStructure,
|
|
477
477
|
writeResult
|
|
478
478
|
} from "./impl/merge/mod.js";
|
|
479
|
-
export { migrateAnythingToBun } from "./impl/migrate/codemods/anything-bun.js";
|
|
480
|
-
export { commanderToRempts } from "./impl/migrate/codemods/commander-rempts.js";
|
|
481
|
-
export { consoleToRelinka } from "./impl/migrate/codemods/console-relinka.js";
|
|
482
|
-
export { migrateFsToRelifso } from "./impl/migrate/codemods/fs-relifso.js";
|
|
483
|
-
export {
|
|
484
|
-
displayMigrationResults,
|
|
485
|
-
extractDependencies,
|
|
486
|
-
mergeToCatalog,
|
|
487
|
-
migrateFromCatalog,
|
|
488
|
-
migrateToCatalog,
|
|
489
|
-
removeCatalogFromRoot,
|
|
490
|
-
replaceDependenciesWithCatalogRefs,
|
|
491
|
-
restoreCatalogReferences,
|
|
492
|
-
shouldSkipDependency,
|
|
493
|
-
updateRootWithCatalog
|
|
494
|
-
} from "./impl/migrate/codemods/monorepo-catalog.js";
|
|
495
|
-
export {
|
|
496
|
-
migrateModuleResolution,
|
|
497
|
-
migrateToBundler,
|
|
498
|
-
migrateToNodeNext
|
|
499
|
-
} from "./impl/migrate/codemods/nodenext-bundler.js";
|
|
500
|
-
export { migratePathToPathkit } from "./impl/migrate/codemods/path-pathkit.js";
|
|
501
|
-
export { migrateReaddirToGlob } from "./impl/migrate/codemods/readdir-glob.js";
|
|
502
479
|
export {
|
|
503
480
|
cachePackageOutput,
|
|
504
481
|
cleanCache,
|
|
@@ -767,10 +744,10 @@ export {
|
|
|
767
744
|
wrapWith
|
|
768
745
|
} from "./impl/transform/transform-impl-mod.js";
|
|
769
746
|
export {
|
|
770
|
-
|
|
747
|
+
checkPackageUpdatesForFile,
|
|
771
748
|
handleInstallation,
|
|
772
749
|
prepareAllUpdateCandidates,
|
|
773
|
-
|
|
750
|
+
updatePackageJsonFileDirectly,
|
|
774
751
|
validatePackageJson
|
|
775
752
|
} from "./impl/update/impl.js";
|
|
776
753
|
export {
|
|
@@ -1037,3 +1014,12 @@ export {
|
|
|
1037
1014
|
validateTemplate
|
|
1038
1015
|
} from "./impl/utils/utils-security.js";
|
|
1039
1016
|
export { createProjectTSConfig, createTSConfig } from "./impl/utils/utils-tsconfig.js";
|
|
1017
|
+
export {
|
|
1018
|
+
promptWorkspacePackages,
|
|
1019
|
+
showPackageSummary
|
|
1020
|
+
} from "./impl/utils/workspace-prompt.js";
|
|
1021
|
+
export {
|
|
1022
|
+
detectWorkspaces,
|
|
1023
|
+
filterPackagesByPatterns,
|
|
1024
|
+
sortPackagesByDependencies
|
|
1025
|
+
} from "./impl/utils/workspace-utils.js";
|
package/package.json
CHANGED
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
"execa": "^9.6.0",
|
|
56
56
|
"file-type": "^21.0.0",
|
|
57
57
|
"fix-dts-default-cjs-exports": "^1.0.1",
|
|
58
|
+
"glob": "^11.0.3",
|
|
58
59
|
"globby": "^15.0.0",
|
|
59
60
|
"gpt-tokenizer": "^3.2.0",
|
|
60
61
|
"gradient-string": "^3.0.0",
|
|
@@ -123,7 +124,7 @@
|
|
|
123
124
|
"license": "MIT",
|
|
124
125
|
"name": "@reliverse/dler",
|
|
125
126
|
"type": "module",
|
|
126
|
-
"version": "1.7.
|
|
127
|
+
"version": "1.7.153",
|
|
127
128
|
"author": "reliverse",
|
|
128
129
|
"bugs": {
|
|
129
130
|
"email": "blefnk@gmail.com",
|