@unisphere/nx 1.0.1

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 (102) hide show
  1. package/README.md +32 -0
  2. package/dist/generators/add-application/add-application.d.ts +5 -0
  3. package/dist/generators/add-application/add-application.d.ts.map +1 -0
  4. package/dist/generators/add-application/add-application.js +98 -0
  5. package/dist/generators/add-application/schema.d.ts +6 -0
  6. package/dist/generators/add-application/schema.json +92 -0
  7. package/dist/generators/add-application/templates/default/.babelrc +11 -0
  8. package/dist/generators/add-application/templates/default/.eslintrc.json +18 -0
  9. package/dist/generators/add-application/templates/default/jest.config.d.ts +14 -0
  10. package/dist/generators/add-application/templates/default/jest.config.d.ts.map +1 -0
  11. package/dist/generators/add-application/templates/default/jest.config.js +13 -0
  12. package/dist/generators/add-application/templates/default/package.json.template +7 -0
  13. package/dist/generators/add-application/templates/default/project.json.template +9 -0
  14. package/dist/generators/add-application/templates/default/src/app/app.tsx.template +76 -0
  15. package/dist/generators/add-application/templates/default/src/favicon.ico +0 -0
  16. package/dist/generators/add-application/templates/default/src/index.html.template +17 -0
  17. package/dist/generators/add-application/templates/default/src/main.tsx +13 -0
  18. package/dist/generators/add-application/templates/default/src/styles.css +0 -0
  19. package/dist/generators/add-application/templates/default/tsconfig.app.json +24 -0
  20. package/dist/generators/add-application/templates/default/tsconfig.json +20 -0
  21. package/dist/generators/add-application/templates/default/tsconfig.spec.json +25 -0
  22. package/dist/generators/add-application/templates/default/webpack.config.js.template +33 -0
  23. package/dist/generators/add-application/templates/interactive-playground/.babelrc +11 -0
  24. package/dist/generators/add-application/templates/interactive-playground/.eslintrc.json +18 -0
  25. package/dist/generators/add-application/templates/interactive-playground/jest.config.d.ts +14 -0
  26. package/dist/generators/add-application/templates/interactive-playground/jest.config.d.ts.map +1 -0
  27. package/dist/generators/add-application/templates/interactive-playground/jest.config.js +13 -0
  28. package/dist/generators/add-application/templates/interactive-playground/package.json +7 -0
  29. package/dist/generators/add-application/templates/interactive-playground/project.json +9 -0
  30. package/dist/generators/add-application/templates/interactive-playground/src/app/app.tsx.template +122 -0
  31. package/dist/generators/add-application/templates/interactive-playground/src/app/components/header.tsx.template +123 -0
  32. package/dist/generators/add-application/templates/interactive-playground/src/app/components/settings-buttons.tsx +59 -0
  33. package/dist/generators/add-application/templates/interactive-playground/src/app/components/settings-form.tsx +104 -0
  34. package/dist/generators/add-application/templates/interactive-playground/src/app/components/settings.tsx +74 -0
  35. package/dist/generators/add-application/templates/interactive-playground/src/app/configuration-provider.tsx +163 -0
  36. package/dist/generators/add-application/templates/interactive-playground/src/app/definitions.d.ts +11 -0
  37. package/dist/generators/add-application/templates/interactive-playground/src/app/definitions.d.ts.map +1 -0
  38. package/dist/generators/add-application/templates/interactive-playground/src/app/definitions.js +19 -0
  39. package/dist/generators/add-application/templates/interactive-playground/src/app/utils/merge-deep.d.ts +13 -0
  40. package/dist/generators/add-application/templates/interactive-playground/src/app/utils/merge-deep.d.ts.map +1 -0
  41. package/dist/generators/add-application/templates/interactive-playground/src/app/utils/merge-deep.js +35 -0
  42. package/dist/generators/add-application/templates/interactive-playground/src/favicon.ico +0 -0
  43. package/dist/generators/add-application/templates/interactive-playground/src/index.html +17 -0
  44. package/dist/generators/add-application/templates/interactive-playground/src/main.tsx +13 -0
  45. package/dist/generators/add-application/templates/interactive-playground/src/styles.css +0 -0
  46. package/dist/generators/add-application/templates/interactive-playground/tsconfig.app.json +24 -0
  47. package/dist/generators/add-application/templates/interactive-playground/tsconfig.json +20 -0
  48. package/dist/generators/add-application/templates/interactive-playground/tsconfig.spec.json +25 -0
  49. package/dist/generators/add-application/templates/interactive-playground/webpack.config.js +33 -0
  50. package/dist/generators/add-package/README.md +70 -0
  51. package/dist/generators/add-package/add-package.d.ts +5 -0
  52. package/dist/generators/add-package/add-package.d.ts.map +1 -0
  53. package/dist/generators/add-package/add-package.js +85 -0
  54. package/dist/generators/add-package/files/.babelrc +12 -0
  55. package/dist/generators/add-package/files/.eslintrc.json +18 -0
  56. package/dist/generators/add-package/files/README.md +1 -0
  57. package/dist/generators/add-package/files/package.json.template +22 -0
  58. package/dist/generators/add-package/files/project.json.template +22 -0
  59. package/dist/generators/add-package/files/rollup.config.js +6 -0
  60. package/dist/generators/add-package/files/src/index.ts +1 -0
  61. package/dist/generators/add-package/files/tsconfig.json +20 -0
  62. package/dist/generators/add-package/files/tsconfig.lib.json +23 -0
  63. package/dist/generators/add-package/files/tsconfig.spec.json +26 -0
  64. package/dist/generators/add-package/files/vite.config.ts +30 -0
  65. package/dist/generators/add-package/schema.d.ts +4 -0
  66. package/dist/generators/add-package/schema.json +46 -0
  67. package/dist/generators/add-runtime/add-runtime.d.ts +5 -0
  68. package/dist/generators/add-runtime/add-runtime.d.ts.map +1 -0
  69. package/dist/generators/add-runtime/add-runtime.js +112 -0
  70. package/dist/generators/add-runtime/core-templates/__runtimeName__-runtime/runtime-types.ts.template +21 -0
  71. package/dist/generators/add-runtime/files/.babelrc +12 -0
  72. package/dist/generators/add-runtime/files/.eslintrc.json +18 -0
  73. package/dist/generators/add-runtime/files/README.md.template +1 -0
  74. package/dist/generators/add-runtime/files/package.json.template +12 -0
  75. package/dist/generators/add-runtime/files/project.json.template +22 -0
  76. package/dist/generators/add-runtime/files/rollup.config.js +6 -0
  77. package/dist/generators/add-runtime/files/src/index.ts +1 -0
  78. package/dist/generators/add-runtime/files/src/lib/create-factory.tsx.template +21 -0
  79. package/dist/generators/add-runtime/files/src/lib/runtime.tsx.template +66 -0
  80. package/dist/generators/add-runtime/files/tsconfig.json +20 -0
  81. package/dist/generators/add-runtime/files/tsconfig.lib.json +23 -0
  82. package/dist/generators/add-runtime/files/tsconfig.spec.json +26 -0
  83. package/dist/generators/add-runtime/files/vite.config.ts +30 -0
  84. package/dist/generators/add-runtime/schema.d.ts +4 -0
  85. package/dist/generators/add-runtime/schema.json +44 -0
  86. package/dist/generators/add-visual/add-visual.d.ts +8 -0
  87. package/dist/generators/add-visual/add-visual.d.ts.map +1 -0
  88. package/dist/generators/add-visual/add-visual.js +236 -0
  89. package/dist/generators/add-visual/files/render-method.template +31 -0
  90. package/dist/generators/add-visual/schema.d.ts +5 -0
  91. package/dist/generators/add-visual/schema.json +30 -0
  92. package/dist/generators/add-visual/visual-utils.d.ts +42 -0
  93. package/dist/generators/add-visual/visual-utils.d.ts.map +1 -0
  94. package/dist/generators/add-visual/visual-utils.js +99 -0
  95. package/dist/generators/utils.d.ts +18 -0
  96. package/dist/generators/utils.d.ts.map +1 -0
  97. package/dist/generators/utils.js +198 -0
  98. package/dist/index.d.ts +2 -0
  99. package/dist/index.d.ts.map +1 -0
  100. package/dist/index.js +2 -0
  101. package/generators.json +24 -0
  102. package/package.json +81 -0
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addRuntimeGenerator = addRuntimeGenerator;
4
+ const tslib_1 = require("tslib");
5
+ const devkit_1 = require("@nx/devkit");
6
+ const path = tslib_1.__importStar(require("path"));
7
+ const utils_1 = require("../utils");
8
+ const add_package_1 = require("../add-package/add-package");
9
+ const add_application_1 = require("../add-application/add-application");
10
+ function updateCoreIndexExport(tree, runtimeName) {
11
+ const coreIndexPath = 'unisphere/packages/core/src/index.ts';
12
+ if (!tree.exists(coreIndexPath)) {
13
+ throw new Error(`Core index file not found at ${coreIndexPath}`);
14
+ }
15
+ const currentContent = tree.read(coreIndexPath, 'utf-8');
16
+ if (!currentContent) {
17
+ throw new Error(`Failed to read content from ${coreIndexPath}`);
18
+ }
19
+ const exportLine = `export * from './lib/${runtimeName}-runtime/runtime-types';`;
20
+ // Check if the export already exists
21
+ if (currentContent.includes(exportLine)) {
22
+ return; // Already exported
23
+ }
24
+ // Add the export at the end of the file
25
+ const updatedContent = currentContent + '\n' + exportLine;
26
+ tree.write(coreIndexPath, updatedContent);
27
+ }
28
+ async function addRuntimeGenerator(tree, options) {
29
+ // Validate and read .unisphere configuration
30
+ const unisphereConfig = (0, utils_1.validateUnisphereConfig)(tree);
31
+ // Extract environment variables
32
+ const companyName = unisphereConfig.company;
33
+ const widgetName = unisphereConfig.name;
34
+ const userInputRuntimeName = (0, devkit_1.names)(options.name).fileName;
35
+ const coreAlias = (0, utils_1.findCorePackageAlias)(tree);
36
+ // Prepare template variables
37
+ const templateVariables = {
38
+ companyName,
39
+ coreAlias,
40
+ // Add all name transformations
41
+ ...(0, utils_1.createNameTransforms)(userInputRuntimeName, 'runtimeName'),
42
+ ...(0, utils_1.createNameTransforms)(widgetName, 'widgetName'),
43
+ tmpl: '',
44
+ };
45
+ const projectRoot = `unisphere/runtimes/${userInputRuntimeName}`;
46
+ // Check if the runtime already exists
47
+ if (tree.exists(projectRoot)) {
48
+ throw new Error(`Runtime "${userInputRuntimeName}" already exists at ${projectRoot}.\n` +
49
+ 'Please choose a different runtime name or remove the existing runtime first.');
50
+ }
51
+ // Check if the core runtime types file already exists
52
+ const coreRuntimeTypesPath = `unisphere/packages/core/src/lib/${userInputRuntimeName}-runtime/runtime-types.ts`;
53
+ if (tree.exists(coreRuntimeTypesPath)) {
54
+ throw new Error(`Runtime types file "${userInputRuntimeName}-runtime/runtime-types.ts" already exists in core package.\n` +
55
+ 'Please choose a different runtime name or remove the existing file first.');
56
+ }
57
+ // Generate files from templates for the runtime
58
+ (0, devkit_1.generateFiles)(tree, path.join(__dirname, 'files'), projectRoot, templateVariables);
59
+ // Generate the runtime types file in the core package using template
60
+ (0, devkit_1.generateFiles)(tree, path.join(__dirname, 'core-templates'), 'unisphere/packages/core/src/lib', templateVariables);
61
+ // Update core index.ts to export the new runtime types
62
+ updateCoreIndexExport(tree, userInputRuntimeName);
63
+ // Update .unisphere configuration
64
+ (0, utils_1.updateUnisphereConfig)(tree, 'runtimes', userInputRuntimeName, {
65
+ sourceRoot: `unisphere/runtimes/${userInputRuntimeName}`,
66
+ distributionChannel: 'unisphere',
67
+ });
68
+ // Update tsconfig.base.json with path mapping
69
+ const runtimePathKey = `unisphere-runtime-${userInputRuntimeName}`;
70
+ const runtimePathValue = `unisphere/runtimes/${userInputRuntimeName}/src/index.ts`;
71
+ (0, utils_1.updateTsConfigPaths)(tree, runtimePathKey, runtimePathValue);
72
+ // Handle loadedByExternalHost usage - create package and expo application
73
+ 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
+ // Create an expo application without prompts
84
+ const applicationResult = await (0, add_application_1.addApplicationGenerator)(tree, {
85
+ name: `${userInputRuntimeName}-expo`,
86
+ servingType: 'interactive-playground',
87
+ runtimeName: userInputRuntimeName
88
+ });
89
+ // Execute the application generation callback if it exists
90
+ if (applicationResult && typeof applicationResult === 'function') {
91
+ applicationResult();
92
+ }
93
+ }
94
+ await (0, devkit_1.formatFiles)(tree);
95
+ // Return a function that will be executed after all file operations are complete
96
+ return () => {
97
+ devkit_1.logger.info('');
98
+ devkit_1.logger.info('✅ Runtime generated successfully!');
99
+ devkit_1.logger.info('');
100
+ devkit_1.logger.info(`🚀 Runtime Name: ${userInputRuntimeName}`);
101
+ devkit_1.logger.info(`📁 Location: ${projectRoot}`);
102
+ devkit_1.logger.info(`🔧 Usage: ${options.usage}`);
103
+ if (options.usage === 'loadedByExternalHost') {
104
+ devkit_1.logger.info('');
105
+ 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`);
108
+ }
109
+ devkit_1.logger.info('');
110
+ };
111
+ }
112
+ exports.default = addRuntimeGenerator;
@@ -0,0 +1,21 @@
1
+ import { ValidatorSchema } from '@unisphere/core';
2
+ import { UnisphereRuntimeBaseType } from '@unisphere/runtime';
3
+ import { WidgetName } from '../widget-types';
4
+
5
+ export const <%= runtimeName__pascalCase %>RuntimeName = '<%= runtimeName__lowerDashCase %>' as const;
6
+
7
+ export type <%= runtimeName__pascalCase %>Runtime = UnisphereRuntimeBaseType<<%= runtimeName__pascalCase %>RuntimeSettings> & {
8
+ readonly widgetName: typeof WidgetName;
9
+ readonly runtimeName: typeof <%= runtimeName__pascalCase %>RuntimeName;
10
+ };
11
+
12
+ export interface <%= runtimeName__pascalCase %>RuntimeSettings {
13
+ schemaVersion?: string;
14
+ }
15
+
16
+ export const <%= runtimeName__camelCase %>RuntimeSettingsSchema: ValidatorSchema = {
17
+ type: 'object',
18
+ properties: {
19
+ schemaVersion: { type: 'literal', value: '1', optional: true },
20
+ },
21
+ };
@@ -0,0 +1,12 @@
1
+ {
2
+ "presets": [
3
+ [
4
+ "@nx/react/babel",
5
+ {
6
+ "runtime": "automatic",
7
+ "useBuiltIns": "usage"
8
+ }
9
+ ]
10
+ ],
11
+ "plugins": []
12
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "extends": ["plugin:@nx/react", "../../../.eslintrc.json"],
3
+ "ignorePatterns": ["!**/*"],
4
+ "overrides": [
5
+ {
6
+ "files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
7
+ "rules": {}
8
+ },
9
+ {
10
+ "files": ["*.ts", "*.tsx"],
11
+ "rules": {}
12
+ },
13
+ {
14
+ "files": ["*.js", "*.jsx"],
15
+ "rules": {}
16
+ }
17
+ ]
18
+ }
@@ -0,0 +1 @@
1
+ # Unisphere <%= widgetName__humanReadable %> - Package <%= runtimeName__humanReadable %>
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "unisphere-runtime-<%= runtimeName__lowerDashCase %>",
3
+ "version": "1.0.0",
4
+ "main": "./index.js",
5
+ "types": "./index.d.ts",
6
+ "exports": {
7
+ ".": {
8
+ "import": "./index.mjs",
9
+ "require": "./index.js"
10
+ }
11
+ }
12
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "unisphere-runtime-<%= runtimeName__lowerDashCase %>",
3
+ "$schema": "../../../node_modules/nx/schemas/project-schema.json",
4
+ "sourceRoot": "unisphere/runtimes/<%= runtimeName__lowerDashCase %>/src",
5
+ "projectType": "library",
6
+ "tags": [],
7
+ "// targets": "to see all targets run: nx show project unisphere-runtime-<%= runtimeName__lowerDashCase %> --web",
8
+ "targets": {
9
+ "lint": {
10
+ "executor": "@nx/eslint:lint",
11
+ "outputs": [
12
+ "{options.outputFile}"
13
+ ],
14
+ "options": {
15
+ "lintFilePatterns": [
16
+ "unisphere/runtimes|packages/<%= runtimeName__lowerDashCase %>/src/**/*.{ts,tsx,js,jsx}",
17
+ "unisphere/runtimes|packages/<%= runtimeName__lowerDashCase %>/package.json"
18
+ ]
19
+ }
20
+ }
21
+ }
22
+ }
@@ -0,0 +1,6 @@
1
+ const createUnisphereWithNX = require('../../../node_modules/@unisphere/cli/bundler/runtime/rollup.js');
2
+
3
+
4
+ module.exports = createUnisphereWithNX({
5
+ cwd: __dirname,
6
+ })
@@ -0,0 +1 @@
1
+ export * from './lib/create-factory';
@@ -0,0 +1,21 @@
1
+ import { Root } from 'react-dom/client';
2
+ import { Runtime } from './runtime';
3
+ import { <%= runtimeName__pascalCase %>RuntimeSettings } from '<%= coreAlias %>'
4
+ import {
5
+ CreateElementOptions,
6
+ UnisphereElementBase,
7
+ UnisphereElementFactory,
8
+ } from '@unisphere/runtime-js';
9
+
10
+ class ContextFactory extends UnisphereElementFactory<
11
+ <%= runtimeName__pascalCase %>RuntimeSettings,
12
+ Root
13
+ > {
14
+ create(
15
+ options: CreateElementOptions<<%= runtimeName__pascalCase %>RuntimeSettings>
16
+ ): UnisphereElementBase<<%= runtimeName__pascalCase %>RuntimeSettings, Root> {
17
+ return new Runtime(options);
18
+ }
19
+ }
20
+
21
+ export const createFactory = () => new ContextFactory();
@@ -0,0 +1,66 @@
1
+ import * as ReactDOM from 'react-dom/client';
2
+ import { Root } from 'react-dom/client';
3
+ import { ThemeProvider } from '@kaltura/ds-react-theme';
4
+ import {
5
+ CreateElementOptions,
6
+ UnisphereRuntimeBase,
7
+ } from '@unisphere/runtime-js';
8
+ import {
9
+ <%= runtimeName__pascalCase %>Runtime,
10
+ <%= runtimeName__pascalCase %>RuntimeName,
11
+ <%= runtimeName__pascalCase %>RuntimeSettings,
12
+ <%= runtimeName__camelCase %>RuntimeSettingsSchema,
13
+ } from '<%= coreAlias %>';
14
+ import {
15
+ ScopedUnisphereWorkspaceProvider
16
+ } from '@unisphere/runtime-react';
17
+ import { HtmlDomRuntimeVisual } from '@unisphere/runtime';
18
+ import { WidgetName } from '<%= coreAlias %>'
19
+
20
+ export class Runtime
21
+ extends UnisphereRuntimeBase<<%= runtimeName__pascalCase %>RuntimeSettings, Root>
22
+ implements <%= runtimeName__pascalCase %>Runtime
23
+ {
24
+ readonly id = WidgetName;
25
+ readonly runtime = <%= runtimeName__pascalCase %>RuntimeName;
26
+ readonly widgetName = WidgetName;
27
+ readonly runtimeName = <%= runtimeName__pascalCase %>RuntimeName;
28
+
29
+ protected _onKilled(): void {
30
+ this._logger.log('runtime killed');
31
+ }
32
+
33
+ constructor(options: CreateElementOptions<<%= runtimeName__pascalCase %>RuntimeSettings>) {
34
+ super({
35
+ ...options,
36
+ settingsSchema: <%= runtimeName__camelCase %>RuntimeSettingsSchema,
37
+ visualTypes: {},
38
+ });
39
+
40
+ this._logger.log('runtime initialized', {
41
+ data: {
42
+ widgetName: this.widgetName,
43
+ runtimeName: this.runtimeName,
44
+ },
45
+ });
46
+ }
47
+
48
+ override _createVisualContainer(htmlElement: HTMLElement): Root {
49
+ return ReactDOM.createRoot(htmlElement);
50
+ }
51
+
52
+ override _onVisualMount(visual: HtmlDomRuntimeVisual<Root>) {
53
+ switch (visual.type) {
54
+ default:
55
+ return false;
56
+ }
57
+ }
58
+
59
+ override _onVisualUnmount(visual: HtmlDomRuntimeVisual<Root>) {
60
+ visual.htmlContainer?.unmount();
61
+ }
62
+
63
+ protected _onSettingsUpdated(settings: <%= runtimeName__pascalCase %>RuntimeSettings) {
64
+ // remove if not needed
65
+ }
66
+ }
@@ -0,0 +1,20 @@
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.lib.json"
14
+ },
15
+ {
16
+ "path": "./tsconfig.spec.json"
17
+ }
18
+ ],
19
+ "extends": "../../../tsconfig.base.json"
20
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "../../../dist/out-tsc",
5
+ "types": [
6
+ "node",
7
+
8
+ "@nx/react/typings/cssmodule.d.ts",
9
+ "@nx/react/typings/image.d.ts"
10
+ ]
11
+ },
12
+ "exclude": [
13
+ "**/*.spec.ts",
14
+ "**/*.test.ts",
15
+ "**/*.spec.tsx",
16
+ "**/*.test.tsx",
17
+ "**/*.spec.js",
18
+ "**/*.test.js",
19
+ "**/*.spec.jsx",
20
+ "**/*.test.jsx"
21
+ ],
22
+ "include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"]
23
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "../../../dist/out-tsc",
5
+ "types": [
6
+ "vitest/globals",
7
+ "vitest/importMeta",
8
+ "vite/client",
9
+ "node",
10
+ "vitest"
11
+ ]
12
+ },
13
+ "include": [
14
+ "vite.config.ts",
15
+ "vitest.config.ts",
16
+ "src/**/*.test.ts",
17
+ "src/**/*.spec.ts",
18
+ "src/**/*.test.tsx",
19
+ "src/**/*.spec.tsx",
20
+ "src/**/*.test.js",
21
+ "src/**/*.spec.js",
22
+ "src/**/*.test.jsx",
23
+ "src/**/*.spec.jsx",
24
+ "src/**/*.d.ts"
25
+ ]
26
+ }
@@ -0,0 +1,30 @@
1
+ import { defineConfig } from 'vite';
2
+ import react from '@vitejs/plugin-react';
3
+ import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
4
+
5
+ export default defineConfig({
6
+ root: __dirname,
7
+ cacheDir: '../../../node_modules/.vite/libs/unisphere-context-application',
8
+
9
+ plugins: [react(), nxViteTsPaths()],
10
+
11
+ // Uncomment this if you are using workers.
12
+ // worker: {
13
+ // plugins: [ nxViteTsPaths() ],
14
+ // },
15
+
16
+ test: {
17
+ watch: false,
18
+ globals: true,
19
+ cache: {
20
+ dir: '../../../node_modules/.vitest/libs/unisphere-context-application',
21
+ },
22
+ environment: 'jsdom',
23
+ include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
24
+ reporters: ['default'],
25
+ coverage: {
26
+ reportsDirectory: '../../../coverage/libs/unisphere-context-application',
27
+ provider: 'v8',
28
+ },
29
+ },
30
+ });
@@ -0,0 +1,4 @@
1
+ export interface AddRuntimeGeneratorSchema {
2
+ name: string;
3
+ usage: 'loadedByExternalHost' | 'embeddedInWidgetPlayground';
4
+ }
@@ -0,0 +1,44 @@
1
+ {
2
+ "$schema": "https://json-schema.org/schema",
3
+ "$id": "AddRuntime",
4
+ "title": "Add a new runtime",
5
+ "type": "object",
6
+ "properties": {
7
+ "name": {
8
+ "type": "string",
9
+ "description": "The name of the runtime to create",
10
+ "pattern": "^[a-zA-Z][a-zA-Z0-9\\-\\s]*$",
11
+ "x-prompt": "What's the runtime name? (letters, numbers, dashes and spaces allowed)"
12
+ },
13
+ "usage": {
14
+ "type": "string",
15
+ "description": "How will this runtime be used?",
16
+ "enum": [
17
+ "loadedByExternalHost",
18
+ "embeddedInWidgetPlayground"
19
+ ],
20
+ "x-prompt": {
21
+ "message": "How will this runtime be used?",
22
+ "type": "list",
23
+ "items": [
24
+ {
25
+ "value": "loadedByExternalHost",
26
+ "label": "Loaded by External Host (creates package + expo playground)"
27
+ },
28
+ {
29
+ "value": "embeddedInWidgetPlayground",
30
+ "label": "Embedded in Widget Playground (uses existing expo app)"
31
+ }
32
+ ]
33
+ },
34
+ "enumDescriptions": [
35
+ "It's loaded by an external host or runtime (it needs its own Expo playground application and package)",
36
+ "It's part of another runtime in this widget (it will use the same Expo playground application)"
37
+ ]
38
+ }
39
+ },
40
+ "required": [
41
+ "name",
42
+ "usage"
43
+ ]
44
+ }
@@ -0,0 +1,8 @@
1
+ import { Tree } from '@nx/devkit';
2
+ import { AddVisualGeneratorSchema } from './schema';
3
+ /**
4
+ * Nx generator to create a new visual within a specified runtime.
5
+ */
6
+ export declare function addVisualGenerator(tree: Tree, options: AddVisualGeneratorSchema): Promise<void>;
7
+ export default addVisualGenerator;
8
+ //# sourceMappingURL=add-visual.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-visual.d.ts","sourceRoot":"","sources":["../../../src/generators/add-visual/add-visual.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,IAAI,EAAE,MAAM,YAAY,CAAC;AAqB9D,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AA+RpD;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,IAAI,CAAC,CAmEf;AAED,eAAe,kBAAkB,CAAC"}