@unisphere/nx 3.19.3 → 3.21.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.
Files changed (24) hide show
  1. package/dist/generators/add-application/add-application.d.ts.map +1 -1
  2. package/dist/generators/add-application/add-application.js +37 -16
  3. package/dist/generators/add-application/schema.d.ts +1 -1
  4. package/dist/generators/add-application/schema.json +4 -0
  5. package/dist/generators/add-application/templates/assets-only/.babelrc +11 -0
  6. package/dist/generators/add-application/templates/assets-only/.env-template +6 -0
  7. package/dist/generators/add-application/templates/assets-only/.eslintrc.json +22 -0
  8. package/dist/generators/add-application/templates/assets-only/package.json.template +5 -0
  9. package/dist/generators/add-application/templates/assets-only/project.json.template +9 -0
  10. package/dist/generators/add-application/templates/assets-only/readme.md.template +13 -0
  11. package/dist/generators/add-application/templates/assets-only/src/assets/README.md +20 -0
  12. package/dist/generators/add-application/templates/assets-only/src/index.html.template +16 -0
  13. package/dist/generators/add-application/templates/assets-only/src/main.tsx.template +2 -0
  14. package/dist/generators/add-application/templates/assets-only/tsconfig.app.json +11 -0
  15. package/dist/generators/add-application/templates/assets-only/tsconfig.json +17 -0
  16. package/dist/generators/add-application/templates/assets-only/webpack.config.js.template +24 -0
  17. package/dist/generators/internal-dev-runner/generator.js +2 -2
  18. package/dist/generators/remove/remove.d.ts.map +1 -1
  19. package/dist/generators/remove/remove.js +10 -0
  20. package/dist/migrations/3-19-4/update-eslint-ignored-files.d.ts +11 -0
  21. package/dist/migrations/3-19-4/update-eslint-ignored-files.d.ts.map +1 -0
  22. package/dist/migrations/3-19-4/update-eslint-ignored-files.js +62 -0
  23. package/migrations.json +8 -0
  24. package/package.json +1 -1
@@ -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,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"}
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,uBAoLvC;AAED,eAAe,uBAAuB,CAAC"}
@@ -79,19 +79,30 @@ async function addApplicationGenerator(tree, options) {
79
79
  throw new Error('iframe-with-post-messages serving type is not currently supported. Please choose a different serving type.');
80
80
  }
81
81
  const isPlayground = options.servingType === 'local-dev-playground';
82
+ const isAssetsOnly = options.servingType === 'assets-only';
82
83
  // Validate and read .unisphere configuration
83
84
  const unisphereConfig = (0, utils_1.validateUnisphereConfig)(tree);
84
- const promptResult = await promptForRuntimeName(unisphereConfig.runtimes, options.runtimeName || '', options.visualName || '', options.skipDynamicRuntimeVisualPrompt || false);
85
- const runtimeName = promptResult.runtimeName;
86
- const visualName = promptResult.visualName;
87
- if (!isPlayground && !options.htmlPageTitle) {
88
- options.htmlPageTitle = options.htmlPageTitle || await promptForHtmlPageTitle();
85
+ let runtimeName = '';
86
+ let visualName = '';
87
+ let selectedDependencies = [];
88
+ if (isAssetsOnly) {
89
+ // Assets-only apps don't need runtime, visual, or dependencies
90
+ options.htmlPageTitle = options.htmlPageTitle || options.name;
91
+ selectedDependencies = [];
89
92
  }
90
- if (options.dependencies === undefined) {
91
- options.dependencies = await promptForDependencies(isPlayground);
93
+ else {
94
+ const promptResult = await promptForRuntimeName(unisphereConfig.runtimes, options.runtimeName || '', options.visualName || '', options.skipDynamicRuntimeVisualPrompt || false);
95
+ runtimeName = promptResult.runtimeName;
96
+ visualName = promptResult.visualName;
97
+ if (!isPlayground && !options.htmlPageTitle) {
98
+ options.htmlPageTitle = options.htmlPageTitle || await promptForHtmlPageTitle();
99
+ }
100
+ if (options.dependencies === undefined) {
101
+ options.dependencies = await promptForDependencies(isPlayground);
102
+ }
103
+ const baseDependencies = ['react'];
104
+ selectedDependencies = [...baseDependencies, ...(options.dependencies || [])];
92
105
  }
93
- const baseDependencies = ['react'];
94
- const selectedDependencies = [...baseDependencies, ...(options.dependencies || [])];
95
106
  // Validate runtime exists if runtimeName is provided
96
107
  if (runtimeName) {
97
108
  if (!(0, utils_1.checkIfRuntimeExists)(tree, runtimeName)) {
@@ -132,7 +143,7 @@ async function addApplicationGenerator(tree, options) {
132
143
  'Please choose a different application name or remove the existing application first.');
133
144
  }
134
145
  // Choose template based on serving type
135
- const templatePath = 'templates/default';
146
+ const templatePath = isAssetsOnly ? 'templates/assets-only' : 'templates/default';
136
147
  // Generate files from templates
137
148
  (0, devkit_1.generateFiles)(tree, path.join(__dirname, templatePath), projectRoot, templateVariables);
138
149
  // For local-dev-playground apps, generate setup-local-runtimes.ts
@@ -176,14 +187,19 @@ async function addApplicationGenerator(tree, options) {
176
187
  const applicationPathValue = `${projectRoot}/src/index.ts`;
177
188
  (0, utils_1.updateTsConfigPaths)(tree, applicationPathKey, applicationPathValue);
178
189
  const scriptName = `serve:${applicationNameAsLowerDashCase}`;
179
- const scriptCommand = runtimeName ?
180
- `concurrently "npx unisphere runtime serve ${runtimeName} --port 8400" "npx unisphere application serve ${applicationNameAsLowerDashCase} --port 4002"`
181
- : `npx unisphere application serve ${applicationNameAsLowerDashCase} --port 4002`;
182
- (0, utils_1.addScriptToRootPackageJson)(tree, scriptName, scriptCommand);
190
+ if (!isAssetsOnly) {
191
+ const scriptCommand = runtimeName ?
192
+ `concurrently "npx unisphere runtime serve ${runtimeName} --port 8400" "npx unisphere application serve ${applicationNameAsLowerDashCase} --port 4002"`
193
+ : `npx unisphere application serve ${applicationNameAsLowerDashCase} --port 4002`;
194
+ (0, utils_1.addScriptToRootPackageJson)(tree, scriptName, scriptCommand);
195
+ }
183
196
  await (0, devkit_1.formatFiles)(tree);
184
197
  // Return a function that will be executed after all file operations are complete
198
+ const hasExtraDependencies = selectedDependencies.length > 0;
185
199
  return () => {
186
- (0, devkit_1.installPackagesTask)(tree, true);
200
+ if (hasExtraDependencies) {
201
+ (0, devkit_1.installPackagesTask)(tree, true);
202
+ }
187
203
  devkit_1.logger.info('');
188
204
  devkit_1.logger.info('✅ Application generated successfully!');
189
205
  devkit_1.logger.info('');
@@ -191,7 +207,12 @@ async function addApplicationGenerator(tree, options) {
191
207
  devkit_1.logger.info(`🔧 Serving Type: ${options.servingType}`);
192
208
  devkit_1.logger.info(`📁 Location: ${projectRoot}`);
193
209
  devkit_1.logger.info('');
194
- devkit_1.logger.info(`📜 To run the application locally: npm run ${scriptName}`);
210
+ if (isAssetsOnly) {
211
+ devkit_1.logger.info(`📂 Place your assets in: ${projectRoot}/src/assets/`);
212
+ }
213
+ else {
214
+ devkit_1.logger.info(`📜 To run the application locally: npm run ${scriptName}`);
215
+ }
195
216
  devkit_1.logger.info('');
196
217
  };
197
218
  }
@@ -1,7 +1,7 @@
1
1
  export interface AddApplicationGeneratorSchema {
2
2
  name: string;
3
3
  htmlPageTitle?: string;
4
- servingType: 'local-dev-playground' | 'self-hosted' | 'iframe-with-post-messages';
4
+ servingType: 'local-dev-playground' | 'self-hosted' | 'iframe-with-post-messages' | 'assets-only';
5
5
  runtimeName?: string;
6
6
  visualName?: string;
7
7
  skipDynamicRuntimeVisualPrompt?: boolean; // Internal option to skip the dynamic prompt for visual when runtime is selected
@@ -33,6 +33,10 @@
33
33
  {
34
34
  "value": "iframe-with-post-messages",
35
35
  "label": "Iframe + Post Messages (suitible to applications that gets required configuration from post messages)"
36
+ },
37
+ {
38
+ "value": "assets-only",
39
+ "label": "Assets Only (static assets served via CDN, no application logic)"
36
40
  }
37
41
  ]
38
42
  }
@@ -0,0 +1,11 @@
1
+ {
2
+ "presets": [
3
+ [
4
+ "@nx/react/babel",
5
+ {
6
+ "runtime": "automatic"
7
+ }
8
+ ]
9
+ ],
10
+ "plugins": []
11
+ }
@@ -0,0 +1,6 @@
1
+ # Environment variables template
2
+ # Copy this file to .env and fill in the values
3
+ # Do not commit .env to version control
4
+
5
+ # Example:
6
+ # API_URL=https://api.example.com
@@ -0,0 +1,22 @@
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
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "name": "unisphere-application-<%= applicationName__lowerDashCase %>",
3
+ "version": "1.0.0",
4
+ "dependencies": {}
5
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "unisphere-application-<%= applicationName__lowerDashCase %>",
3
+ "$schema": "../../../../node_modules/nx/schemas/project-schema.json",
4
+ "sourceRoot": "<%= projectRoot %>/src",
5
+ "projectType": "application",
6
+ "tags": [],
7
+ "// targets": "to see all targets run: nx show project unisphere-application-<%= applicationName__lowerDashCase %> --web",
8
+ "targets": {}
9
+ }
@@ -0,0 +1,13 @@
1
+ # <%= applicationName__pascalCase %> Application (Assets Only)
2
+
3
+ This is an assets-only application. Place your static assets in the `src/assets/` directory.
4
+
5
+ ## Assets URL
6
+
7
+ After publishing, assets are available at:
8
+
9
+ ```
10
+ https://unisphere.nvp1.ovp.kaltura.com/v1/static/applications/{experience name}/<%= applicationName__lowerDashCase %>/{version}/assets/
11
+ ```
12
+
13
+ ## Overview section
@@ -0,0 +1,20 @@
1
+ # Assets
2
+
3
+ Place your static assets in this directory. They are bundled automatically during the build process.
4
+
5
+ ## Accessing Assets
6
+
7
+ Releasing a package will automatically deploy it to nvp1. Assets can be consumed without activating the version using the following URL pattern:
8
+
9
+ ```
10
+ https://unisphere.nvp1.ovp.kaltura.com/v1/static/applications/{experience name}/{app name}/{version}/assets/
11
+ ```
12
+
13
+ For example:
14
+ ```
15
+ https://unisphere.nvp1.ovp.kaltura.com/v1/static/applications/vod-avatars/studio/1.1.0/assets/avatars/1X1/adam.png
16
+ ```
17
+
18
+ ## Caching
19
+
20
+ Caching is handled on the assets directly.
@@ -0,0 +1,16 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+
4
+ <head>
5
+ <meta charset="utf-8" />
6
+ <title>
7
+ <%= htmlPageTitle %>
8
+ </title>
9
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
10
+ </head>
11
+
12
+ <body>
13
+ <div id="root"></div>
14
+ </body>
15
+
16
+ </html>
@@ -0,0 +1,2 @@
1
+ // Assets-only application — no application logic required.
2
+ // Place your static assets in the ./assets/ directory.
@@ -0,0 +1,11 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "../../../dist/out-tsc",
5
+ "types": [
6
+ "node"
7
+ ]
8
+ },
9
+ "exclude": [],
10
+ "include": ["src/**/*.ts", "src/**/*.tsx"]
11
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "compilerOptions": {
3
+ "jsx": "react-jsx",
4
+ "allowJs": false,
5
+ "esModuleInterop": false,
6
+ "allowSyntheticDefaultImports": true,
7
+ "strict": true
8
+ },
9
+ "files": [],
10
+ "include": [],
11
+ "references": [
12
+ {
13
+ "path": "./tsconfig.app.json"
14
+ }
15
+ ],
16
+ "extends": "../../../../tsconfig.base.json"
17
+ }
@@ -0,0 +1,24 @@
1
+ const { NxAppWebpackPlugin } = require('@nx/webpack/app-plugin');
2
+ const { join } = require('path');
3
+
4
+ const baseHref = process.env.UNISPHERE_BASE_HREF || '/';
5
+
6
+ module.exports = {
7
+ output: {
8
+ path: join(__dirname, '../../../../dist/<%= projectRoot %>'),
9
+ publicPath: baseHref
10
+ },
11
+ plugins: [
12
+ new NxAppWebpackPlugin({
13
+ tsConfig: './tsconfig.app.json',
14
+ compiler: 'babel',
15
+ main: './src/main.tsx',
16
+ index: './src/index.html',
17
+ baseHref,
18
+ assets: [{ glob: '**/*', input: './src/assets', output: './assets', ignore: ['**/README.md'] }],
19
+ styles: [],
20
+ outputHashing: process.env['NODE_ENV'] === 'production' ? 'all' : 'none',
21
+ optimization: process.env['NODE_ENV'] === 'production',
22
+ }),
23
+ ],
24
+ };
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = testMigrationGenerator;
4
4
  const tslib_1 = require("tslib");
5
5
  // Import the migrations to test
6
- const add_local_runtimes_setup_1 = tslib_1.__importDefault(require("../../migrations/3-17-0/add-local-runtimes-setup"));
6
+ const update_eslint_ignored_files_1 = tslib_1.__importDefault(require("../../migrations/3-19-4/update-eslint-ignored-files"));
7
7
  async function testMigrationGenerator(tree) {
8
- await (0, add_local_runtimes_setup_1.default)(tree);
8
+ await (0, update_eslint_ignored_files_1.default)(tree);
9
9
  }
@@ -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;AAoQjD,wBAAsB,eAAe,CACnC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,qBAAqB,iBAqF/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;AAiRjD,wBAAsB,eAAe,CACnC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,qBAAqB,iBAqF/B;AAED,eAAe,eAAe,CAAC"}
@@ -193,10 +193,20 @@ function removeFromPackageLock(tree, sourceRoot) {
193
193
  const packageLock = (0, devkit_1.readJson)(tree, packageLockPath);
194
194
  let updated = false;
195
195
  if (packageLock.packages) {
196
+ // Remove the source entry
196
197
  if (packageLock.packages[sourceRoot]) {
197
198
  delete packageLock.packages[sourceRoot];
198
199
  updated = true;
199
200
  }
201
+ // Remove the node_modules symlink entry that points to this sourceRoot
202
+ for (const key of Object.keys(packageLock.packages)) {
203
+ if (key.startsWith('node_modules/') &&
204
+ packageLock.packages[key].resolved === sourceRoot &&
205
+ packageLock.packages[key].link === true) {
206
+ delete packageLock.packages[key];
207
+ updated = true;
208
+ }
209
+ }
200
210
  }
201
211
  if (updated) {
202
212
  (0, devkit_1.writeJson)(tree, packageLockPath, packageLock);
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Migration: Update ESLint dependency-checks ignoredFiles
3
+ *
4
+ * Updates the @nx/dependency-checks ignoredFiles patterns in .eslintrc.json
5
+ * to use glob patterns that cover all vite/rollup config file extensions
6
+ * (ts, mts, js, mjs). Previously only vite.config.ts and rollup.config.js
7
+ * were ignored, causing false positives when projects use .mts or .mjs extensions.
8
+ */
9
+ import { Tree } from '@nx/devkit';
10
+ export default function update(tree: Tree): Promise<void>;
11
+ //# sourceMappingURL=update-eslint-ignored-files.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-eslint-ignored-files.d.ts","sourceRoot":"","sources":["../../../src/migrations/3-19-4/update-eslint-ignored-files.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,IAAI,EAA+B,MAAM,YAAY,CAAC;AAO/D,wBAA8B,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CA+D9D"}
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ /**
3
+ * Migration: Update ESLint dependency-checks ignoredFiles
4
+ *
5
+ * Updates the @nx/dependency-checks ignoredFiles patterns in .eslintrc.json
6
+ * to use glob patterns that cover all vite/rollup config file extensions
7
+ * (ts, mts, js, mjs). Previously only vite.config.ts and rollup.config.js
8
+ * were ignored, causing false positives when projects use .mts or .mjs extensions.
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.default = update;
12
+ const devkit_1 = require("@nx/devkit");
13
+ const OLD_VITE_PATTERN = '**/vite.config.ts';
14
+ const OLD_ROLLUP_PATTERN = '**/rollup.config.js';
15
+ const NEW_VITE_PATTERN = '**/vite.config.{ts,mts,js,mjs}';
16
+ const NEW_ROLLUP_PATTERN = '**/rollup.config.{js,mjs}';
17
+ async function update(tree) {
18
+ devkit_1.logger.info('🔄 Updating ESLint dependency-checks ignoredFiles patterns...');
19
+ const eslintrcPath = '.eslintrc.json';
20
+ if (!tree.exists(eslintrcPath)) {
21
+ devkit_1.logger.info('â„šī¸ No .eslintrc.json found, skipping migration');
22
+ return;
23
+ }
24
+ const eslintrc = (0, devkit_1.readJson)(tree, eslintrcPath);
25
+ if (!eslintrc.overrides || !Array.isArray(eslintrc.overrides)) {
26
+ devkit_1.logger.info('â„šī¸ No overrides found in .eslintrc.json, skipping migration');
27
+ return;
28
+ }
29
+ let updated = false;
30
+ for (const override of eslintrc.overrides) {
31
+ const depChecks = override.rules?.['@nx/dependency-checks'];
32
+ if (!depChecks || !Array.isArray(depChecks))
33
+ continue;
34
+ const options = depChecks[1];
35
+ if (!options?.ignoredFiles || !Array.isArray(options.ignoredFiles))
36
+ continue;
37
+ const ignoredFiles = options.ignoredFiles;
38
+ // Check if already using new patterns
39
+ if (ignoredFiles.includes(NEW_VITE_PATTERN) &&
40
+ ignoredFiles.includes(NEW_ROLLUP_PATTERN)) {
41
+ devkit_1.logger.info('✅ ESLint ignoredFiles already using updated patterns, skipping');
42
+ return;
43
+ }
44
+ // Replace old patterns with new ones
45
+ const newIgnoredFiles = ignoredFiles.map((pattern) => {
46
+ if (pattern === OLD_VITE_PATTERN)
47
+ return NEW_VITE_PATTERN;
48
+ if (pattern === OLD_ROLLUP_PATTERN)
49
+ return NEW_ROLLUP_PATTERN;
50
+ return pattern;
51
+ });
52
+ options.ignoredFiles = newIgnoredFiles;
53
+ updated = true;
54
+ }
55
+ if (updated) {
56
+ (0, devkit_1.writeJson)(tree, eslintrcPath, eslintrc);
57
+ devkit_1.logger.info('✅ Updated ignoredFiles to cover all vite/rollup config extensions');
58
+ }
59
+ else {
60
+ devkit_1.logger.info('â„šī¸ No @nx/dependency-checks ignoredFiles found to update');
61
+ }
62
+ }
package/migrations.json CHANGED
@@ -370,6 +370,14 @@
370
370
  "cli": {
371
371
  "postUpdateMessage": "✅ Claude Code configuration added to root .gitignore"
372
372
  }
373
+ },
374
+ "3-19-4-update-eslint-ignored-files": {
375
+ "version": "3.19.4",
376
+ "description": "Updates ESLint dependency-checks ignoredFiles to cover all vite/rollup config extensions",
377
+ "factory": "./dist/migrations/3-19-4/update-eslint-ignored-files.js",
378
+ "cli": {
379
+ "postUpdateMessage": "✅ ESLint ignoredFiles updated to cover vite.config.{ts,mts,js,mjs} and rollup.config.{js,mjs}"
380
+ }
373
381
  }
374
382
  },
375
383
  "packageJsonUpdates": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unisphere/nx",
3
- "version": "3.19.3",
3
+ "version": "3.21.0",
4
4
  "private": false,
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",