@reliverse/dler 1.7.141 → 1.7.142

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/README.md CHANGED
@@ -10,7 +10,7 @@ Visit [docs.reliverse.org/libraries/dler](https://docs.reliverse.org/libraries/d
10
10
 
11
11
  ## Stand With Ukraine
12
12
 
13
- - 💙 Please help fund drones, medkits, and victory. [Donate now](https://u24.gov.ua), it matters.
13
+ - 💙 Please help fund drones, medkits, and victory. [Donate now](https://u24.gov.ua), please, it matters.
14
14
  - 💛 Every dollar helps stop [russia's war crimes](https://war.ukraine.ua/russia-war-crimes) and saves lives.
15
15
 
16
16
  ## Stand With Reliverse
@@ -146,17 +146,17 @@ export declare const optionsSchema: z.ZodObject<{
146
146
  cwd: z.ZodString;
147
147
  config: z.ZodOptional<z.ZodString>;
148
148
  database: z.ZodOptional<z.ZodEnum<{
149
- mysql: "mysql";
150
149
  sqlite: "sqlite";
151
- mongodb: "mongodb";
152
- postgres: "postgres";
150
+ mysql: "mysql";
153
151
  mssql: "mssql";
152
+ postgres: "postgres";
154
153
  "drizzle:pg": "drizzle:pg";
155
154
  "drizzle:mysql": "drizzle:mysql";
156
155
  "drizzle:sqlite": "drizzle:sqlite";
157
156
  "prisma:postgresql": "prisma:postgresql";
158
157
  "prisma:mysql": "prisma:mysql";
159
158
  "prisma:sqlite": "prisma:sqlite";
159
+ mongodb: "mongodb";
160
160
  }>>;
161
161
  "skip-db": z.ZodOptional<z.ZodBoolean>;
162
162
  "skip-plugins": z.ZodOptional<z.ZodBoolean>;
@@ -165,7 +165,7 @@ export declare const optionsSchema: z.ZodObject<{
165
165
  }, z.core.$strip>;
166
166
  export declare const outroText = "\uD83E\uDD73 All Done, Happy Hacking!";
167
167
  export declare function getLatestNpmVersion(packageName: string): Promise<string>;
168
- export declare function getPackageManager(): Promise<"npm" | "pnpm" | "yarn" | "bun">;
168
+ export declare function getPackageManager(): Promise<"pnpm" | "bun" | "npm" | "yarn">;
169
169
  export declare function getEnvFiles(cwd: string): Promise<string[]>;
170
170
  export declare function updateEnvs({ envs, files, isCommented, }: {
171
171
  /**
@@ -1,5 +1,5 @@
1
1
  export declare const PROJECT_ROOT: string;
2
- export declare const cliVersion = "1.7.141";
2
+ export declare const cliVersion = "1.7.142";
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.141";
4
+ const version = "1.7.142";
5
5
  export const cliVersion = version;
6
6
  export const cliName = "@reliverse/rse";
7
7
  export const rseName = "@reliverse/rse";
@@ -1,27 +1,27 @@
1
1
  import { z } from "zod";
2
2
  export declare const DatabaseSchema: z.ZodEnum<{
3
3
  none: "none";
4
- mysql: "mysql";
5
4
  sqlite: "sqlite";
6
- mongodb: "mongodb";
5
+ mysql: "mysql";
7
6
  postgres: "postgres";
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
+ prisma: "prisma";
12
13
  drizzle: "drizzle";
13
14
  mongoose: "mongoose";
14
- prisma: "prisma";
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
20
  next: "next";
21
- convex: "convex";
22
21
  express: "express";
23
22
  fastify: "fastify";
24
23
  elysia: "elysia";
24
+ convex: "convex";
25
25
  }>;
26
26
  export type Backend = z.infer<typeof BackendSchema>;
27
27
  export declare const RuntimeSchema: z.ZodEnum<{
@@ -34,8 +34,8 @@ export type Runtime = z.infer<typeof RuntimeSchema>;
34
34
  export declare const FrontendSchema: z.ZodEnum<{
35
35
  none: "none";
36
36
  svelte: "svelte";
37
- nuxt: "nuxt";
38
37
  solid: "solid";
38
+ nuxt: "nuxt";
39
39
  next: "next";
40
40
  "react-router": "react-router";
41
41
  "tanstack-router": "tanstack-router";
@@ -55,15 +55,15 @@ export declare const AddonsSchema: z.ZodEnum<{
55
55
  }>;
56
56
  export type Addons = z.infer<typeof AddonsSchema>;
57
57
  export declare const ExamplesSchema: z.ZodEnum<{
58
- none: "none";
59
58
  ai: "ai";
59
+ none: "none";
60
60
  todo: "todo";
61
61
  }>;
62
62
  export type Examples = z.infer<typeof ExamplesSchema>;
63
63
  export declare const PackageManagerSchema: z.ZodEnum<{
64
- npm: "npm";
65
64
  pnpm: "pnpm";
66
65
  bun: "bun";
66
+ npm: "npm";
67
67
  }>;
68
68
  export type PackageManager = z.infer<typeof PackageManagerSchema>;
69
69
  export declare const DatabaseSetupSchema: z.ZodEnum<{
@@ -5,17 +5,19 @@ interface UpdateArgs {
5
5
  name?: string[];
6
6
  ignore?: string[];
7
7
  dryRun?: boolean;
8
- withInstall?: boolean;
8
+ install?: boolean;
9
9
  allowMajor?: boolean;
10
10
  concurrency?: number;
11
+ ignoreFields?: string[];
11
12
  }
12
13
  export declare function validatePackageJson(): Promise<string>;
13
14
  export declare function prepareAllUpdateCandidates(args: UpdateArgs): Promise<{
14
15
  candidates: string[];
15
16
  allDepsMap: Record<string, any>;
16
17
  packageJsonFiles: string[];
18
+ fileDepsMap: Map<string, Record<string, any>>;
17
19
  }>;
18
20
  export declare function checkPackageUpdates(candidates: string[], allDepsMap: Record<string, any>, args: UpdateArgs): Promise<UpdateResult[]>;
19
- export declare function updateAllPackageJsonFiles(packageJsonFiles: string[], toUpdate: UpdateResult[], savePrefix: string): Promise<number>;
21
+ export declare function updateAllPackageJsonFiles(packageJsonFiles: string[], toUpdate: UpdateResult[], savePrefix: string, fieldsToIgnore?: string[]): Promise<number>;
20
22
  export declare function handleInstallation(): Promise<void>;
21
23
  export {};
@@ -38,16 +38,18 @@ export async function prepareAllUpdateCandidates(args) {
38
38
  });
39
39
  if (packageJsonFiles.length === 0) {
40
40
  relinka("warn", "No package.json files found");
41
- return { candidates: [], allDepsMap: {}, packageJsonFiles: [] };
41
+ return { candidates: [], allDepsMap: {}, packageJsonFiles: [], fileDepsMap: /* @__PURE__ */ new Map() };
42
42
  }
43
43
  relinka("verbose", `Found ${packageJsonFiles.length} package.json files`);
44
44
  const allDepsMap = {};
45
45
  const allCandidates = /* @__PURE__ */ new Set();
46
+ const fileDepsMap = /* @__PURE__ */ new Map();
46
47
  for (const packageJsonPath of packageJsonFiles) {
47
48
  try {
48
49
  const packageJson = JSON.parse(await fs.readFile(packageJsonPath, "utf8"));
49
50
  const { map } = collectTargetDependencies(packageJson);
50
51
  const candidates2 = prepareDependenciesForUpdate(map, args);
52
+ fileDepsMap.set(packageJsonPath, map);
51
53
  for (const [dep, info] of Object.entries(map)) {
52
54
  if (!allDepsMap[dep]) {
53
55
  allDepsMap[dep] = { ...info, locations: new Set(info.locations) };
@@ -71,10 +73,10 @@ export async function prepareAllUpdateCandidates(args) {
71
73
  const candidates = Array.from(allCandidates);
72
74
  if (candidates.length === 0) {
73
75
  relinka("warn", "No dependencies to update");
74
- return { candidates: [], allDepsMap: {}, packageJsonFiles };
76
+ return { candidates: [], allDepsMap: {}, packageJsonFiles, fileDepsMap };
75
77
  }
76
78
  relinka("verbose", `Processing ${packageJsonFiles.length} package.json files`);
77
- return { candidates, allDepsMap, packageJsonFiles };
79
+ return { candidates, allDepsMap, packageJsonFiles, fileDepsMap };
78
80
  }
79
81
  export async function checkPackageUpdates(candidates, allDepsMap, args) {
80
82
  const options = {
@@ -95,7 +97,7 @@ export async function checkPackageUpdates(candidates, allDepsMap, args) {
95
97
  updated: false,
96
98
  error: "Current version not found",
97
99
  semverCompatible: false,
98
- location: Array.from(depInfo?.locations || ["unknown"]).join(", ")
100
+ location: "unknown"
99
101
  };
100
102
  }
101
103
  return checkPackageUpdate(dep, depInfo.versionSpec, depInfo.locations, options);
@@ -103,7 +105,7 @@ export async function checkPackageUpdates(candidates, allDepsMap, args) {
103
105
  { concurrency: args.concurrency || 5 }
104
106
  );
105
107
  }
106
- export async function updateAllPackageJsonFiles(packageJsonFiles, toUpdate, savePrefix) {
108
+ export async function updateAllPackageJsonFiles(packageJsonFiles, toUpdate, savePrefix, fieldsToIgnore = []) {
107
109
  if (packageJsonFiles.length === 0 || toUpdate.length === 0) {
108
110
  return 0;
109
111
  }
@@ -118,7 +120,8 @@ export async function updateAllPackageJsonFiles(packageJsonFiles, toUpdate, save
118
120
  packageJsonPath,
119
121
  fileDepsMap,
120
122
  fileSpecificUpdates,
121
- savePrefix
123
+ savePrefix,
124
+ fieldsToIgnore
122
125
  );
123
126
  totalUpdated += updated;
124
127
  if (updated > 0) {
@@ -68,11 +68,11 @@ export declare function prepareDependenciesForUpdate(allDepsMap: Record<string,
68
68
  /**
69
69
  * Update a single package.json file with new dependency versions
70
70
  */
71
- export declare function updatePackageJsonFile(packageJsonPath: string, dependencies: Record<string, DependencyInfo>, updatesToApply: UpdateResult[], savePrefix: string): Promise<number>;
71
+ export declare function updatePackageJsonFile(packageJsonPath: string, dependencies: Record<string, DependencyInfo>, updatesToApply: UpdateResult[], savePrefix: string, fieldsToIgnore?: string[]): Promise<number>;
72
72
  /**
73
- * Display update results in a formatted way
73
+ * Display update results in a structured, file-by-file format
74
74
  */
75
- export declare function displayUpdateResults(results: UpdateResult[]): void;
75
+ export declare function displayStructuredUpdateResults(results: UpdateResult[], packageJsonFiles: string[], fileDepsMap: Map<string, Record<string, any>>, showDetails?: boolean): void;
76
76
  /**
77
77
  * Run install command for the detected package manager
78
78
  */
@@ -2,6 +2,7 @@ import fs from "@reliverse/relifso";
2
2
  import { relinka } from "@reliverse/relinka";
3
3
  import rematch from "@reliverse/rematch";
4
4
  import { $ } from "bun";
5
+ import path from "path";
5
6
  import semver from "semver";
6
7
  import {
7
8
  getAllPkgManagers
@@ -239,6 +240,20 @@ export function prepareDependenciesForUpdate(allDepsMap, args) {
239
240
  relinka("verbose", `Ignored ${ignoredCount} dependencies matching ignore patterns`);
240
241
  }
241
242
  }
243
+ const ignoreFields = args.ignoreFields || [];
244
+ if (ignoreFields.length > 0) {
245
+ filteredDeps = filteredDeps.filter((dep) => {
246
+ const locations = allDepsMap[dep]?.locations || /* @__PURE__ */ new Set();
247
+ return !Array.from(locations).some((location) => ignoreFields.includes(location));
248
+ });
249
+ const ignoredFieldsCount = depsToUpdate.length - filteredDeps.length;
250
+ if (ignoredFieldsCount > 0) {
251
+ relinka(
252
+ "verbose",
253
+ `Ignored ${ignoredFieldsCount} dependencies in ignored fields: ${ignoreFields.join(", ")}`
254
+ );
255
+ }
256
+ }
242
257
  return filteredDeps.filter((dep) => {
243
258
  const versionSpec = allDepsMap[dep]?.versionSpec ?? "";
244
259
  if (!versionSpec) return false;
@@ -246,15 +261,30 @@ export function prepareDependenciesForUpdate(allDepsMap, args) {
246
261
  return true;
247
262
  });
248
263
  }
249
- export async function updatePackageJsonFile(packageJsonPath, dependencies, updatesToApply, savePrefix) {
264
+ export async function updatePackageJsonFile(packageJsonPath, dependencies, updatesToApply, savePrefix, fieldsToIgnore = []) {
250
265
  if (updatesToApply.length === 0) return 0;
251
266
  try {
252
267
  const packageJson = JSON.parse(await fs.readFile(packageJsonPath, "utf8"));
253
268
  const updatedPackageJson = { ...packageJson };
254
269
  for (const update of updatesToApply) {
255
- const prefix = savePrefix === "none" ? "" : savePrefix;
256
- const newVersion = `${prefix}${update.latestVersion}`;
257
270
  const locations = dependencies[update.package]?.locations || /* @__PURE__ */ new Set();
271
+ const shouldIgnore = Array.from(locations).some(
272
+ (location) => fieldsToIgnore.includes(location)
273
+ );
274
+ if (shouldIgnore) {
275
+ continue;
276
+ }
277
+ let newVersion;
278
+ if (locations.has("peerDependencies")) {
279
+ const currentVersion = dependencies[update.package]?.versionSpec || "";
280
+ if (currentVersion.startsWith(">=")) {
281
+ newVersion = `>=${update.latestVersion}`;
282
+ } else {
283
+ newVersion = savePrefix === "none" ? update.latestVersion : `${savePrefix}${update.latestVersion}`;
284
+ }
285
+ } else {
286
+ newVersion = savePrefix === "none" ? update.latestVersion : `${savePrefix}${update.latestVersion}`;
287
+ }
258
288
  applyVersionUpdate(updatedPackageJson, update.package, newVersion, locations);
259
289
  }
260
290
  await fs.writeFile(packageJsonPath, JSON.stringify(updatedPackageJson, null, 2) + "\n", "utf8");
@@ -267,7 +297,7 @@ export async function updatePackageJsonFile(packageJsonPath, dependencies, updat
267
297
  return 0;
268
298
  }
269
299
  }
270
- export function displayUpdateResults(results) {
300
+ export function displayStructuredUpdateResults(results, packageJsonFiles, fileDepsMap, showDetails = false) {
271
301
  const toUpdate = results.filter((r) => r.updated && !r.error);
272
302
  const errors = results.filter((r) => r.error);
273
303
  const upToDate = results.filter((r) => !r.updated && !r.error && r.semverCompatible);
@@ -276,28 +306,101 @@ export function displayUpdateResults(results) {
276
306
  for (const error of errors) {
277
307
  relinka("warn", ` ${error.package} (${error.location}): ${error.error}`);
278
308
  }
309
+ relinka("log", "");
279
310
  }
280
- if (upToDate.length > 0) {
281
- relinka("log", `${upToDate.length} deps are already up to date`);
282
- }
283
- if (toUpdate.length === 0) {
284
- relinka("verbose", `All ${upToDate.length} deps are already up to date`);
311
+ if (!showDetails) {
312
+ if (toUpdate.length === 0) {
313
+ relinka("log", `All ${upToDate.length} dependencies are already up to date`);
314
+ } else {
315
+ relinka(
316
+ "log",
317
+ `${toUpdate.length} dependencies can be updated across ${packageJsonFiles.length} package.json files`
318
+ );
319
+ }
285
320
  return;
286
321
  }
287
- relinka("log", `${toUpdate.length} deps can be updated:`);
288
- const byLocation = /* @__PURE__ */ new Map();
289
- for (const update of toUpdate) {
290
- const location = update.location || "unknown";
291
- if (!byLocation.has(location)) {
292
- byLocation.set(location, []);
322
+ const resultsByFile = /* @__PURE__ */ new Map();
323
+ for (const result of results) {
324
+ let filePath = "unknown";
325
+ for (const [pkgPath, deps] of fileDepsMap.entries()) {
326
+ if (deps[result.package]) {
327
+ filePath = pkgPath;
328
+ break;
329
+ }
330
+ }
331
+ if (!resultsByFile.has(filePath)) {
332
+ resultsByFile.set(filePath, []);
333
+ }
334
+ const fileResults = resultsByFile.get(filePath);
335
+ if (fileResults) {
336
+ fileResults.push(result);
293
337
  }
294
- byLocation.get(location).push(update);
295
338
  }
296
- for (const [location, updates] of byLocation.entries()) {
297
- relinka("log", ` ${location}:`);
298
- for (const update of updates) {
299
- relinka("log", ` ${update.package}: ${update.currentVersion} \u2192 ${update.latestVersion}`);
339
+ for (const [filePath, fileResults] of resultsByFile.entries()) {
340
+ const relativePath = filePath !== "unknown" ? path.relative(process.cwd(), filePath) : "unknown";
341
+ relinka("info", `${relativePath}`);
342
+ const byCategory = /* @__PURE__ */ new Map();
343
+ for (const result of fileResults) {
344
+ const category = result.location || "unknown";
345
+ if (!byCategory.has(category)) {
346
+ byCategory.set(category, []);
347
+ }
348
+ byCategory.get(category).push(result);
349
+ }
350
+ const upToDateInFile = fileResults.filter((r) => !r.updated && !r.error && r.semverCompatible);
351
+ if (upToDateInFile.length > 0) {
352
+ relinka("log", ` * ${upToDateInFile.length} deps are already up to date`);
353
+ }
354
+ const toUpdateInFile = fileResults.filter((r) => r.updated && !r.error);
355
+ if (toUpdateInFile.length > 0) {
356
+ relinka("log", ` * ${toUpdateInFile.length} deps can be updated:`);
357
+ const sortedCategories = Array.from(byCategory.entries()).sort(([a], [b]) => {
358
+ const order = {
359
+ catalog: 0,
360
+ dependencies: 1,
361
+ devDependencies: 2,
362
+ peerDependencies: 3,
363
+ optionalDependencies: 4
364
+ };
365
+ const aOrder = order[a] ?? 999;
366
+ const bOrder = order[b] ?? 999;
367
+ return aOrder - bOrder;
368
+ });
369
+ for (const [category, updates] of sortedCategories) {
370
+ const categoryUpdates = updates.filter((r) => r.updated && !r.error);
371
+ if (categoryUpdates.length > 0) {
372
+ let displayCategory = category;
373
+ if (category.startsWith("catalogs.")) {
374
+ displayCategory = `workspaces.${category}`;
375
+ } else if (category === "catalog") {
376
+ displayCategory = "workspaces.catalog";
377
+ }
378
+ relinka("log", ` - ${displayCategory}:`);
379
+ for (const update of categoryUpdates) {
380
+ relinka(
381
+ "log",
382
+ ` ${update.package}: ${update.currentVersion} \u2192 ${update.latestVersion}`
383
+ );
384
+ }
385
+ }
386
+ }
387
+ }
388
+ const errorsInFile = fileResults.filter((r) => r.error);
389
+ if (errorsInFile.length > 0) {
390
+ relinka("warn", ` * ${errorsInFile.length} deps failed to check:`);
391
+ for (const error of errorsInFile) {
392
+ relinka("warn", ` ${error.package}: ${error.error}`);
393
+ }
300
394
  }
395
+ relinka("log", "");
396
+ }
397
+ if (toUpdate.length === 0) {
398
+ relinka("log", `All ${upToDate.length} dependencies are already up to date`);
399
+ } else {
400
+ relinka(
401
+ "success",
402
+ `Summary: ${toUpdate.length} dependencies can be updated across ${packageJsonFiles.length} package.json files`
403
+ );
301
404
  }
302
405
  }
303
406
  export async function runInstallCommand(packageManager) {
package/bin/mod.d.ts CHANGED
@@ -310,7 +310,7 @@ export { append, compose, createBundle, createTransformer, createTransformerFrom
310
310
  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";
311
311
  export { checkPackageUpdates, handleInstallation, prepareAllUpdateCandidates, updateAllPackageJsonFiles, validatePackageJson, } from "./impl/update/impl";
312
312
  export type { DependencyInfo, PackageCheckOptions, UpdateResult, } from "./impl/update/utils";
313
- export { applyVersionUpdate, checkPackageUpdate, collectTargetDependencies, displayUpdateResults, fetchVersionFromRegistry, getLatestVersion, getPmOptions, isCatalogReference, isNonSemverSpecifier, isNpmAlias, isSemverCompatible, isWorkspaceDependency, prepareDependenciesForUpdate, runInstallCommand, updatePackageJsonFile, } from "./impl/update/utils";
313
+ export { applyVersionUpdate, checkPackageUpdate, collectTargetDependencies, displayStructuredUpdateResults, fetchVersionFromRegistry, getLatestVersion, getPmOptions, isCatalogReference, isNonSemverSpecifier, isNpmAlias, isSemverCompatible, isWorkspaceDependency, prepareDependenciesForUpdate, runInstallCommand, updatePackageJsonFile, } from "./impl/update/utils";
314
314
  export type { UploadFile, UploadResult } from "./impl/upload/providers/providers-mod";
315
315
  export { readFilesFromPaths, uploadToProvider, } from "./impl/upload/providers/providers-mod";
316
316
  export type { UploadedUCFile } from "./impl/upload/providers/uploadcare";
package/bin/mod.js CHANGED
@@ -756,7 +756,7 @@ export {
756
756
  applyVersionUpdate,
757
757
  checkPackageUpdate,
758
758
  collectTargetDependencies,
759
- displayUpdateResults,
759
+ displayStructuredUpdateResults,
760
760
  fetchVersionFromRegistry,
761
761
  getLatestVersion,
762
762
  getPmOptions,
package/package.json CHANGED
@@ -123,7 +123,7 @@
123
123
  "license": "MIT",
124
124
  "name": "@reliverse/dler",
125
125
  "type": "module",
126
- "version": "1.7.141",
126
+ "version": "1.7.142",
127
127
  "author": "reliverse",
128
128
  "bugs": {
129
129
  "email": "blefnk@gmail.com",