@unisphere/nx 4.12.4 → 4.12.5
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/dist/migrations/4-12-5/disable-module-boundaries-for-rollup-config.d.ts +19 -0
- package/dist/migrations/4-12-5/disable-module-boundaries-for-rollup-config.d.ts.map +1 -0
- package/dist/migrations/4-12-5/disable-module-boundaries-for-rollup-config.js +58 -0
- package/migrations.json +8 -0
- package/package.json +1 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Migration: Disable @nx/enforce-module-boundaries for rollup.config files
|
|
3
|
+
*
|
|
4
|
+
* Under nx 22.7.x the @nx/enforce-module-boundaries rule started flagging the
|
|
5
|
+
* relative `require('../../node_modules/@unisphere/cli/bundler/.../rollup.js')`
|
|
6
|
+
* that every generated rollup.config.js uses:
|
|
7
|
+
* "External resources cannot be imported using a relative or absolute path"
|
|
8
|
+
*
|
|
9
|
+
* That require is intentional — @unisphere/cli's `exports` map does not expose
|
|
10
|
+
* the bundler entry, so a bare specifier cannot resolve. rollup.config.js is a
|
|
11
|
+
* build-config file, not application code, so the boundaries rule should not
|
|
12
|
+
* apply to it. This migration adds an override to the workspace-root
|
|
13
|
+
* .eslintrc.json that turns the rule off for rollup.config.{js,mjs} files.
|
|
14
|
+
*
|
|
15
|
+
* Idempotent: re-running makes no further changes.
|
|
16
|
+
*/
|
|
17
|
+
import { Tree } from '@nx/devkit';
|
|
18
|
+
export default function update(tree: Tree): Promise<void>;
|
|
19
|
+
//# sourceMappingURL=disable-module-boundaries-for-rollup-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disable-module-boundaries-for-rollup-config.d.ts","sourceRoot":"","sources":["../../../src/migrations/4-12-5/disable-module-boundaries-for-rollup-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,IAAI,EAA+B,MAAM,YAAY,CAAC;AAY/D,wBAA8B,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CA+C9D"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Migration: Disable @nx/enforce-module-boundaries for rollup.config files
|
|
4
|
+
*
|
|
5
|
+
* Under nx 22.7.x the @nx/enforce-module-boundaries rule started flagging the
|
|
6
|
+
* relative `require('../../node_modules/@unisphere/cli/bundler/.../rollup.js')`
|
|
7
|
+
* that every generated rollup.config.js uses:
|
|
8
|
+
* "External resources cannot be imported using a relative or absolute path"
|
|
9
|
+
*
|
|
10
|
+
* That require is intentional — @unisphere/cli's `exports` map does not expose
|
|
11
|
+
* the bundler entry, so a bare specifier cannot resolve. rollup.config.js is a
|
|
12
|
+
* build-config file, not application code, so the boundaries rule should not
|
|
13
|
+
* apply to it. This migration adds an override to the workspace-root
|
|
14
|
+
* .eslintrc.json that turns the rule off for rollup.config.{js,mjs} files.
|
|
15
|
+
*
|
|
16
|
+
* Idempotent: re-running makes no further changes.
|
|
17
|
+
*/
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.default = update;
|
|
20
|
+
const devkit_1 = require("@nx/devkit");
|
|
21
|
+
const ESLINTRC_PATH = '.eslintrc.json';
|
|
22
|
+
const ROLLUP_FILES_PATTERN = '**/rollup.config.{js,mjs}';
|
|
23
|
+
const RULE = '@nx/enforce-module-boundaries';
|
|
24
|
+
async function update(tree) {
|
|
25
|
+
devkit_1.logger.info(`🔄 Disabling ${RULE} for rollup.config files in ${ESLINTRC_PATH}...`);
|
|
26
|
+
if (!tree.exists(ESLINTRC_PATH)) {
|
|
27
|
+
devkit_1.logger.info(`ℹ️ No ${ESLINTRC_PATH} found, skipping migration`);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const eslintrc = (0, devkit_1.readJson)(tree, ESLINTRC_PATH);
|
|
31
|
+
if (!Array.isArray(eslintrc.overrides)) {
|
|
32
|
+
eslintrc.overrides = [];
|
|
33
|
+
}
|
|
34
|
+
const overrides = eslintrc.overrides;
|
|
35
|
+
// Idempotency: skip if an override already turns the rule off for rollup configs
|
|
36
|
+
const alreadyDisabled = overrides.some((override) => {
|
|
37
|
+
const files = Array.isArray(override.files)
|
|
38
|
+
? override.files
|
|
39
|
+
: override.files
|
|
40
|
+
? [override.files]
|
|
41
|
+
: [];
|
|
42
|
+
return (files.includes(ROLLUP_FILES_PATTERN) &&
|
|
43
|
+
override.rules?.[RULE] === 'off');
|
|
44
|
+
});
|
|
45
|
+
if (alreadyDisabled) {
|
|
46
|
+
devkit_1.logger.info(`✅ ${RULE} already disabled for rollup configs, skipping`);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
// Append last so it wins over the earlier *.js override that enables the rule
|
|
50
|
+
overrides.push({
|
|
51
|
+
files: [ROLLUP_FILES_PATTERN],
|
|
52
|
+
rules: {
|
|
53
|
+
[RULE]: 'off',
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
(0, devkit_1.writeJson)(tree, ESLINTRC_PATH, eslintrc);
|
|
57
|
+
devkit_1.logger.info(`✅ Disabled ${RULE} for ${ROLLUP_FILES_PATTERN}`);
|
|
58
|
+
}
|
package/migrations.json
CHANGED
|
@@ -506,6 +506,14 @@
|
|
|
506
506
|
"cli": {
|
|
507
507
|
"postUpdateMessage": "✅ .gitignore updated to exclude migrations-*.json"
|
|
508
508
|
}
|
|
509
|
+
},
|
|
510
|
+
"4.12.5-disable-module-boundaries-for-rollup-config": {
|
|
511
|
+
"version": "4.12.5",
|
|
512
|
+
"description": "Disables @nx/enforce-module-boundaries for rollup.config.{js,mjs} in the root ESLint config (nx 22.7.x flags the bundler's relative require into node_modules)",
|
|
513
|
+
"factory": "./dist/migrations/4-12-5/disable-module-boundaries-for-rollup-config.js",
|
|
514
|
+
"cli": {
|
|
515
|
+
"postUpdateMessage": "✅ ESLint: @nx/enforce-module-boundaries disabled for rollup.config.{js,mjs}"
|
|
516
|
+
}
|
|
509
517
|
}
|
|
510
518
|
},
|
|
511
519
|
"packageJsonUpdates": {
|