@unisphere/nx 1.13.0 → 1.19.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.
Files changed (54) hide show
  1. package/README.md +4 -4
  2. package/dist/generators/add-application/add-application.d.ts.map +1 -1
  3. package/dist/generators/add-application/add-application.js +74 -30
  4. package/dist/generators/add-application/schema.d.ts +2 -1
  5. package/dist/generators/add-application/schema.json +16 -33
  6. package/dist/generators/add-application/templates/default/package.json.template +2 -1
  7. package/dist/generators/add-application/templates/default/src/app/app.tsx.template +24 -3
  8. package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/package.json +2 -4
  9. package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/src/app/app.tsx.template +8 -12
  10. package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/src/app/components/header.tsx.template +1 -1
  11. package/dist/generators/add-package/add-package.d.ts.map +1 -1
  12. package/dist/generators/add-package/add-package.js +10 -2
  13. package/dist/generators/add-package/schema.d.ts +1 -0
  14. package/dist/generators/add-package/schema.json +29 -1
  15. package/dist/generators/add-runtime/add-runtime.d.ts.map +1 -1
  16. package/dist/generators/add-runtime/add-runtime.js +26 -20
  17. package/dist/generators/add-runtime/schema.d.ts +2 -1
  18. package/dist/generators/add-runtime/schema.json +46 -11
  19. package/dist/generators/add-runtime/templates/core-templates/__runtimeName__-runtime/runtime-types.ts.template +2 -2
  20. package/dist/generators/add-runtime/templates/new-runtime/src/lib/create-factory.tsx.template +13 -12
  21. package/dist/generators/dependency-config.d.ts +23 -0
  22. package/dist/generators/dependency-config.d.ts.map +1 -0
  23. package/dist/generators/dependency-config.js +134 -0
  24. package/dist/generators/rename-package/rename-package.d.ts +18 -0
  25. package/dist/generators/rename-package/rename-package.d.ts.map +1 -0
  26. package/dist/generators/rename-package/rename-package.js +274 -0
  27. package/dist/generators/rename-package/schema.d.ts +4 -0
  28. package/dist/generators/rename-package/schema.json +23 -0
  29. package/dist/generators/unisphere-migrate/run-locally.md +4 -1
  30. package/dist/generators/unisphere-migrate/upgrade-guide.md +22 -6
  31. package/dist/migrations/update-1-1-5/templates/_publish-artifacts.template +210 -0
  32. package/dist/migrations/update-1-1-5/templates/cicd.template +13 -3
  33. package/dist/migrations/update-1-1-5/update-github-workflow.d.ts.map +1 -1
  34. package/dist/migrations/update-1-1-5/update-github-workflow.js +28 -17
  35. package/generators.json +5 -0
  36. package/package.json +2 -2
  37. /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/.babelrc +0 -0
  38. /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/.eslintrc.json +0 -0
  39. /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/jest.config.ts +0 -0
  40. /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/project.json +0 -0
  41. /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/src/app/components/settings-buttons.tsx +0 -0
  42. /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/src/app/components/settings-form.tsx +0 -0
  43. /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/src/app/components/settings.tsx +0 -0
  44. /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/src/app/configuration-provider.tsx +0 -0
  45. /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/src/app/definitions.ts +0 -0
  46. /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/src/app/utils/merge-deep.ts +0 -0
  47. /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/src/favicon.ico +0 -0
  48. /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/src/index.html +0 -0
  49. /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/src/main.tsx +0 -0
  50. /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/src/styles.css +0 -0
  51. /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/tsconfig.app.json +0 -0
  52. /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/tsconfig.json +0 -0
  53. /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/tsconfig.spec.json +0 -0
  54. /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/webpack.config.js +0 -0
@@ -0,0 +1,210 @@
1
+ name: Shared Deployment Jobs
2
+
3
+ on:
4
+ workflow_call:
5
+
6
+ jobs:
7
+ prepare-runtimes:
8
+ runs-on:
9
+ - codebuild-ovp-unisphere-runner-${{ github.run_id }}-${{ github.attempt }}
10
+ - instance-size:medium
11
+ outputs:
12
+ unisphereElementsArtifactsFolder: ${{ steps.prepare-runtimes.outputs.artifactsRootFolder }}
13
+ hasArtifacts: ${{ steps.prepare-runtimes.outputs.hasArtifacts }}
14
+ commit_sha: ${{ steps.capture_commit_sha.outputs.commit_sha }}
15
+ steps:
16
+ - name: Checkout Repo
17
+ uses: actions/checkout@v3
18
+ with:
19
+ ref: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref }}
20
+ fetch-tags: true
21
+ - name: Setup Node.js
22
+ uses: actions/setup-node@v4
23
+ with:
24
+ node-version-file: '.nvmrc'
25
+ - name: Clean workspace
26
+ run: git reset --hard HEAD
27
+ - name: Clean npm cache
28
+ run: npm cache clean --force
29
+ - name: Install dependencies
30
+ run: npm ci --include=optional
31
+ env:
32
+ GIT_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33
+ - name: Prepare Unisphere Elements
34
+ id: prepare-runtimes
35
+ run: npx unisphere runtime publish prepare --verbose
36
+ - name: Capture Commit SHA
37
+ id: capture_commit_sha
38
+ run: echo "commit_sha=$(git rev-parse HEAD)" >> $GITHUB_ENV
39
+ - name: Set commit_sha as output
40
+ id: set_commit_sha
41
+ run: echo "commit_sha=${{ env.commit_sha }}" >> $GITHUB_OUTPUT
42
+ - uses: actions/upload-artifact@v4
43
+ id: upload-unisphere-elements-artifacts
44
+ with:
45
+ name: unisphere-elements
46
+ path: ${{ steps.prepare-runtimes.outputs.artifactsRootFolder }}
47
+ retention-days: 1
48
+
49
+ deploy-runtimes:
50
+ if: needs.prepare-runtimes.outputs.hasArtifacts == 'true'
51
+ needs: prepare-runtimes
52
+ runs-on:
53
+ - codebuild-ovp-unisphere-runner-${{ github.run_id }}-${{ github.attempt }}
54
+ - instance-size:medium
55
+ strategy:
56
+ matrix:
57
+ envs_regions:
58
+ - { env: 'nvp1', region: 'us-east-1', accountid: '583352821080' }
59
+ - { env: 'frp2', region: 'eu-central-1', accountid: '082111255551' }
60
+ - { env: 'irp2', region: 'eu-west-1', accountid: '137576761235' }
61
+ - { env: 'nvq2', region: 'us-east-1', accountid: '383697330906' }
62
+ - { env: 'sgp2', region: 'ap-southeast-1', accountid: '882351240370' }
63
+ - { env: 'syp2', region: 'ap-southeast-2', accountid: '650755435642' }
64
+ - { env: 'cap2', region: 'ca-central-1', accountid: '948632009361' }
65
+ fail-fast: false
66
+ steps:
67
+ - name: Checkout Repo at specific commit
68
+ uses: actions/checkout@v3
69
+ with:
70
+ ref: ${{ needs.prepare-runtimes.outputs.commit_sha }}
71
+ fetch-tags: true
72
+ - name: Setup Node.js
73
+ uses: actions/setup-node@v4
74
+ with:
75
+ node-version-file: '.nvmrc'
76
+ - name: Install dependencies
77
+ run: npm ci --include=optional
78
+ env:
79
+ GIT_TOKEN: ${{ secrets.GITHUB_TOKEN }}
80
+ - name: Download artifacts folder
81
+ uses: actions/download-artifact@v4
82
+ with:
83
+ name: unisphere-elements
84
+ path: ${{ needs.prepare-runtimes.outputs.unisphereElementsArtifactsFolder }}
85
+ - name: Sync S3 bucket
86
+ run: |
87
+ npx unisphere runtime publish execute \
88
+ --env ${{ matrix.envs_regions.env }} \
89
+ --aws-region '${{ matrix.envs_regions.region }}' \
90
+ --aws-arn 'arn:aws:iam::${{matrix.envs_regions.accountid }}:role/${{ matrix.envs_regions.env }}-unisphere-content-role' \
91
+ --artifacts-folder '${{ needs.prepare-runtimes.outputs.unisphereElementsArtifactsFolder }}' \
92
+ --verbose
93
+
94
+ deploy-packages:
95
+ if: always()
96
+ needs: [prepare-runtimes, deploy-runtimes]
97
+ runs-on:
98
+ - codebuild-ovp-unisphere-runner-${{ github.run_id }}-${{ github.attempt }}
99
+ - instance-size:medium
100
+ steps:
101
+ - name: Checkout Repo
102
+ uses: actions/checkout@v3
103
+ with:
104
+ ref: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref }}
105
+ fetch-tags: true
106
+ - name: Setup Node.js
107
+ uses: actions/setup-node@v4
108
+ with:
109
+ node-version: 20
110
+ - name: Install dependencies
111
+ run: npm ci --include=optional
112
+ env:
113
+ GIT_TOKEN: ${{ secrets.GITHUB_TOKEN }}
114
+ - name: Get NPM Token from AWS Secrets Manager
115
+ id: get-npm-token
116
+ run: |
117
+ NPM_TOKEN=$(aws secretsmanager get-secret-value --secret-id arn:aws:secretsmanager:eu-central-1:785328604905:secret:unisphere-secrets-um86Cs --query SecretString --output text | jq -r '."NPM_UNISPHERE_TOKEN"')
118
+ echo "NPM_TOKEN=$NPM_TOKEN" >> $GITHUB_ENV
119
+ echo "::debug::Token exists: $([ ! -z "$NPM_TOKEN" ] && echo 'true' || echo 'false')"
120
+ - name: Deploy to registry
121
+ run: npx unisphere package publish --verbose --githubToken ${{ secrets.GITHUB_TOKEN }} --npmToken ${{ env.NPM_TOKEN }} --branch "${{ github.event_name == 'pull_request' && github.head_ref || github.ref }}"
122
+
123
+ prepare-applications:
124
+ if: always()
125
+ needs: [prepare-runtimes, deploy-runtimes]
126
+ runs-on:
127
+ - codebuild-ovp-unisphere-runner-${{ github.run_id }}-${{ github.attempt }}
128
+ - instance-size:medium
129
+ outputs:
130
+ unisphereApplicationsArtifactsFolder: ${{ steps.prepare-applications.outputs.artifactsRootFolder }}
131
+ hasArtifacts: ${{ steps.prepare-applications.outputs.hasArtifacts }}
132
+ commit_sha: ${{ steps.capture_commit_sha.outputs.commit_sha }}
133
+ steps:
134
+ - name: Checkout Repo
135
+ uses: actions/checkout@v3
136
+ with:
137
+ ref: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref }}
138
+ fetch-tags: true
139
+ - name: Setup Node.js
140
+ uses: actions/setup-node@v4
141
+ with:
142
+ node-version-file: '.nvmrc'
143
+ - name: Clean workspace
144
+ run: git reset --hard HEAD
145
+ - name: Clean npm cache
146
+ run: npm cache clean --force
147
+ - name: Install dependencies
148
+ run: npm ci --include=optional
149
+ env:
150
+ GIT_TOKEN: ${{ secrets.GITHUB_TOKEN }}
151
+ - name: Prepare Unisphere Applications
152
+ id: prepare-applications
153
+ run: npx unisphere application publish prepare --verbose
154
+ - name: Capture Commit SHA
155
+ id: capture_commit_sha
156
+ run: echo "commit_sha=$(git rev-parse HEAD)" >> $GITHUB_ENV
157
+ - name: Set commit_sha as output
158
+ id: set_commit_sha
159
+ run: echo "commit_sha=${{ env.commit_sha }}" >> $GITHUB_OUTPUT
160
+ - uses: actions/upload-artifact@v4
161
+ id: upload-unisphere-applications-artifacts
162
+ with:
163
+ name: unisphere-applications
164
+ path: ${{ steps.prepare-applications.outputs.artifactsRootFolder }}
165
+ retention-days: 1
166
+
167
+ deploy-applications:
168
+ if: always() && needs.prepare-applications.outputs.hasArtifacts == 'true'
169
+ needs: [prepare-applications, deploy-runtimes]
170
+ runs-on:
171
+ - codebuild-ovp-unisphere-runner-${{ github.run_id }}-${{ github.attempt }}
172
+ - instance-size:medium
173
+ strategy:
174
+ matrix:
175
+ envs_regions:
176
+ - { env: 'nvp1', region: 'us-east-1', accountid: '583352821080' }
177
+ - { env: 'frp2', region: 'eu-central-1', accountid: '082111255551' }
178
+ - { env: 'irp2', region: 'eu-west-1', accountid: '137576761235' }
179
+ - { env: 'nvq2', region: 'us-east-1', accountid: '383697330906' }
180
+ - { env: 'sgp2', region: 'ap-southeast-1', accountid: '882351240370' }
181
+ - { env: 'syp2', region: 'ap-southeast-2', accountid: '650755435642' }
182
+ - { env: 'cap2', region: 'ca-central-1', accountid: '948632009361' }
183
+ fail-fast: false
184
+ steps:
185
+ - name: Checkout Repo at specific commit
186
+ uses: actions/checkout@v3
187
+ with:
188
+ ref: ${{ needs.prepare-applications.outputs.commit_sha }}
189
+ fetch-tags: true
190
+ - name: Setup Node.js
191
+ uses: actions/setup-node@v4
192
+ with:
193
+ node-version: 20
194
+ - name: Install dependencies
195
+ run: npm ci --include=optional
196
+ env:
197
+ GIT_TOKEN: ${{ secrets.GITHUB_TOKEN }}
198
+ - name: Download artifacts folder
199
+ uses: actions/download-artifact@v4
200
+ with:
201
+ name: unisphere-applications
202
+ path: ${{ needs.prepare-applications.outputs.unisphereApplicationsArtifactsFolder }}
203
+ - name: Sync S3 bucket
204
+ run: |
205
+ npx unisphere application publish execute \
206
+ --env ${{ matrix.envs_regions.env }} \
207
+ --aws-region '${{ matrix.envs_regions.region }}' \
208
+ --aws-arn 'arn:aws:iam::${{matrix.envs_regions.accountid }}:role/${{ matrix.envs_regions.env }}-unisphere-content-role' \
209
+ --artifacts-folder '${{ needs.prepare-applications.outputs.unisphereApplicationsArtifactsFolder }}' \
210
+ --verbose
@@ -18,10 +18,15 @@ jobs:
18
18
  - name: Check if part of prerelease or official release
19
19
  id: check
20
20
  run: |
21
- if [ ! -f ".changeset/pre.json" ] && [ "${{ github.ref }}" != "refs/heads/main" ]; then
21
+ if [ "${{ github.ref }}" = "refs/heads/main" ] && [ -f ".changeset/pre.json" ]; then
22
+ echo "main branch should not have pre.json file, skipping job"
23
+ exit 1
24
+ elif [[ "${{ github.ref }}" == "refs/heads/prerelease/"* ]] && [ ! -f ".changeset/pre.json" ]; then
25
+ echo "prerelease branch must have pre.json file, skipping job"
26
+ exit 1
27
+ elif [ "${{ github.ref }}" != "refs/heads/main" ] && [[ "${{ github.ref }}" != "refs/heads/prerelease/"* ]]; then
22
28
  echo "not part of prerelease or official release, skipping job"
23
- echo "::stop-commands::`date +%s`"
24
- exit 0
29
+ exit 1
25
30
  fi
26
31
 
27
32
  - name: Checkout Repo
@@ -32,6 +37,11 @@ jobs:
32
37
  with:
33
38
  node-version-file: '.nvmrc'
34
39
 
40
+ - name: Run Kaltura Tools Check
41
+ uses: kaltura/kaltura-tools@main
42
+ with:
43
+ repo-path: '${{ github.workspace }}'
44
+
35
45
  - name: Install Dependencies
36
46
  run: npm ci --include=optional
37
47
  env:
@@ -1 +1 @@
1
- {"version":3,"file":"update-github-workflow.d.ts","sourceRoot":"","sources":["../../../src/migrations/update-1-1-5/update-github-workflow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAU,MAAM,YAAY,CAAC;AAI1C,wBAA8B,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAmC9D"}
1
+ {"version":3,"file":"update-github-workflow.d.ts","sourceRoot":"","sources":["../../../src/migrations/update-1-1-5/update-github-workflow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAU,MAAM,YAAY,CAAC;AAI1C,wBAA8B,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CA6C9D"}
@@ -5,31 +5,42 @@ const devkit_1 = require("@nx/devkit");
5
5
  const fs_1 = require("fs");
6
6
  const path_1 = require("path");
7
7
  async function update(tree) {
8
- devkit_1.logger.info('🔄 Updating .github/workflows/cicd.yml from template...');
9
- const workflowPath = '.github/workflows/cicd.yml';
10
- const templatePath = (0, path_1.join)(__dirname, 'templates', 'cicd.template');
8
+ devkit_1.logger.info('🔄 Updating .github/workflows files from templates...');
9
+ // Ensure .github/workflows directory exists
10
+ if (!tree.exists('.github')) {
11
+ tree.write('.github/.gitkeep', '');
12
+ devkit_1.logger.info('✅ Created .github directory');
13
+ }
14
+ if (!tree.exists('.github/workflows')) {
15
+ tree.write('.github/workflows/.gitkeep', '');
16
+ devkit_1.logger.info('✅ Created .github/workflows directory');
17
+ }
11
18
  try {
12
- // Read the template file
13
- const templateContent = (0, fs_1.readFileSync)(templatePath, 'utf-8');
14
- // Ensure .github/workflows directory exists
15
- if (!tree.exists('.github')) {
16
- tree.write('.github/.gitkeep', '');
17
- devkit_1.logger.info('✅ Created .github directory');
19
+ // Update cicd.yml
20
+ const cicdWorkflowPath = '.github/workflows/cicd.yml';
21
+ const cicdTemplatePath = (0, path_1.join)(__dirname, 'templates', 'cicd.template');
22
+ const cicdTemplateContent = (0, fs_1.readFileSync)(cicdTemplatePath, 'utf-8');
23
+ tree.write(cicdWorkflowPath, cicdTemplateContent);
24
+ if (tree.exists(cicdWorkflowPath)) {
25
+ devkit_1.logger.info(`✅ Updated ${cicdWorkflowPath} from template`);
18
26
  }
19
- if (!tree.exists('.github/workflows')) {
20
- tree.write('.github/workflows/.gitkeep', '');
21
- devkit_1.logger.info('✅ Created .github/workflows directory');
27
+ else {
28
+ devkit_1.logger.info(`✅ Created ${cicdWorkflowPath} from template`);
22
29
  }
23
- tree.write(workflowPath, templateContent);
24
- if (tree.exists(workflowPath)) {
25
- devkit_1.logger.info(`✅ Updated ${workflowPath} from template`);
30
+ // Update _publish-artifacts.yml
31
+ const publishArtifactsWorkflowPath = '.github/workflows/_publish-artifacts.yml';
32
+ const publishArtifactsTemplatePath = (0, path_1.join)(__dirname, 'templates', '_publish-artifacts.template');
33
+ const publishArtifactsTemplateContent = (0, fs_1.readFileSync)(publishArtifactsTemplatePath, 'utf-8');
34
+ tree.write(publishArtifactsWorkflowPath, publishArtifactsTemplateContent);
35
+ if (tree.exists(publishArtifactsWorkflowPath)) {
36
+ devkit_1.logger.info(`✅ Updated ${publishArtifactsWorkflowPath} from template`);
26
37
  }
27
38
  else {
28
- devkit_1.logger.info(`✅ Created ${workflowPath} from template`);
39
+ devkit_1.logger.info(`✅ Created ${publishArtifactsWorkflowPath} from template`);
29
40
  }
30
41
  }
31
42
  catch (error) {
32
- devkit_1.logger.error(`❌ Failed to update GitHub workflow: ${error?.message || 'Unknown error'}`);
43
+ devkit_1.logger.error(`❌ Failed to update GitHub workflows: ${error?.message || 'Unknown error'}`);
33
44
  throw error;
34
45
  }
35
46
  }
package/generators.json CHANGED
@@ -25,6 +25,11 @@
25
25
  "schema": "./dist/generators/unisphere-migrate/schema.json",
26
26
  "description": "Manually run all Unisphere migrations from migrations.json",
27
27
  "hidden": false
28
+ },
29
+ "rename-package": {
30
+ "factory": "./dist/generators/rename-package/rename-package",
31
+ "schema": "./dist/generators/rename-package/schema.json",
32
+ "description": "Rename a unisphere package and update all references"
28
33
  }
29
34
  }
30
35
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unisphere/nx",
3
- "version": "1.13.0",
3
+ "version": "1.19.0",
4
4
  "private": false,
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -95,4 +95,4 @@
95
95
  "nx-migrations": {
96
96
  "migrations": "./migrations.json"
97
97
  }
98
- }
98
+ }