@unisphere/nx 3.20.0 → 3.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/generators/add-application/add-application.d.ts.map +1 -1
- package/dist/generators/add-application/add-application.js +37 -16
- package/dist/generators/add-application/schema.d.ts +1 -1
- package/dist/generators/add-application/schema.json +4 -0
- package/dist/generators/add-application/templates/assets-only/.babelrc +11 -0
- package/dist/generators/add-application/templates/assets-only/.env-template +6 -0
- package/dist/generators/add-application/templates/assets-only/.eslintrc.json +22 -0
- package/dist/generators/add-application/templates/assets-only/package.json.template +5 -0
- package/dist/generators/add-application/templates/assets-only/project.json.template +9 -0
- package/dist/generators/add-application/templates/assets-only/readme.md.template +13 -0
- package/dist/generators/add-application/templates/assets-only/src/assets/README.md +20 -0
- package/dist/generators/add-application/templates/assets-only/src/index.html.template +16 -0
- package/dist/generators/add-application/templates/assets-only/src/main.tsx.template +2 -0
- package/dist/generators/add-application/templates/assets-only/tsconfig.app.json +11 -0
- package/dist/generators/add-application/templates/assets-only/tsconfig.json +17 -0
- package/dist/generators/add-application/templates/assets-only/webpack.config.js.template +24 -0
- package/dist/generators/remove/remove.d.ts.map +1 -1
- package/dist/generators/remove/remove.js +10 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-application.d.ts","sourceRoot":"","sources":["../../../src/generators/add-application/add-application.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,IAAI,EAAgD,MAAM,YAAY,CAAC;AAE5G,OAAO,EAAE,6BAA6B,EAAE,MAAM,UAAU,CAAC;AAkHzD,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,6BAA6B,
|
|
1
|
+
{"version":3,"file":"add-application.d.ts","sourceRoot":"","sources":["../../../src/generators/add-application/add-application.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,IAAI,EAAgD,MAAM,YAAY,CAAC;AAE5G,OAAO,EAAE,6BAA6B,EAAE,MAAM,UAAU,CAAC;AAkHzD,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,6BAA6B,uBAoLvC;AAED,eAAe,uBAAuB,CAAC"}
|
|
@@ -79,19 +79,30 @@ async function addApplicationGenerator(tree, options) {
|
|
|
79
79
|
throw new Error('iframe-with-post-messages serving type is not currently supported. Please choose a different serving type.');
|
|
80
80
|
}
|
|
81
81
|
const isPlayground = options.servingType === 'local-dev-playground';
|
|
82
|
+
const isAssetsOnly = options.servingType === 'assets-only';
|
|
82
83
|
// Validate and read .unisphere configuration
|
|
83
84
|
const unisphereConfig = (0, utils_1.validateUnisphereConfig)(tree);
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
if (
|
|
88
|
-
|
|
85
|
+
let runtimeName = '';
|
|
86
|
+
let visualName = '';
|
|
87
|
+
let selectedDependencies = [];
|
|
88
|
+
if (isAssetsOnly) {
|
|
89
|
+
// Assets-only apps don't need runtime, visual, or dependencies
|
|
90
|
+
options.htmlPageTitle = options.htmlPageTitle || options.name;
|
|
91
|
+
selectedDependencies = [];
|
|
89
92
|
}
|
|
90
|
-
|
|
91
|
-
|
|
93
|
+
else {
|
|
94
|
+
const promptResult = await promptForRuntimeName(unisphereConfig.runtimes, options.runtimeName || '', options.visualName || '', options.skipDynamicRuntimeVisualPrompt || false);
|
|
95
|
+
runtimeName = promptResult.runtimeName;
|
|
96
|
+
visualName = promptResult.visualName;
|
|
97
|
+
if (!isPlayground && !options.htmlPageTitle) {
|
|
98
|
+
options.htmlPageTitle = options.htmlPageTitle || await promptForHtmlPageTitle();
|
|
99
|
+
}
|
|
100
|
+
if (options.dependencies === undefined) {
|
|
101
|
+
options.dependencies = await promptForDependencies(isPlayground);
|
|
102
|
+
}
|
|
103
|
+
const baseDependencies = ['react'];
|
|
104
|
+
selectedDependencies = [...baseDependencies, ...(options.dependencies || [])];
|
|
92
105
|
}
|
|
93
|
-
const baseDependencies = ['react'];
|
|
94
|
-
const selectedDependencies = [...baseDependencies, ...(options.dependencies || [])];
|
|
95
106
|
// Validate runtime exists if runtimeName is provided
|
|
96
107
|
if (runtimeName) {
|
|
97
108
|
if (!(0, utils_1.checkIfRuntimeExists)(tree, runtimeName)) {
|
|
@@ -132,7 +143,7 @@ async function addApplicationGenerator(tree, options) {
|
|
|
132
143
|
'Please choose a different application name or remove the existing application first.');
|
|
133
144
|
}
|
|
134
145
|
// Choose template based on serving type
|
|
135
|
-
const templatePath = 'templates/default';
|
|
146
|
+
const templatePath = isAssetsOnly ? 'templates/assets-only' : 'templates/default';
|
|
136
147
|
// Generate files from templates
|
|
137
148
|
(0, devkit_1.generateFiles)(tree, path.join(__dirname, templatePath), projectRoot, templateVariables);
|
|
138
149
|
// For local-dev-playground apps, generate setup-local-runtimes.ts
|
|
@@ -176,14 +187,19 @@ async function addApplicationGenerator(tree, options) {
|
|
|
176
187
|
const applicationPathValue = `${projectRoot}/src/index.ts`;
|
|
177
188
|
(0, utils_1.updateTsConfigPaths)(tree, applicationPathKey, applicationPathValue);
|
|
178
189
|
const scriptName = `serve:${applicationNameAsLowerDashCase}`;
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
190
|
+
if (!isAssetsOnly) {
|
|
191
|
+
const scriptCommand = runtimeName ?
|
|
192
|
+
`concurrently "npx unisphere runtime serve ${runtimeName} --port 8400" "npx unisphere application serve ${applicationNameAsLowerDashCase} --port 4002"`
|
|
193
|
+
: `npx unisphere application serve ${applicationNameAsLowerDashCase} --port 4002`;
|
|
194
|
+
(0, utils_1.addScriptToRootPackageJson)(tree, scriptName, scriptCommand);
|
|
195
|
+
}
|
|
183
196
|
await (0, devkit_1.formatFiles)(tree);
|
|
184
197
|
// Return a function that will be executed after all file operations are complete
|
|
198
|
+
const hasExtraDependencies = selectedDependencies.length > 0;
|
|
185
199
|
return () => {
|
|
186
|
-
(
|
|
200
|
+
if (hasExtraDependencies) {
|
|
201
|
+
(0, devkit_1.installPackagesTask)(tree, true);
|
|
202
|
+
}
|
|
187
203
|
devkit_1.logger.info('');
|
|
188
204
|
devkit_1.logger.info('✅ Application generated successfully!');
|
|
189
205
|
devkit_1.logger.info('');
|
|
@@ -191,7 +207,12 @@ async function addApplicationGenerator(tree, options) {
|
|
|
191
207
|
devkit_1.logger.info(`🔧 Serving Type: ${options.servingType}`);
|
|
192
208
|
devkit_1.logger.info(`📁 Location: ${projectRoot}`);
|
|
193
209
|
devkit_1.logger.info('');
|
|
194
|
-
|
|
210
|
+
if (isAssetsOnly) {
|
|
211
|
+
devkit_1.logger.info(`📂 Place your assets in: ${projectRoot}/src/assets/`);
|
|
212
|
+
}
|
|
213
|
+
else {
|
|
214
|
+
devkit_1.logger.info(`📜 To run the application locally: npm run ${scriptName}`);
|
|
215
|
+
}
|
|
195
216
|
devkit_1.logger.info('');
|
|
196
217
|
};
|
|
197
218
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export interface AddApplicationGeneratorSchema {
|
|
2
2
|
name: string;
|
|
3
3
|
htmlPageTitle?: string;
|
|
4
|
-
servingType: 'local-dev-playground' | 'self-hosted' | 'iframe-with-post-messages';
|
|
4
|
+
servingType: 'local-dev-playground' | 'self-hosted' | 'iframe-with-post-messages' | 'assets-only';
|
|
5
5
|
runtimeName?: string;
|
|
6
6
|
visualName?: string;
|
|
7
7
|
skipDynamicRuntimeVisualPrompt?: boolean; // Internal option to skip the dynamic prompt for visual when runtime is selected
|
|
@@ -33,6 +33,10 @@
|
|
|
33
33
|
{
|
|
34
34
|
"value": "iframe-with-post-messages",
|
|
35
35
|
"label": "Iframe + Post Messages (suitible to applications that gets required configuration from post messages)"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"value": "assets-only",
|
|
39
|
+
"label": "Assets Only (static assets served via CDN, no application logic)"
|
|
36
40
|
}
|
|
37
41
|
]
|
|
38
42
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": ["plugin:@nx/react", "../../../../.eslintrc.json"],
|
|
3
|
+
"ignorePatterns": [
|
|
4
|
+
"!**/*",
|
|
5
|
+
"**/vite.config.*.timestamp*",
|
|
6
|
+
"**/vitest.config.*.timestamp*"
|
|
7
|
+
],
|
|
8
|
+
"overrides": [
|
|
9
|
+
{
|
|
10
|
+
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
|
|
11
|
+
"rules": {}
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"files": ["*.ts", "*.tsx"],
|
|
15
|
+
"rules": {}
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"files": ["*.js", "*.jsx"],
|
|
19
|
+
"rules": {}
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "unisphere-application-<%= applicationName__lowerDashCase %>",
|
|
3
|
+
"$schema": "../../../../node_modules/nx/schemas/project-schema.json",
|
|
4
|
+
"sourceRoot": "<%= projectRoot %>/src",
|
|
5
|
+
"projectType": "application",
|
|
6
|
+
"tags": [],
|
|
7
|
+
"// targets": "to see all targets run: nx show project unisphere-application-<%= applicationName__lowerDashCase %> --web",
|
|
8
|
+
"targets": {}
|
|
9
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# <%= applicationName__pascalCase %> Application (Assets Only)
|
|
2
|
+
|
|
3
|
+
This is an assets-only application. Place your static assets in the `src/assets/` directory.
|
|
4
|
+
|
|
5
|
+
## Assets URL
|
|
6
|
+
|
|
7
|
+
After publishing, assets are available at:
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
https://unisphere.nvp1.ovp.kaltura.com/v1/static/applications/{experience name}/<%= applicationName__lowerDashCase %>/{version}/assets/
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Overview section
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Assets
|
|
2
|
+
|
|
3
|
+
Place your static assets in this directory. They are bundled automatically during the build process.
|
|
4
|
+
|
|
5
|
+
## Accessing Assets
|
|
6
|
+
|
|
7
|
+
Releasing a package will automatically deploy it to nvp1. Assets can be consumed without activating the version using the following URL pattern:
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
https://unisphere.nvp1.ovp.kaltura.com/v1/static/applications/{experience name}/{app name}/{version}/assets/
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
For example:
|
|
14
|
+
```
|
|
15
|
+
https://unisphere.nvp1.ovp.kaltura.com/v1/static/applications/vod-avatars/studio/1.1.0/assets/avatars/1X1/adam.png
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Caching
|
|
19
|
+
|
|
20
|
+
Caching is handled on the assets directly.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="utf-8" />
|
|
6
|
+
<title>
|
|
7
|
+
<%= htmlPageTitle %>
|
|
8
|
+
</title>
|
|
9
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
10
|
+
</head>
|
|
11
|
+
|
|
12
|
+
<body>
|
|
13
|
+
<div id="root"></div>
|
|
14
|
+
</body>
|
|
15
|
+
|
|
16
|
+
</html>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"jsx": "react-jsx",
|
|
4
|
+
"allowJs": false,
|
|
5
|
+
"esModuleInterop": false,
|
|
6
|
+
"allowSyntheticDefaultImports": true,
|
|
7
|
+
"strict": true
|
|
8
|
+
},
|
|
9
|
+
"files": [],
|
|
10
|
+
"include": [],
|
|
11
|
+
"references": [
|
|
12
|
+
{
|
|
13
|
+
"path": "./tsconfig.app.json"
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"extends": "../../../../tsconfig.base.json"
|
|
17
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const { NxAppWebpackPlugin } = require('@nx/webpack/app-plugin');
|
|
2
|
+
const { join } = require('path');
|
|
3
|
+
|
|
4
|
+
const baseHref = process.env.UNISPHERE_BASE_HREF || '/';
|
|
5
|
+
|
|
6
|
+
module.exports = {
|
|
7
|
+
output: {
|
|
8
|
+
path: join(__dirname, '../../../../dist/<%= projectRoot %>'),
|
|
9
|
+
publicPath: baseHref
|
|
10
|
+
},
|
|
11
|
+
plugins: [
|
|
12
|
+
new NxAppWebpackPlugin({
|
|
13
|
+
tsConfig: './tsconfig.app.json',
|
|
14
|
+
compiler: 'babel',
|
|
15
|
+
main: './src/main.tsx',
|
|
16
|
+
index: './src/index.html',
|
|
17
|
+
baseHref,
|
|
18
|
+
assets: [{ glob: '**/*', input: './src/assets', output: './assets', ignore: ['**/README.md'] }],
|
|
19
|
+
styles: [],
|
|
20
|
+
outputHashing: process.env['NODE_ENV'] === 'production' ? 'all' : 'none',
|
|
21
|
+
optimization: process.env['NODE_ENV'] === 'production',
|
|
22
|
+
}),
|
|
23
|
+
],
|
|
24
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remove.d.ts","sourceRoot":"","sources":["../../../src/generators/remove/remove.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EACL,IAAI,EAKL,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"remove.d.ts","sourceRoot":"","sources":["../../../src/generators/remove/remove.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EACL,IAAI,EAKL,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAiRjD,wBAAsB,eAAe,CACnC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,qBAAqB,iBAqF/B;AAED,eAAe,eAAe,CAAC"}
|
|
@@ -193,10 +193,20 @@ function removeFromPackageLock(tree, sourceRoot) {
|
|
|
193
193
|
const packageLock = (0, devkit_1.readJson)(tree, packageLockPath);
|
|
194
194
|
let updated = false;
|
|
195
195
|
if (packageLock.packages) {
|
|
196
|
+
// Remove the source entry
|
|
196
197
|
if (packageLock.packages[sourceRoot]) {
|
|
197
198
|
delete packageLock.packages[sourceRoot];
|
|
198
199
|
updated = true;
|
|
199
200
|
}
|
|
201
|
+
// Remove the node_modules symlink entry that points to this sourceRoot
|
|
202
|
+
for (const key of Object.keys(packageLock.packages)) {
|
|
203
|
+
if (key.startsWith('node_modules/') &&
|
|
204
|
+
packageLock.packages[key].resolved === sourceRoot &&
|
|
205
|
+
packageLock.packages[key].link === true) {
|
|
206
|
+
delete packageLock.packages[key];
|
|
207
|
+
updated = true;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
200
210
|
}
|
|
201
211
|
if (updated) {
|
|
202
212
|
(0, devkit_1.writeJson)(tree, packageLockPath, packageLock);
|