@unisphere/nx 1.18.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.
- package/README.md +4 -4
- package/dist/generators/add-application/add-application.d.ts.map +1 -1
- package/dist/generators/add-application/add-application.js +74 -30
- package/dist/generators/add-application/schema.d.ts +2 -1
- package/dist/generators/add-application/schema.json +16 -33
- package/dist/generators/add-application/templates/default/package.json.template +2 -1
- package/dist/generators/add-application/templates/default/src/app/app.tsx.template +24 -3
- package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/package.json +2 -4
- package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/src/app/app.tsx.template +8 -12
- package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/src/app/components/header.tsx.template +1 -1
- package/dist/generators/add-package/add-package.d.ts.map +1 -1
- package/dist/generators/add-package/add-package.js +9 -1
- package/dist/generators/add-package/schema.d.ts +1 -0
- package/dist/generators/add-package/schema.json +29 -1
- package/dist/generators/add-runtime/add-runtime.d.ts.map +1 -1
- package/dist/generators/add-runtime/add-runtime.js +14 -6
- package/dist/generators/add-runtime/schema.d.ts +1 -0
- package/dist/generators/add-runtime/schema.json +44 -2
- package/dist/generators/add-runtime/templates/new-runtime/src/lib/create-factory.tsx.template +13 -12
- package/dist/generators/dependency-config.d.ts +23 -0
- package/dist/generators/dependency-config.d.ts.map +1 -0
- package/dist/generators/dependency-config.js +134 -0
- package/dist/generators/unisphere-migrate/run-locally.md +4 -1
- package/dist/generators/unisphere-migrate/upgrade-guide.md +22 -6
- package/dist/migrations/update-1-1-5/templates/_publish-artifacts.template +210 -0
- package/dist/migrations/update-1-1-5/templates/cicd.template +13 -3
- package/dist/migrations/update-1-1-5/update-github-workflow.d.ts.map +1 -1
- package/dist/migrations/update-1-1-5/update-github-workflow.js +28 -17
- package/package.json +2 -2
- /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/.babelrc +0 -0
- /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/.eslintrc.json +0 -0
- /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/jest.config.ts +0 -0
- /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/project.json +0 -0
- /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/src/app/components/settings-buttons.tsx +0 -0
- /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/src/app/components/settings-form.tsx +0 -0
- /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/src/app/components/settings.tsx +0 -0
- /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/src/app/configuration-provider.tsx +0 -0
- /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/src/app/definitions.ts +0 -0
- /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/src/app/utils/merge-deep.ts +0 -0
- /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/src/favicon.ico +0 -0
- /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/src/index.html +0 -0
- /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/src/main.tsx +0 -0
- /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/src/styles.css +0 -0
- /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/tsconfig.app.json +0 -0
- /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/tsconfig.json +0 -0
- /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/tsconfig.spec.json +0 -0
- /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
|
|
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
|
|
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
|
-
- **
|
|
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;
|
|
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 === '
|
|
28
|
-
? `${options.runtimeName || 'Runtime'} -
|
|
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 === '
|
|
45
|
-
? 'templates/
|
|
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
|
-
//
|
|
50
|
-
|
|
51
|
-
|
|
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:
|
|
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 === '
|
|
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} -
|
|
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: '
|
|
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": "
|
|
27
|
-
"label": "
|
|
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
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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,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
|
|
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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 %>-
|
|
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 %>-
|
|
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 %>
|
|
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;
|
|
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
|
|
@@ -120,12 +121,17 @@ export const ${demoName} = () => {
|
|
|
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 () => {
|
|
@@ -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;
|
|
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,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
|
const add_application_1 = require("../add-application/add-application");
|
|
9
10
|
function updateCoreIndexExport(tree, runtimeName) {
|
|
10
11
|
const coreIndexPath = 'unisphere/packages/core/src/index.ts';
|
|
@@ -27,10 +28,15 @@ function updateCoreIndexExport(tree, runtimeName) {
|
|
|
27
28
|
async function addRuntimeGenerator(tree, options) {
|
|
28
29
|
// Validate and read .unisphere configuration
|
|
29
30
|
const unisphereConfig = (0, utils_1.validateUnisphereConfig)(tree);
|
|
31
|
+
// Validate dependencies
|
|
32
|
+
const selectedDependencies = options.dependencies || [];
|
|
33
|
+
(0, dependency_config_1.validateGitToken)(selectedDependencies);
|
|
30
34
|
// Extract environment variables
|
|
31
35
|
const companyName = unisphereConfig.company;
|
|
32
36
|
const widgetName = unisphereConfig.name;
|
|
33
|
-
|
|
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);
|
|
34
40
|
const coreAlias = (0, utils_1.findCorePackageAlias)(tree);
|
|
35
41
|
// Prepare template variables
|
|
36
42
|
const templateVariables = {
|
|
@@ -77,12 +83,12 @@ async function addRuntimeGenerator(tree, options) {
|
|
|
77
83
|
// if (packageResult && typeof packageResult === 'function') {
|
|
78
84
|
// packageResult();
|
|
79
85
|
// }
|
|
80
|
-
// Handle loadedByExternalHost usage - create package and
|
|
86
|
+
// Handle loadedByExternalHost usage - create package and dev application
|
|
81
87
|
if (options.standalone === true) {
|
|
82
|
-
// Create an
|
|
88
|
+
// Create an dev application without prompts
|
|
83
89
|
const applicationResult = await (0, add_application_1.addApplicationGenerator)(tree, {
|
|
84
|
-
name: `${userInputRuntimeName}-
|
|
85
|
-
servingType: '
|
|
90
|
+
name: `${userInputRuntimeName}-dev`,
|
|
91
|
+
servingType: 'local-dev-playground',
|
|
86
92
|
runtimeName: userInputRuntimeName,
|
|
87
93
|
});
|
|
88
94
|
// Execute the application generation callback if it exists
|
|
@@ -90,6 +96,8 @@ async function addRuntimeGenerator(tree, options) {
|
|
|
90
96
|
applicationResult();
|
|
91
97
|
}
|
|
92
98
|
}
|
|
99
|
+
// Install selected dependencies
|
|
100
|
+
(0, dependency_config_1.installSelectedDependencies)(tree, selectedDependencies);
|
|
93
101
|
await (0, devkit_1.formatFiles)(tree);
|
|
94
102
|
// Return a function that will be executed after all file operations are complete
|
|
95
103
|
return () => {
|
|
@@ -102,7 +110,7 @@ async function addRuntimeGenerator(tree, options) {
|
|
|
102
110
|
if (options.standalone === true) {
|
|
103
111
|
devkit_1.logger.info('');
|
|
104
112
|
devkit_1.logger.info('📦 Additional components created:');
|
|
105
|
-
devkit_1.logger.info(` •
|
|
113
|
+
devkit_1.logger.info(` • Dev Application: ${userInputRuntimeName}-dev`);
|
|
106
114
|
}
|
|
107
115
|
devkit_1.logger.info('');
|
|
108
116
|
};
|
|
@@ -15,7 +15,49 @@
|
|
|
15
15
|
"description": "Is this experience being loaded by the host application, or by another experience (not this one)?",
|
|
16
16
|
"x-prompt": {
|
|
17
17
|
"message": "Is this experience being loaded by the host application, or by another experience (not this one)?",
|
|
18
|
-
"type": "
|
|
18
|
+
"type": "list",
|
|
19
|
+
"items": [
|
|
20
|
+
{
|
|
21
|
+
"value": true,
|
|
22
|
+
"label": "Yes -loaded by host application"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"value": false,
|
|
26
|
+
"label": "No - loaded by another experience"
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"type": "array",
|
|
33
|
+
"description": "Select packages to install (use space to select, enter to confirm)",
|
|
34
|
+
"items": {
|
|
35
|
+
"type": "string",
|
|
36
|
+
"enum": [
|
|
37
|
+
"react",
|
|
38
|
+
"ds",
|
|
39
|
+
"mui"
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
"default": [],
|
|
43
|
+
"x-prompt": {
|
|
44
|
+
"message": "Select dependencies to install (use space to select, enter to confirm):",
|
|
45
|
+
"type": "list",
|
|
46
|
+
"multiselect": true,
|
|
47
|
+
"items": [
|
|
48
|
+
{
|
|
49
|
+
"value": "react",
|
|
50
|
+
"label": "React - UI library for building components"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"value": "ds",
|
|
54
|
+
"label": "Kaltura DS - Design System (requires GIT_TOKEN)"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"value": "mui",
|
|
58
|
+
"label": "Material UI - Component library"
|
|
59
|
+
}
|
|
60
|
+
]
|
|
19
61
|
}
|
|
20
62
|
}
|
|
21
63
|
},
|
|
@@ -23,4 +65,4 @@
|
|
|
23
65
|
"name",
|
|
24
66
|
"standalone"
|
|
25
67
|
]
|
|
26
|
-
}
|
|
68
|
+
}
|