@unisphere/nx 4.3.2 → 4.4.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.
@@ -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;AAyJzD,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,6BAA6B,uBAuLvC;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,EAAgD,MAAM,YAAY,CAAC;AAE5G,OAAO,EAAE,6BAA6B,EAAE,MAAM,UAAU,CAAC;AAuEzD,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,6BAA6B,uBA0KvC;AAED,eAAe,uBAAuB,CAAC"}
@@ -32,73 +32,16 @@ function validateOptions(options) {
32
32
  ` Allowed values: local-dev-playground, self-hosted, iframe-with-post-messages, assets-only\n` +
33
33
  ` Received: ${options.servingType}`);
34
34
  }
35
- }
36
- async function getEnquirerPrompt() {
37
- const enquirer = await import('enquirer');
38
- // Handle both CommonJS and ESM exports
39
- return enquirer.prompt || enquirer.default?.prompt || enquirer;
40
- }
41
- async function promptForRuntimeName(availableRuntimes, existingRuntimeName, existingVisualName, skipDynamicRuntimeVisualPrompt) {
42
- const prompt = await getEnquirerPrompt();
43
- let runtimeName = existingRuntimeName;
44
- let visualName = existingVisualName;
45
- if (skipDynamicRuntimeVisualPrompt) {
46
- return { runtimeName, visualName };
47
- }
48
- if (!runtimeName) {
49
- const runtimeChoices = [
50
- { value: '', name: '(none)' },
51
- ...Object.keys(availableRuntimes).map(name => ({ name, value: name }))
52
- ];
53
- const response = await prompt({
54
- type: 'select',
55
- name: 'runtimeName',
56
- message: 'Select a runtime for this application (optional):',
57
- choices: runtimeChoices,
58
- });
59
- runtimeName = response.runtimeName;
60
- runtimeName = runtimeName === '(none)' ? '' : runtimeName;
61
- }
62
- if (!visualName && runtimeName && availableRuntimes[runtimeName]) {
63
- const availableVisuals = availableRuntimes[runtimeName].visuals;
64
- if (availableVisuals.length > 0) {
65
- const visualChoices = [
66
- { value: '', name: '(none)' },
67
- ...availableVisuals.map(name => ({ name, value: name }))
68
- ];
69
- const response = await prompt({
70
- type: 'select',
71
- name: 'visualName',
72
- message: 'Select a visual type to mount (optional):',
73
- choices: visualChoices,
74
- });
75
- visualName = response.visualName;
76
- visualName = visualName === '(none)' ? '' : visualName;
35
+ const allowedDependencies = ['ds', 'mui', 'react-hook-form'];
36
+ if (options.dependencies) {
37
+ for (const dep of options.dependencies) {
38
+ if (!allowedDependencies.includes(dep)) {
39
+ throw new Error(`Invalid value '${dep}' in option 'dependencies'\n` +
40
+ ` Allowed values: ${allowedDependencies.join(', ')}\n` +
41
+ ` Received: ${dep}`);
42
+ }
77
43
  }
78
44
  }
79
- return { runtimeName, visualName };
80
- }
81
- async function promptForHtmlPageTitle() {
82
- const prompt = await getEnquirerPrompt();
83
- const response = await prompt({
84
- type: 'input',
85
- name: 'htmlPageTitle',
86
- message: 'What should the HTML page title be?',
87
- });
88
- return response.htmlPageTitle;
89
- }
90
- async function promptForDependencies(_isPlayground) {
91
- const prompt = await getEnquirerPrompt();
92
- const choices = [
93
- { value: 'ds', label: 'Kaltura DS - Design System (requires GIT_TOKEN)' },
94
- ];
95
- const response = await prompt({
96
- type: 'multiselect',
97
- name: 'dependencies',
98
- message: 'Select dependencies to install (use space to select, enter to confirm):',
99
- choices: choices.map(c => ({ name: c.value, message: c.label })),
100
- });
101
- return response.dependencies;
102
45
  }
103
46
  async function addApplicationGenerator(tree, options) {
104
47
  // Validate options
@@ -111,23 +54,16 @@ async function addApplicationGenerator(tree, options) {
111
54
  const isAssetsOnly = options.servingType === 'assets-only';
112
55
  // Validate and read .unisphere configuration
113
56
  const unisphereConfig = (0, utils_1.validateUnisphereConfig)(tree);
114
- let runtimeName = '';
115
- let visualName = '';
57
+ let runtimeName = options.runtimeName || '';
58
+ let visualName = options.visualName || '';
116
59
  let selectedDependencies = [];
117
60
  if (isAssetsOnly) {
118
- // Assets-only apps don't need runtime, visual, or dependencies
119
61
  options.htmlPageTitle = options.htmlPageTitle || options.name;
120
62
  selectedDependencies = [];
121
63
  }
122
64
  else {
123
- const promptResult = await promptForRuntimeName(unisphereConfig.runtimes, options.runtimeName || '', options.visualName || '', options.skipDynamicRuntimeVisualPrompt || false);
124
- runtimeName = promptResult.runtimeName;
125
- visualName = promptResult.visualName;
126
65
  if (!isPlayground && !options.htmlPageTitle) {
127
- options.htmlPageTitle = options.htmlPageTitle || await promptForHtmlPageTitle();
128
- }
129
- if (options.dependencies === undefined) {
130
- options.dependencies = await promptForDependencies(isPlayground);
66
+ options.htmlPageTitle = options.name;
131
67
  }
132
68
  const baseDependencies = ['react'];
133
69
  selectedDependencies = [...baseDependencies, ...(options.dependencies || [])];
@@ -4,6 +4,5 @@ export interface AddApplicationGeneratorSchema {
4
4
  servingType: 'local-dev-playground' | 'self-hosted' | 'iframe-with-post-messages' | 'assets-only';
5
5
  runtimeName?: string;
6
6
  visualName?: string;
7
- skipDynamicRuntimeVisualPrompt?: boolean; // Internal option to skip the dynamic prompt for visual when runtime is selected
8
7
  dependencies?: string[];
9
8
  }
@@ -17,32 +17,37 @@
17
17
  "type": "string",
18
18
  "description": "How should this app be served?",
19
19
  "default": "local-dev-playground",
20
- "enum": [
21
- "local-dev-playground",
22
- "self-hosted",
23
- "iframe-with-post-messages",
24
- "assets-only"
20
+ "oneOf": [
21
+ { "const": "local-dev-playground", "title": "Local Dev Playground" },
22
+ { "const": "self-hosted", "title": "Self-Hosted" },
23
+ { "const": "iframe-with-post-messages", "title": "Iframe with Post Messages" },
24
+ { "const": "assets-only", "title": "Assets Only" }
25
25
  ]
26
26
  },
27
27
  "runtimeName": {
28
28
  "type": "string",
29
- "description": "Which runtime should the playground load?"
29
+ "description": "The runtime to associate with this application (optional, must exist in .unisphere config)"
30
+ },
31
+ "visualName": {
32
+ "type": "string",
33
+ "description": "The visual type to mount for the selected runtime (optional, must exist in the runtime's visuals list)"
30
34
  },
31
35
  "htmlPageTitle": {
32
36
  "type": "string",
33
- "description": "The HTML page title for your app"
37
+ "description": "The HTML page title for non-playground apps (defaults to app name if not provided)"
34
38
  },
35
39
  "dependencies": {
36
40
  "type": "array",
37
- "description": "Select packages to install (use space to select, enter to confirm)",
41
+ "description": "Additional packages to install",
38
42
  "items": {
39
43
  "type": "string",
40
- "enum": [
41
- "ds",
42
- "mui",
43
- "react-hook-form"
44
+ "oneOf": [
45
+ { "const": "ds", "title": "Design System" },
46
+ { "const": "mui", "title": "Material UI" },
47
+ { "const": "react-hook-form", "title": "React Hook Form" }
44
48
  ]
45
- }
49
+ },
50
+ "default": []
46
51
  }
47
52
  },
48
53
  "required": [
@@ -1 +1 @@
1
- {"version":3,"file":"add-runtime.d.ts","sourceRoot":"","sources":["../../../src/generators/add-runtime/add-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,IAAI,EAAsC,MAAM,YAAY,CAAC;AAElG,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAgFrD,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,yBAAyB,uBA+GnC;AAED,eAAe,mBAAmB,CAAC"}
1
+ {"version":3,"file":"add-runtime.d.ts","sourceRoot":"","sources":["../../../src/generators/add-runtime/add-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,IAAI,EAAsC,MAAM,YAAY,CAAC;AAElG,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAgFrD,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,yBAAyB,uBA8GnC;AAED,eAAe,mBAAmB,CAAC"}
@@ -52,7 +52,6 @@ function updateTypesIndexExport(tree, runtimeName, basePath) {
52
52
  }
53
53
  async function addRuntimeGenerator(tree, options) {
54
54
  validateOptions(options);
55
- // Normalize consumer option - Nx list prompts may return string labels instead of boolean values
56
55
  let isExternal = options?.consumer === 'external' ? true : false;
57
56
  // Validate and read .unisphere configuration
58
57
  const unisphereConfig = (0, utils_1.validateUnisphereConfig)(tree);
@@ -52,7 +52,7 @@ function addCicdStep(tree) {
52
52
  devkit_1.logger.info('ℹ️ Security Audit step already exists in cicd.yml, skipping');
53
53
  return;
54
54
  }
55
- const installDepsMatch = content.match(/( *- name: Install Dependencies\n(?:.*\n)*?)( - name: )/);
55
+ const installDepsMatch = content.match(/( *- name: Install Dependencies[ \t]*\n(?:.*\n)*?)([ \t]*- name: )/);
56
56
  if (!installDepsMatch) {
57
57
  devkit_1.logger.warn('⚠️ Could not find Install Dependencies step in cicd.yml');
58
58
  throw new Error('Could not find Install Dependencies step in cicd.yml');
package/migrations.json CHANGED
@@ -686,6 +686,65 @@
686
686
  "alwaysAddToPackageJson": false
687
687
  }
688
688
  }
689
+ },
690
+ "4.4.0": {
691
+ "version": "4.4.0",
692
+ "cli": "nx",
693
+ "postUpdateMessage": "🎉 Migration to @unisphere/nx 4.4.0 completed successfully!",
694
+ "packages": {
695
+ "nx": {
696
+ "version": "22.7.1",
697
+ "alwaysAddToPackageJson": false
698
+ },
699
+ "@nx/devkit": {
700
+ "version": "22.7.1",
701
+ "alwaysAddToPackageJson": false
702
+ },
703
+ "@nx/eslint": {
704
+ "version": "22.7.1",
705
+ "alwaysAddToPackageJson": false
706
+ },
707
+ "@nx/eslint-plugin": {
708
+ "version": "22.7.1",
709
+ "alwaysAddToPackageJson": false
710
+ },
711
+ "@nx/jest": {
712
+ "version": "22.7.1",
713
+ "alwaysAddToPackageJson": false
714
+ },
715
+ "@nx/js": {
716
+ "version": "22.7.1",
717
+ "alwaysAddToPackageJson": false
718
+ },
719
+ "@nx/react": {
720
+ "version": "22.7.1",
721
+ "alwaysAddToPackageJson": false
722
+ },
723
+ "@nx/rollup": {
724
+ "version": "22.7.1",
725
+ "alwaysAddToPackageJson": false
726
+ },
727
+ "@nx/vite": {
728
+ "version": "22.7.1",
729
+ "alwaysAddToPackageJson": false
730
+ },
731
+ "@nx/web": {
732
+ "version": "22.7.1",
733
+ "alwaysAddToPackageJson": false
734
+ },
735
+ "@nx/webpack": {
736
+ "version": "22.7.1",
737
+ "alwaysAddToPackageJson": false
738
+ },
739
+ "@nx/workspace": {
740
+ "version": "22.7.1",
741
+ "alwaysAddToPackageJson": false
742
+ },
743
+ "@unisphere/cli": {
744
+ "version": "5.0.1",
745
+ "alwaysAddToPackageJson": false
746
+ }
747
+ }
689
748
  }
690
749
  }
691
750
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unisphere/nx",
3
- "version": "4.3.2",
3
+ "version": "4.4.0",
4
4
  "private": false,
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",