@unisphere/nx 3.17.0 → 3.18.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,EAAsC,MAAM,YAAY,CAAC;AAElG,OAAO,EAAE,6BAA6B,EAAE,MAAM,UAAU,CAAC;AAkHzD,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,6BAA6B,uBAiIvC;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;AAkHzD,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,6BAA6B,uBAgKvC;AAED,eAAe,uBAAuB,CAAC"}
@@ -135,6 +135,36 @@ async function addApplicationGenerator(tree, options) {
135
135
  const templatePath = 'templates/default';
136
136
  // Generate files from templates
137
137
  (0, devkit_1.generateFiles)(tree, path.join(__dirname, templatePath), projectRoot, templateVariables);
138
+ // For local-dev-playground apps, generate setup-local-runtimes.ts
139
+ if (isPlayground) {
140
+ const rawConfig = (0, devkit_1.readJson)(tree, '.unisphere');
141
+ const experienceName = `${rawConfig.company}.${rawConfig.type}.${rawConfig.name}`;
142
+ const setupLocalRuntimesContent = `export function setupLocalRuntimes() {
143
+ if (!process.env.LOCAL_RUNTIMES) return;
144
+
145
+ const runtimes: Record<string, { token: string; baseEnvName: string }> = {};
146
+ process.env.LOCAL_RUNTIMES.split(',').forEach((entry) => {
147
+ const [name, port] = entry.split('@');
148
+ if (name && port) {
149
+ runtimes[name] = { token: port, baseEnvName: '' };
150
+ }
151
+ });
152
+
153
+ const overrides = {
154
+ baseEnvName: '',
155
+ mode: 'integration',
156
+ options: { verbose: 'inherit' },
157
+ baseEnvScope: { core: 'inherit', presets: 'inherit' },
158
+ runtimes: {
159
+ '${experienceName}': runtimes,
160
+ },
161
+ };
162
+
163
+ (window as any).unisphereRuntimeOverrides = btoa(JSON.stringify(overrides));
164
+ }
165
+ `;
166
+ tree.write(path.join(projectRoot, 'src', 'setup-local-runtimes.ts'), setupLocalRuntimesContent);
167
+ }
138
168
  // Install selected dependencies
139
169
  (0, dependency_config_1.installSelectedDependencies)(tree, selectedDependencies);
140
170
  // Update .unisphere configuration
@@ -1,8 +1,11 @@
1
1
  import { StrictMode } from 'react';
2
2
  import * as ReactDOM from 'react-dom/client';
3
-
3
+ <% if (servingType === 'local-dev-playground') { %>import { setupLocalRuntimes } from './setup-local-runtimes';
4
+ <% } %>
4
5
  import App from './app/app';
5
-
6
+ <% if (servingType === 'local-dev-playground') { %>
7
+ setupLocalRuntimes();
8
+ <% } %>
6
9
  const root = ReactDOM.createRoot(
7
10
  document.getElementById('root') as HTMLElement
8
11
  );
@@ -17,7 +17,8 @@ module.exports = {
17
17
  new DefinePlugin({
18
18
  // Add your environment variables here
19
19
  // Example: 'process.env.API_URL': JSON.stringify(process.env.API_URL),
20
- }),
20
+ <% if (servingType === 'local-dev-playground') { %> 'process.env.LOCAL_RUNTIMES': JSON.stringify(process.env.LOCAL_RUNTIMES),
21
+ <% } %> }),
21
22
  new NxAppWebpackPlugin({
22
23
  tsConfig: './tsconfig.app.json',
23
24
  compiler: 'babel',
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Migration: Update .gitignore to exclude user-scripts directory
3
+ *
4
+ * Adds user-scripts/ to .gitignore to prevent user scripts
5
+ * from being committed to the repository.
6
+ */
7
+ import { Tree } from '@nx/devkit';
8
+ export default function update(tree: Tree): Promise<void>;
9
+ //# sourceMappingURL=update-gitignore-user-scripts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-gitignore-user-scripts.d.ts","sourceRoot":"","sources":["../../../src/migrations/3-17-0/update-gitignore-user-scripts.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAU,MAAM,YAAY,CAAC;AAE1C,wBAA8B,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAgC9D"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ /**
3
+ * Migration: Update .gitignore to exclude user-scripts directory
4
+ *
5
+ * Adds user-scripts/ to .gitignore to prevent user scripts
6
+ * from being committed to the repository.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.default = update;
10
+ const devkit_1 = require("@nx/devkit");
11
+ async function update(tree) {
12
+ devkit_1.logger.info('🔄 Updating .gitignore to exclude user-scripts/...');
13
+ const gitignorePath = '.gitignore';
14
+ if (!tree.exists(gitignorePath)) {
15
+ devkit_1.logger.warn('⚠️ .gitignore file not found, creating one');
16
+ tree.write(gitignorePath, '');
17
+ }
18
+ try {
19
+ const currentContent = tree.read(gitignorePath, 'utf-8') || '';
20
+ let updatedContent = currentContent;
21
+ const userScriptsRegex = /^user-scripts\/\s*$/gm;
22
+ if (!userScriptsRegex.test(updatedContent)) {
23
+ if (!updatedContent.includes('user-scripts/')) {
24
+ updatedContent = updatedContent.trim() + '\nuser-scripts/\n';
25
+ devkit_1.logger.info('📝 Added user-scripts/ to .gitignore');
26
+ }
27
+ tree.write(gitignorePath, updatedContent);
28
+ devkit_1.logger.info('✅ Successfully updated .gitignore');
29
+ }
30
+ else {
31
+ devkit_1.logger.info('ℹ️ user-scripts/ already exists in .gitignore');
32
+ }
33
+ }
34
+ catch (error) {
35
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error';
36
+ devkit_1.logger.error(`❌ Failed to update .gitignore: ${errorMessage}`);
37
+ throw new Error(`Failed to update .gitignore: ${errorMessage}`);
38
+ }
39
+ }
package/migrations.json CHANGED
@@ -346,6 +346,14 @@
346
346
  "cli": {
347
347
  "postUpdateMessage": "✅ Local runtimes setup added to local applications"
348
348
  }
349
+ },
350
+ "3-17-0-update-gitignore-user-scripts": {
351
+ "version": "3.17.0",
352
+ "description": "Updates .gitignore to exclude user-scripts directory",
353
+ "factory": "./dist/migrations/3-17-0/update-gitignore-user-scripts.js",
354
+ "cli": {
355
+ "postUpdateMessage": "✅ .gitignore updated to exclude user-scripts/"
356
+ }
349
357
  }
350
358
  },
351
359
  "packageJsonUpdates": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unisphere/nx",
3
- "version": "3.17.0",
3
+ "version": "3.18.0",
4
4
  "private": false,
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",