@unisphere/nx 2.2.2 → 3.2.4
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/generators/add-application/add-application.d.ts.map +1 -1
- package/dist/generators/add-application/add-application.js +186 -63
- package/dist/generators/add-application/schema.d.ts +3 -1
- package/dist/generators/add-application/schema.json +8 -8
- package/dist/generators/add-application/templates/default/.env-template +6 -0
- package/dist/generators/add-application/templates/default/.eslintrc.json +1 -1
- package/dist/generators/add-application/templates/default/jest.config.ts +3 -3
- package/dist/generators/add-application/templates/default/project.json.template +2 -2
- package/dist/generators/add-application/templates/default/readme.md.template +11 -0
- package/dist/generators/add-application/templates/default/src/app/app.tsx.template +77 -77
- package/dist/generators/add-application/templates/default/tsconfig.json +1 -1
- package/dist/generators/add-application/templates/default/webpack.config.js.template +6 -1
- package/dist/generators/add-package/README.md +2 -2
- package/dist/generators/add-package/add-package.d.ts.map +1 -1
- package/dist/generators/add-package/add-package.js +11 -23
- package/dist/generators/add-package/schema.d.ts +1 -1
- package/dist/generators/add-package/schema.json +27 -19
- package/dist/generators/add-package/templates/new-package/.eslintrc.json +1 -1
- package/dist/generators/add-package/templates/new-package/package.json.template +0 -1
- package/dist/generators/add-package/templates/new-package/project.json.template +4 -4
- package/dist/generators/add-package/templates/new-package/rollup.config.js +1 -1
- package/dist/generators/add-package/templates/new-package/tsconfig.json +1 -1
- package/dist/generators/add-package/templates/new-package/tsconfig.lib.json.template +1 -1
- package/dist/generators/add-package/templates/new-package/tsconfig.spec.json +1 -1
- package/dist/generators/add-runtime/add-runtime.d.ts.map +1 -1
- package/dist/generators/add-runtime/add-runtime.js +62 -9
- package/dist/generators/add-runtime/schema.d.ts +1 -0
- package/dist/generators/add-runtime/schema.json +1 -9
- package/dist/generators/add-runtime/templates/new-runtime/src/lib/create-factory.tsx.template +4 -4
- package/dist/generators/add-runtime/templates/new-runtime/src/lib/runtime.tsx.template +26 -2
- package/dist/generators/add-visual/add-visual.d.ts +1 -1
- package/dist/generators/add-visual/add-visual.d.ts.map +1 -1
- package/dist/generators/add-visual/add-visual.js +108 -15
- package/dist/generators/add-visual/schema.d.ts +3 -3
- package/dist/generators/add-visual/schema.json +2 -24
- package/dist/generators/dependency-config.d.ts.map +1 -1
- package/dist/generators/dependency-config.js +1 -0
- package/dist/generators/internal-dev-runner/generator.d.ts +3 -0
- package/dist/generators/internal-dev-runner/generator.d.ts.map +1 -0
- package/dist/generators/internal-dev-runner/generator.js +47 -0
- package/dist/generators/internal-dev-runner/schema.json +9 -0
- package/dist/generators/remove/remove.d.ts +19 -0
- package/dist/generators/remove/remove.d.ts.map +1 -0
- package/dist/generators/remove/remove.js +270 -0
- package/dist/generators/remove/schema.d.ts +4 -0
- package/dist/generators/remove/schema.json +38 -0
- package/dist/generators/rename-package/rename-package.d.ts +3 -0
- package/dist/generators/rename-package/rename-package.d.ts.map +1 -1
- package/dist/generators/rename-package/rename-package.js +139 -20
- package/dist/generators/utils.d.ts +30 -1
- package/dist/generators/utils.d.ts.map +1 -1
- package/dist/generators/utils.js +258 -7
- package/dist/migrations/1-22-0/patches/@changesets+cli+2.29.7.patch +36 -4
- package/dist/migrations/3-0-0/add-define-plugin-to-webpack.d.ts +3 -0
- package/dist/migrations/3-0-0/add-define-plugin-to-webpack.d.ts.map +1 -0
- package/dist/migrations/3-0-0/add-define-plugin-to-webpack.js +233 -0
- package/dist/migrations/3-0-0/add-env-to-application-gitignore.d.ts +3 -0
- package/dist/migrations/3-0-0/add-env-to-application-gitignore.d.ts.map +1 -0
- package/dist/migrations/3-0-0/add-env-to-application-gitignore.js +117 -0
- package/dist/migrations/3-0-0/fix-vite-config-cache-paths.d.ts +10 -0
- package/dist/migrations/3-0-0/fix-vite-config-cache-paths.d.ts.map +1 -0
- package/dist/migrations/3-0-0/fix-vite-config-cache-paths.js +66 -0
- package/dist/migrations/3-0-0/patches/@changesets+cli+2.29.7.patch +88 -0
- package/dist/migrations/3-0-0/post-cleanup-empty-directories.d.ts +12 -0
- package/dist/migrations/3-0-0/post-cleanup-empty-directories.d.ts.map +1 -0
- package/dist/migrations/3-0-0/post-cleanup-empty-directories.js +62 -0
- package/dist/migrations/3-0-0/pre-cleanup-empty-directories.d.ts +14 -0
- package/dist/migrations/3-0-0/pre-cleanup-empty-directories.d.ts.map +1 -0
- package/dist/migrations/3-0-0/pre-cleanup-empty-directories.js +105 -0
- package/dist/migrations/3-0-0/remove-kaltura-tools-to-pre-install.d.ts +3 -0
- package/dist/migrations/3-0-0/remove-kaltura-tools-to-pre-install.d.ts.map +1 -0
- package/dist/migrations/3-0-0/remove-kaltura-tools-to-pre-install.js +21 -0
- package/dist/migrations/3-0-0/remove-private-from-applications-and-runtimes.d.ts +9 -0
- package/dist/migrations/3-0-0/remove-private-from-applications-and-runtimes.d.ts.map +1 -0
- package/dist/migrations/3-0-0/remove-private-from-applications-and-runtimes.js +88 -0
- package/dist/migrations/3-0-0/remove-publish-config-from-packages.d.ts +9 -0
- package/dist/migrations/3-0-0/remove-publish-config-from-packages.d.ts.map +1 -0
- package/dist/migrations/3-0-0/remove-publish-config-from-packages.js +45 -0
- package/dist/migrations/3-0-0/reorganize-applications-by-distribution-channel.d.ts +15 -0
- package/dist/migrations/3-0-0/reorganize-applications-by-distribution-channel.d.ts.map +1 -0
- package/dist/migrations/3-0-0/reorganize-applications-by-distribution-channel.js +563 -0
- package/dist/migrations/3-0-0/reorganize-packages-by-distribution-channel.d.ts +23 -0
- package/dist/migrations/3-0-0/reorganize-packages-by-distribution-channel.d.ts.map +1 -0
- package/dist/migrations/3-0-0/reorganize-packages-by-distribution-channel.js +645 -0
- package/dist/migrations/3-0-0/replace-github-workflow.d.ts +3 -0
- package/dist/migrations/3-0-0/replace-github-workflow.d.ts.map +1 -0
- package/dist/migrations/3-0-0/replace-github-workflow.js +48 -0
- package/dist/migrations/3-0-0/sync-package-lock.d.ts +10 -0
- package/dist/migrations/3-0-0/sync-package-lock.d.ts.map +1 -0
- package/dist/migrations/3-0-0/sync-package-lock.js +26 -0
- package/dist/migrations/3-0-0/templates/_publish-artifacts.template +363 -0
- package/dist/migrations/3-0-0/templates/cicd.template +89 -0
- package/dist/migrations/3-0-0/update-changeset-patch.d.ts +3 -0
- package/dist/migrations/3-0-0/update-changeset-patch.d.ts.map +1 -0
- package/dist/migrations/3-0-0/update-changeset-patch.js +31 -0
- package/dist/migrations/3-0-0/upgrade-schema-to-2-0-0.d.ts +21 -0
- package/dist/migrations/3-0-0/upgrade-schema-to-2-0-0.d.ts.map +1 -0
- package/dist/migrations/3-0-0/upgrade-schema-to-2-0-0.js +105 -0
- package/dist/migrations/3-1-0/fix-workspaces-pattern.d.ts +23 -0
- package/dist/migrations/3-1-0/fix-workspaces-pattern.d.ts.map +1 -0
- package/dist/migrations/3-1-0/fix-workspaces-pattern.js +72 -0
- package/dist/migrations/utils/has-react-dependency.d.ts +14 -0
- package/dist/migrations/utils/has-react-dependency.d.ts.map +1 -0
- package/dist/migrations/utils/has-react-dependency.js +72 -0
- package/dist/shared.d.ts +6 -0
- package/dist/shared.d.ts.map +1 -0
- package/dist/shared.js +9 -0
- package/generators.json +12 -1
- package/migrations.json +125 -0
- package/package.json +3 -2
- package/dist/generators/add-application/templates/local-dev-playground/.babelrc +0 -11
- package/dist/generators/add-application/templates/local-dev-playground/.eslintrc.json +0 -22
- package/dist/generators/add-application/templates/local-dev-playground/jest.config.ts +0 -11
- package/dist/generators/add-application/templates/local-dev-playground/package.json +0 -6
- package/dist/generators/add-application/templates/local-dev-playground/project.json +0 -9
- package/dist/generators/add-application/templates/local-dev-playground/src/app/app.tsx.template +0 -212
- package/dist/generators/add-application/templates/local-dev-playground/src/app/components/header.tsx.template +0 -123
- package/dist/generators/add-application/templates/local-dev-playground/src/app/components/settings-buttons.tsx +0 -57
- package/dist/generators/add-application/templates/local-dev-playground/src/app/components/settings-form.tsx +0 -108
- package/dist/generators/add-application/templates/local-dev-playground/src/app/components/settings.tsx +0 -74
- package/dist/generators/add-application/templates/local-dev-playground/src/app/configuration-provider.tsx +0 -163
- package/dist/generators/add-application/templates/local-dev-playground/src/app/definitions.ts +0 -25
- package/dist/generators/add-application/templates/local-dev-playground/src/app/utils/merge-deep.ts +0 -31
- package/dist/generators/add-application/templates/local-dev-playground/src/favicon.ico +0 -0
- package/dist/generators/add-application/templates/local-dev-playground/src/index.html +0 -17
- package/dist/generators/add-application/templates/local-dev-playground/src/main.tsx +0 -13
- package/dist/generators/add-application/templates/local-dev-playground/src/styles.css +0 -0
- package/dist/generators/add-application/templates/local-dev-playground/tsconfig.app.json +0 -24
- package/dist/generators/add-application/templates/local-dev-playground/tsconfig.json +0 -20
- package/dist/generators/add-application/templates/local-dev-playground/tsconfig.spec.json +0 -25
- package/dist/generators/add-application/templates/local-dev-playground/webpack.config.js +0 -33
- /package/dist/generators/add-runtime/templates/{core-templates → types-templates}/__runtimeName__-runtime/index.ts.template +0 -0
- /package/dist/generators/add-runtime/templates/{core-templates → types-templates}/__runtimeName__-runtime/runtime-types.ts.template +0 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = removeDistributionChannel;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
/**
|
|
6
|
+
* Migration: Remove distributionChannel property from packages and update schema version
|
|
7
|
+
*
|
|
8
|
+
* After the reorganize-packages-by-distribution-channel migration, the distributionChannel
|
|
9
|
+
* property for packages is redundant and can be inferred from the folder path:
|
|
10
|
+
*
|
|
11
|
+
* Packages:
|
|
12
|
+
* - unisphere/packages/private/* → distributionChannel: "none"
|
|
13
|
+
* - unisphere/packages/corp/* → distributionChannel: "github"
|
|
14
|
+
* - unisphere/packages/public/* → distributionChannel: "npm"
|
|
15
|
+
*
|
|
16
|
+
* Runtimes & Applications:
|
|
17
|
+
* - Keep distributionChannel property (cannot be inferred from path)
|
|
18
|
+
*
|
|
19
|
+
* This migration:
|
|
20
|
+
* 1. Removes the distributionChannel property only from packages in .unisphere
|
|
21
|
+
* 2. Updates schemaVersion from "1.0.0" to "2.0.0"
|
|
22
|
+
*/
|
|
23
|
+
async function removeDistributionChannel(tree) {
|
|
24
|
+
devkit_1.logger.info('');
|
|
25
|
+
devkit_1.logger.info('========================================');
|
|
26
|
+
devkit_1.logger.info('Upgrading .unisphere to schema version 2.0.0');
|
|
27
|
+
devkit_1.logger.info('========================================');
|
|
28
|
+
devkit_1.logger.info('');
|
|
29
|
+
// Check if .unisphere file exists
|
|
30
|
+
if (!tree.exists('.unisphere')) {
|
|
31
|
+
devkit_1.logger.warn('⚠️ .unisphere file not found. Skipping migration.');
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
// Read current configuration
|
|
35
|
+
let config;
|
|
36
|
+
try {
|
|
37
|
+
config = (0, devkit_1.readJson)(tree, '.unisphere');
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
devkit_1.logger.error(`❌ Failed to read .unisphere: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
41
|
+
throw error;
|
|
42
|
+
}
|
|
43
|
+
// Track changes
|
|
44
|
+
let totalRemoved = 0;
|
|
45
|
+
let schemaUpdated = false;
|
|
46
|
+
// Update schema version from 1.0.0 to 2.0.0
|
|
47
|
+
if (config.schemaVersion === '1.0.0') {
|
|
48
|
+
config.schemaVersion = '2.0.0';
|
|
49
|
+
schemaUpdated = true;
|
|
50
|
+
devkit_1.logger.info('✅ Updated schemaVersion: 1.0.0 → 2.0.0');
|
|
51
|
+
devkit_1.logger.info('');
|
|
52
|
+
}
|
|
53
|
+
else if (config.schemaVersion === '2.0.0') {
|
|
54
|
+
devkit_1.logger.info('ℹ️ Schema already at version 2.0.0');
|
|
55
|
+
devkit_1.logger.info('');
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
devkit_1.logger.warn(`⚠️ Unknown schemaVersion: ${config.schemaVersion}. Expected 1.0.0 or 2.0.0`);
|
|
59
|
+
devkit_1.logger.info('');
|
|
60
|
+
}
|
|
61
|
+
// Process packages only (not runtimes or applications)
|
|
62
|
+
if (config.elements?.packages) {
|
|
63
|
+
for (const packageName in config.elements.packages) {
|
|
64
|
+
const packageConfig = config.elements.packages[packageName];
|
|
65
|
+
if ('distributionChannel' in packageConfig) {
|
|
66
|
+
delete packageConfig.distributionChannel;
|
|
67
|
+
totalRemoved++;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
// Write updated configuration back
|
|
72
|
+
if (totalRemoved > 0 || schemaUpdated) {
|
|
73
|
+
try {
|
|
74
|
+
(0, devkit_1.writeJson)(tree, '.unisphere', config);
|
|
75
|
+
if (totalRemoved > 0) {
|
|
76
|
+
devkit_1.logger.info('✅ Successfully removed distributionChannel property from packages');
|
|
77
|
+
devkit_1.logger.info('');
|
|
78
|
+
devkit_1.logger.info(`Removed distributionChannel from ${totalRemoved} package(s)`);
|
|
79
|
+
devkit_1.logger.info('');
|
|
80
|
+
devkit_1.logger.info('ℹ️ Distribution channel for packages can now be inferred from folder paths:');
|
|
81
|
+
devkit_1.logger.info(' - packages/private/* → "none"');
|
|
82
|
+
devkit_1.logger.info(' - packages/corp/* → "github"');
|
|
83
|
+
devkit_1.logger.info(' - packages/public/* → "npm"');
|
|
84
|
+
devkit_1.logger.info('');
|
|
85
|
+
devkit_1.logger.info('ℹ️ Runtimes and applications still have distributionChannel property');
|
|
86
|
+
}
|
|
87
|
+
else if (schemaUpdated) {
|
|
88
|
+
devkit_1.logger.info('ℹ️ No distributionChannel properties found in packages.');
|
|
89
|
+
devkit_1.logger.info('ℹ️ Only schema version was updated.');
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
devkit_1.logger.error(`❌ Failed to write .unisphere: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
94
|
+
throw error;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
devkit_1.logger.info('ℹ️ No changes needed. Schema already at 2.0.0 and no distributionChannel properties found.');
|
|
99
|
+
}
|
|
100
|
+
devkit_1.logger.info('');
|
|
101
|
+
devkit_1.logger.info('========================================');
|
|
102
|
+
devkit_1.logger.info('Migration complete');
|
|
103
|
+
devkit_1.logger.info('========================================');
|
|
104
|
+
devkit_1.logger.info('');
|
|
105
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Tree } from '@nx/devkit';
|
|
2
|
+
/**
|
|
3
|
+
* Migration: Fix npm workspaces pattern to use explicit includes
|
|
4
|
+
*
|
|
5
|
+
* This migration updates the root package.json workspaces array to use
|
|
6
|
+
* explicit include patterns instead of a catch-all pattern with exclusions.
|
|
7
|
+
*
|
|
8
|
+
* The problem with "unisphere/**" + "!unisphere/applications/documentation/**"
|
|
9
|
+
* is that npm's negation patterns don't work reliably. This caused documentation
|
|
10
|
+
* apps (like Docusaurus) to be unable to have their own node_modules.
|
|
11
|
+
*
|
|
12
|
+
* The fix is to use explicit patterns that only include what should be workspaces:
|
|
13
|
+
* - unisphere/packages/**
|
|
14
|
+
* - unisphere/runtimes/**
|
|
15
|
+
* - unisphere/visuals/**
|
|
16
|
+
* - unisphere/applications/local/**
|
|
17
|
+
* - unisphere/applications/server/**
|
|
18
|
+
*
|
|
19
|
+
* This automatically excludes unisphere/applications/documentation/** without
|
|
20
|
+
* needing a negation pattern.
|
|
21
|
+
*/
|
|
22
|
+
export default function update(tree: Tree): Promise<void>;
|
|
23
|
+
//# sourceMappingURL=fix-workspaces-pattern.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fix-workspaces-pattern.d.ts","sourceRoot":"","sources":["../../../src/migrations/3-1-0/fix-workspaces-pattern.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAA+B,MAAM,YAAY,CAAC;AAE/D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAA8B,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CA8D9D"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = update;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
/**
|
|
6
|
+
* Migration: Fix npm workspaces pattern to use explicit includes
|
|
7
|
+
*
|
|
8
|
+
* This migration updates the root package.json workspaces array to use
|
|
9
|
+
* explicit include patterns instead of a catch-all pattern with exclusions.
|
|
10
|
+
*
|
|
11
|
+
* The problem with "unisphere/**" + "!unisphere/applications/documentation/**"
|
|
12
|
+
* is that npm's negation patterns don't work reliably. This caused documentation
|
|
13
|
+
* apps (like Docusaurus) to be unable to have their own node_modules.
|
|
14
|
+
*
|
|
15
|
+
* The fix is to use explicit patterns that only include what should be workspaces:
|
|
16
|
+
* - unisphere/packages/**
|
|
17
|
+
* - unisphere/runtimes/**
|
|
18
|
+
* - unisphere/visuals/**
|
|
19
|
+
* - unisphere/applications/local/**
|
|
20
|
+
* - unisphere/applications/server/**
|
|
21
|
+
*
|
|
22
|
+
* This automatically excludes unisphere/applications/documentation/** without
|
|
23
|
+
* needing a negation pattern.
|
|
24
|
+
*/
|
|
25
|
+
async function update(tree) {
|
|
26
|
+
devkit_1.logger.info('🔄 Fixing npm workspaces pattern to use explicit includes');
|
|
27
|
+
const packageJsonPath = 'package.json';
|
|
28
|
+
if (!tree.exists(packageJsonPath)) {
|
|
29
|
+
devkit_1.logger.warn('No package.json found, skipping migration');
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const packageJson = (0, devkit_1.readJson)(tree, packageJsonPath);
|
|
33
|
+
if (!packageJson.workspaces || !Array.isArray(packageJson.workspaces)) {
|
|
34
|
+
devkit_1.logger.warn('No workspaces array found in package.json, skipping migration');
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const oldWorkspaces = packageJson.workspaces;
|
|
38
|
+
// Check if using the old catch-all pattern
|
|
39
|
+
const hasCatchAllPattern = oldWorkspaces.includes('unisphere/**');
|
|
40
|
+
const hasNegationPattern = oldWorkspaces.some((pattern) => pattern.startsWith('!'));
|
|
41
|
+
if (!hasCatchAllPattern && !hasNegationPattern) {
|
|
42
|
+
// Check if already using explicit patterns
|
|
43
|
+
const expectedPatterns = [
|
|
44
|
+
'unisphere/packages/**',
|
|
45
|
+
'unisphere/runtimes/**',
|
|
46
|
+
'unisphere/visuals/**',
|
|
47
|
+
'unisphere/applications/local/**',
|
|
48
|
+
'unisphere/applications/server/**',
|
|
49
|
+
];
|
|
50
|
+
const hasAllExpectedPatterns = expectedPatterns.every(pattern => oldWorkspaces.includes(pattern));
|
|
51
|
+
if (hasAllExpectedPatterns) {
|
|
52
|
+
devkit_1.logger.info('Workspaces already using explicit patterns, skipping migration');
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
// Replace with explicit patterns
|
|
57
|
+
const newWorkspaces = [
|
|
58
|
+
'unisphere/packages/**',
|
|
59
|
+
'unisphere/runtimes/**',
|
|
60
|
+
'unisphere/visuals/**',
|
|
61
|
+
'unisphere/applications/local/**',
|
|
62
|
+
'unisphere/applications/server/**',
|
|
63
|
+
];
|
|
64
|
+
packageJson.workspaces = newWorkspaces;
|
|
65
|
+
(0, devkit_1.writeJson)(tree, packageJsonPath, packageJson);
|
|
66
|
+
devkit_1.logger.info('✅ Updated workspaces from:');
|
|
67
|
+
devkit_1.logger.info(` ${JSON.stringify(oldWorkspaces)}`);
|
|
68
|
+
devkit_1.logger.info(' to:');
|
|
69
|
+
devkit_1.logger.info(` ${JSON.stringify(newWorkspaces)}`);
|
|
70
|
+
devkit_1.logger.info('');
|
|
71
|
+
devkit_1.logger.info('This allows documentation apps (like Docusaurus) to have their own node_modules.');
|
|
72
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check if a project has React dependencies, including transitive dependencies
|
|
3
|
+
* through workspace projects only.
|
|
4
|
+
*
|
|
5
|
+
* Uses Nx's project graph to traverse dependencies. Only traverses into
|
|
6
|
+
* workspace projects' transitive dependencies, not external npm packages.
|
|
7
|
+
* This prevents false positives from build tools (like @vitejs/plugin-react)
|
|
8
|
+
* that have transitive dependencies on react-refresh, react-is, etc.
|
|
9
|
+
*
|
|
10
|
+
* @param projectName - The Nx project name to check
|
|
11
|
+
* @returns true if the project or any transitive workspace dependency depends on React
|
|
12
|
+
*/
|
|
13
|
+
export declare function hasReactDependency(projectName: string): Promise<boolean>;
|
|
14
|
+
//# sourceMappingURL=has-react-dependency.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"has-react-dependency.d.ts","sourceRoot":"","sources":["../../../src/migrations/utils/has-react-dependency.ts"],"names":[],"mappings":"AAmCA;;;;;;;;;;;GAWG;AACH,wBAAsB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAiC9E"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hasReactDependency = hasReactDependency;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
/**
|
|
6
|
+
* React-related dependency patterns.
|
|
7
|
+
* Matches actual React ecosystem packages, not workspace projects
|
|
8
|
+
* that happen to have "react" in their name.
|
|
9
|
+
*/
|
|
10
|
+
function isReactRelatedDependency(dep) {
|
|
11
|
+
return (
|
|
12
|
+
// Exact match for "react" package
|
|
13
|
+
dep === 'react' ||
|
|
14
|
+
// react-* packages (react-dom, react-is, react-refresh, etc.)
|
|
15
|
+
dep.startsWith('react-') ||
|
|
16
|
+
// @types/react packages
|
|
17
|
+
dep.startsWith('@types/react') ||
|
|
18
|
+
// @mui/* pattern
|
|
19
|
+
dep.startsWith('@mui/') ||
|
|
20
|
+
// @kaltura/ds* pattern
|
|
21
|
+
dep.startsWith('@kaltura/ds'));
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Extract package name from Nx dependency target.
|
|
25
|
+
* Handles both workspace projects and npm packages (npm:package-name format).
|
|
26
|
+
*/
|
|
27
|
+
function getPackageName(target, graph) {
|
|
28
|
+
// Check if it's an external npm package
|
|
29
|
+
const externalNode = graph.externalNodes?.[target];
|
|
30
|
+
if (externalNode) {
|
|
31
|
+
return externalNode.data?.packageName || target.replace(/^npm:/, '');
|
|
32
|
+
}
|
|
33
|
+
return target;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Check if a project has React dependencies, including transitive dependencies
|
|
37
|
+
* through workspace projects only.
|
|
38
|
+
*
|
|
39
|
+
* Uses Nx's project graph to traverse dependencies. Only traverses into
|
|
40
|
+
* workspace projects' transitive dependencies, not external npm packages.
|
|
41
|
+
* This prevents false positives from build tools (like @vitejs/plugin-react)
|
|
42
|
+
* that have transitive dependencies on react-refresh, react-is, etc.
|
|
43
|
+
*
|
|
44
|
+
* @param projectName - The Nx project name to check
|
|
45
|
+
* @returns true if the project or any transitive workspace dependency depends on React
|
|
46
|
+
*/
|
|
47
|
+
async function hasReactDependency(projectName) {
|
|
48
|
+
const graph = await (0, devkit_1.createProjectGraphAsync)();
|
|
49
|
+
const visited = new Set();
|
|
50
|
+
function traverse(current) {
|
|
51
|
+
if (visited.has(current)) {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
visited.add(current);
|
|
55
|
+
const deps = graph.dependencies[current] || [];
|
|
56
|
+
for (const dep of deps) {
|
|
57
|
+
const packageName = getPackageName(dep.target, graph);
|
|
58
|
+
if (isReactRelatedDependency(packageName)) {
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
// Only recursively check dependencies for workspace projects, not external npm packages.
|
|
62
|
+
// External npm packages (like @vitejs/plugin-react, vitest) have their own transitive deps
|
|
63
|
+
// (like react-refresh, react-is) which are build tools, not actual runtime dependencies.
|
|
64
|
+
const isDepExternal = !!graph.externalNodes?.[dep.target];
|
|
65
|
+
if (!isDepExternal && traverse(dep.target)) {
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
return traverse(projectName);
|
|
72
|
+
}
|
package/dist/shared.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AAAA,oBAAY,cAAc;IACtB,WAAW,cAAc;IACzB,YAAY,eAAe;IAC3B,cAAc,iBAAiB;CAClC"}
|
package/dist/shared.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PackagesScopes = void 0;
|
|
4
|
+
var PackagesScopes;
|
|
5
|
+
(function (PackagesScopes) {
|
|
6
|
+
PackagesScopes["unisphere"] = "unisphere";
|
|
7
|
+
PackagesScopes["kaltura-ai"] = "kaltura-ai";
|
|
8
|
+
PackagesScopes["kaltura-corp"] = "kaltura-corp";
|
|
9
|
+
})(PackagesScopes || (exports.PackagesScopes = PackagesScopes = {}));
|
package/generators.json
CHANGED
|
@@ -24,6 +24,17 @@
|
|
|
24
24
|
"factory": "./dist/generators/rename-package/rename-package",
|
|
25
25
|
"schema": "./dist/generators/rename-package/schema.json",
|
|
26
26
|
"description": "Rename a unisphere package and update all references"
|
|
27
|
+
},
|
|
28
|
+
"remove": {
|
|
29
|
+
"factory": "./dist/generators/remove/remove",
|
|
30
|
+
"schema": "./dist/generators/remove/schema.json",
|
|
31
|
+
"aliases": ["rm"],
|
|
32
|
+
"description": "Remove a unisphere element (package, runtime, or application)"
|
|
33
|
+
},
|
|
34
|
+
"internal-dev-runner": {
|
|
35
|
+
"factory": "./dist/generators/internal-dev-runner/generator",
|
|
36
|
+
"schema": "./dist/generators/internal-dev-runner/schema.json",
|
|
37
|
+
"description": "Internal-dev-runner - Run a migration for testing purposes (dev only)"
|
|
27
38
|
}
|
|
28
39
|
}
|
|
29
|
-
}
|
|
40
|
+
}
|
package/migrations.json
CHANGED
|
@@ -169,6 +169,120 @@
|
|
|
169
169
|
"postUpdateMessage": "✅ GitHub workflow updated with some changes."
|
|
170
170
|
}
|
|
171
171
|
},
|
|
172
|
+
"3-0-0-pre-cleanup-empty-directories": {
|
|
173
|
+
"version": "3.0.0",
|
|
174
|
+
"description": "Cleans up empty directories before reorganization migrations",
|
|
175
|
+
"factory": "./dist/migrations/3-0-0/pre-cleanup-empty-directories.js"
|
|
176
|
+
},
|
|
177
|
+
"3-0-0-reorganize-packages-by-distribution-channel": {
|
|
178
|
+
"version": "3.0.0",
|
|
179
|
+
"description": "Reorganizes packages into private/, corp/, and public/ subdirectories based on distributionChannel. Also renames 'core' package to 'types' if it exists.",
|
|
180
|
+
"factory": "./dist/migrations/3-0-0/reorganize-packages-by-distribution-channel.js",
|
|
181
|
+
"cli": {
|
|
182
|
+
"postUpdateMessage": "✅ Packages reorganized by distribution channel. 'core' renamed to 'types' if present. Run npm install."
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
"3-0-0-reorganize-applications-by-distribution-channel": {
|
|
186
|
+
"version": "3.0.0",
|
|
187
|
+
"description": "Reorganizes applications into local/ and server/ subdirectories based on distributionChannel.",
|
|
188
|
+
"factory": "./dist/migrations/3-0-0/reorganize-applications-by-distribution-channel.js",
|
|
189
|
+
"cli": {
|
|
190
|
+
"postUpdateMessage": "✅ Applications reorganized by distribution channel into local/ and server/ subdirectories. Run npm install."
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
"3-0-0-upgrade-schema-to-2-0-0": {
|
|
194
|
+
"version": "3.0.0",
|
|
195
|
+
"description": "Upgrades .unisphere schema to 2.0.0 and removes distributionChannel from packages",
|
|
196
|
+
"factory": "./dist/migrations/3-0-0/upgrade-schema-to-2-0-0.js",
|
|
197
|
+
"cli": {
|
|
198
|
+
"postUpdateMessage": "✅ .unisphere upgraded to schema 2.0.0"
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
"3-0-0-update-changeset-patch": {
|
|
202
|
+
"version": "3.0.0",
|
|
203
|
+
"description": "Updates @changesets/cli patch to filter runtime packages from major bump selection",
|
|
204
|
+
"factory": "./dist/migrations/3-0-0/update-changeset-patch.js",
|
|
205
|
+
"cli": {
|
|
206
|
+
"postUpdateMessage": "✅ @changesets/cli patch updated"
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
"3-0-0-add-env-to-application-gitignore": {
|
|
210
|
+
"version": "3.0.0",
|
|
211
|
+
"description": "Adds .env to .gitignore files for all elements (applications, packages, runtimes, etc.)",
|
|
212
|
+
"factory": "./dist/migrations/3-0-0/add-env-to-application-gitignore.js",
|
|
213
|
+
"cli": {
|
|
214
|
+
"postUpdateMessage": "✅ .env added to .gitignore files for all elements"
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
"3-0-0-add-define-plugin-to-webpack": {
|
|
218
|
+
"version": "3.0.0",
|
|
219
|
+
"description": "Adds DefinePlugin to application webpack configs and creates .env-template",
|
|
220
|
+
"factory": "./dist/migrations/3-0-0/add-define-plugin-to-webpack.js",
|
|
221
|
+
"cli": {
|
|
222
|
+
"postUpdateMessage": "✅ DefinePlugin added to webpack configs and .env-template files created"
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
"3-0-0-replace-github-workflow": {
|
|
226
|
+
"version": "3.0.0",
|
|
227
|
+
"description": "Updates GitHub workflow files (cicd.yml and _publish-artifacts.yml)",
|
|
228
|
+
"factory": "./dist/migrations/3-0-0/replace-github-workflow.js",
|
|
229
|
+
"cli": {
|
|
230
|
+
"postUpdateMessage": "✅ GitHub workflow files updated"
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
"3-0-0-remove-publish-config-from-packages": {
|
|
234
|
+
"version": "3.0.0",
|
|
235
|
+
"description": "Removes publishConfig from package.json files in packages",
|
|
236
|
+
"factory": "./dist/migrations/3-0-0/remove-publish-config-from-packages.js",
|
|
237
|
+
"cli": {
|
|
238
|
+
"postUpdateMessage": "✅ publishConfig removed from package.json files"
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
"3-0-0-remove-private-from-applications-and-runtimes": {
|
|
242
|
+
"version": "3.0.0",
|
|
243
|
+
"description": "Removes private field from package.json files in applications, runtimes, and packages",
|
|
244
|
+
"factory": "./dist/migrations/3-0-0/remove-private-from-applications-and-runtimes.js",
|
|
245
|
+
"cli": {
|
|
246
|
+
"postUpdateMessage": "✅ private field removed from applications, runtimes, and packages package.json files"
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
"3-0-0-fix-vite-config-cache-paths": {
|
|
250
|
+
"version": "3.0.0",
|
|
251
|
+
"description": "Fixes vite.config.ts cache directory paths to match package names",
|
|
252
|
+
"factory": "./dist/migrations/3-0-0/fix-vite-config-cache-paths.js",
|
|
253
|
+
"cli": {
|
|
254
|
+
"postUpdateMessage": "✅ vite.config.ts cache paths fixed"
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
"3-0-0-post-cleanup-empty-directories": {
|
|
258
|
+
"version": "3.0.0",
|
|
259
|
+
"description": "Cleans up empty directories after all reorganization migrations",
|
|
260
|
+
"factory": "./dist/migrations/3-0-0/post-cleanup-empty-directories.js",
|
|
261
|
+
"cli": {
|
|
262
|
+
"postUpdateMessage": "✅ Empty directories cleaned up"
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
"3-0-0-sync-package-lock": {
|
|
266
|
+
"version": "3.0.0",
|
|
267
|
+
"description": "Runs npm install to sync package-lock.json after all migrations",
|
|
268
|
+
"factory": "./dist/migrations/3-0-0/sync-package-lock.js",
|
|
269
|
+
"cli": {
|
|
270
|
+
"postUpdateMessage": "✅ package-lock.json synced"
|
|
271
|
+
}
|
|
272
|
+
},
|
|
273
|
+
"3-0-0-remove-pre-install": {
|
|
274
|
+
"version": "3.0.0",
|
|
275
|
+
"description": "Removes kaltura-tools preinstall script from package.json",
|
|
276
|
+
"factory": "./dist/migrations/3-0-0/remove-kaltura-tools-to-pre-install.js"
|
|
277
|
+
},
|
|
278
|
+
"3-1-0-fix-workspaces-pattern": {
|
|
279
|
+
"version": "3.1.0",
|
|
280
|
+
"description": "Fixes npm workspaces pattern to use explicit includes instead of catch-all with exclusions",
|
|
281
|
+
"factory": "./dist/migrations/3-1-0/fix-workspaces-pattern.js",
|
|
282
|
+
"cli": {
|
|
283
|
+
"postUpdateMessage": "✅ npm workspaces pattern updated to use explicit includes. Documentation apps can now have their own node_modules."
|
|
284
|
+
}
|
|
285
|
+
}
|
|
172
286
|
},
|
|
173
287
|
"packageJsonUpdates": {
|
|
174
288
|
"1.22.0": {
|
|
@@ -312,6 +426,17 @@
|
|
|
312
426
|
"alwaysAddToPackageJson": false
|
|
313
427
|
}
|
|
314
428
|
}
|
|
429
|
+
},
|
|
430
|
+
"3.0.0": {
|
|
431
|
+
"version": "3.0.0",
|
|
432
|
+
"cli": "nx",
|
|
433
|
+
"postUpdateMessage": "🎉 Migration to @unisphere/nx 3.0.0 finished!\n\nPackages reorganized by distribution channel:\n- private/ for distributionChannel: none (@local/)\n- corp/ for distributionChannel: github (@unisphere-corp/)\n- public/ for distributionChannel: npm (@unisphere/)",
|
|
434
|
+
"packages": {
|
|
435
|
+
"@unisphere/cli": {
|
|
436
|
+
"version": "2.4.2",
|
|
437
|
+
"alwaysAddToPackageJson": false
|
|
438
|
+
}
|
|
439
|
+
}
|
|
315
440
|
}
|
|
316
441
|
}
|
|
317
442
|
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unisphere/nx",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.2.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
8
|
"publishConfig": {
|
|
9
|
-
"access": "public"
|
|
9
|
+
"access": "public",
|
|
10
|
+
"registry": "https://registry.npmjs.org/"
|
|
10
11
|
},
|
|
11
12
|
"repository": {
|
|
12
13
|
"type": "git",
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": ["plugin:@nx/react", "../../../.eslintrc.json"],
|
|
3
|
-
"ignorePatterns": [
|
|
4
|
-
"!**/*",
|
|
5
|
-
"**/vite.config.*.timestamp*",
|
|
6
|
-
"**/vitest.config.*.timestamp*"
|
|
7
|
-
],
|
|
8
|
-
"overrides": [
|
|
9
|
-
{
|
|
10
|
-
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
|
|
11
|
-
"rules": {}
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
"files": ["*.ts", "*.tsx"],
|
|
15
|
-
"rules": {}
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
"files": ["*.js", "*.jsx"],
|
|
19
|
-
"rules": {}
|
|
20
|
-
}
|
|
21
|
-
]
|
|
22
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
export default {
|
|
3
|
-
displayName: 'admin',
|
|
4
|
-
preset: '../../../jest.preset.js',
|
|
5
|
-
transform: {
|
|
6
|
-
'^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest',
|
|
7
|
-
'^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/react/babel'] }],
|
|
8
|
-
},
|
|
9
|
-
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
|
|
10
|
-
coverageDirectory: '../../../coverage/unisphere/applications/admin',
|
|
11
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "unisphere-application-<%= applicationName__lowerDashCase %>",
|
|
3
|
-
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
|
|
4
|
-
"sourceRoot": "unisphere/applications/<%= applicationName__lowerDashCase %>/src",
|
|
5
|
-
"projectType": "application",
|
|
6
|
-
"tags": [],
|
|
7
|
-
"// targets": "to see all targets run: nx show project unisphere-application-<%= applicationName__lowerDashCase %> --web",
|
|
8
|
-
"targets": {}
|
|
9
|
-
}
|