@unisphere/nx 3.17.0 → 3.19.0

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.
@@ -1 +1 @@
1
- {"version":3,"file":"add-application.d.ts","sourceRoot":"","sources":["../../../src/generators/add-application/add-application.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,IAAI,EAAsC,MAAM,YAAY,CAAC;AAElG,OAAO,EAAE,6BAA6B,EAAE,MAAM,UAAU,CAAC;AAkHzD,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,6BAA6B,uBAiIvC;AAED,eAAe,uBAAuB,CAAC"}
1
+ {"version":3,"file":"add-application.d.ts","sourceRoot":"","sources":["../../../src/generators/add-application/add-application.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,IAAI,EAAgD,MAAM,YAAY,CAAC;AAE5G,OAAO,EAAE,6BAA6B,EAAE,MAAM,UAAU,CAAC;AAkHzD,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,6BAA6B,uBAgKvC;AAED,eAAe,uBAAuB,CAAC"}
@@ -135,6 +135,36 @@ async function addApplicationGenerator(tree, options) {
135
135
  const templatePath = 'templates/default';
136
136
  // Generate files from templates
137
137
  (0, devkit_1.generateFiles)(tree, path.join(__dirname, templatePath), projectRoot, templateVariables);
138
+ // For local-dev-playground apps, generate setup-local-runtimes.ts
139
+ if (isPlayground) {
140
+ const rawConfig = (0, devkit_1.readJson)(tree, '.unisphere');
141
+ const experienceName = `unisphere.${rawConfig.type}.${rawConfig.name}`;
142
+ const setupLocalRuntimesContent = `export function setupLocalRuntimes() {
143
+ if (!process.env.LOCAL_RUNTIMES) return;
144
+
145
+ const runtimes: Record<string, { token: string; baseEnvName: string }> = {};
146
+ process.env.LOCAL_RUNTIMES.split(',').forEach((entry) => {
147
+ const [name, port] = entry.split('@');
148
+ if (name && port) {
149
+ runtimes[name] = { token: port, baseEnvName: '' };
150
+ }
151
+ });
152
+
153
+ const overrides = {
154
+ baseEnvName: '',
155
+ mode: 'integration',
156
+ options: { verbose: 'inherit' },
157
+ baseEnvScope: { core: 'inherit', presets: 'inherit' },
158
+ runtimes: {
159
+ '${experienceName}': runtimes,
160
+ },
161
+ };
162
+
163
+ (window as any).unisphereRuntimeOverrides = btoa(JSON.stringify(overrides));
164
+ }
165
+ `;
166
+ tree.write(path.join(projectRoot, 'src', 'setup-local-runtimes.ts'), setupLocalRuntimesContent);
167
+ }
138
168
  // Install selected dependencies
139
169
  (0, dependency_config_1.installSelectedDependencies)(tree, selectedDependencies);
140
170
  // Update .unisphere configuration
@@ -1,8 +1,11 @@
1
1
  import { StrictMode } from 'react';
2
2
  import * as ReactDOM from 'react-dom/client';
3
-
3
+ <% if (servingType === 'local-dev-playground') { %>import { setupLocalRuntimes } from './setup-local-runtimes';
4
+ <% } %>
4
5
  import App from './app/app';
5
-
6
+ <% if (servingType === 'local-dev-playground') { %>
7
+ setupLocalRuntimes();
8
+ <% } %>
6
9
  const root = ReactDOM.createRoot(
7
10
  document.getElementById('root') as HTMLElement
8
11
  );
@@ -17,7 +17,8 @@ module.exports = {
17
17
  new DefinePlugin({
18
18
  // Add your environment variables here
19
19
  // Example: 'process.env.API_URL': JSON.stringify(process.env.API_URL),
20
- }),
20
+ <% if (servingType === 'local-dev-playground') { %> 'process.env.LOCAL_RUNTIMES': JSON.stringify(process.env.LOCAL_RUNTIMES),
21
+ <% } %> }),
21
22
  new NxAppWebpackPlugin({
22
23
  tsConfig: './tsconfig.app.json',
23
24
  compiler: 'babel',
@@ -0,0 +1,21 @@
1
+ import { Tree } from '@nx/devkit';
2
+ export interface PackageJsonDependent {
3
+ path: string;
4
+ field: string;
5
+ }
6
+ export interface DependentsResult {
7
+ packageJsonDependents: PackageJsonDependent[];
8
+ importDependents: string[];
9
+ }
10
+ /**
11
+ * Check all workspace members under unisphere/ for dependents of the given package.
12
+ *
13
+ * @param tree - Nx virtual file tree
14
+ * @param normalizedName - Kebab-case package name (already normalized via names().fileName)
15
+ */
16
+ export declare function checkPackageDependents(tree: Tree, normalizedName: string): DependentsResult;
17
+ /**
18
+ * Format a human-readable error listing all dependents.
19
+ */
20
+ export declare function formatDependentsError(packageName: string, packageJsonDependents: PackageJsonDependent[], importDependents: string[]): string;
21
+ //# sourceMappingURL=remove-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remove-utils.d.ts","sourceRoot":"","sources":["../../../src/generators/remove/remove-utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAoB,MAAM,YAAY,CAAC;AAEpD,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,gBAAgB;IAC/B,qBAAqB,EAAE,oBAAoB,EAAE,CAAC;IAC9C,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC5B;AAoCD;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,IAAI,EACV,cAAc,EAAE,MAAM,GACrB,gBAAgB,CAmElB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,MAAM,EACnB,qBAAqB,EAAE,oBAAoB,EAAE,EAC7C,gBAAgB,EAAE,MAAM,EAAE,GACzB,MAAM,CAyBR"}
@@ -0,0 +1,132 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.checkPackageDependents = checkPackageDependents;
4
+ exports.formatDependentsError = formatDependentsError;
5
+ // packages/nx/src/generators/remove/remove-utils.ts
6
+ const devkit_1 = require("@nx/devkit");
7
+ /**
8
+ * Recursively collect all file paths under a directory in the Tree.
9
+ */
10
+ function collectFiles(tree, dir) {
11
+ if (!tree.exists(dir))
12
+ return [];
13
+ const results = [];
14
+ for (const child of tree.children(dir)) {
15
+ const full = `${dir}/${child}`;
16
+ if (tree.isFile(full)) {
17
+ results.push(full);
18
+ }
19
+ else {
20
+ results.push(...collectFiles(tree, full));
21
+ }
22
+ }
23
+ return results;
24
+ }
25
+ /**
26
+ * Resolve the path alias for a package from tsconfig.base.json.
27
+ * Returns undefined if no matching entry found.
28
+ */
29
+ function resolveAlias(tree, normalizedName) {
30
+ if (!tree.exists('tsconfig.base.json'))
31
+ return undefined;
32
+ const tsconfig = (0, devkit_1.readJson)(tree, 'tsconfig.base.json');
33
+ const paths = tsconfig?.compilerOptions?.paths ?? {};
34
+ const suffix = `/${normalizedName}/src/index.ts`;
35
+ for (const [alias, values] of Object.entries(paths)) {
36
+ if (Array.isArray(values) && values.some((v) => v.endsWith(suffix))) {
37
+ return alias;
38
+ }
39
+ }
40
+ return undefined;
41
+ }
42
+ /**
43
+ * Check all workspace members under unisphere/ for dependents of the given package.
44
+ *
45
+ * @param tree - Nx virtual file tree
46
+ * @param normalizedName - Kebab-case package name (already normalized via names().fileName)
47
+ */
48
+ function checkPackageDependents(tree, normalizedName) {
49
+ const packageJsonDependents = [];
50
+ const importDependents = [];
51
+ // 1. Resolve alias
52
+ const alias = resolveAlias(tree, normalizedName);
53
+ if (!alias) {
54
+ devkit_1.logger.warn(`Could not resolve path alias for package '${normalizedName}' in tsconfig.base.json — import scan skipped.`);
55
+ }
56
+ // Derive sourceRoot of the package being removed (to exclude its own files)
57
+ const tsconfig = tree.exists('tsconfig.base.json')
58
+ ? (0, devkit_1.readJson)(tree, 'tsconfig.base.json')
59
+ : {};
60
+ const paths = tsconfig?.compilerOptions?.paths ?? {};
61
+ const suffix = `/${normalizedName}/src/index.ts`;
62
+ let packageSourceRoot;
63
+ for (const values of Object.values(paths)) {
64
+ if (Array.isArray(values)) {
65
+ const match = values.find((v) => v.endsWith(suffix));
66
+ if (match) {
67
+ packageSourceRoot = match.replace('/src/index.ts', '');
68
+ break;
69
+ }
70
+ }
71
+ }
72
+ // 2. Walk all files under unisphere/
73
+ const allFiles = collectFiles(tree, 'unisphere');
74
+ const DEP_FIELDS = ['dependencies', 'devDependencies', 'peerDependencies'];
75
+ for (const filePath of allFiles) {
76
+ // Skip files within the package being removed
77
+ if (packageSourceRoot && filePath.startsWith(packageSourceRoot + '/')) {
78
+ continue;
79
+ }
80
+ // 2a. package.json scan
81
+ if (filePath.endsWith('/package.json') || filePath === 'package.json') {
82
+ if (!alias)
83
+ continue;
84
+ try {
85
+ const pkg = (0, devkit_1.readJson)(tree, filePath);
86
+ const dir = filePath.replace('/package.json', '');
87
+ for (const field of DEP_FIELDS) {
88
+ if (pkg[field]?.[alias] !== undefined) {
89
+ packageJsonDependents.push({ path: dir, field });
90
+ }
91
+ }
92
+ }
93
+ catch {
94
+ // malformed package.json — skip
95
+ }
96
+ continue;
97
+ }
98
+ // 2b. TypeScript import scan
99
+ if (alias && (filePath.endsWith('.ts') || filePath.endsWith('.tsx'))) {
100
+ const content = tree.read(filePath, 'utf-8');
101
+ if (content && content.includes(alias)) {
102
+ importDependents.push(filePath);
103
+ }
104
+ }
105
+ }
106
+ return { packageJsonDependents, importDependents };
107
+ }
108
+ /**
109
+ * Format a human-readable error listing all dependents.
110
+ */
111
+ function formatDependentsError(packageName, packageJsonDependents, importDependents) {
112
+ const lines = [
113
+ `Cannot remove package "${packageName}" — it is still in use.`,
114
+ '',
115
+ ];
116
+ if (packageJsonDependents.length > 0) {
117
+ lines.push('package.json dependents:');
118
+ for (const dep of packageJsonDependents) {
119
+ lines.push(` • ${dep.path} (${dep.field})`);
120
+ }
121
+ lines.push('');
122
+ }
123
+ if (importDependents.length > 0) {
124
+ lines.push('Import dependents:');
125
+ for (const file of importDependents) {
126
+ lines.push(` • ${file}`);
127
+ }
128
+ lines.push('');
129
+ }
130
+ lines.push('To force removal anyway, run with --forceRemove.');
131
+ return lines.join('\n');
132
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"remove.d.ts","sourceRoot":"","sources":["../../../src/generators/remove/remove.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EACL,IAAI,EAKL,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAmQjD,wBAAsB,eAAe,CACnC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,qBAAqB,iBA6E/B;AAED,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"remove.d.ts","sourceRoot":"","sources":["../../../src/generators/remove/remove.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EACL,IAAI,EAKL,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAoQjD,wBAAsB,eAAe,CACnC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,qBAAqB,iBAqF/B;AAED,eAAe,eAAe,CAAC"}
@@ -18,6 +18,7 @@ exports.removeGenerator = removeGenerator;
18
18
  const devkit_1 = require("@nx/devkit");
19
19
  const generators_1 = require("@nx/workspace/generators");
20
20
  const utils_1 = require("../utils");
21
+ const remove_utils_1 = require("./remove-utils");
21
22
  const VALID_ELEMENT_TYPES = ['package', 'runtime', 'application'];
22
23
  /**
23
24
  * Parse the element string in format "type:name"
@@ -210,6 +211,13 @@ async function removeGenerator(tree, options) {
210
211
  const normalizedName = (0, devkit_1.names)(name).fileName;
211
212
  // Validate element exists and get sourceRoot
212
213
  const sourceRoot = validateElementExists(tree, elementType, normalizedName);
214
+ // Step 0: For packages, check for dependents before removing
215
+ if (elementType === 'package' && !options.forceRemove) {
216
+ const { packageJsonDependents, importDependents } = (0, remove_utils_1.checkPackageDependents)(tree, normalizedName);
217
+ if (packageJsonDependents.length > 0 || importDependents.length > 0) {
218
+ throw new Error((0, remove_utils_1.formatDependentsError)(normalizedName, packageJsonDependents, importDependents));
219
+ }
220
+ }
213
221
  // Verify the directory exists
214
222
  if (!tree.exists(sourceRoot)) {
215
223
  devkit_1.logger.warn(`Directory not found at ${sourceRoot}. The .unisphere configuration may be out of sync.`);
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d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AQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAwBzH;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,CAwBlF;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAgB7E;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,WAAW,GAAG,cAAc,GAAG,OAAO,GAAG,YAAY,GAAG,cAAc,GAAG,aAAa,GAAG,MAAM,CAE9I;AAED;;;;GAIG;AACH,wBAAgB,iCAAiC,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAWnF;AAED;;;;GAIG;AACH,wBAAgB,gCAAgC,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAI3E;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,GACpB,IAAI,CAyBN"}
@@ -230,6 +230,7 @@ function isCorePackagePath(pathValue) {
230
230
  // Old pattern: unisphere/packages/core/src/index.ts
231
231
  // New patterns with subdirectories
232
232
  const corePatterns = [
233
+ 'unisphere/packages/core/src/index.ts',
233
234
  'unisphere/packages/local/core/src/index.ts',
234
235
  'unisphere/packages/kaltura-corp/core/src/index.ts',
235
236
  'unisphere/packages/unisphere/core/src/index.ts',
@@ -100,7 +100,7 @@ async function update(tree) {
100
100
  return;
101
101
  }
102
102
  const config = (0, devkit_1.readJson)(tree, '.unisphere');
103
- const experienceName = `${config.company}.${config.type}.${config.name}`;
103
+ const experienceName = `unisphere.${config.type}.${config.name}`;
104
104
  const applications = config.elements?.applications;
105
105
  if (!applications || Object.keys(applications).length === 0) {
106
106
  devkit_1.logger.info('ℹ️ No applications found, skipping');
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Migration: Update .gitignore to exclude user-scripts directory
3
+ *
4
+ * Adds user-scripts/ to .gitignore to prevent user scripts
5
+ * from being committed to the repository.
6
+ */
7
+ import { Tree } from '@nx/devkit';
8
+ export default function update(tree: Tree): Promise<void>;
9
+ //# sourceMappingURL=update-gitignore-user-scripts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-gitignore-user-scripts.d.ts","sourceRoot":"","sources":["../../../src/migrations/3-17-0/update-gitignore-user-scripts.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAU,MAAM,YAAY,CAAC;AAE1C,wBAA8B,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAgC9D"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ /**
3
+ * Migration: Update .gitignore to exclude user-scripts directory
4
+ *
5
+ * Adds user-scripts/ to .gitignore to prevent user scripts
6
+ * from being committed to the repository.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.default = update;
10
+ const devkit_1 = require("@nx/devkit");
11
+ async function update(tree) {
12
+ devkit_1.logger.info('🔄 Updating .gitignore to exclude user-scripts/...');
13
+ const gitignorePath = '.gitignore';
14
+ if (!tree.exists(gitignorePath)) {
15
+ devkit_1.logger.warn('⚠️ .gitignore file not found, creating one');
16
+ tree.write(gitignorePath, '');
17
+ }
18
+ try {
19
+ const currentContent = tree.read(gitignorePath, 'utf-8') || '';
20
+ let updatedContent = currentContent;
21
+ const userScriptsRegex = /^user-scripts\/\s*$/gm;
22
+ if (!userScriptsRegex.test(updatedContent)) {
23
+ if (!updatedContent.includes('user-scripts/')) {
24
+ updatedContent = updatedContent.trim() + '\nuser-scripts/\n';
25
+ devkit_1.logger.info('📝 Added user-scripts/ to .gitignore');
26
+ }
27
+ tree.write(gitignorePath, updatedContent);
28
+ devkit_1.logger.info('✅ Successfully updated .gitignore');
29
+ }
30
+ else {
31
+ devkit_1.logger.info('ℹ️ user-scripts/ already exists in .gitignore');
32
+ }
33
+ }
34
+ catch (error) {
35
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error';
36
+ devkit_1.logger.error(`❌ Failed to update .gitignore: ${errorMessage}`);
37
+ throw new Error(`Failed to update .gitignore: ${errorMessage}`);
38
+ }
39
+ }
package/migrations.json CHANGED
@@ -346,6 +346,14 @@
346
346
  "cli": {
347
347
  "postUpdateMessage": "✅ Local runtimes setup added to local applications"
348
348
  }
349
+ },
350
+ "3-17-0-update-gitignore-user-scripts": {
351
+ "version": "3.17.0",
352
+ "description": "Updates .gitignore to exclude user-scripts directory",
353
+ "factory": "./dist/migrations/3-17-0/update-gitignore-user-scripts.js",
354
+ "cli": {
355
+ "postUpdateMessage": "✅ .gitignore updated to exclude user-scripts/"
356
+ }
349
357
  }
350
358
  },
351
359
  "packageJsonUpdates": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unisphere/nx",
3
- "version": "3.17.0",
3
+ "version": "3.19.0",
4
4
  "private": false,
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",