@unisphere/nx 4.12.4 → 4.12.6
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/dist/migrations/4-12-6/comment-out-security-audit.d.ts +22 -0
- package/dist/migrations/4-12-6/comment-out-security-audit.d.ts.map +1 -0
- package/dist/migrations/4-12-6/comment-out-security-audit.js +64 -0
- package/migrations.json +16 -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
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Migration: Comment out the "Security Audit" step in cicd.yml
|
|
3
|
+
*
|
|
4
|
+
* The `Security Audit` step (`npx unisphere tools audit`) is temporarily
|
|
5
|
+
* disabled across projects. This migration comments out the step's lines in
|
|
6
|
+
* .github/workflows/cicd.yml by prefixing each with `#`:
|
|
7
|
+
*
|
|
8
|
+
* # - name: Security Audit
|
|
9
|
+
* # run: npx unisphere tools audit
|
|
10
|
+
* # env:
|
|
11
|
+
* # KALTURA_JFROG_TOKEN: ${{ steps.setup-jfrog.outputs.oidc-token }}
|
|
12
|
+
*
|
|
13
|
+
* The step's block is matched by its `- name: Security Audit` anchor and the
|
|
14
|
+
* following contiguous body lines (stopping at the first blank line or the next
|
|
15
|
+
* `- name:` step), so it is resilient to indentation differences between repos.
|
|
16
|
+
*
|
|
17
|
+
* Idempotent: if the step is already commented out (or absent), re-running
|
|
18
|
+
* makes no further changes.
|
|
19
|
+
*/
|
|
20
|
+
import { Tree } from '@nx/devkit';
|
|
21
|
+
export default function update(tree: Tree): Promise<void>;
|
|
22
|
+
//# sourceMappingURL=comment-out-security-audit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comment-out-security-audit.d.ts","sourceRoot":"","sources":["../../../src/migrations/4-12-6/comment-out-security-audit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,IAAI,EAAU,MAAM,YAAY,CAAC;AAK1C,wBAA8B,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAkD9D"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Migration: Comment out the "Security Audit" step in cicd.yml
|
|
4
|
+
*
|
|
5
|
+
* The `Security Audit` step (`npx unisphere tools audit`) is temporarily
|
|
6
|
+
* disabled across projects. This migration comments out the step's lines in
|
|
7
|
+
* .github/workflows/cicd.yml by prefixing each with `#`:
|
|
8
|
+
*
|
|
9
|
+
* # - name: Security Audit
|
|
10
|
+
* # run: npx unisphere tools audit
|
|
11
|
+
* # env:
|
|
12
|
+
* # KALTURA_JFROG_TOKEN: ${{ steps.setup-jfrog.outputs.oidc-token }}
|
|
13
|
+
*
|
|
14
|
+
* The step's block is matched by its `- name: Security Audit` anchor and the
|
|
15
|
+
* following contiguous body lines (stopping at the first blank line or the next
|
|
16
|
+
* `- name:` step), so it is resilient to indentation differences between repos.
|
|
17
|
+
*
|
|
18
|
+
* Idempotent: if the step is already commented out (or absent), re-running
|
|
19
|
+
* makes no further changes.
|
|
20
|
+
*/
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.default = update;
|
|
23
|
+
const devkit_1 = require("@nx/devkit");
|
|
24
|
+
const CICD_PATH = '.github/workflows/cicd.yml';
|
|
25
|
+
const STEP_ANCHOR = '- name: Security Audit';
|
|
26
|
+
async function update(tree) {
|
|
27
|
+
devkit_1.logger.info(`🔄 Commenting out the Security Audit step in ${CICD_PATH}...`);
|
|
28
|
+
if (!tree.exists(CICD_PATH)) {
|
|
29
|
+
devkit_1.logger.info(`ℹ️ No ${CICD_PATH} found, skipping migration`);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const content = tree.read(CICD_PATH, 'utf-8') ?? '';
|
|
33
|
+
const lines = content.split('\n');
|
|
34
|
+
// Match the anchor whether or not it is already commented out, so re-running
|
|
35
|
+
// recognises the existing state instead of treating it as "not found".
|
|
36
|
+
const stripComment = (line) => line.replace(/^\s*#/, '').trim();
|
|
37
|
+
const anchorIndex = lines.findIndex((line) => stripComment(line) === STEP_ANCHOR);
|
|
38
|
+
if (anchorIndex === -1) {
|
|
39
|
+
devkit_1.logger.info(`ℹ️ Security Audit step not found in ${CICD_PATH}, skipping migration`);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
// Already commented? (anchor line begins with #) — don't add a second #.
|
|
43
|
+
if (lines[anchorIndex].trimStart().startsWith('#')) {
|
|
44
|
+
devkit_1.logger.info('✅ Security Audit step already commented out, skipping');
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
// Comment the step's contiguous block: the anchor line plus the following
|
|
48
|
+
// body lines, stopping at the first blank line or the next `- name:` step.
|
|
49
|
+
let commented = 0;
|
|
50
|
+
for (let i = anchorIndex; i < lines.length; i++) {
|
|
51
|
+
const line = lines[i];
|
|
52
|
+
if (i > anchorIndex &&
|
|
53
|
+
(line.trim() === '' || stripComment(line).startsWith('- name:'))) {
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
// Per-line guard: never prefix a line that is already commented.
|
|
57
|
+
if (!line.trimStart().startsWith('#')) {
|
|
58
|
+
lines[i] = `#${line}`;
|
|
59
|
+
commented++;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
tree.write(CICD_PATH, lines.join('\n'));
|
|
63
|
+
devkit_1.logger.info(`✅ Commented out ${commented} lines of the Security Audit step`);
|
|
64
|
+
}
|
package/migrations.json
CHANGED
|
@@ -506,6 +506,22 @@
|
|
|
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
|
+
}
|
|
517
|
+
},
|
|
518
|
+
"4.12.6-comment-out-security-audit": {
|
|
519
|
+
"version": "4.12.6",
|
|
520
|
+
"description": "Comments out the Security Audit step (npx unisphere tools audit) in .github/workflows/cicd.yml",
|
|
521
|
+
"factory": "./dist/migrations/4-12-6/comment-out-security-audit.js",
|
|
522
|
+
"cli": {
|
|
523
|
+
"postUpdateMessage": "✅ Security Audit step commented out in .github/workflows/cicd.yml"
|
|
524
|
+
}
|
|
509
525
|
}
|
|
510
526
|
},
|
|
511
527
|
"packageJsonUpdates": {
|