@uxf/scripts 11.109.1 → 11.109.2
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
|
@@ -101,6 +101,21 @@ npx uxf-dependencies-check --dry-run
|
|
|
101
101
|
npx uxf-dependencies-check --exclude lodash dayjs
|
|
102
102
|
```
|
|
103
103
|
|
|
104
|
+
### Ignoring known conflicts
|
|
105
|
+
|
|
106
|
+
Some version conflicts are caused by third-party packages and cannot be resolved (e.g. `@udecode/plate-floating` pulling an old `@floating-ui/react`). Each `@uxf/*` package can declare known conflicts in its own `package.json`:
|
|
107
|
+
|
|
108
|
+
```json
|
|
109
|
+
{
|
|
110
|
+
"name": "@uxf/wysiwyg",
|
|
111
|
+
"uxf": {
|
|
112
|
+
"ignoredConflicts": ["@floating-ui/react"]
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Ignored conflicts are still printed as informational output but do **not** cause a non-zero exit code. The `--exclude` CLI flag hides packages completely (not printed at all).
|
|
118
|
+
|
|
104
119
|
### What it checks
|
|
105
120
|
|
|
106
121
|
- Parses the lock file (yarn.lock / package-lock.json / pnpm-lock.yaml / bun.lock) to detect version conflicts
|
package/package.json
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import type { Conflict, LockData } from "./types";
|
|
2
|
+
export interface UxfDepsInfo {
|
|
3
|
+
depNames: Set<string>;
|
|
4
|
+
ignoredConflicts: Set<string>;
|
|
5
|
+
}
|
|
2
6
|
/**
|
|
3
|
-
* Collect the set of package names that are direct dependencies of any installed @uxf/* package
|
|
4
|
-
*
|
|
7
|
+
* Collect the set of package names that are direct dependencies of any installed @uxf/* package,
|
|
8
|
+
* and the set of ignored conflicts declared via `uxf.ignoredConflicts` in each package's package.json.
|
|
5
9
|
*/
|
|
6
|
-
export declare function
|
|
7
|
-
export
|
|
10
|
+
export declare function collectUxfDepsInfo(uxfPackages: string[], nodeModulesPath: string): UxfDepsInfo;
|
|
11
|
+
export interface ConflictCheckResult {
|
|
12
|
+
conflicts: Conflict[];
|
|
13
|
+
ignoredConflicts: Conflict[];
|
|
14
|
+
}
|
|
15
|
+
export declare function checkMultipleVersions(lockData: LockData, relevantPackages: Set<string>, excludedPackages?: Set<string>, ignoredPackages?: Set<string>): ConflictCheckResult;
|
|
@@ -3,19 +3,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.collectUxfDepsInfo = collectUxfDepsInfo;
|
|
7
7
|
exports.checkMultipleVersions = checkMultipleVersions;
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const types_1 = require("./types");
|
|
10
10
|
/** Build-time / CLI-only dependencies that cannot cause runtime conflicts */
|
|
11
11
|
const IGNORED_PACKAGES = new Set(["yargs", "fast-glob"]);
|
|
12
12
|
/**
|
|
13
|
-
* Collect the set of package names that are direct dependencies of any installed @uxf/* package
|
|
14
|
-
*
|
|
13
|
+
* Collect the set of package names that are direct dependencies of any installed @uxf/* package,
|
|
14
|
+
* and the set of ignored conflicts declared via `uxf.ignoredConflicts` in each package's package.json.
|
|
15
15
|
*/
|
|
16
|
-
function
|
|
17
|
-
var _a, _b;
|
|
16
|
+
function collectUxfDepsInfo(uxfPackages, nodeModulesPath) {
|
|
17
|
+
var _a, _b, _c;
|
|
18
18
|
const depNames = new Set();
|
|
19
|
+
const ignoredConflicts = new Set();
|
|
19
20
|
for (const uxfPkg of uxfPackages) {
|
|
20
21
|
const pkgJsonPath = path_1.default.join(nodeModulesPath, uxfPkg, "package.json");
|
|
21
22
|
const pkgJson = (0, types_1.readPackageJson)(pkgJsonPath);
|
|
@@ -28,20 +29,33 @@ function collectUxfDependencyNames(uxfPackages, nodeModulesPath) {
|
|
|
28
29
|
for (const name of Object.keys((_b = pkgJson.peerDependencies) !== null && _b !== void 0 ? _b : {})) {
|
|
29
30
|
depNames.add(name);
|
|
30
31
|
}
|
|
32
|
+
const pkgIgnored = (_c = pkgJson.uxf) === null || _c === void 0 ? void 0 : _c.ignoredConflicts;
|
|
33
|
+
if (Array.isArray(pkgIgnored)) {
|
|
34
|
+
for (const name of pkgIgnored) {
|
|
35
|
+
ignoredConflicts.add(name);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
31
38
|
}
|
|
32
|
-
return depNames;
|
|
39
|
+
return { depNames, ignoredConflicts };
|
|
33
40
|
}
|
|
34
|
-
function checkMultipleVersions(lockData, relevantPackages, excludedPackages = new Set()) {
|
|
41
|
+
function checkMultipleVersions(lockData, relevantPackages, excludedPackages = new Set(), ignoredPackages = new Set()) {
|
|
35
42
|
const allExcluded = new Set([...IGNORED_PACKAGES, ...excludedPackages]);
|
|
36
43
|
const conflicts = [];
|
|
44
|
+
const ignoredConflicts = [];
|
|
37
45
|
for (const name of relevantPackages) {
|
|
38
46
|
if (allExcluded.has(name)) {
|
|
39
47
|
continue;
|
|
40
48
|
}
|
|
41
49
|
const versions = lockData.get(name);
|
|
42
50
|
if (versions && versions.size > 1) {
|
|
43
|
-
|
|
51
|
+
const conflict = { name, versions: Array.from(versions) };
|
|
52
|
+
if (ignoredPackages.has(name)) {
|
|
53
|
+
ignoredConflicts.push(conflict);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
conflicts.push(conflict);
|
|
57
|
+
}
|
|
44
58
|
}
|
|
45
59
|
}
|
|
46
|
-
return conflicts;
|
|
60
|
+
return { conflicts, ignoredConflicts };
|
|
47
61
|
}
|
|
@@ -43,8 +43,8 @@ async function checkUxfDependencies(options) {
|
|
|
43
43
|
// Only check dependencies of @uxf/* packages, not the entire lock file
|
|
44
44
|
try {
|
|
45
45
|
const lockData = await (0, lock_parsers_1.parseLockFile)(pm, cwd);
|
|
46
|
-
const
|
|
47
|
-
const conflicts = (0, conflict_check_1.checkMultipleVersions)(lockData,
|
|
46
|
+
const { depNames, ignoredConflicts: packageIgnored } = (0, conflict_check_1.collectUxfDepsInfo)(uxfPackages, nodeModulesPath);
|
|
47
|
+
const { conflicts, ignoredConflicts } = (0, conflict_check_1.checkMultipleVersions)(lockData, depNames, new Set(options.exclude), packageIgnored);
|
|
48
48
|
if (conflicts.length > 0) {
|
|
49
49
|
console.log("Dependency version conflicts in @uxf/* packages:"); // eslint-disable-line no-console
|
|
50
50
|
for (const { name, versions } of conflicts) {
|
|
@@ -53,7 +53,14 @@ async function checkUxfDependencies(options) {
|
|
|
53
53
|
console.log(); // eslint-disable-line no-console
|
|
54
54
|
hasIssues = true;
|
|
55
55
|
}
|
|
56
|
-
|
|
56
|
+
if (ignoredConflicts.length > 0) {
|
|
57
|
+
console.log("Ignored conflicts (configured in package.json):"); // eslint-disable-line no-console
|
|
58
|
+
for (const { name, versions } of ignoredConflicts) {
|
|
59
|
+
console.log(` ${name}: ${versions.join(", ")}`); // eslint-disable-line no-console
|
|
60
|
+
}
|
|
61
|
+
console.log(); // eslint-disable-line no-console
|
|
62
|
+
}
|
|
63
|
+
if (conflicts.length === 0 && ignoredConflicts.length === 0) {
|
|
57
64
|
console.log("No dependency version conflicts found.\n"); // eslint-disable-line no-console
|
|
58
65
|
}
|
|
59
66
|
}
|
|
@@ -3,6 +3,9 @@ export interface PackageJson {
|
|
|
3
3
|
dependencies?: Partial<Record<string, string>>;
|
|
4
4
|
devDependencies?: Partial<Record<string, string>>;
|
|
5
5
|
peerDependencies?: Partial<Record<string, string>>;
|
|
6
|
+
uxf?: {
|
|
7
|
+
ignoredConflicts?: string[];
|
|
8
|
+
};
|
|
6
9
|
}
|
|
7
10
|
export interface DepInfo {
|
|
8
11
|
isDev: boolean;
|