@unisphere/nx 3.2.3 → 3.3.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,uBAoIvC;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,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"}
@@ -60,7 +60,7 @@ async function promptForHtmlPageTitle() {
60
60
  });
61
61
  return response.htmlPageTitle;
62
62
  }
63
- async function promptForDependencies(isPlayground) {
63
+ async function promptForDependencies(_isPlayground) {
64
64
  const prompt = await getEnquirerPrompt();
65
65
  const choices = [
66
66
  { value: 'ds', label: 'Kaltura DS - Design System (requires GIT_TOKEN)' },
@@ -81,7 +81,9 @@ async function addApplicationGenerator(tree, options) {
81
81
  const isPlayground = options.servingType === 'local-dev-playground';
82
82
  // Validate and read .unisphere configuration
83
83
  const unisphereConfig = (0, utils_1.validateUnisphereConfig)(tree);
84
- const { runtimeName, visualName } = await promptForRuntimeName(unisphereConfig.runtimes, options.runtimeName || '', options.visualName || '', options.skipDynamicRuntimeVisualPrompt || false);
84
+ const promptResult = await promptForRuntimeName(unisphereConfig.runtimes, options.runtimeName || '', options.visualName || '', options.skipDynamicRuntimeVisualPrompt || false);
85
+ const runtimeName = promptResult.runtimeName;
86
+ const visualName = promptResult.visualName;
85
87
  if (!isPlayground && !options.htmlPageTitle) {
86
88
  options.htmlPageTitle = options.htmlPageTitle || await promptForHtmlPageTitle();
87
89
  }
@@ -103,7 +105,6 @@ async function addApplicationGenerator(tree, options) {
103
105
  applicationName += '-dev';
104
106
  }
105
107
  const applicationNameAsLowerDashCase = (0, devkit_1.names)(applicationName).fileName;
106
- // Find types package (or fallback to core)
107
108
  const typesPackageInfo = (0, utils_1.findTypesOrCorePackageInfo)(tree);
108
109
  // Determine subdirectory based on serving type
109
110
  // local-dev-playground -> local/, other types -> server/
@@ -0,0 +1,5 @@
1
+ import { Tree } from '@nx/devkit';
2
+ import { AddDocumentationGeneratorSchema } from './schema';
3
+ export declare function addDocumentationGenerator(tree: Tree, options: AddDocumentationGeneratorSchema): Promise<() => void>;
4
+ export default addDocumentationGenerator;
5
+ //# sourceMappingURL=add-documentation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-documentation.d.ts","sourceRoot":"","sources":["../../../src/generators/add-documentation/add-documentation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,IAAI,EAAiB,MAAM,YAAY,CAAC;AAI9D,OAAO,EAAE,+BAA+B,EAAE,MAAM,UAAU,CAAC;AAM3D,wBAAsB,yBAAyB,CAC7C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,+BAA+B,uBA4GzC;AAED,eAAe,yBAAyB,CAAC"}
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addDocumentationGenerator = addDocumentationGenerator;
4
+ const tslib_1 = require("tslib");
5
+ const devkit_1 = require("@nx/devkit");
6
+ const path = tslib_1.__importStar(require("path"));
7
+ const child_process_1 = require("child_process");
8
+ const fs = tslib_1.__importStar(require("fs"));
9
+ const utils_1 = require("../utils");
10
+ async function addDocumentationGenerator(tree, options) {
11
+ // Validate .unisphere configuration exists
12
+ (0, utils_1.validateUnisphereConfig)(tree);
13
+ // Check workspace pattern for documentation apps
14
+ const rootPackageJsonPath = 'package.json';
15
+ if (tree.exists(rootPackageJsonPath)) {
16
+ const packageJson = JSON.parse(tree.read(rootPackageJsonPath, 'utf-8') || '{}');
17
+ const workspaces = packageJson.workspaces || [];
18
+ // Check if using the old catch-all pattern that doesn't work with documentation apps
19
+ const hasCatchAllPattern = workspaces.includes('unisphere/**');
20
+ if (hasCatchAllPattern) {
21
+ throw new Error('Documentation sites require @unisphere/nx version 3.1.0 or higher.\n\n' +
22
+ 'Your workspace is using an old npm workspaces pattern that prevents documentation sites ' +
23
+ 'from having their own node_modules.\n\n' +
24
+ 'Please upgrade by running:\n' +
25
+ ' npx nx migrate @unisphere/nx@latest\n' +
26
+ ' npx nx migrate --run-migrations\n\n' +
27
+ 'This will update your workspace pattern to support documentation sites.');
28
+ }
29
+ }
30
+ const documentationName = options.name;
31
+ const documentationNameAsLowerDashCase = (0, devkit_1.names)(documentationName).fileName;
32
+ const projectRoot = `unisphere/documentation/${documentationNameAsLowerDashCase}`;
33
+ // Check if the documentation site already exists
34
+ if (tree.exists(projectRoot)) {
35
+ throw new Error(`Documentation site "${documentationNameAsLowerDashCase}" already exists at ${projectRoot}.\n` +
36
+ 'Please choose a different name or remove the existing documentation site first.');
37
+ }
38
+ // Update .unisphere configuration
39
+ (0, utils_1.updateUnisphereConfig)(tree, 'documentation', documentationNameAsLowerDashCase, {
40
+ sourceRoot: projectRoot,
41
+ });
42
+ // Add documentation folder to .nxignore to prevent NX from scanning it
43
+ // Docusaurus has its own node_modules which can slow down NX
44
+ const nxIgnorePath = '.nxignore';
45
+ const ignoreEntry = `${projectRoot}/node_modules`;
46
+ let nxIgnoreContent = '';
47
+ if (tree.exists(nxIgnorePath)) {
48
+ nxIgnoreContent = tree.read(nxIgnorePath, 'utf-8') || '';
49
+ }
50
+ if (!nxIgnoreContent.includes(ignoreEntry)) {
51
+ const newContent = nxIgnoreContent
52
+ ? `${nxIgnoreContent.trimEnd()}\n\n# Documentation site (Docusaurus) - has its own node_modules\n${ignoreEntry}\n`
53
+ : `# Documentation site (Docusaurus) - has its own node_modules\n${ignoreEntry}\n`;
54
+ tree.write(nxIgnorePath, newContent);
55
+ }
56
+ await (0, devkit_1.formatFiles)(tree);
57
+ // Return a function that will be executed after all file operations are complete
58
+ return () => {
59
+ const workspaceRoot = process.cwd();
60
+ const fullProjectPath = path.join(workspaceRoot, projectRoot);
61
+ devkit_1.logger.info('');
62
+ devkit_1.logger.info('Setting up Docusaurus documentation site...');
63
+ devkit_1.logger.info('');
64
+ try {
65
+ // Create the parent directory if it doesn't exist
66
+ const parentDir = path.dirname(fullProjectPath);
67
+ if (!fs.existsSync(parentDir)) {
68
+ fs.mkdirSync(parentDir, { recursive: true });
69
+ }
70
+ // Run Docusaurus CLI to scaffold the project
71
+ // Docusaurus creates a self-contained project with its own package.json
72
+ // No NX integration needed - we just delegate to Docusaurus CLI for serve/build
73
+ // Use public npm registry explicitly (workspaces may have private registry configured)
74
+ devkit_1.logger.info('Running Docusaurus CLI...');
75
+ (0, child_process_1.execSync)(`npx --yes --registry https://registry.npmjs.org create-docusaurus@3 "${fullProjectPath}" classic --typescript`, {
76
+ stdio: 'inherit',
77
+ cwd: workspaceRoot,
78
+ });
79
+ devkit_1.logger.info('');
80
+ devkit_1.logger.info('Documentation site generated successfully!');
81
+ devkit_1.logger.info('');
82
+ devkit_1.logger.info(`Name: ${documentationNameAsLowerDashCase}`);
83
+ devkit_1.logger.info(`Type: Documentation Site (Docusaurus)`);
84
+ devkit_1.logger.info(`Location: ${projectRoot}`);
85
+ devkit_1.logger.info('');
86
+ devkit_1.logger.info(`To serve: npx unisphere documentation serve ${documentationNameAsLowerDashCase}`);
87
+ devkit_1.logger.info(`To build: npx unisphere documentation build ${documentationNameAsLowerDashCase}`);
88
+ devkit_1.logger.info('');
89
+ }
90
+ catch (error) {
91
+ devkit_1.logger.error('Failed to create Docusaurus project:');
92
+ devkit_1.logger.error(error instanceof Error ? error.message : String(error));
93
+ throw error;
94
+ }
95
+ };
96
+ }
97
+ exports.default = addDocumentationGenerator;
@@ -0,0 +1,3 @@
1
+ export interface AddDocumentationGeneratorSchema {
2
+ name: string;
3
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "$schema": "https://json-schema.org/schema",
3
+ "$id": "AddDocumentation",
4
+ "title": "Add Documentation Generator",
5
+ "type": "object",
6
+ "properties": {
7
+ "name": {
8
+ "type": "string",
9
+ "description": "The name of the documentation site to create",
10
+ "pattern": "^[a-zA-Z][a-zA-Z0-9\\-\\s]*$",
11
+ "$default": {
12
+ "$source": "argv",
13
+ "index": 0
14
+ },
15
+ "x-prompt": "What is the documentation site name? (letters, numbers, dashes and spaces allowed)"
16
+ }
17
+ },
18
+ "required": [
19
+ "name"
20
+ ]
21
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../src/generators/internal-dev-runner/generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAalC,wBAA8B,sBAAsB,CAAC,IAAI,EAAE,IAAI,iBAsC9D"}
1
+ {"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../src/generators/internal-dev-runner/generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAclC,wBAA8B,sBAAsB,CAAC,IAAI,EAAE,IAAI,iBAuC9D"}
@@ -11,7 +11,8 @@ const tslib_1 = require("tslib");
11
11
  // import reorganizeApplicationsByDistributionChannel from '../../migrations/3-0-0/reorganize-applications-by-distribution-channel';
12
12
  // import upgradeSchemaTo2 from '../../migrations/3-0-0/upgrade-schema-to-2-0-0';
13
13
  // import postCleanupEmptyDirectories from '../../migrations/3-0-0/post-cleanup-empty-directories';
14
- const remove_private_from_applications_and_runtimes_1 = tslib_1.__importDefault(require("../../migrations/3-0-0/remove-private-from-applications-and-runtimes"));
14
+ // import removePrivateFromApplicationsAndRuntimes from '../../migrations/3-0-0/remove-private-from-applications-and-runtimes';
15
+ const fix_workspaces_pattern_1 = tslib_1.__importDefault(require("../../migrations/3-1-0/fix-workspaces-pattern"));
15
16
  async function testMigrationGenerator(tree) {
16
17
  // Collect all callbacks to run after all migrations complete
17
18
  // const callbacks: (() => void)[] = [];
@@ -29,7 +30,8 @@ async function testMigrationGenerator(tree) {
29
30
  // Upgrade schema to 2.0.0 and remove distributionChannel from packages
30
31
  // await upgradeSchemaTo2(tree);
31
32
  // Remove private field from applications, runtimes, and packages
32
- await (0, remove_private_from_applications_and_runtimes_1.default)(tree);
33
+ // await removePrivateFromApplicationsAndRuntimes(tree);
34
+ await (0, fix_workspaces_pattern_1.default)(tree);
33
35
  // Post-cleanup: Remove empty directories after reorganization
34
36
  // const postCleanupCallback = await postCleanupEmptyDirectories(tree);
35
37
  // if (postCleanupCallback) {
@@ -9,7 +9,7 @@ export interface UnisphereConfig {
9
9
  }
10
10
  export declare function validateUnisphereConfig(tree: Tree): UnisphereConfig;
11
11
  export declare function updateTsConfigPaths(tree: Tree, pathKey: string, pathValue: string): void;
12
- export declare function updateUnisphereConfig(tree: Tree, elementType: 'packages' | 'runtimes' | 'applications', elementName: string, elementConfig: Record<string, any>): void;
12
+ export declare function updateUnisphereConfig(tree: Tree, elementType: 'packages' | 'runtimes' | 'applications' | 'documentation', elementName: string, elementConfig: Record<string, any>): void;
13
13
  export declare function validateRuntimeExists(tree: Tree, runtimeName: string): string;
14
14
  export declare function findCorePackageAlias(tree: Tree): string;
15
15
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/generators/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EAKL,MAAM,YAAY,CAAC;AAGpB,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EA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E,WAAW,EAAE,MAAM,GAAG,OAAO,CAgB7E;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,QAAQ,GAAG,UAAU,GAAG,MAAM,GAAG,YAAY,GAAG,MAAM,CAQrG;AAED;;;;GAIG;AACH,wBAAgB,iCAAiC,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAWnF;AAED;;;;GAIG;AACH,wBAAgB,gCAAgC,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAI3E;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,GACpB,IAAI,CAyBN"}
@@ -0,0 +1,23 @@
1
+ import { Tree } from '@nx/devkit';
2
+ /**
3
+ * Migration: Fix npm workspaces pattern to use explicit includes
4
+ *
5
+ * This migration updates the root package.json workspaces array to use
6
+ * explicit include patterns instead of a catch-all pattern with exclusions.
7
+ *
8
+ * The problem with "unisphere/**" + "!unisphere/applications/documentation/**"
9
+ * is that npm's negation patterns don't work reliably. This caused documentation
10
+ * apps (like Docusaurus) to be unable to have their own node_modules.
11
+ *
12
+ * The fix is to use explicit patterns that only include what should be workspaces:
13
+ * - unisphere/packages/**
14
+ * - unisphere/runtimes/**
15
+ * - unisphere/visuals/**
16
+ * - unisphere/applications/local/**
17
+ * - unisphere/applications/server/**
18
+ *
19
+ * This automatically excludes unisphere/applications/documentation/** without
20
+ * needing a negation pattern.
21
+ */
22
+ export default function update(tree: Tree): Promise<void>;
23
+ //# sourceMappingURL=fix-workspaces-pattern.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fix-workspaces-pattern.d.ts","sourceRoot":"","sources":["../../../src/migrations/3-1-0/fix-workspaces-pattern.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAA+B,MAAM,YAAY,CAAC;AAE/D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAA8B,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CA8D9D"}
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = update;
4
+ const devkit_1 = require("@nx/devkit");
5
+ /**
6
+ * Migration: Fix npm workspaces pattern to use explicit includes
7
+ *
8
+ * This migration updates the root package.json workspaces array to use
9
+ * explicit include patterns instead of a catch-all pattern with exclusions.
10
+ *
11
+ * The problem with "unisphere/**" + "!unisphere/applications/documentation/**"
12
+ * is that npm's negation patterns don't work reliably. This caused documentation
13
+ * apps (like Docusaurus) to be unable to have their own node_modules.
14
+ *
15
+ * The fix is to use explicit patterns that only include what should be workspaces:
16
+ * - unisphere/packages/**
17
+ * - unisphere/runtimes/**
18
+ * - unisphere/visuals/**
19
+ * - unisphere/applications/local/**
20
+ * - unisphere/applications/server/**
21
+ *
22
+ * This automatically excludes unisphere/applications/documentation/** without
23
+ * needing a negation pattern.
24
+ */
25
+ async function update(tree) {
26
+ devkit_1.logger.info('🔄 Fixing npm workspaces pattern to use explicit includes');
27
+ const packageJsonPath = 'package.json';
28
+ if (!tree.exists(packageJsonPath)) {
29
+ devkit_1.logger.warn('No package.json found, skipping migration');
30
+ return;
31
+ }
32
+ const packageJson = (0, devkit_1.readJson)(tree, packageJsonPath);
33
+ if (!packageJson.workspaces || !Array.isArray(packageJson.workspaces)) {
34
+ devkit_1.logger.warn('No workspaces array found in package.json, skipping migration');
35
+ return;
36
+ }
37
+ const oldWorkspaces = packageJson.workspaces;
38
+ // Check if using the old catch-all pattern
39
+ const hasCatchAllPattern = oldWorkspaces.includes('unisphere/**');
40
+ const hasNegationPattern = oldWorkspaces.some((pattern) => pattern.startsWith('!'));
41
+ if (!hasCatchAllPattern && !hasNegationPattern) {
42
+ // Check if already using explicit patterns
43
+ const expectedPatterns = [
44
+ 'unisphere/packages/**',
45
+ 'unisphere/runtimes/**',
46
+ 'unisphere/visuals/**',
47
+ 'unisphere/applications/local/**',
48
+ 'unisphere/applications/server/**',
49
+ ];
50
+ const hasAllExpectedPatterns = expectedPatterns.every(pattern => oldWorkspaces.includes(pattern));
51
+ if (hasAllExpectedPatterns) {
52
+ devkit_1.logger.info('Workspaces already using explicit patterns, skipping migration');
53
+ return;
54
+ }
55
+ }
56
+ // Replace with explicit patterns
57
+ const newWorkspaces = [
58
+ 'unisphere/packages/**',
59
+ 'unisphere/runtimes/**',
60
+ 'unisphere/visuals/**',
61
+ 'unisphere/applications/local/**',
62
+ 'unisphere/applications/server/**',
63
+ ];
64
+ packageJson.workspaces = newWorkspaces;
65
+ (0, devkit_1.writeJson)(tree, packageJsonPath, packageJson);
66
+ devkit_1.logger.info('✅ Updated workspaces from:');
67
+ devkit_1.logger.info(` ${JSON.stringify(oldWorkspaces)}`);
68
+ devkit_1.logger.info(' to:');
69
+ devkit_1.logger.info(` ${JSON.stringify(newWorkspaces)}`);
70
+ devkit_1.logger.info('');
71
+ devkit_1.logger.info('This allows documentation apps (like Docusaurus) to have their own node_modules.');
72
+ }
package/generators.json CHANGED
@@ -15,6 +15,11 @@
15
15
  "schema": "./dist/generators/add-application/schema.json",
16
16
  "description": "add-application generator"
17
17
  },
18
+ "add-documentation": {
19
+ "factory": "./dist/generators/add-documentation/add-documentation",
20
+ "schema": "./dist/generators/add-documentation/schema.json",
21
+ "description": "Add a documentation site (Docusaurus)"
22
+ },
18
23
  "add-visual": {
19
24
  "factory": "./dist/generators/add-visual/add-visual",
20
25
  "schema": "./dist/generators/add-visual/schema.json",
package/migrations.json CHANGED
@@ -273,7 +273,15 @@
273
273
  "3-0-0-remove-pre-install": {
274
274
  "version": "3.0.0",
275
275
  "description": "Removes kaltura-tools preinstall script from package.json",
276
- "factory": "./dist/migrations/3-0-0/remove-kaltura-tools-to-pre-install.js",
276
+ "factory": "./dist/migrations/3-0-0/remove-kaltura-tools-to-pre-install.js"
277
+ },
278
+ "3-1-0-fix-workspaces-pattern": {
279
+ "version": "3.1.0",
280
+ "description": "Fixes npm workspaces pattern to use explicit includes instead of catch-all with exclusions",
281
+ "factory": "./dist/migrations/3-1-0/fix-workspaces-pattern.js",
282
+ "cli": {
283
+ "postUpdateMessage": "✅ npm workspaces pattern updated to use explicit includes. Documentation apps can now have their own node_modules."
284
+ }
277
285
  }
278
286
  },
279
287
  "packageJsonUpdates": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unisphere/nx",
3
- "version": "3.2.3",
3
+ "version": "3.3.0",
4
4
  "private": false,
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",