@unisphere/nx 1.1.1 → 1.1.3
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 +163 -14
- package/dist/generators/add-application/templates/interactive-playground/src/app/app.tsx.template +104 -10
- package/dist/generators/add-package/add-package.d.ts.map +1 -1
- package/dist/generators/add-package/add-package.js +77 -0
- package/dist/generators/add-package/schema.json +16 -16
- package/dist/generators/add-package/templates/new-package/src/index.ts.template +1 -0
- package/dist/generators/add-package/templates/new-package/tsconfig.lib.json +1 -1
- package/dist/generators/add-runtime/add-runtime.js +9 -9
- package/dist/generators/add-runtime/schema.d.ts +1 -1
- package/dist/generators/add-runtime/schema.json +4 -4
- package/dist/generators/add-runtime/templates/new-runtime/src/lib/runtime.tsx.template +3 -0
- package/dist/generators/add-visual/templates/new-visual/render-method.template +1 -1
- package/package.json +3 -2
- package/dist/generators/add-package/templates/new-package/src/index.ts +0 -1
- package/dist/generators/add-package/templates/new-package/src/lib/.keep +0 -0
package/README.md
CHANGED
|
@@ -1,32 +1,181 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Getting Started with Unisphere Project
|
|
2
2
|
|
|
3
|
-
This
|
|
3
|
+
> This is a temporary documentation to the @unisphere/nx plugin until the official documentation is available.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Unisphere is Kaltura’s frontend framework for building dynamic, composable experiences. A **Unisphere project** is a structured repository that allows developers to create and organize **applications**, **runtimes**, and **packages** under a single cohesive experience. This setup encourages healthy module separation, runtime decoupling, reusability, and clean ownership boundaries — all key ingredients for scaling product development in a multi-team environment.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Whether you're building a full application like _Content Lab_ or a lightweight widget like _Chat_, Unisphere gives you the tooling and conventions to do it the right way from the start.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
---
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
## Create a New Unisphere Project
|
|
12
12
|
|
|
13
|
+
To scaffold a new project you can use [create-unisphere-project](https://www.npmjs.com/package/create-unisphere-project) npm package with all necessary tooling and structure, run:
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
```bash
|
|
16
|
+
npm create unisphere-project@latest
|
|
17
|
+
```
|
|
15
18
|
|
|
16
|
-
|
|
19
|
+
> ⚠️ **This generator is currently available only to Kaltura developers.**
|
|
20
|
+
> It depends on internal resources such as CI/CD templates, design systems, and private NPM packages. External support for Kaltura customers is on our roadmap.
|
|
17
21
|
|
|
18
|
-
|
|
22
|
+
**Before running the command**, make sure you have a valid `GITHUB_TOKEN` exported in your environment. This is required for GitHub operations during setup.
|
|
19
23
|
|
|
20
|
-
|
|
24
|
+
---
|
|
21
25
|
|
|
22
|
-
|
|
26
|
+
### Set Up the GitHub Repository
|
|
23
27
|
|
|
24
|
-
|
|
28
|
+
Once the project is generated locally, you’ll need to create a new GitHub repository so that CI/CD can operate correctly and your team has proper access.
|
|
25
29
|
|
|
30
|
+
Please contact **Eran Sakal** or **Omri Ceisler** to provision the repository. The following steps will be completed as part of this process:
|
|
26
31
|
|
|
27
|
-
|
|
32
|
+
1. **Repository Creation**
|
|
33
|
+
The new repo will be created with **internal scope** and named according to this convention:
|
|
28
34
|
|
|
29
|
-
|
|
35
|
+
```
|
|
36
|
+
unisphere-{friendly-experience-name}
|
|
37
|
+
```
|
|
30
38
|
|
|
39
|
+
> The friendly name is derived from your declared experience name (e.g., `unisphere.widget.reactions` → `reactions` → `unisphere-reactions` as the repository name).
|
|
31
40
|
|
|
41
|
+
2. **Team Access Configuration**
|
|
42
|
+
The appropriate GitHub teams will be granted access to the repository to match the experience's ownership and collaboration needs.
|
|
32
43
|
|
|
44
|
+
3. **CI/CD Enablement**
|
|
45
|
+
These steps are required to ensure that CI/CD workflows are automatically triggered for builds, deployments, versioning, and testing.
|
|
46
|
+
|
|
47
|
+
Once created, you can push your local project into the new repository and begin active development.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Use the `@unisphere/nx` Plugin
|
|
52
|
+
|
|
53
|
+
After your project is set up, you’ll use the `@unisphere/nx` plugin to generate and manage your project’s core elements. All generators are interactive and designed to enforce Unisphere best practices and conventions.
|
|
54
|
+
|
|
55
|
+
All generators support interactive usage through `nx g` and prompt you for the correct configuration.
|
|
56
|
+
|
|
57
|
+
### 🧹 `add-runtime`
|
|
58
|
+
|
|
59
|
+
Creates a new **runtime**, one of the possible entry points into an experience. Runtimes define **where** and **how** a specific part of the experience is used.
|
|
60
|
+
|
|
61
|
+
For example, in the **Genie experience**, there's a runtime called **page** used when the host injects the experience into the main body of a site, and another called **player-plugin** for injecting it into a player drawer. We have additional runtimes, one for each tool that is used by the experience, e.g **flashcards-tool**, **source-tool**, **follow-up-tool** etc.
|
|
62
|
+
|
|
63
|
+
Naming your runtime based on its integration point helps communicate its purpose and role clearly.
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
npx nx g @unisphere/nx:add-runtime
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
#### Prompts
|
|
70
|
+
|
|
71
|
+
- **Runtime name** – e.g., `page`, `player-plugin`, `flashcards-tool`, `source-tool`, `follow-up-tool`, `content-lab-drawer`.
|
|
72
|
+
|
|
73
|
+
- **How will this runtime be used?**
|
|
74
|
+
|
|
75
|
+
- **Loaded by External Host**
|
|
76
|
+
|
|
77
|
+
- Deployed independently and loaded at runtime
|
|
78
|
+
|
|
79
|
+
- **Embedded in Widget Playground**
|
|
80
|
+
- Composed by other runtimes, no standalone deployment
|
|
81
|
+
|
|
82
|
+
- **How will this runtime be used?**
|
|
83
|
+
|
|
84
|
+
- **Independent experience used as an entry point (loaded by host or another experience)**
|
|
85
|
+
|
|
86
|
+
- Includes an Expo playground expo application for developing and simulating a host environment
|
|
87
|
+
|
|
88
|
+
- **Composed into another runtime of this experience (not used as an entry point)**
|
|
89
|
+
|
|
90
|
+
- Composed by another runtime within the same experience
|
|
91
|
+
|
|
92
|
+
- Assume it is developed using a playground expo application of another runtime in the project
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
### 🎨 `add-visual`
|
|
97
|
+
|
|
98
|
+
Creates a **visual component** within a runtime — the building blocks of your UI.
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
npx nx g @unisphere/nx:add-visual
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
#### Prompts
|
|
105
|
+
|
|
106
|
+
- **Runtime name** – Where this visual belongs
|
|
107
|
+
- **Visual name** – e.g., `card`, `toolbar`, `timeline-visual`
|
|
108
|
+
- **Is this visual limited to a single occurrence?**
|
|
109
|
+
Choose `Yes` for singleton visuals (e.g., when the visual represent a container that can only have one instance), otherwise `No`.
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
### 📱 `add-application`
|
|
114
|
+
|
|
115
|
+
Creates an **application** that acts as a host for your runtime(s). These apps can be used for development, standalone deployments, or iframe integrations. The application can be used as a playground for developing and simulating a host environment without the need to deploy the experience to a customer, or it can be an additional entry point for the experience and use the Unisphere ci/cd to be publically available in multi region environments.
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
npx nx g @unisphere/nx:add-application
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
#### Prompts
|
|
122
|
+
|
|
123
|
+
- **Application name**
|
|
124
|
+
|
|
125
|
+
- **Serving type**
|
|
126
|
+
|
|
127
|
+
- **Interactive Playground** – Local development using Expo (used mostly for development and testing)
|
|
128
|
+
- **Self-Hosted** – Standalone deployment with routing/auth (used for publically available applications)
|
|
129
|
+
- **Iframe + Query Params** – Embedded apps with config in URL (used for embedding into other applications like Kaltura Admin or KMC)
|
|
130
|
+
- **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.
|
|
131
|
+
|
|
132
|
+
- **Runtime to load in playground** (if Playground selected)
|
|
133
|
+
|
|
134
|
+
- **HTML page title** (if not using Playground)
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
### 📦 `add-package`
|
|
139
|
+
|
|
140
|
+
Creates a shared **package** for separating concerns within an experience. Most of the actual code in a Unisphere project lives in packages — not in runtimes — making it easier to reuse components, services, and logic across multiple entry points. These packages are usually not distributed externally but serve as internal modules consumed by runtimes.
|
|
141
|
+
|
|
142
|
+
By using packages this way, you can introduce multiple runtimes (e.g., page, player-plugin, admin-panel) that share the same functionality while remaining decoupled.
|
|
143
|
+
|
|
144
|
+
Some packages, however, are designed for external consumption. For example:
|
|
145
|
+
|
|
146
|
+
- Each experience has a `Core` package expose the types needed for runtime integration.
|
|
147
|
+
- Differetn `kit` packages act as extendable, design-system-driven building blocks that allow other teams to plug into your experience in a consistent and styled way.
|
|
148
|
+
|
|
149
|
+
Packages can be published to GitHub or npm, but in most cases, they serve as a clean internal abstraction layer inside the experience repository without being deployed.
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
npx nx g @unisphere/nx:add-package
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
#### Prompts
|
|
156
|
+
|
|
157
|
+
- **Package name**
|
|
158
|
+
- **Package scope**
|
|
159
|
+
|
|
160
|
+
- **None (no scope)** - Used only internally by the experience runtimes.
|
|
161
|
+
- **Internal** - Published to GitHub packages (`@kaltura/unisphere-<experience-name>-<package-name>`)
|
|
162
|
+
- **Public** - Published to npm (`@unisphere/<experience-name>-<package-name>`)
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## Best Practices
|
|
167
|
+
|
|
168
|
+
🧠 Use descriptive names that reflect the purpose of the runtime or visual. For example, use `player-plugin` for a runtime that integrates into a video player, or `container` for visual that represent a container that can only have one instance, or `drawer` if it is a drawer runtime.
|
|
169
|
+
|
|
170
|
+
🎯 Select the correct runtime type depending on the deployment context. Choose "Independent experience" if the runtime will be loaded by a host or standalone app, and "Composed into another runtime" if it will only exist as part of a larger experience.
|
|
171
|
+
|
|
172
|
+
♻️ Share logic and components using packages. Most Unisphere code lives in packages rather than runtimes. This promotes reusability and modularity — for instance, content-lab-drawer and content-lab-modal runtimes may reuse the same internal package. Use the non scoped package if you are not sure what to choose.
|
|
173
|
+
|
|
174
|
+
🔍 Use the interactive CLI mode to generate all project elements. This ensures naming consistency, correct scaffolding, and alignment with Unisphere conventions.
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## What’s Next?
|
|
179
|
+
|
|
180
|
+
Stay tuned for full documentation on each concept and tool at
|
|
181
|
+
**[unisphere.kaltura.com](https://unisphere.kaltura.com)** _(coming soon)_
|
package/dist/generators/add-application/templates/interactive-playground/src/app/app.tsx.template
CHANGED
|
@@ -10,6 +10,98 @@ import { UnisphereWorkspaceConfig } from '@unisphere/runtime';
|
|
|
10
10
|
import { UnisphereWorkspaceType } from '@unisphere/runtime';
|
|
11
11
|
import { <%= runtimeName__pascalCase %>Runtime } from '<%= coreAlias %>';
|
|
12
12
|
|
|
13
|
+
|
|
14
|
+
const Hihi: React.FC = () => {
|
|
15
|
+
return (
|
|
16
|
+
<div
|
|
17
|
+
style={{
|
|
18
|
+
display: 'flex',
|
|
19
|
+
flexDirection: 'column',
|
|
20
|
+
alignItems: 'center',
|
|
21
|
+
justifyContent: 'center',
|
|
22
|
+
height: '100vh',
|
|
23
|
+
padding: '2rem',
|
|
24
|
+
backgroundColor: '#f9f9f9',
|
|
25
|
+
color: '#333',
|
|
26
|
+
fontFamily: 'sans-serif',
|
|
27
|
+
textAlign: 'center',
|
|
28
|
+
}}
|
|
29
|
+
>
|
|
30
|
+
<h1
|
|
31
|
+
style={{
|
|
32
|
+
fontSize: '1.5rem',
|
|
33
|
+
}}
|
|
34
|
+
>
|
|
35
|
+
Hihi :)
|
|
36
|
+
</h1>
|
|
37
|
+
|
|
38
|
+
<h2
|
|
39
|
+
style={{
|
|
40
|
+
fontSize: '1.0rem',
|
|
41
|
+
marginBottom: '1rem',
|
|
42
|
+
}}
|
|
43
|
+
>
|
|
44
|
+
No visuals are mounted yet
|
|
45
|
+
</h2>
|
|
46
|
+
|
|
47
|
+
<p
|
|
48
|
+
style={{
|
|
49
|
+
fontSize: '1rem',
|
|
50
|
+
maxWidth: '400px',
|
|
51
|
+
lineHeight: 1.4,
|
|
52
|
+
marginBottom: '2rem',
|
|
53
|
+
}}
|
|
54
|
+
>
|
|
55
|
+
You haven’t created a runtime visual or just didn't mount it in the Expo
|
|
56
|
+
application. Once you add one, open{' '}
|
|
57
|
+
<span
|
|
58
|
+
style={{
|
|
59
|
+
backgroundColor: '#eaeaea',
|
|
60
|
+
padding: '0.2rem 0.4rem',
|
|
61
|
+
borderRadius: '4px',
|
|
62
|
+
fontFamily: 'monospace',
|
|
63
|
+
}}
|
|
64
|
+
>
|
|
65
|
+
app.tsx
|
|
66
|
+
</span>{' '}
|
|
67
|
+
and uncomment the{' '}
|
|
68
|
+
<span
|
|
69
|
+
style={{
|
|
70
|
+
backgroundColor: '#eaeaea',
|
|
71
|
+
padding: '0.2rem 0.4rem',
|
|
72
|
+
borderRadius: '4px',
|
|
73
|
+
fontFamily: 'monospace',
|
|
74
|
+
}}
|
|
75
|
+
>
|
|
76
|
+
<UnisphereRuntimeVisual />
|
|
77
|
+
</span>{' '}
|
|
78
|
+
component to see it render here.
|
|
79
|
+
</p>
|
|
80
|
+
|
|
81
|
+
<pre
|
|
82
|
+
style={{
|
|
83
|
+
backgroundColor: '#fff',
|
|
84
|
+
padding: '1rem',
|
|
85
|
+
border: '1px solid #ddd',
|
|
86
|
+
borderRadius: '4px',
|
|
87
|
+
overflowX: 'auto',
|
|
88
|
+
fontFamily: 'monospace',
|
|
89
|
+
textAlign: 'left',
|
|
90
|
+
}}
|
|
91
|
+
>
|
|
92
|
+
{`<UnisphereRuntimeVisual
|
|
93
|
+
widgetName="unisphere.widget.<%= widgetName__lowerDashCase %>"
|
|
94
|
+
runtimeName="<%= runtimeName__lowerDashCase %>"
|
|
95
|
+
visualType="-- provide here the visual name --"
|
|
96
|
+
visualSettings={{
|
|
97
|
+
-- provide here the visual settings --
|
|
98
|
+
}}
|
|
99
|
+
/>`}
|
|
100
|
+
</pre>
|
|
101
|
+
</div>
|
|
102
|
+
);
|
|
103
|
+
};
|
|
104
|
+
|
|
13
105
|
export function AppContent() {
|
|
14
106
|
const { configuration } = useContext(ConfigurationContext);
|
|
15
107
|
|
|
@@ -22,18 +114,18 @@ export function AppContent() {
|
|
|
22
114
|
() => {
|
|
23
115
|
/*
|
|
24
116
|
Developer Note:
|
|
25
|
-
|
|
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.
|
|
26
118
|
|
|
27
|
-
•
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
119
|
+
• If the runtime is already active in production or staging:
|
|
120
|
+
1. Open Unisphere (Cmd + K) and choose Manage Workspace Runtimes.
|
|
121
|
+
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.
|
|
123
|
+
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.
|
|
31
124
|
|
|
32
|
-
•
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
The application will save it in the local storage and will load it on the next run.
|
|
125
|
+
• If the runtime isn’t yet in use:
|
|
126
|
+
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.
|
|
128
|
+
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.
|
|
37
129
|
*/
|
|
38
130
|
|
|
39
131
|
try {
|
|
@@ -95,6 +187,8 @@ export function AppContent() {
|
|
|
95
187
|
onWorkspaceLoaded={onWorkspaceLoaded}
|
|
96
188
|
initialConfiguration={initialConfiguration}
|
|
97
189
|
>
|
|
190
|
+
<Hihi />
|
|
191
|
+
|
|
98
192
|
{/* <UnisphereRuntimeVisual
|
|
99
193
|
widgetName="unisphere.widget.<%= widgetName__lowerDashCase %>"
|
|
100
194
|
runtimeName="<%= runtimeName__lowerDashCase %>"
|
|
@@ -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,EAAiB,MAAM,YAAY,CAAC;AAE7E,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,EAAiB,MAAM,YAAY,CAAC;AAE7E,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAuGrD,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,yBAAyB,uBAyGnC;AAED,eAAe,mBAAmB,CAAC"}
|
|
@@ -5,6 +5,82 @@ 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
|
+
function generateDemoComponent(tree, projectRoot, vars) {
|
|
9
|
+
// path: packages/<pkg>/src/lib/panel-demo.tsx
|
|
10
|
+
const targetPath = `${projectRoot}/src/lib/${vars['packageName__lowerDashCase']}-demo.tsx`;
|
|
11
|
+
// component and logger names
|
|
12
|
+
const loggerName = `${vars['packageName__lowerDashCase']}-demo`;
|
|
13
|
+
const demoName = `${vars['packageName__pascalCase']}Demo`;
|
|
14
|
+
const content = `import { useContext, useEffect } from 'react';
|
|
15
|
+
import {
|
|
16
|
+
ScopedUnisphereWorkspaceContext,
|
|
17
|
+
useGetScopedWorkspaceLogger,
|
|
18
|
+
} from '@unisphere/runtime-react';
|
|
19
|
+
|
|
20
|
+
const Hihi = () => {
|
|
21
|
+
return (
|
|
22
|
+
<div
|
|
23
|
+
style={{
|
|
24
|
+
border: '2px dashed #888',
|
|
25
|
+
borderRadius: '8px',
|
|
26
|
+
padding: '2rem',
|
|
27
|
+
margin: '2rem auto',
|
|
28
|
+
maxWidth: '500px',
|
|
29
|
+
textAlign: 'center',
|
|
30
|
+
fontFamily: 'sans-serif',
|
|
31
|
+
color: '#444',
|
|
32
|
+
backgroundColor: '#fcfcfc',
|
|
33
|
+
}}
|
|
34
|
+
>
|
|
35
|
+
<h2
|
|
36
|
+
style={{
|
|
37
|
+
marginBottom: '1rem',
|
|
38
|
+
fontSize: '1.25rem',
|
|
39
|
+
fontWeight: 500,
|
|
40
|
+
}}
|
|
41
|
+
>
|
|
42
|
+
Hihi :)
|
|
43
|
+
</h2>
|
|
44
|
+
<p
|
|
45
|
+
style={{
|
|
46
|
+
lineHeight: 1.5,
|
|
47
|
+
marginBottom: '1.5rem',
|
|
48
|
+
fontSize: '1rem',
|
|
49
|
+
}}
|
|
50
|
+
>
|
|
51
|
+
This '${demoName}' component shows you how to connect with the Unisphere workspace and set up a scoped logger.
|
|
52
|
+
</p>
|
|
53
|
+
</div>
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const ${demoName} = () => {
|
|
58
|
+
const { unisphereWorkspace } = useContext(ScopedUnisphereWorkspaceContext);
|
|
59
|
+
const logger = useGetScopedWorkspaceLogger({
|
|
60
|
+
type: 'react',
|
|
61
|
+
name: '${loggerName}',
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
// example only - feel free to remove
|
|
66
|
+
logger.log('${loggerName} mounted');
|
|
67
|
+
return () => {
|
|
68
|
+
logger.log('${loggerName} unmounted');
|
|
69
|
+
};
|
|
70
|
+
}, []);
|
|
71
|
+
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
if (!unisphereWorkspace) return;
|
|
74
|
+
|
|
75
|
+
// you can access the unisphere workspace that renders the runtime this component is mounted in
|
|
76
|
+
}, [unisphereWorkspace]);
|
|
77
|
+
|
|
78
|
+
// render your visual
|
|
79
|
+
return <Hihi />;
|
|
80
|
+
};
|
|
81
|
+
`;
|
|
82
|
+
tree.write(targetPath, content);
|
|
83
|
+
}
|
|
8
84
|
async function addPackageGenerator(tree, options) {
|
|
9
85
|
// Validate and read .unisphere configuration
|
|
10
86
|
const unisphereConfig = (0, utils_1.validateUnisphereConfig)(tree);
|
|
@@ -68,6 +144,7 @@ async function addPackageGenerator(tree, options) {
|
|
|
68
144
|
});
|
|
69
145
|
// Update tsconfig.base.json with path mapping
|
|
70
146
|
(0, utils_1.updateTsConfigPaths)(tree, packageJsonName, `unisphere/packages/${userInputPackageName}/src/index.ts`);
|
|
147
|
+
generateDemoComponent(tree, projectRoot, templateVariables);
|
|
71
148
|
await (0, devkit_1.formatFiles)(tree);
|
|
72
149
|
// Return a function that will be executed after all file operations are complete
|
|
73
150
|
return () => {
|
|
@@ -15,23 +15,23 @@
|
|
|
15
15
|
"description": "The distribution scope of the package",
|
|
16
16
|
"default": "none",
|
|
17
17
|
"x-prompt": {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
]
|
|
18
|
+
"message": "What scope should this package have? If you’re unsure, choose Private.",
|
|
19
|
+
"type": "list",
|
|
20
|
+
"items": [
|
|
21
|
+
{
|
|
22
|
+
"value": "none",
|
|
23
|
+
"label": "Private – only for this Unisphere experience (not published externally)"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"value": "internal",
|
|
27
|
+
"label": "Kaltura – published as a GitHub package (@kaltura/unisphere-… for Kaltura teams)"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"value": "public",
|
|
31
|
+
"label": "Public – published to npm (@unisphere/… available to everyone)"
|
|
34
32
|
}
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
37
|
"required": [
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './lib/<%= packageName__lowerDashCase %>-demo';
|
|
@@ -69,17 +69,17 @@ async function addRuntimeGenerator(tree, options) {
|
|
|
69
69
|
const runtimePathKey = `unisphere-runtime-${userInputRuntimeName}`;
|
|
70
70
|
const runtimePathValue = `unisphere/runtimes/${userInputRuntimeName}/src/index.ts`;
|
|
71
71
|
(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
|
+
}
|
|
72
81
|
// Handle loadedByExternalHost usage - create package and expo application
|
|
73
82
|
if (options.usage === 'loadedByExternalHost') {
|
|
74
|
-
// Create a package with the same name as the runtime and distribution set to none
|
|
75
|
-
const packageResult = await (0, add_package_1.addPackageGenerator)(tree, {
|
|
76
|
-
packageName: userInputRuntimeName,
|
|
77
|
-
scope: 'none',
|
|
78
|
-
});
|
|
79
|
-
// Execute the package generation callback if it exists
|
|
80
|
-
if (packageResult && typeof packageResult === 'function') {
|
|
81
|
-
packageResult();
|
|
82
|
-
}
|
|
83
83
|
// Create an expo application without prompts
|
|
84
84
|
const applicationResult = await (0, add_application_1.addApplicationGenerator)(tree, {
|
|
85
85
|
name: `${userInputRuntimeName}-expo`,
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
"items": [
|
|
20
20
|
{
|
|
21
21
|
"value": "loadedByExternalHost",
|
|
22
|
-
"label": "
|
|
22
|
+
"label": "Independent experience used as an entry point (loaded by host or another experience)"
|
|
23
23
|
},
|
|
24
24
|
{
|
|
25
|
-
"value": "
|
|
26
|
-
"label": "
|
|
27
|
-
}
|
|
25
|
+
"value": "composedIntoAnotherRuntime",
|
|
26
|
+
"label": "Composed into another runtime of this experience (not used as an entry point)"
|
|
27
|
+
}
|
|
28
28
|
]
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -31,6 +31,9 @@ export class Runtime
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
constructor(options: CreateElementOptions<<%= runtimeName__pascalCase %>RuntimeSettings>) {
|
|
34
|
+
/*
|
|
35
|
+
Developer Note: to generate a visual run `npx nx g @unisphere/nx:add-visual`
|
|
36
|
+
*/
|
|
34
37
|
super({
|
|
35
38
|
...options,
|
|
36
39
|
settingsSchema: <%= runtimeName__camelCase %>RuntimeSettingsSchema,
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
this._logger.log('rendering <%= visualName__humanReadable %>');
|
|
10
10
|
|
|
11
11
|
visual.htmlContainer?.render(
|
|
12
|
-
<ScopedUnisphereWorkspaceProvider unisphereWorkspace={this._workspace}>
|
|
12
|
+
<ScopedUnisphereWorkspaceProvider unisphereWorkspace={this._workspace} runtimeLogger={this._logger}>
|
|
13
13
|
<ThemeProvider
|
|
14
14
|
cssPrefix={'<%= widgetName__lowerDashCase %>-<%= runtimeName__lowerDashCase %>-<%= visualName__lowerDashCase %>'}
|
|
15
15
|
mode={typeof this._theme === 'string' ? this._theme : this._theme.mode}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unisphere/nx",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -75,7 +75,8 @@
|
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
77
|
"@nx/devkit": "21.2.1",
|
|
78
|
-
"tslib": "^2.3.0"
|
|
78
|
+
"tslib": "^2.3.0",
|
|
79
|
+
"ts-morph": "^26.0.0"
|
|
79
80
|
},
|
|
80
81
|
"generators": "./generators.json",
|
|
81
82
|
"files": [
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
File without changes
|