@reliverse/dler 1.7.83 → 1.7.84
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/update/cmd.d.ts
CHANGED
package/bin/app/update/cmd.js
CHANGED
|
@@ -193,6 +193,21 @@ async function findWorkspacePackageJsons(cwd) {
|
|
|
193
193
|
}
|
|
194
194
|
return pkgJsonPaths;
|
|
195
195
|
}
|
|
196
|
+
async function isMonorepo(cwd) {
|
|
197
|
+
try {
|
|
198
|
+
const root = await readPackageJSON(cwd);
|
|
199
|
+
const ws = root.workspaces;
|
|
200
|
+
if (Array.isArray(ws) && ws.length > 0) {
|
|
201
|
+
return true;
|
|
202
|
+
}
|
|
203
|
+
if (ws && Array.isArray(ws.packages) && ws.packages.length > 0) {
|
|
204
|
+
return true;
|
|
205
|
+
}
|
|
206
|
+
return false;
|
|
207
|
+
} catch {
|
|
208
|
+
return false;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
196
211
|
async function fetchVersionFromRegistry(packageName) {
|
|
197
212
|
const response = await fetch(`https://registry.npmjs.org/${packageName}/latest`);
|
|
198
213
|
if (!response.ok) {
|
|
@@ -656,7 +671,7 @@ async function handleGlobalUpdates(args) {
|
|
|
656
671
|
export default defineCommand({
|
|
657
672
|
meta: {
|
|
658
673
|
name: "update",
|
|
659
|
-
description: "Update all dependencies and catalogs to their latest available versions"
|
|
674
|
+
description: "Update all dependencies and catalogs to their latest available versions (includes workspaces in monorepos)"
|
|
660
675
|
},
|
|
661
676
|
args: defineArgs({
|
|
662
677
|
name: {
|
|
@@ -726,7 +741,11 @@ export default defineCommand({
|
|
|
726
741
|
},
|
|
727
742
|
"all-workspaces": {
|
|
728
743
|
type: "boolean",
|
|
729
|
-
description: "Update dependencies across all workspace packages"
|
|
744
|
+
description: "Update dependencies across all workspace packages (automatic in monorepos)"
|
|
745
|
+
},
|
|
746
|
+
"root-only": {
|
|
747
|
+
type: "boolean",
|
|
748
|
+
description: "Update only the root package.json (skip workspace packages in monorepos)"
|
|
730
749
|
},
|
|
731
750
|
"save-prefix": {
|
|
732
751
|
type: "string",
|
|
@@ -756,6 +775,10 @@ export default defineCommand({
|
|
|
756
775
|
);
|
|
757
776
|
return process.exit(1);
|
|
758
777
|
}
|
|
778
|
+
if (args["all-workspaces"] && args["root-only"]) {
|
|
779
|
+
relinka("error", "Cannot specify both --all-workspaces and --root-only flags");
|
|
780
|
+
return process.exit(1);
|
|
781
|
+
}
|
|
759
782
|
if (args.global) {
|
|
760
783
|
return await handleGlobalUpdates(args);
|
|
761
784
|
}
|
|
@@ -890,12 +913,30 @@ export default defineCommand({
|
|
|
890
913
|
args["save-prefix"]
|
|
891
914
|
);
|
|
892
915
|
let totalUpdated = rootUpdated;
|
|
893
|
-
|
|
916
|
+
const shouldUpdateWorkspaces = args["all-workspaces"] || // Explicit flag
|
|
917
|
+
!args["root-only"] && await isMonorepo(process.cwd());
|
|
918
|
+
if (shouldUpdateWorkspaces) {
|
|
894
919
|
const workspacePkgJsons = await findWorkspacePackageJsons(process.cwd());
|
|
895
|
-
|
|
896
|
-
|
|
920
|
+
if (workspacePkgJsons.length > 0) {
|
|
921
|
+
const workspaceUpdated = await updateWorkspacePackages(workspacePkgJsons, args, options);
|
|
922
|
+
totalUpdated += workspaceUpdated;
|
|
923
|
+
} else if (args["all-workspaces"]) {
|
|
924
|
+
relinka("warn", "No workspace packages found but --all-workspaces flag was provided");
|
|
925
|
+
}
|
|
926
|
+
} else if (await isMonorepo(process.cwd())) {
|
|
927
|
+
relinka("info", "Skipping workspace packages due to --root-only flag");
|
|
928
|
+
}
|
|
929
|
+
const isMonorepoProject = await isMonorepo(process.cwd());
|
|
930
|
+
if (isMonorepoProject && shouldUpdateWorkspaces) {
|
|
931
|
+
relinka(
|
|
932
|
+
"success",
|
|
933
|
+
`Updated ${totalUpdated} dependencies across workspace (root + workspaces)`
|
|
934
|
+
);
|
|
935
|
+
} else if (isMonorepoProject && !shouldUpdateWorkspaces) {
|
|
936
|
+
relinka("success", `Updated ${totalUpdated} dependencies in root package.json only`);
|
|
937
|
+
} else {
|
|
938
|
+
relinka("success", `Updated ${totalUpdated} dependencies`);
|
|
897
939
|
}
|
|
898
|
-
relinka("success", `Updated ${totalUpdated} dependencies across workspace`);
|
|
899
940
|
const packageManager = await detectPackageManager(process.cwd());
|
|
900
941
|
if (!args["with-install"]) {
|
|
901
942
|
const installCommand = packageManager?.command || "your package manager";
|
|
@@ -13,13 +13,13 @@ export async function mkdist(options = {}) {
|
|
|
13
13
|
options.srcDir = resolve(options.rootDir, options.srcDir || "src");
|
|
14
14
|
options.distDir = resolve(options.rootDir, options.distDir || "dist");
|
|
15
15
|
if (options.cleanDist !== false) {
|
|
16
|
-
relinka("
|
|
16
|
+
relinka("verbose", "Cleaning distribution directory...");
|
|
17
17
|
await fsp.unlink(options.distDir).catch(() => {
|
|
18
18
|
});
|
|
19
19
|
await fsp.rm(options.distDir, { recursive: true, force: true });
|
|
20
20
|
await fsp.mkdir(options.distDir, { recursive: true });
|
|
21
21
|
}
|
|
22
|
-
relinka("
|
|
22
|
+
relinka("verbose", "Scanning input files...");
|
|
23
23
|
const filePaths = await glob(options.pattern || "**", {
|
|
24
24
|
absolute: false,
|
|
25
25
|
ignore: ["**/node_modules", "**/coverage", "**/.git"],
|
|
@@ -36,10 +36,10 @@ export async function mkdist(options = {}) {
|
|
|
36
36
|
getContents: () => fsp.readFile(sourcePath, { encoding: "utf8" })
|
|
37
37
|
};
|
|
38
38
|
});
|
|
39
|
-
relinka("
|
|
39
|
+
relinka("verbose", `Found ${files.length} files to process`);
|
|
40
40
|
options.typescript ||= {};
|
|
41
41
|
if (options.typescript.compilerOptions) {
|
|
42
|
-
relinka("
|
|
42
|
+
relinka("verbose", "Normalizing TypeScript compiler options...");
|
|
43
43
|
options.typescript.compilerOptions = await normalizeCompilerOptions(
|
|
44
44
|
options.typescript.compilerOptions
|
|
45
45
|
);
|
|
@@ -57,9 +57,9 @@ export async function mkdist(options = {}) {
|
|
|
57
57
|
allowNonTsExtensions: true
|
|
58
58
|
}
|
|
59
59
|
);
|
|
60
|
-
relinka("
|
|
60
|
+
relinka("verbose", "Creating file loaders...");
|
|
61
61
|
const { loadFile } = createLoader(options);
|
|
62
|
-
relinka("
|
|
62
|
+
relinka("verbose", "Processing files with loaders...");
|
|
63
63
|
const outputs = [];
|
|
64
64
|
let processedCount = 0;
|
|
65
65
|
await Promise.all(
|
|
@@ -71,7 +71,7 @@ export async function mkdist(options = {}) {
|
|
|
71
71
|
processedCount++;
|
|
72
72
|
})
|
|
73
73
|
);
|
|
74
|
-
relinka("
|
|
74
|
+
relinka("verbose", "Normalizing output extensions...");
|
|
75
75
|
const pathConflicts = [];
|
|
76
76
|
for (const output of outputs.filter((o) => o.extension)) {
|
|
77
77
|
const renamed = basename(output.path, extname(output.path)) + output.extension;
|
|
@@ -88,7 +88,7 @@ export async function mkdist(options = {}) {
|
|
|
88
88
|
}
|
|
89
89
|
const dtsOutputs = outputs.filter((o) => o.declaration && !o.skip);
|
|
90
90
|
if (dtsOutputs.length > 0) {
|
|
91
|
-
relinka("
|
|
91
|
+
relinka("verbose", `Generating TypeScript declarations for ${dtsOutputs.length} files...`);
|
|
92
92
|
const vfs = new Map(dtsOutputs.map((o) => [o.srcPath, o.contents || ""]));
|
|
93
93
|
const declarations = /* @__PURE__ */ Object.create(null);
|
|
94
94
|
for (const loader of [getVueDeclarations, getDeclarations]) {
|
|
@@ -104,7 +104,7 @@ export async function mkdist(options = {}) {
|
|
|
104
104
|
dtsProcessed++;
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
|
-
relinka("
|
|
107
|
+
relinka("verbose", "Resolving relative imports...");
|
|
108
108
|
const outPaths = new Set(outputs.map((o) => o.path));
|
|
109
109
|
const resolveId = (from, id = "", resolveExtensions) => {
|
|
110
110
|
if (!id.startsWith(".")) {
|
|
@@ -137,7 +137,7 @@ export async function mkdist(options = {}) {
|
|
|
137
137
|
);
|
|
138
138
|
}
|
|
139
139
|
const outputsToWrite = outputs.filter((o) => !o.skip);
|
|
140
|
-
relinka("
|
|
140
|
+
relinka("verbose", `Writing ${outputsToWrite.length} output files...`);
|
|
141
141
|
const writtenFiles = [];
|
|
142
142
|
const errors = [];
|
|
143
143
|
let writtenCount = 0;
|