@unisphere/nx 1.0.1 → 1.1.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 (56) hide show
  1. package/dist/generators/add-application/add-application.d.ts.map +1 -1
  2. package/dist/generators/add-application/add-application.js +1 -0
  3. package/dist/generators/add-application/schema.json +1 -7
  4. package/dist/generators/add-application/templates/default/jest.config.ts +11 -0
  5. package/dist/generators/add-application/templates/interactive-playground/jest.config.ts +11 -0
  6. package/dist/generators/add-application/templates/interactive-playground/src/app/app.tsx.template +1 -1
  7. package/dist/generators/add-application/templates/interactive-playground/src/app/definitions.ts +25 -0
  8. package/dist/generators/add-application/templates/interactive-playground/src/app/utils/merge-deep.ts +31 -0
  9. package/dist/generators/add-package/add-package.d.ts.map +1 -1
  10. package/dist/generators/add-package/add-package.js +1 -1
  11. package/dist/generators/add-package/schema.json +7 -12
  12. package/dist/generators/add-package/templates/new-package/src/lib/.keep +0 -0
  13. package/dist/generators/add-runtime/add-runtime.js +5 -5
  14. package/dist/generators/add-runtime/schema.json +6 -17
  15. package/dist/generators/add-runtime/templates/core-templates/__runtimeName__-runtime/index.ts.template +1 -0
  16. package/dist/generators/add-visual/add-visual.d.ts.map +1 -1
  17. package/dist/generators/add-visual/add-visual.js +31 -15
  18. package/package.json +6 -1
  19. package/dist/generators/add-application/templates/default/jest.config.d.ts +0 -14
  20. package/dist/generators/add-application/templates/default/jest.config.d.ts.map +0 -1
  21. package/dist/generators/add-application/templates/default/jest.config.js +0 -13
  22. package/dist/generators/add-application/templates/interactive-playground/jest.config.d.ts +0 -14
  23. package/dist/generators/add-application/templates/interactive-playground/jest.config.d.ts.map +0 -1
  24. package/dist/generators/add-application/templates/interactive-playground/jest.config.js +0 -13
  25. package/dist/generators/add-application/templates/interactive-playground/src/app/definitions.d.ts +0 -11
  26. package/dist/generators/add-application/templates/interactive-playground/src/app/definitions.d.ts.map +0 -1
  27. package/dist/generators/add-application/templates/interactive-playground/src/app/definitions.js +0 -19
  28. package/dist/generators/add-application/templates/interactive-playground/src/app/utils/merge-deep.d.ts +0 -13
  29. package/dist/generators/add-application/templates/interactive-playground/src/app/utils/merge-deep.d.ts.map +0 -1
  30. package/dist/generators/add-application/templates/interactive-playground/src/app/utils/merge-deep.js +0 -35
  31. /package/dist/generators/add-package/{files → templates/new-package}/.babelrc +0 -0
  32. /package/dist/generators/add-package/{files → templates/new-package}/.eslintrc.json +0 -0
  33. /package/dist/generators/add-package/{files → templates/new-package}/README.md +0 -0
  34. /package/dist/generators/add-package/{files → templates/new-package}/package.json.template +0 -0
  35. /package/dist/generators/add-package/{files → templates/new-package}/project.json.template +0 -0
  36. /package/dist/generators/add-package/{files → templates/new-package}/rollup.config.js +0 -0
  37. /package/dist/generators/add-package/{files → templates/new-package}/src/index.ts +0 -0
  38. /package/dist/generators/add-package/{files → templates/new-package}/tsconfig.json +0 -0
  39. /package/dist/generators/add-package/{files → templates/new-package}/tsconfig.lib.json +0 -0
  40. /package/dist/generators/add-package/{files → templates/new-package}/tsconfig.spec.json +0 -0
  41. /package/dist/generators/add-package/{files → templates/new-package}/vite.config.ts +0 -0
  42. /package/dist/generators/add-runtime/{core-templates → templates/core-templates}/__runtimeName__-runtime/runtime-types.ts.template +0 -0
  43. /package/dist/generators/add-runtime/{files → templates/new-runtime}/.babelrc +0 -0
  44. /package/dist/generators/add-runtime/{files → templates/new-runtime}/.eslintrc.json +0 -0
  45. /package/dist/generators/add-runtime/{files → templates/new-runtime}/README.md.template +0 -0
  46. /package/dist/generators/add-runtime/{files → templates/new-runtime}/package.json.template +0 -0
  47. /package/dist/generators/add-runtime/{files → templates/new-runtime}/project.json.template +0 -0
  48. /package/dist/generators/add-runtime/{files → templates/new-runtime}/rollup.config.js +0 -0
  49. /package/dist/generators/add-runtime/{files → templates/new-runtime}/src/index.ts +0 -0
  50. /package/dist/generators/add-runtime/{files → templates/new-runtime}/src/lib/create-factory.tsx.template +0 -0
  51. /package/dist/generators/add-runtime/{files → templates/new-runtime}/src/lib/runtime.tsx.template +0 -0
  52. /package/dist/generators/add-runtime/{files → templates/new-runtime}/tsconfig.json +0 -0
  53. /package/dist/generators/add-runtime/{files → templates/new-runtime}/tsconfig.lib.json +0 -0
  54. /package/dist/generators/add-runtime/{files → templates/new-runtime}/tsconfig.spec.json +0 -0
  55. /package/dist/generators/add-runtime/{files → templates/new-runtime}/vite.config.ts +0 -0
  56. /package/dist/generators/add-visual/{files → templates/new-visual}/render-method.template +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"add-application.d.ts","sourceRoot":"","sources":["../../../src/generators/add-application/add-application.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,IAAI,EAGL,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,6BAA6B,EAAE,MAAM,UAAU,CAAC;AAezD,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,6BAA6B,uBAiHvC;AAED,eAAe,uBAAuB,CAAC"}
1
+ {"version":3,"file":"add-application.d.ts","sourceRoot":"","sources":["../../../src/generators/add-application/add-application.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,IAAI,EAAiB,MAAM,YAAY,CAAC;AAG7E,OAAO,EAAE,6BAA6B,EAAE,MAAM,UAAU,CAAC;AAgBzD,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,6BAA6B,uBAuHvC;AAED,eAAe,uBAAuB,CAAC"}
@@ -32,6 +32,7 @@ async function addApplicationGenerator(tree, options) {
32
32
  ...(0, utils_1.createNameTransforms)(widgetName, 'widgetName'),
33
33
  ...(0, utils_1.createNameTransforms)(options.runtimeName || 'runtime', 'runtimeName'),
34
34
  tmpl: '',
35
+ coreAlias: (0, utils_1.findCorePackageAlias)(tree),
35
36
  };
36
37
  const projectRoot = `unisphere/applications/${userInputApplicationName}`;
37
38
  // Check if the application already exists
@@ -16,13 +16,7 @@
16
16
  },
17
17
  "servingType": {
18
18
  "type": "string",
19
- "description": "How should this app be served?",
20
- "enum": [
21
- "interactive-playground",
22
- "self-hosted",
23
- "iframe-with-query-params",
24
- "iframe-with-post-messages"
25
- ],
19
+ "description": "How should this app be served?",
26
20
  "default": "self-hosted",
27
21
  "x-prompt": {
28
22
  "message": "Which serving type do you want?",
@@ -0,0 +1,11 @@
1
+ /* eslint-disable */
2
+ export default {
3
+ displayName: 'admin',
4
+ preset: '../../../jest.preset.js',
5
+ transform: {
6
+ '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest',
7
+ '^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/react/babel'] }],
8
+ },
9
+ moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
10
+ coverageDirectory: '../../../coverage/unisphere/applications/admin',
11
+ };
@@ -0,0 +1,11 @@
1
+ /* eslint-disable */
2
+ export default {
3
+ displayName: 'admin',
4
+ preset: '../../../jest.preset.js',
5
+ transform: {
6
+ '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest',
7
+ '^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/react/babel'] }],
8
+ },
9
+ moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
10
+ coverageDirectory: '../../../coverage/unisphere/applications/admin',
11
+ };
@@ -8,7 +8,7 @@ import { ConfigurationProvider } from './configuration-provider';
8
8
  import { UnisphereProvider } from '@unisphere/runtime-react';
9
9
  import { UnisphereWorkspaceConfig } from '@unisphere/runtime';
10
10
  import { UnisphereWorkspaceType } from '@unisphere/runtime';
11
- import { <%= runtimeName__pascalCase %>Runtime } from '@kaltura/unisphere-<%= widgetName__lowerDashCase %>-core';
11
+ import { <%= runtimeName__pascalCase %>Runtime } from '<%= coreAlias %>';
12
12
 
13
13
  export function AppContent() {
14
14
  const { configuration } = useContext(ConfigurationContext);
@@ -0,0 +1,25 @@
1
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2
+ // @ts-ignore
3
+ export const inProduction = process.env.NODE_ENV === 'production';
4
+
5
+ // todo update the configuration and default values
6
+ export interface Configuration {
7
+ _schemaVersion: string;
8
+ unisphereServerUrl: string;
9
+ language: string;
10
+ theme: 'light' | 'dark';
11
+ settings: string;
12
+ }
13
+
14
+ export const getDefaultConfiguration = (): Configuration => ({
15
+ unisphereServerUrl: 'https://unisphere.nvq2.ovp.kaltura.com/v1',
16
+ language: 'en',
17
+ _schemaVersion: '1',
18
+ theme: 'light',
19
+ settings: '',
20
+ });
21
+
22
+ // todo set here the logic needed to validate configuration
23
+ export const isConfigurationValid = (config: any): config is Configuration => {
24
+ return config?.unisphereServerUrl && config?.settings;
25
+ };
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Simple object check.
3
+ * @param item
4
+ * @returns {boolean}
5
+ */
6
+ export function isObject(item: any) {
7
+ return item && typeof item === 'object' && !Array.isArray(item);
8
+ }
9
+
10
+ /**
11
+ * Deep merge two objects.
12
+ * @param target
13
+ * @param ...sources
14
+ */
15
+ export function mergeDeep(target: any, ...sources: any[]): any {
16
+ if (!sources.length) return target;
17
+ const source = sources.shift();
18
+
19
+ if (isObject(target) && isObject(source)) {
20
+ for (const key in source) {
21
+ if (isObject(source[key])) {
22
+ if (!target[key]) Object.assign(target, { [key]: {} });
23
+ mergeDeep(target[key], source[key]);
24
+ } else {
25
+ Object.assign(target, { [key]: source[key] });
26
+ }
27
+ }
28
+ }
29
+
30
+ return mergeDeep(target, ...sources);
31
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"add-package.d.ts","sourceRoot":"","sources":["../../../src/generators/add-package/add-package.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,IAAI,EAGL,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAkBrD,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,yBAAyB,uBAoGnC;AAED,eAAe,mBAAmB,CAAC"}
1
+ {"version":3,"file":"add-package.d.ts","sourceRoot":"","sources":["../../../src/generators/add-package/add-package.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,IAAI,EAAiB,MAAM,YAAY,CAAC;AAE7E,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAkBrD,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,yBAAyB,uBAwGnC;AAED,eAAe,mBAAmB,CAAC"}
@@ -59,7 +59,7 @@ async function addPackageGenerator(tree, options) {
59
59
  'Please choose a different package name or remove the existing package first.');
60
60
  }
61
61
  // Generate files from templates (project.json.template will define the project)
62
- (0, devkit_1.generateFiles)(tree, path.join(__dirname, 'files'), projectRoot, templateVariables);
62
+ (0, devkit_1.generateFiles)(tree, path.join(__dirname, 'templates/new-package'), projectRoot, templateVariables);
63
63
  // Update .unisphere configuration
64
64
  (0, utils_1.updateUnisphereConfig)(tree, 'packages', userInputPackageName, {
65
65
  sourceRoot: `unisphere/packages/${userInputPackageName}`,
@@ -12,28 +12,23 @@
12
12
  },
13
13
  "scope": {
14
14
  "type": "string",
15
- "description": "The distribution scope of the package",
16
- "enum": [
17
- "public",
18
- "internal",
19
- "none"
20
- ],
21
- "default": "internal",
15
+ "description": "The distribution scope of the package",
16
+ "default": "none",
22
17
  "x-prompt": {
23
18
  "message": "What scope should this package have?",
24
19
  "type": "list",
25
20
  "items": [
26
21
  {
27
- "value": "public",
28
- "label": "Public (@unisphere/) - Published to npm"
29
- },
22
+ "value": "none",
23
+ "label": "None (no scope) - Private repository only"
24
+ },
30
25
  {
31
26
  "value": "internal",
32
27
  "label": "Internal (@kaltura/unisphere-) - Published to GitHub packages"
33
28
  },
34
29
  {
35
- "value": "none",
36
- "label": "None (no scope) - Private repository only"
30
+ "value": "public",
31
+ "label": "Public (@unisphere/) - Published to npm"
37
32
  }
38
33
  ]
39
34
  }
@@ -16,7 +16,7 @@ function updateCoreIndexExport(tree, runtimeName) {
16
16
  if (!currentContent) {
17
17
  throw new Error(`Failed to read content from ${coreIndexPath}`);
18
18
  }
19
- const exportLine = `export * from './lib/${runtimeName}-runtime/runtime-types';`;
19
+ const exportLine = `export * from './lib/${runtimeName}-runtime';`;
20
20
  // Check if the export already exists
21
21
  if (currentContent.includes(exportLine)) {
22
22
  return; // Already exported
@@ -55,9 +55,9 @@ async function addRuntimeGenerator(tree, options) {
55
55
  'Please choose a different runtime name or remove the existing file first.');
56
56
  }
57
57
  // Generate files from templates for the runtime
58
- (0, devkit_1.generateFiles)(tree, path.join(__dirname, 'files'), projectRoot, templateVariables);
58
+ (0, devkit_1.generateFiles)(tree, path.join(__dirname, 'templates/new-runtime'), projectRoot, templateVariables);
59
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);
60
+ (0, devkit_1.generateFiles)(tree, path.join(__dirname, 'templates/core-templates'), 'unisphere/packages/core/src/lib', templateVariables);
61
61
  // Update core index.ts to export the new runtime types
62
62
  updateCoreIndexExport(tree, userInputRuntimeName);
63
63
  // Update .unisphere configuration
@@ -74,7 +74,7 @@ async function addRuntimeGenerator(tree, options) {
74
74
  // Create a package with the same name as the runtime and distribution set to none
75
75
  const packageResult = await (0, add_package_1.addPackageGenerator)(tree, {
76
76
  packageName: userInputRuntimeName,
77
- scope: 'none'
77
+ scope: 'none',
78
78
  });
79
79
  // Execute the package generation callback if it exists
80
80
  if (packageResult && typeof packageResult === 'function') {
@@ -84,7 +84,7 @@ async function addRuntimeGenerator(tree, options) {
84
84
  const applicationResult = await (0, add_application_1.addApplicationGenerator)(tree, {
85
85
  name: `${userInputRuntimeName}-expo`,
86
86
  servingType: 'interactive-playground',
87
- runtimeName: userInputRuntimeName
87
+ runtimeName: userInputRuntimeName,
88
88
  });
89
89
  // Execute the application generation callback if it exists
90
90
  if (applicationResult && typeof applicationResult === 'function') {
@@ -12,33 +12,22 @@
12
12
  },
13
13
  "usage": {
14
14
  "type": "string",
15
- "description": "How will this runtime be used?",
16
- "enum": [
17
- "loadedByExternalHost",
18
- "embeddedInWidgetPlayground"
19
- ],
15
+ "description": "How will this runtime be used?",
20
16
  "x-prompt": {
21
17
  "message": "How will this runtime be used?",
22
18
  "type": "list",
23
19
  "items": [
24
20
  {
25
21
  "value": "loadedByExternalHost",
26
- "label": "Loaded by External Host (creates package + expo playground)"
22
+ "label": "Loaded by External Host (requires separate package and Expo playground)"
27
23
  },
28
24
  {
29
25
  "value": "embeddedInWidgetPlayground",
30
- "label": "Embedded in Widget Playground (uses existing expo app)"
26
+ "label": "Embedded in Widget Playground (no separate package or playground needed)"
31
27
  }
32
28
  ]
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
- ]
29
+ }
38
30
  }
39
31
  },
40
- "required": [
41
- "name",
42
- "usage"
43
- ]
44
- }
32
+ "required": ["name", "usage"]
33
+ }
@@ -1 +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"}
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;AAkUpD;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,IAAI,CAAC,CAmEf;AAED,eAAe,kBAAkB,CAAC"}
@@ -31,6 +31,24 @@ function addImportToRuntime(sourceFilePath, tree, vars, project) {
31
31
  (0, visual_utils_1.saveSourceFile)(tree, sourceFilePath, sourceFile.getFullText());
32
32
  console.log(`✅ Added import for visual ${humanName}`);
33
33
  }
34
+ function updateRuntimeIndexExport(tree, runtimeName, visualName) {
35
+ const runtimeIndexPath = `unisphere/packages/core/src/lib/${runtimeName}-runtime/index.ts`;
36
+ if (!tree.exists(runtimeIndexPath)) {
37
+ throw new Error(`Runtime index file not found at ${runtimeIndexPath}`);
38
+ }
39
+ const currentContent = tree.read(runtimeIndexPath, 'utf-8');
40
+ if (!currentContent) {
41
+ throw new Error(`Failed to read content from ${runtimeIndexPath}`);
42
+ }
43
+ const exportLine = `export * from './${visualName}-visual-types';`;
44
+ // Check if the export already exists
45
+ if (currentContent.includes(exportLine)) {
46
+ return; // Already exported
47
+ }
48
+ // Add the export at the end of the file
49
+ const updatedContent = currentContent.replace(/\n\n$/, '\n') + exportLine;
50
+ tree.write(runtimeIndexPath, updatedContent);
51
+ }
34
52
  /**
35
53
  * Adds a new case to the primary switch statement in the runtime file.
36
54
  */
@@ -113,10 +131,11 @@ function addRenderMethod(sourceFilePath, tree, vars, project) {
113
131
  }
114
132
  // Use Nx's generateFiles to process the template to a temporary location
115
133
  const tempDir = 'temp-render-method';
116
- (0, devkit_1.generateFiles)(tree, path.join(__dirname, 'files'), tempDir, {
134
+ (0, devkit_1.generateFiles)(tree, path.join(__dirname, 'templates', 'new-visual'), tempDir, {
117
135
  ...vars,
118
136
  tmpl: '', // This removes the .template extension
119
137
  });
138
+ updateRuntimeIndexExport(tree, vars.runtimeName__lowerDashCase, vars.visualName__lowerDashCase);
120
139
  // Read the processed template content
121
140
  const processedContent = (0, visual_utils_1.readTreeFile)(tree, `${tempDir}/render-method`);
122
141
  // Clean up the temporary file
@@ -148,20 +167,17 @@ function addRenderMethod(sourceFilePath, tree, vars, project) {
148
167
  /**
149
168
  * Adds an interface and schema definition to the core runtime types file.
150
169
  */
151
- function addVariablesInCore(tree, vars) {
152
- const coreFile = `unisphere/packages/core/src/lib/${vars.runtimeName__lowerDashCase}-runtime/runtime-types.ts`;
153
- if (!tree.exists(coreFile)) {
154
- throw new Error(`Core file not found at ${coreFile}`);
170
+ function createVisualTypes(tree, vars) {
171
+ // Check if the core runtime types file already exists
172
+ const visualTypesPath = `unisphere/packages/core/src/lib/${vars.runtimeName__lowerDashCase}-runtime/${vars.visualName__lowerDashCase}-visual-types.ts`;
173
+ if (tree.exists(visualTypesPath)) {
174
+ throw new Error(`Visual types file "${vars.visualName__lowerDashCase}-visual-types.ts" already exists in core package.\n` +
175
+ 'Please choose a different runtime name or remove the existing file first.');
155
176
  }
156
- const currentContent = (0, visual_utils_1.readTreeFile)(tree, coreFile);
157
177
  const { runtimeVisualSettings: interfaceName, runtimeVisualSchema: schemaName, visualName__humanReadable: humanName, } = vars;
158
- // Check if the interface already exists to prevent duplicates.
159
- if (currentContent.includes(`export interface ${interfaceName}`)) {
160
- console.log(`⚠️ Interface ${interfaceName} already exists in core file.`);
161
- return;
162
- }
163
178
  // Construct the new interface and schema content.
164
- const newContent = `
179
+ const newContent = `import { ValidatorSchema } from '@unisphere/core';
180
+
165
181
  export interface ${interfaceName} {
166
182
  schemaVersion?: string;
167
183
  }
@@ -174,8 +190,8 @@ export const ${schemaName}: ValidatorSchema = {
174
190
  };
175
191
  `;
176
192
  // Append the new content to the file.
177
- tree.write(coreFile, currentContent + newContent);
178
- console.log(`✅ Added interface and schema for ${humanName} to core file.`);
193
+ tree.write(visualTypesPath, newContent);
194
+ console.log(`✅ Added interface and schema for ${humanName}`);
179
195
  }
180
196
  /* -------------------------------------------
181
197
  * Entry Point (Main generator function)
@@ -223,7 +239,7 @@ async function addVisualGenerator(tree, options) {
223
239
  addSwitchCaseToRuntime(runtimeTSxPath, tree, templateVariables, project);
224
240
  addRenderMethod(runtimeTSxPath, tree, templateVariables, project);
225
241
  // 'project' parameter is not needed here as addVariablesInCore directly writes to the tree.
226
- addVariablesInCore(tree, templateVariables);
242
+ createVisualTypes(tree, templateVariables);
227
243
  // Format all modified files for consistent code style.
228
244
  await (0, devkit_1.formatFiles)(tree);
229
245
  // Log success and summary information to the console.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unisphere/nx",
3
- "version": "1.0.1",
3
+ "version": "1.1.1",
4
4
  "private": false,
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -62,6 +62,11 @@
62
62
  "input": "./packages/nx/src/generators",
63
63
  "glob": "**/files/**/*",
64
64
  "output": "./generators"
65
+ },
66
+ {
67
+ "input": "./packages/nx/src/generators",
68
+ "glob": "**/templates/**/*",
69
+ "output": "./generators"
65
70
  }
66
71
  ]
67
72
  }
@@ -1,14 +0,0 @@
1
- declare const _default: {
2
- displayName: string;
3
- preset: string;
4
- transform: {
5
- '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': string;
6
- '^.+\\.[tj]sx?$': (string | {
7
- presets: string[];
8
- })[];
9
- };
10
- moduleFileExtensions: string[];
11
- coverageDirectory: string;
12
- };
13
- export default _default;
14
- //# sourceMappingURL=jest.config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"jest.config.d.ts","sourceRoot":"","sources":["../../../../../src/generators/add-application/templates/default/jest.config.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,wBASE"}
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- /* eslint-disable */
4
- exports.default = {
5
- displayName: 'admin',
6
- preset: '../../../jest.preset.js',
7
- transform: {
8
- '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest',
9
- '^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/react/babel'] }],
10
- },
11
- moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
12
- coverageDirectory: '../../../coverage/unisphere/applications/admin',
13
- };
@@ -1,14 +0,0 @@
1
- declare const _default: {
2
- displayName: string;
3
- preset: string;
4
- transform: {
5
- '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': string;
6
- '^.+\\.[tj]sx?$': (string | {
7
- presets: string[];
8
- })[];
9
- };
10
- moduleFileExtensions: string[];
11
- coverageDirectory: string;
12
- };
13
- export default _default;
14
- //# sourceMappingURL=jest.config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"jest.config.d.ts","sourceRoot":"","sources":["../../../../../src/generators/add-application/templates/interactive-playground/jest.config.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,wBASE"}
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- /* eslint-disable */
4
- exports.default = {
5
- displayName: 'admin',
6
- preset: '../../../jest.preset.js',
7
- transform: {
8
- '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest',
9
- '^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/react/babel'] }],
10
- },
11
- moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
12
- coverageDirectory: '../../../coverage/unisphere/applications/admin',
13
- };
@@ -1,11 +0,0 @@
1
- export declare const inProduction: boolean;
2
- export interface Configuration {
3
- _schemaVersion: string;
4
- unisphereServerUrl: string;
5
- language: string;
6
- theme: 'light' | 'dark';
7
- settings: string;
8
- }
9
- export declare const getDefaultConfiguration: () => Configuration;
10
- export declare const isConfigurationValid: (config: any) => config is Configuration;
11
- //# sourceMappingURL=definitions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../../../../../../../src/generators/add-application/templates/interactive-playground/src/app/definitions.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,SAAwC,CAAC;AAGlE,MAAM,WAAW,aAAa;IAC5B,cAAc,EAAE,MAAM,CAAC;IACvB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,uBAAuB,QAAO,aAMzC,CAAC;AAGH,eAAO,MAAM,oBAAoB,GAAI,QAAQ,GAAG,KAAG,MAAM,IAAI,aAE5D,CAAC"}
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isConfigurationValid = exports.getDefaultConfiguration = exports.inProduction = void 0;
4
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
5
- // @ts-ignore
6
- exports.inProduction = process.env.NODE_ENV === 'production';
7
- const getDefaultConfiguration = () => ({
8
- unisphereServerUrl: 'https://unisphere.nvq2.ovp.kaltura.com/v1',
9
- language: 'en',
10
- _schemaVersion: '1',
11
- theme: 'light',
12
- settings: '',
13
- });
14
- exports.getDefaultConfiguration = getDefaultConfiguration;
15
- // todo set here the logic needed to validate configuration
16
- const isConfigurationValid = (config) => {
17
- return config?.unisphereServerUrl && config?.settings;
18
- };
19
- exports.isConfigurationValid = isConfigurationValid;
@@ -1,13 +0,0 @@
1
- /**
2
- * Simple object check.
3
- * @param item
4
- * @returns {boolean}
5
- */
6
- export declare function isObject(item: any): any;
7
- /**
8
- * Deep merge two objects.
9
- * @param target
10
- * @param ...sources
11
- */
12
- export declare function mergeDeep(target: any, ...sources: any[]): any;
13
- //# sourceMappingURL=merge-deep.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"merge-deep.d.ts","sourceRoot":"","sources":["../../../../../../../../src/generators/add-application/templates/interactive-playground/src/app/utils/merge-deep.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,GAAG,OAEjC;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,EAAE,GAAG,EAAE,GAAG,GAAG,CAgB7D"}
@@ -1,35 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isObject = isObject;
4
- exports.mergeDeep = mergeDeep;
5
- /**
6
- * Simple object check.
7
- * @param item
8
- * @returns {boolean}
9
- */
10
- function isObject(item) {
11
- return item && typeof item === 'object' && !Array.isArray(item);
12
- }
13
- /**
14
- * Deep merge two objects.
15
- * @param target
16
- * @param ...sources
17
- */
18
- function mergeDeep(target, ...sources) {
19
- if (!sources.length)
20
- return target;
21
- const source = sources.shift();
22
- if (isObject(target) && isObject(source)) {
23
- for (const key in source) {
24
- if (isObject(source[key])) {
25
- if (!target[key])
26
- Object.assign(target, { [key]: {} });
27
- mergeDeep(target[key], source[key]);
28
- }
29
- else {
30
- Object.assign(target, { [key]: source[key] });
31
- }
32
- }
33
- }
34
- return mergeDeep(target, ...sources);
35
- }