@unisphere/nx 1.13.0 → 1.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.
Files changed (54) hide show
  1. package/README.md +4 -4
  2. package/dist/generators/add-application/add-application.d.ts.map +1 -1
  3. package/dist/generators/add-application/add-application.js +74 -30
  4. package/dist/generators/add-application/schema.d.ts +2 -1
  5. package/dist/generators/add-application/schema.json +16 -33
  6. package/dist/generators/add-application/templates/default/package.json.template +2 -1
  7. package/dist/generators/add-application/templates/default/src/app/app.tsx.template +24 -3
  8. package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/package.json +2 -4
  9. package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/src/app/app.tsx.template +8 -12
  10. package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/src/app/components/header.tsx.template +1 -1
  11. package/dist/generators/add-package/add-package.d.ts.map +1 -1
  12. package/dist/generators/add-package/add-package.js +10 -2
  13. package/dist/generators/add-package/schema.d.ts +1 -0
  14. package/dist/generators/add-package/schema.json +29 -1
  15. package/dist/generators/add-runtime/add-runtime.d.ts.map +1 -1
  16. package/dist/generators/add-runtime/add-runtime.js +26 -20
  17. package/dist/generators/add-runtime/schema.d.ts +2 -1
  18. package/dist/generators/add-runtime/schema.json +46 -11
  19. package/dist/generators/add-runtime/templates/core-templates/__runtimeName__-runtime/runtime-types.ts.template +2 -2
  20. package/dist/generators/add-runtime/templates/new-runtime/src/lib/create-factory.tsx.template +13 -12
  21. package/dist/generators/dependency-config.d.ts +23 -0
  22. package/dist/generators/dependency-config.d.ts.map +1 -0
  23. package/dist/generators/dependency-config.js +134 -0
  24. package/dist/generators/rename-package/rename-package.d.ts +18 -0
  25. package/dist/generators/rename-package/rename-package.d.ts.map +1 -0
  26. package/dist/generators/rename-package/rename-package.js +274 -0
  27. package/dist/generators/rename-package/schema.d.ts +4 -0
  28. package/dist/generators/rename-package/schema.json +23 -0
  29. package/dist/generators/unisphere-migrate/run-locally.md +4 -1
  30. package/dist/generators/unisphere-migrate/upgrade-guide.md +22 -6
  31. package/dist/migrations/update-1-1-5/templates/_publish-artifacts.template +210 -0
  32. package/dist/migrations/update-1-1-5/templates/cicd.template +13 -3
  33. package/dist/migrations/update-1-1-5/update-github-workflow.d.ts.map +1 -1
  34. package/dist/migrations/update-1-1-5/update-github-workflow.js +28 -17
  35. package/generators.json +5 -0
  36. package/package.json +2 -2
  37. /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/.babelrc +0 -0
  38. /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/.eslintrc.json +0 -0
  39. /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/jest.config.ts +0 -0
  40. /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/project.json +0 -0
  41. /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/src/app/components/settings-buttons.tsx +0 -0
  42. /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/src/app/components/settings-form.tsx +0 -0
  43. /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/src/app/components/settings.tsx +0 -0
  44. /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/src/app/configuration-provider.tsx +0 -0
  45. /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/src/app/definitions.ts +0 -0
  46. /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/src/app/utils/merge-deep.ts +0 -0
  47. /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/src/favicon.ico +0 -0
  48. /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/src/index.html +0 -0
  49. /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/src/main.tsx +0 -0
  50. /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/src/styles.css +0 -0
  51. /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/tsconfig.app.json +0 -0
  52. /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/tsconfig.json +0 -0
  53. /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/tsconfig.spec.json +0 -0
  54. /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/webpack.config.js +0 -0
package/README.md CHANGED
@@ -68,7 +68,7 @@ npx nx g @unisphere/nx:add-runtime
68
68
 
69
69
  - **How will this runtime be used?**
70
70
 
71
- - **Loaded by External Host**
71
+ - **Loaded by External Host**u
72
72
 
73
73
  - Deployed independently and loaded at runtime
74
74
 
@@ -79,13 +79,13 @@ npx nx g @unisphere/nx:add-runtime
79
79
 
80
80
  - **Independent experience used as an entry point (loaded by host or another experience)**
81
81
 
82
- - Includes an Expo playground expo application for developing and simulating a host environment
82
+ - Includes an Dev playground application for developing and simulating a host environment
83
83
 
84
84
  - **Composed into another runtime of this experience (not used as an entry point)**
85
85
 
86
86
  - Composed by another runtime within the same experience
87
87
 
88
- - Assume it is developed using a playground expo application of another runtime in the project
88
+ - Assume it is developed using a playground dev application of another runtime in the project
89
89
 
90
90
  ### 🎨 `add-visual`
91
91
 
@@ -116,7 +116,7 @@ npx nx g @unisphere/nx:add-application
116
116
 
117
117
  - **Serving type**
118
118
 
119
- - **Interactive Playground** – Local development using Expo (used mostly for development and testing)
119
+ - **Local Dev Playground** – Local development playground (for development and testing)
120
120
  - **Self-Hosted** – Standalone deployment with routing/auth (used for publically available applications)
121
121
  - **Iframe + Query Params** – Embedded apps with config in URL (used for embedding into other applications like Kaltura Admin or KMC)
122
122
  - **Iframe + Post Messages** – Embedded apps using `postMessage` API (used for embedding into other applications like Kaltura Admin or KMC) - this will replace eventually the query param method to be more secure and reliable but is not yet available.
@@ -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,EAAiB,MAAM,YAAY,CAAC;AAG7E,OAAO,EAAE,6BAA6B,EAAE,MAAM,UAAU,CAAC;AAgBzD,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,6BAA6B,uBAuHvC;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,EAAiB,MAAM,YAAY,CAAC;AAE7E,OAAO,EAAE,6BAA6B,EAAE,MAAM,UAAU,CAAC;AA0EzD,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,6BAA6B,uBA6HvC;AAED,eAAe,uBAAuB,CAAC"}
@@ -4,15 +4,74 @@ exports.addApplicationGenerator = addApplicationGenerator;
4
4
  const tslib_1 = require("tslib");
5
5
  const devkit_1 = require("@nx/devkit");
6
6
  const path = tslib_1.__importStar(require("path"));
7
- const child_process_1 = require("child_process");
8
7
  const utils_1 = require("../utils");
8
+ const dependency_config_1 = require("../dependency-config");
9
+ async function getEnquirerPrompt() {
10
+ const enquirer = await import('enquirer');
11
+ // Handle both CommonJS and ESM exports
12
+ return enquirer.prompt || enquirer.default?.prompt || enquirer;
13
+ }
14
+ async function promptForRuntimeName() {
15
+ const prompt = await getEnquirerPrompt();
16
+ const response = await prompt({
17
+ type: 'input',
18
+ name: 'runtimeName',
19
+ message: 'Enter the runtime name to load in the playground:',
20
+ });
21
+ return response.runtimeName;
22
+ }
23
+ async function promptForHtmlPageTitle() {
24
+ const prompt = await getEnquirerPrompt();
25
+ const response = await prompt({
26
+ type: 'input',
27
+ name: 'htmlPageTitle',
28
+ message: 'What should the HTML page title be?',
29
+ });
30
+ return response.htmlPageTitle;
31
+ }
32
+ async function promptForDependencies(isPlayground) {
33
+ const prompt = await getEnquirerPrompt();
34
+ const choices = [
35
+ { value: 'ds', label: 'Kaltura DS - Design System (requires GIT_TOKEN)' },
36
+ { value: 'react-hook-form', label: 'React Hook Form - Form management' },
37
+ ];
38
+ // Only show mui option for local-dev-playground
39
+ if (isPlayground) {
40
+ choices.splice(1, 0, { value: 'mui', label: 'Material UI - Component library' });
41
+ }
42
+ const response = await prompt({
43
+ type: 'multiselect',
44
+ name: 'dependencies',
45
+ message: 'Select dependencies to install (use space to select, enter to confirm):',
46
+ choices: choices.map(c => ({ name: c.value, message: c.label })),
47
+ });
48
+ return response.dependencies;
49
+ }
9
50
  async function addApplicationGenerator(tree, options) {
10
51
  // Validate iframe-with-post-messages is not supported
11
52
  if (options.servingType === 'iframe-with-post-messages') {
12
53
  throw new Error('iframe-with-post-messages serving type is not currently supported. Please choose a different serving type.');
13
54
  }
55
+ const isPlayground = options.servingType === 'local-dev-playground';
56
+ // Handle dynamic prompts based on servingType
57
+ if (isPlayground && !options.runtimeName) {
58
+ options.runtimeName = await promptForRuntimeName();
59
+ }
60
+ if (!isPlayground && !options.htmlPageTitle) {
61
+ options.htmlPageTitle = await promptForHtmlPageTitle();
62
+ }
63
+ if (options.dependencies === undefined) {
64
+ options.dependencies = await promptForDependencies(isPlayground);
65
+ }
14
66
  // Validate and read .unisphere configuration
15
67
  const unisphereConfig = (0, utils_1.validateUnisphereConfig)(tree);
68
+ // Validate dependencies - always include react, add mui and react-hook-form for local-dev-playground
69
+ const baseDependencies = ['react'];
70
+ if (options.servingType === 'local-dev-playground') {
71
+ baseDependencies.push('mui', 'react-hook-form');
72
+ }
73
+ const selectedDependencies = [...baseDependencies, ...(options.dependencies || [])];
74
+ (0, dependency_config_1.validateGitToken)(selectedDependencies);
16
75
  // Validate runtime exists if runtimeName is provided
17
76
  if (options.runtimeName) {
18
77
  if (!(0, utils_1.checkIfRuntimeExists)(tree, options.runtimeName)) {
@@ -23,11 +82,15 @@ async function addApplicationGenerator(tree, options) {
23
82
  const widgetName = unisphereConfig.name;
24
83
  const userInputApplicationName = (0, devkit_1.names)(options.name).fileName;
25
84
  // Prepare template variables
85
+ const hasDs = selectedDependencies.includes('ds');
86
+ const hasMui = selectedDependencies.includes('mui') || hasDs;
26
87
  const templateVariables = {
27
- htmlPageTitle: options.servingType === 'interactive-playground'
28
- ? `${options.runtimeName || 'Runtime'} - Interactive Expo`
88
+ htmlPageTitle: options.servingType === 'local-dev-playground'
89
+ ? `${options.runtimeName || 'Runtime'} - Local Dev Application`
29
90
  : options.htmlPageTitle,
30
91
  servingType: options.servingType,
92
+ hasDs,
93
+ hasMui,
31
94
  ...(0, utils_1.createNameTransforms)(userInputApplicationName, 'applicationName'),
32
95
  ...(0, utils_1.createNameTransforms)(widgetName, 'widgetName'),
33
96
  ...(0, utils_1.createNameTransforms)(options.runtimeName || 'runtime', 'runtimeName'),
@@ -41,37 +104,18 @@ async function addApplicationGenerator(tree, options) {
41
104
  'Please choose a different application name or remove the existing application first.');
42
105
  }
43
106
  // Choose template based on serving type
44
- const templatePath = options.servingType === 'interactive-playground'
45
- ? 'templates/interactive-playground'
107
+ const templatePath = options.servingType === 'local-dev-playground'
108
+ ? 'templates/local-dev-playground'
46
109
  : 'templates/default';
47
110
  // Generate files from templates
48
111
  (0, devkit_1.generateFiles)(tree, path.join(__dirname, templatePath), projectRoot, templateVariables);
49
- // For interactive-playground, ensure react-hook-form is installed
50
- if (options.servingType === 'interactive-playground') {
51
- const installedVersion = (0, utils_1.isPackageInstalled)(tree, 'react-hook-form');
52
- if (!installedVersion) {
53
- const version = '^7.60';
54
- const installCommand = `npm install react-hook-form@${version}`;
55
- devkit_1.logger.info(`📦 Installing react-hook-form@${version}...`);
56
- try {
57
- (0, child_process_1.execSync)(installCommand, {
58
- cwd: process.cwd(),
59
- stdio: 'inherit',
60
- });
61
- devkit_1.logger.info('✅ react-hook-form installed successfully');
62
- }
63
- catch (error) {
64
- devkit_1.logger.error(`❌ Failed to install react-hook-form: ${error}`);
65
- }
66
- }
67
- else {
68
- devkit_1.logger.info(`✅ react-hook-form is already installed (version: ${installedVersion})`);
69
- }
70
- }
112
+ // Install selected dependencies
113
+ (0, dependency_config_1.installSelectedDependencies)(tree, selectedDependencies);
114
+ const distributionChannel = options.servingType !== 'local-dev-playground' ? 'none' : 'unisphere';
71
115
  // Update .unisphere configuration
72
116
  (0, utils_1.updateUnisphereConfig)(tree, 'applications', userInputApplicationName, {
73
117
  sourceRoot: `unisphere/applications/${userInputApplicationName}`,
74
- distributionChannel: 'unisphere',
118
+ distributionChannel: distributionChannel,
75
119
  });
76
120
  // Update tsconfig.base.json with path mapping
77
121
  const applicationPathKey = `unisphere-application-${userInputApplicationName}`;
@@ -85,9 +129,9 @@ async function addApplicationGenerator(tree, options) {
85
129
  devkit_1.logger.info('');
86
130
  devkit_1.logger.info(`🚀 Application Name: ${userInputApplicationName}`);
87
131
  devkit_1.logger.info(`📁 Location: ${projectRoot}`);
88
- if (options.servingType === 'interactive-playground') {
132
+ if (options.servingType === 'local-dev-playground') {
89
133
  devkit_1.logger.info(`🎮 Runtime Name: ${options.runtimeName}`);
90
- devkit_1.logger.info(`📄 HTML Page Title: ${options.runtimeName} - Interactive Expo`);
134
+ devkit_1.logger.info(`📄 HTML Page Title: ${options.runtimeName} - Local Dev Application`);
91
135
  }
92
136
  else {
93
137
  devkit_1.logger.info(`📄 HTML Page Title: ${options.htmlPageTitle}`);
@@ -1,6 +1,7 @@
1
1
  export interface AddApplicationGeneratorSchema {
2
2
  name: string;
3
3
  htmlPageTitle?: string;
4
- servingType: 'interactive-playground' | 'self-hosted' | 'iframe-with-query-params' | 'iframe-with-post-messages';
4
+ servingType: 'local-dev-playground' | 'self-hosted' | 'iframe-with-query-params' | 'iframe-with-post-messages';
5
5
  runtimeName?: string;
6
+ dependencies?: string[];
6
7
  }
@@ -16,15 +16,15 @@
16
16
  },
17
17
  "servingType": {
18
18
  "type": "string",
19
- "description": "How should this app be served?",
19
+ "description": "How should this app be served?",
20
20
  "default": "self-hosted",
21
21
  "x-prompt": {
22
22
  "message": "Which serving type do you want?",
23
23
  "type": "list",
24
24
  "items": [
25
25
  {
26
- "value": "interactive-playground",
27
- "label": "Interactive Playground (Expo demo app for development purposes)"
26
+ "value": "local-dev-playground",
27
+ "label": "Local Dev Playground (for development purposes)"
28
28
  },
29
29
  {
30
30
  "value": "self-hosted",
@@ -43,44 +43,27 @@
43
43
  },
44
44
  "runtimeName": {
45
45
  "type": "string",
46
- "description": "Which runtime should the playground load?",
47
- "x-prompt": {
48
- "message": "Enter the runtime name to load in the playground:",
49
- "when": "servingType === 'interactive-playground'"
50
- }
46
+ "description": "Which runtime should the playground load?"
51
47
  },
52
48
  "htmlPageTitle": {
53
49
  "type": "string",
54
- "description": "The HTML page title for your app",
55
- "x-prompt": {
56
- "message": "What should the HTML page title be?",
57
- "when": "servingType !== 'interactive-playground'"
50
+ "description": "The HTML page title for your app"
51
+ },
52
+ "dependencies": {
53
+ "type": "array",
54
+ "description": "Select packages to install (use space to select, enter to confirm)",
55
+ "items": {
56
+ "type": "string",
57
+ "enum": [
58
+ "ds",
59
+ "mui",
60
+ "react-hook-form"
61
+ ]
58
62
  }
59
63
  }
60
64
  },
61
65
  "required": [
62
66
  "name",
63
67
  "servingType"
64
- ],
65
- "allOf": [
66
- {
67
- "if": {
68
- "properties": {
69
- "servingType": {
70
- "const": "interactive-playground"
71
- }
72
- }
73
- },
74
- "then": {
75
- "required": [
76
- "runtimeName"
77
- ]
78
- },
79
- "else": {
80
- "required": [
81
- "htmlPageTitle"
82
- ]
83
- }
84
- }
85
68
  ]
86
69
  }
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "unisphere-application-<%= applicationName__lowerDashCase %>",
3
3
  "version": "1.0.0",
4
+ "private": true,
4
5
  "dependencies": {
5
- "@nextgis/cancelable-promise": "^3.0.0-alpha.22"
6
+
6
7
  }
7
8
  }
@@ -1,7 +1,7 @@
1
1
  import { useState } from 'react';
2
- import { HostThemeProvider } from '@kaltura/ds-react-theme';
3
- import { Box } from '@mui/material';
4
-
2
+ <% if (hasDs) { %>import { HostThemeProvider } from '@kaltura/ds-react-theme';
3
+ <% } %><% if (hasMui) { %>import { Box } from '@mui/material';
4
+ <% } %>
5
5
  export function App() {
6
6
  const [adapter] = useState(() => {
7
7
  <% if (servingType === 'iframe-with-query-params') { %>
@@ -49,11 +49,14 @@ export function App() {
49
49
  // TODO self hosted logic if needed
50
50
  <% } %>
51
51
 
52
+ <% if (hasDs) { %>
52
53
  const [themeMode] = useState(() => {
53
54
  return 'light' as const
54
55
  });
56
+ <% } %>
55
57
 
56
58
  return (
59
+ <% if (hasMui) { %>
57
60
  <Box
58
61
  sx={{
59
62
  width: '100vw',
@@ -62,6 +65,17 @@ export function App() {
62
65
  padding: '12px 24px',
63
66
  }}
64
67
  >
68
+ <% } else { %>
69
+ <div
70
+ style={{
71
+ width: '100vw',
72
+ height: '100vh',
73
+ overflow: 'hidden',
74
+ padding: '12px 24px',
75
+ }}
76
+ >
77
+ <% } %>
78
+ <% if (hasDs) { %>
65
79
  <HostThemeProvider
66
80
  overrides={{
67
81
  mode: themeMode,
@@ -69,7 +83,14 @@ export function App() {
69
83
  >
70
84
  {adapter ? <div> <%= applicationName__lowerDashCase %> </div> : <div></div>}
71
85
  </HostThemeProvider>
86
+ <% } else { %>
87
+ {adapter ? <div> <%= applicationName__lowerDashCase %> </div> : <div></div>}
88
+ <% } %>
89
+ <% if (hasMui) { %>
72
90
  </Box>
91
+ <% } else { %>
92
+ </div>
93
+ <% } %>
73
94
  );
74
95
  }
75
96
 
@@ -1,7 +1,5 @@
1
1
  {
2
2
  "name": "unisphere-application-<%= applicationName__lowerDashCase %>",
3
3
  "version": "1.0.0",
4
- "dependencies": {
5
- "@nextgis/cancelable-promise": "^3.0.0-alpha.22"
6
- }
7
- }
4
+ "dependencies": {}
5
+ }
@@ -52,7 +52,7 @@ const Hihi: React.FC = () => {
52
52
  marginBottom: '2rem',
53
53
  }}
54
54
  >
55
- You haven’t created a runtime visual or just didn't mount it in the Expo
55
+ You haven’t created a runtime visual or just didn't mount it in the Dev
56
56
  application. Once you add one, open{' '}
57
57
  <span
58
58
  style={{
@@ -93,9 +93,7 @@ const Hihi: React.FC = () => {
93
93
  widgetName="unisphere.widget.<%= widgetName__lowerDashCase %>"
94
94
  runtimeName="<%= runtimeName__lowerDashCase %>"
95
95
  visualType="-- provide here the visual name --"
96
- visualSettings={{
97
- -- provide here the visual settings --
98
- }}
96
+ visualSettings={{ }}
99
97
  />`}
100
98
  </pre>
101
99
  </div>
@@ -114,17 +112,17 @@ export function AppContent() {
114
112
  () => {
115
113
  /*
116
114
  Developer Note:
117
- The Expo app lets you provide runtime configuration as a JSON object that matches the same schema used in your production or staging environments.
115
+ The Dev app lets you provide runtime configuration as a JSON object that matches the same schema used in your production or staging environments.
118
116
 
119
117
  • If the runtime is already active in production or staging:
120
118
  1. Open Unisphere (Cmd + K) and choose Manage Workspace Runtimes.
121
119
  2. Locate your runtime, click the ••• (Actions) menu, and select Copy Settings.
122
- 3. Open the Expo app in the browser, in the header click on the settings icon and paste the JSON into the settings field.
120
+ 3. Open the Dev app in the browser, in the header click on the settings icon and paste the JSON into the settings field.
123
121
  4. Use the Save button to persist your settings. They’ll be stored in local storage and automatically loaded the next time the app runs.
124
122
 
125
123
  • If the runtime isn’t yet in use:
126
124
  1. Manually create a JSON payload that conforms to your runtime’s schema.
127
- 2. Open the Expo app in the browser, in the header click on the settings icon and paste the JSON into the settings field.
125
+ 2. Open the Dev app in the browser, in the header click on the settings icon and paste the JSON into the settings field.
128
126
  3. Use the Save button to persist your settings. They’ll be stored in local storage and automatically loaded the next time the app runs.
129
127
  */
130
128
 
@@ -134,7 +132,7 @@ export function AppContent() {
134
132
  }
135
133
 
136
134
  return {
137
- appId: '<%= runtimeName__lowerDashCase %>-expo',
135
+ appId: '<%= runtimeName__lowerDashCase %>-dev',
138
136
  appVersion: '1.0.0',
139
137
  serverUrl: configuration.unisphereServerUrl,
140
138
  ui: {
@@ -193,9 +191,7 @@ export function AppContent() {
193
191
  widgetName="unisphere.widget.<%= widgetName__lowerDashCase %>"
194
192
  runtimeName="<%= runtimeName__lowerDashCase %>"
195
193
  visualType="-- provide here the visual name --"
196
- visualSettings={{
197
- -- provide here the visual settings --
198
- }}
194
+ visualSettings={{ }}
199
195
  /> */}
200
196
  </UnisphereProvider>
201
197
  )}
@@ -207,7 +203,7 @@ export function AppContent() {
207
203
 
208
204
  const App = () => {
209
205
  return (
210
- <ConfigurationProvider configurationKey="unisphere-<%= widgetName__lowerDashCase %>-<%= runtimeName__lowerDashCase %>-expo">
206
+ <ConfigurationProvider configurationKey="unisphere-<%= widgetName__lowerDashCase %>-<%= runtimeName__lowerDashCase %>-dev">
211
207
  <AppContent />
212
208
  </ConfigurationProvider>
213
209
  );
@@ -66,7 +66,7 @@ export const Header: React.FC = () => {
66
66
  }}
67
67
  >
68
68
  <Typography variant="h6" sx={{ flexGrow: 1 }}>
69
- <%= widgetName__pascalCase %> - <%= runtimeName__pascalCase %> Expo
69
+ <%= widgetName__pascalCase %> - <%= runtimeName__pascalCase %> Dev
70
70
  </Typography>
71
71
  </Box>
72
72
 
@@ -1 +1 @@
1
- {"version":3,"file":"add-package.d.ts","sourceRoot":"","sources":["../../../src/generators/add-package/add-package.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,IAAI,EAA2B,MAAM,YAAY,CAAC;AAEvF,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAoJrD,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,yBAAyB,uBA6GnC;AAED,eAAe,mBAAmB,CAAC"}
1
+ {"version":3,"file":"add-package.d.ts","sourceRoot":"","sources":["../../../src/generators/add-package/add-package.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,IAAI,EAA2B,MAAM,YAAY,CAAC;AAEvF,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAyJrD,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,yBAAyB,uBA0HnC;AAED,eAAe,mBAAmB,CAAC"}
@@ -5,6 +5,7 @@ const tslib_1 = require("tslib");
5
5
  const devkit_1 = require("@nx/devkit");
6
6
  const path = tslib_1.__importStar(require("path"));
7
7
  const utils_1 = require("../utils");
8
+ const dependency_config_1 = require("../dependency-config");
8
9
  /**
9
10
  * Resolves the @unisphere/runtime version from the workspace's root package.json
10
11
  * Falls back to a default version if not found
@@ -113,19 +114,24 @@ export const ${demoName} = () => {
113
114
  `;
114
115
  }
115
116
  else {
116
- content = `export const ${demoName} = () => {}`;
117
+ content = `export const ${demoName} = {}`;
117
118
  }
118
119
  tree.write(targetPath, content);
119
120
  }
120
121
  async function addPackageGenerator(tree, options) {
121
122
  // Validate and read .unisphere configuration
122
123
  const unisphereConfig = (0, utils_1.validateUnisphereConfig)(tree);
124
+ // Validate dependencies
125
+ const selectedDependencies = options.dependencies || [];
126
+ (0, dependency_config_1.validateGitToken)(selectedDependencies);
127
+ // Validate and correct package naming for React/DS dependencies
128
+ let userInputPackageName = (0, devkit_1.names)(options.packageName).fileName;
129
+ userInputPackageName = (0, dependency_config_1.validateReactNaming)(userInputPackageName, selectedDependencies);
123
130
  // Extract environment variables
124
131
  const companyName = unisphereConfig.company;
125
132
  const experienceName = unisphereConfig.name;
126
133
  // Calculate packageJsonName based on scope and names
127
134
  let packageJsonName;
128
- const userInputPackageName = (0, devkit_1.names)(options.packageName).fileName;
129
135
  if (experienceName === userInputPackageName) {
130
136
  packageJsonName = userInputPackageName;
131
137
  }
@@ -184,6 +190,8 @@ async function addPackageGenerator(tree, options) {
184
190
  // Update tsconfig.base.json with path mapping
185
191
  (0, utils_1.updateTsConfigPaths)(tree, packageJsonName, `unisphere/packages/${userInputPackageName}/src/index.ts`);
186
192
  generateDemoComponent(tree, projectRoot, templateVariables);
193
+ // Install selected dependencies
194
+ (0, dependency_config_1.installSelectedDependencies)(tree, selectedDependencies);
187
195
  await (0, devkit_1.formatFiles)(tree);
188
196
  // Return a function that will be executed after all file operations are complete
189
197
  return () => {
@@ -1,4 +1,5 @@
1
1
  export interface AddPackageGeneratorSchema {
2
2
  packageName: string;
3
3
  scope: 'public' | 'internal' | 'none';
4
+ dependencies?: string[];
4
5
  }
@@ -31,7 +31,35 @@
31
31
  "label": "Public – published to npm (@unisphere/… available to everyone)"
32
32
  }
33
33
  ]
34
- }
34
+ }
35
+ },
36
+ "dependencies": {
37
+ "type": "array",
38
+ "description": "Select packages to install (use space to select, enter to confirm)",
39
+ "items": {
40
+ "type": "string",
41
+ "enum": ["react", "ds", "mui"]
42
+ },
43
+ "default": [],
44
+ "x-prompt": {
45
+ "message": "Select dependencies to install (use space to select, enter to confirm):",
46
+ "type": "list",
47
+ "multiselect": true,
48
+ "items": [
49
+ {
50
+ "value": "react",
51
+ "label": "React - UI library for building components"
52
+ },
53
+ {
54
+ "value": "ds",
55
+ "label": "Kaltura DS - Design System (requires GIT_TOKEN)"
56
+ },
57
+ {
58
+ "value": "mui",
59
+ "label": "Material UI - Component library"
60
+ }
61
+ ]
62
+ }
35
63
  }
36
64
  },
37
65
  "required": [
@@ -1 +1 @@
1
- {"version":3,"file":"add-runtime.d.ts","sourceRoot":"","sources":["../../../src/generators/add-runtime/add-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,IAAI,EAAiB,MAAM,YAAY,CAAC;AAE7E,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAyCrD,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,yBAAyB,uBAsHnC;AAED,eAAe,mBAAmB,CAAC"}
1
+ {"version":3,"file":"add-runtime.d.ts","sourceRoot":"","sources":["../../../src/generators/add-runtime/add-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,IAAI,EAAiB,MAAM,YAAY,CAAC;AAE7E,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AA6CrD,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,yBAAyB,uBAiInC;AAED,eAAe,mBAAmB,CAAC"}
@@ -5,7 +5,7 @@ const tslib_1 = require("tslib");
5
5
  const devkit_1 = require("@nx/devkit");
6
6
  const path = tslib_1.__importStar(require("path"));
7
7
  const utils_1 = require("../utils");
8
- const add_package_1 = require("../add-package/add-package");
8
+ const dependency_config_1 = require("../dependency-config");
9
9
  const add_application_1 = require("../add-application/add-application");
10
10
  function updateCoreIndexExport(tree, runtimeName) {
11
11
  const coreIndexPath = 'unisphere/packages/core/src/index.ts';
@@ -28,10 +28,15 @@ function updateCoreIndexExport(tree, runtimeName) {
28
28
  async function addRuntimeGenerator(tree, options) {
29
29
  // Validate and read .unisphere configuration
30
30
  const unisphereConfig = (0, utils_1.validateUnisphereConfig)(tree);
31
+ // Validate dependencies
32
+ const selectedDependencies = options.dependencies || [];
33
+ (0, dependency_config_1.validateGitToken)(selectedDependencies);
31
34
  // Extract environment variables
32
35
  const companyName = unisphereConfig.company;
33
36
  const widgetName = unisphereConfig.name;
34
- const userInputRuntimeName = (0, devkit_1.names)(options.name).fileName;
37
+ // Validate and correct runtime naming for React/DS dependencies
38
+ let userInputRuntimeName = (0, devkit_1.names)(options.name).fileName;
39
+ userInputRuntimeName = (0, dependency_config_1.validateReactNaming)(userInputRuntimeName, selectedDependencies);
35
40
  const coreAlias = (0, utils_1.findCorePackageAlias)(tree);
36
41
  // Prepare template variables
37
42
  const templateVariables = {
@@ -69,21 +74,21 @@ async function addRuntimeGenerator(tree, options) {
69
74
  const runtimePathKey = `unisphere-runtime-${userInputRuntimeName}`;
70
75
  const runtimePathValue = `unisphere/runtimes/${userInputRuntimeName}/src/index.ts`;
71
76
  (0, utils_1.updateTsConfigPaths)(tree, runtimePathKey, runtimePathValue);
72
- // Create a package with the same name as the runtime and distribution set to none
73
- const packageResult = await (0, add_package_1.addPackageGenerator)(tree, {
74
- packageName: userInputRuntimeName,
75
- scope: 'none',
76
- });
77
- // Execute the package generation callback if it exists
78
- if (packageResult && typeof packageResult === 'function') {
79
- packageResult();
80
- }
81
- // Handle loadedByExternalHost usage - create package and expo application
82
- if (options.usage === 'loadedByExternalHost') {
83
- // Create an expo application without prompts
77
+ // // Create a package with the same name as the runtime and distribution set to none
78
+ // const packageResult = await addPackageGenerator(tree, {
79
+ // packageName: userInputRuntimeName,
80
+ // scope: 'none',
81
+ // });
82
+ // // Execute the package generation callback if it exists
83
+ // if (packageResult && typeof packageResult === 'function') {
84
+ // packageResult();
85
+ // }
86
+ // Handle loadedByExternalHost usage - create package and dev application
87
+ if (options.standalone === true) {
88
+ // Create an dev application without prompts
84
89
  const applicationResult = await (0, add_application_1.addApplicationGenerator)(tree, {
85
- name: `${userInputRuntimeName}-expo`,
86
- servingType: 'interactive-playground',
90
+ name: `${userInputRuntimeName}-dev`,
91
+ servingType: 'local-dev-playground',
87
92
  runtimeName: userInputRuntimeName,
88
93
  });
89
94
  // Execute the application generation callback if it exists
@@ -91,6 +96,8 @@ async function addRuntimeGenerator(tree, options) {
91
96
  applicationResult();
92
97
  }
93
98
  }
99
+ // Install selected dependencies
100
+ (0, dependency_config_1.installSelectedDependencies)(tree, selectedDependencies);
94
101
  await (0, devkit_1.formatFiles)(tree);
95
102
  // Return a function that will be executed after all file operations are complete
96
103
  return () => {
@@ -99,12 +106,11 @@ async function addRuntimeGenerator(tree, options) {
99
106
  devkit_1.logger.info('');
100
107
  devkit_1.logger.info(`🚀 Runtime Name: ${userInputRuntimeName}`);
101
108
  devkit_1.logger.info(`📁 Location: ${projectRoot}`);
102
- devkit_1.logger.info(`🔧 Usage: ${options.usage}`);
103
- if (options.usage === 'loadedByExternalHost') {
109
+ devkit_1.logger.info(`🔧 Standalone: ${options.standalone ? 'Yes' : 'No'}`);
110
+ if (options.standalone === true) {
104
111
  devkit_1.logger.info('');
105
112
  devkit_1.logger.info('📦 Additional components created:');
106
- devkit_1.logger.info(` • Package: ${userInputRuntimeName} (scope: none)`);
107
- devkit_1.logger.info(` • Expo Application: ${userInputRuntimeName}-expo`);
113
+ devkit_1.logger.info(` • Dev Application: ${userInputRuntimeName}-dev`);
108
114
  }
109
115
  devkit_1.logger.info('');
110
116
  };
@@ -1,4 +1,5 @@
1
1
  export interface AddRuntimeGeneratorSchema {
2
2
  name: string;
3
- usage: 'loadedByExternalHost' | 'composedIntoAnotherRuntime';
3
+ standalone: boolean;
4
+ dependencies?: string[];
4
5
  }