@unisphere/nx 3.21.0 → 3.23.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.
- package/dist/generators/add-documentation/add-documentation.d.ts.map +1 -1
- package/dist/generators/add-documentation/add-documentation.js +7 -0
- package/dist/generators/add-documentation/discover-typedoc-plugins.d.ts +23 -0
- package/dist/generators/add-documentation/discover-typedoc-plugins.d.ts.map +1 -0
- package/dist/generators/add-documentation/discover-typedoc-plugins.js +128 -0
- package/dist/generators/add-documentation/templates/docusaurus.config.ts.template +2 -1
- package/dist/generators/add-documentation/templates/package.json.template +2 -1
- package/dist/generators/add-documentation/templates/plugins/discover-typedoc-plugins.mjs +156 -0
- package/dist/generators/add-documentation/templates/plugins/typedoc-plugins.ts.template +7 -0
- package/dist/generators/add-documentation/templates/src/theme/Navbar/Content/index.tsx +8 -0
- package/dist/generators/change-package-scope/change-package-scope.d.ts +23 -0
- package/dist/generators/change-package-scope/change-package-scope.d.ts.map +1 -0
- package/dist/generators/change-package-scope/change-package-scope.js +345 -0
- package/dist/generators/change-package-scope/schema.d.ts +4 -0
- package/dist/generators/change-package-scope/schema.json +24 -0
- package/dist/generators/change-package-scope/utils.d.ts +38 -0
- package/dist/generators/change-package-scope/utils.d.ts.map +1 -0
- package/dist/generators/change-package-scope/utils.js +116 -0
- package/dist/migrations/3-23-0/update-documentation-typedoc-plugins.d.ts +12 -0
- package/dist/migrations/3-23-0/update-documentation-typedoc-plugins.d.ts.map +1 -0
- package/dist/migrations/3-23-0/update-documentation-typedoc-plugins.js +160 -0
- package/generators.json +5 -0
- package/migrations.json +8 -0
- package/package.json +1 -1
- package/dist/generators/add-documentation/templates/static/docs/overview/unisphere-for-dummies-1.png +0 -0
- package/dist/generators/add-documentation/templates/static/docs/overview/unisphere-for-dummies-2.png +0 -0
- package/dist/generators/add-documentation/templates/static/docs/overview/unisphere-for-dummies-3.png +0 -0
- package/dist/generators/add-documentation/templates/static/docs/overview/unisphere-for-dummies-4.png +0 -0
- package/dist/generators/add-documentation/templates/static/homepage/divider.svg +0 -5
- package/dist/generators/add-documentation/templates/static/homepage/icons/Architecture.svg +0 -4
- package/dist/generators/add-documentation/templates/static/homepage/icons/Cost.svg +0 -4
- package/dist/generators/add-documentation/templates/static/homepage/icons/ExternalLink.svg +0 -3
- package/dist/generators/add-documentation/templates/static/homepage/icons/Infra.svg +0 -8
- package/dist/generators/add-documentation/templates/static/homepage/icons/Redundancies.svg +0 -6
- package/dist/generators/add-documentation/templates/static/homepage/icons/Speed.svg +0 -6
- package/dist/generators/add-documentation/templates/static/homepage/icons/Standards.svg +0 -4
- package/dist/generators/add-documentation/templates/static/homepage/icons/Unified.svg +0 -12
- package/dist/generators/add-documentation/templates/static/homepage/services/custo.jpg +0 -0
- package/dist/generators/add-documentation/templates/static/homepage/services/flame.jpg +0 -0
- package/dist/generators/add-documentation/templates/static/homepage/services/keepr.jpg +0 -0
- package/dist/generators/add-documentation/templates/static/homepage/services/loggi.jpg +0 -0
- package/dist/generators/add-documentation/templates/static/homepage/services/palleto.jpg +0 -0
- package/dist/generators/add-documentation/templates/static/homepage/services/publi.jpg +0 -0
- package/dist/generators/add-documentation/templates/static/homepage/services/tinker.jpg +0 -0
- package/dist/generators/add-documentation/templates/static/img/logo_big.svg +0 -12
- package/dist/generators/add-documentation/templates/static/img/logo_big_dark.svg +0 -12
- package/dist/generators/add-documentation/templates/static/img/unisphere-social-card.jpg +0 -0
- package/dist/generators/add-documentation/templates/static/llm/INTEGRATE.md +0 -497
- package/dist/generators/add-documentation/templates/static/team/amirc.jpeg +0 -0
- package/dist/generators/add-documentation/templates/static/team/erans.jpeg +0 -0
- package/dist/generators/add-documentation/templates/static/team/hadass.jpeg +0 -0
- package/dist/generators/add-documentation/templates/static/team/hillelc.jpeg +0 -0
- package/dist/generators/add-documentation/templates/static/team/idoz.jpeg +0 -0
- package/dist/generators/add-documentation/templates/static/team/lianb.jpeg +0 -0
- package/dist/generators/add-documentation/templates/static/team/nirb.jpeg +0 -0
- package/dist/generators/add-documentation/templates/static/team/nivs.jpeg +0 -0
- package/dist/generators/add-documentation/templates/static/team/omric.jpeg +0 -0
- package/dist/generators/add-documentation/templates/static/team/roeed.jpeg +0 -0
- package/dist/generators/add-documentation/templates/static/team/sivana.jpeg +0 -0
- package/dist/generators/add-documentation/templates/static/team/stask.png +0 -0
- package/dist/generators/add-documentation/templates/static/team/tanyal.jpeg +0 -0
- package/dist/generators/add-documentation/templates/static/team/tomere.jpeg +0 -0
- package/dist/generators/add-documentation/templates/static/team/tornikem.jpeg +0 -0
- package/dist/generators/add-documentation/templates/static/team/yairn.jpeg +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-documentation.d.ts","sourceRoot":"","sources":["../../../src/generators/add-documentation/add-documentation.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,IAAI,EAAiB,MAAM,YAAY,CAAC;AAG7E,OAAO,EAAE,+BAA+B,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"add-documentation.d.ts","sourceRoot":"","sources":["../../../src/generators/add-documentation/add-documentation.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,IAAI,EAAiB,MAAM,YAAY,CAAC;AAG7E,OAAO,EAAE,+BAA+B,EAAE,MAAM,UAAU,CAAC;AAa3D,wBAAsB,yBAAyB,CAC7C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,+BAA+B,qCA+JzC;AAED,eAAe,yBAAyB,CAAC"}
|
|
@@ -6,6 +6,7 @@ const devkit_1 = require("@nx/devkit");
|
|
|
6
6
|
const child_process_1 = require("child_process");
|
|
7
7
|
const path = tslib_1.__importStar(require("path"));
|
|
8
8
|
const utils_1 = require("../utils");
|
|
9
|
+
const discover_typedoc_plugins_1 = require("./discover-typedoc-plugins");
|
|
9
10
|
async function getEnquirerPrompt() {
|
|
10
11
|
const enquirer = await import('enquirer');
|
|
11
12
|
return enquirer.prompt || enquirer.default?.prompt || enquirer;
|
|
@@ -65,12 +66,18 @@ async function addDocumentationGenerator(tree, options) {
|
|
|
65
66
|
throw new Error(`Documentation site "${fullDocumentationName}" already exists at ${projectRoot}.\n` +
|
|
66
67
|
'Please choose a different name or remove the existing documentation site first.');
|
|
67
68
|
}
|
|
69
|
+
// Discover publishable packages for typedoc plugin auto-configuration
|
|
70
|
+
const discoveredPlugins = (0, discover_typedoc_plugins_1.discoverTypedocPlugins)(tree, projectRoot);
|
|
71
|
+
if (discoveredPlugins.length > 0) {
|
|
72
|
+
devkit_1.logger.info(`📚 Auto-discovered ${discoveredPlugins.length} package(s) for TypeDoc API documentation`);
|
|
73
|
+
}
|
|
68
74
|
// Generate files from template
|
|
69
75
|
const templateVariables = {
|
|
70
76
|
...(0, utils_1.createNameTransforms)(fullDocumentationName, 'documentationName'),
|
|
71
77
|
...(0, utils_1.createNameTransforms)(documentationNameAsLowerDashCase, 'experienceName'),
|
|
72
78
|
hasSubName: !!subNameAsLowerDashCase,
|
|
73
79
|
subNameKebab: subNameAsLowerDashCase || '',
|
|
80
|
+
typedocPluginsConfig: (0, discover_typedoc_plugins_1.buildTypedocPluginsCode)(discoveredPlugins),
|
|
74
81
|
tmpl: '',
|
|
75
82
|
};
|
|
76
83
|
(0, devkit_1.generateFiles)(tree, path.join(__dirname, 'templates'), projectRoot, templateVariables);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Tree } from '@nx/devkit';
|
|
2
|
+
interface TypdocPluginConfig {
|
|
3
|
+
id: string;
|
|
4
|
+
packageName: string;
|
|
5
|
+
entryPointsRelative: string;
|
|
6
|
+
tsconfigRelative: string;
|
|
7
|
+
out: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Discovers publishable packages from .unisphere config and generates
|
|
11
|
+
* docusaurus-plugin-typedoc configuration entries.
|
|
12
|
+
*
|
|
13
|
+
* Excludes packages whose sourceRoot contains '/local/' (internal packages).
|
|
14
|
+
* The docsProjectRoot is used to compute relative paths (e.g. "unisphere/documentation/genie").
|
|
15
|
+
*/
|
|
16
|
+
export declare function discoverTypedocPlugins(tree: Tree, docsProjectRoot: string): TypdocPluginConfig[];
|
|
17
|
+
/**
|
|
18
|
+
* Serialises the discovered plugin configs into a TypeScript source fragment
|
|
19
|
+
* suitable for injection into docusaurus.config.ts via EJS (<%- typedocPluginsConfig %>).
|
|
20
|
+
*/
|
|
21
|
+
export declare function buildTypedocPluginsCode(plugins: TypdocPluginConfig[]): string;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=discover-typedoc-plugins.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discover-typedoc-plugins.d.ts","sourceRoot":"","sources":["../../../src/generators/add-documentation/discover-typedoc-plugins.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAoB,MAAM,YAAY,CAAC;AAepD,UAAU,kBAAkB;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,gBAAgB,EAAE,MAAM,CAAC;IACzB,GAAG,EAAE,MAAM,CAAC;CACb;AAsCD;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,IAAI,EACV,eAAe,EAAE,MAAM,GACtB,kBAAkB,EAAE,CAkDtB;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,kBAAkB,EAAE,GAAG,MAAM,CAyB7E"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.discoverTypedocPlugins = discoverTypedocPlugins;
|
|
4
|
+
exports.buildTypedocPluginsCode = buildTypedocPluginsCode;
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
const devkit_1 = require("@nx/devkit");
|
|
7
|
+
const path = tslib_1.__importStar(require("path"));
|
|
8
|
+
/**
|
|
9
|
+
* Non-local scopes whose packages should be documented.
|
|
10
|
+
* Packages under 'local' are internal-only and excluded.
|
|
11
|
+
*/
|
|
12
|
+
const DOCUMENTED_SCOPES = [
|
|
13
|
+
'kaltura-corp',
|
|
14
|
+
'kaltura-apps',
|
|
15
|
+
'kaltura-ui',
|
|
16
|
+
'kaltura-sdk',
|
|
17
|
+
'unisphere',
|
|
18
|
+
];
|
|
19
|
+
/**
|
|
20
|
+
* Returns the npm package name for a given sourceRoot by looking up
|
|
21
|
+
* tsconfig.base.json paths.
|
|
22
|
+
* e.g. sourceRoot "unisphere/packages/kaltura-corp/shared-react"
|
|
23
|
+
* → "@kaltura-corp/unisphere-genie-shared-react"
|
|
24
|
+
*/
|
|
25
|
+
function findPackageName(tree, sourceRoot) {
|
|
26
|
+
if (!tree.exists('tsconfig.base.json'))
|
|
27
|
+
return null;
|
|
28
|
+
try {
|
|
29
|
+
const tsconfig = (0, devkit_1.readJson)(tree, 'tsconfig.base.json');
|
|
30
|
+
const paths = tsconfig?.compilerOptions?.paths ?? {};
|
|
31
|
+
const expectedPath = `${sourceRoot}/src/index.ts`;
|
|
32
|
+
for (const [alias, pathList] of Object.entries(paths)) {
|
|
33
|
+
if (Array.isArray(pathList) && pathList.includes(expectedPath)) {
|
|
34
|
+
return alias;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
// ignore
|
|
40
|
+
}
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Derives a short plugin id from an npm package name.
|
|
45
|
+
* "@kaltura-corp/unisphere-genie-shared-react" → "unisphere-genie-shared-react"
|
|
46
|
+
* "@unisphere/genie-types" → "genie-types"
|
|
47
|
+
*/
|
|
48
|
+
function shortName(packageName) {
|
|
49
|
+
const parts = packageName.split('/');
|
|
50
|
+
return parts[parts.length - 1];
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Discovers publishable packages from .unisphere config and generates
|
|
54
|
+
* docusaurus-plugin-typedoc configuration entries.
|
|
55
|
+
*
|
|
56
|
+
* Excludes packages whose sourceRoot contains '/local/' (internal packages).
|
|
57
|
+
* The docsProjectRoot is used to compute relative paths (e.g. "unisphere/documentation/genie").
|
|
58
|
+
*/
|
|
59
|
+
function discoverTypedocPlugins(tree, docsProjectRoot) {
|
|
60
|
+
if (!tree.exists('.unisphere'))
|
|
61
|
+
return [];
|
|
62
|
+
let config;
|
|
63
|
+
try {
|
|
64
|
+
config = (0, devkit_1.readJson)(tree, '.unisphere');
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
return [];
|
|
68
|
+
}
|
|
69
|
+
const packages = config?.elements?.packages ?? {};
|
|
70
|
+
const plugins = [];
|
|
71
|
+
for (const [, pkgConfig] of Object.entries(packages)) {
|
|
72
|
+
const sourceRoot = pkgConfig?.sourceRoot;
|
|
73
|
+
if (!sourceRoot)
|
|
74
|
+
continue;
|
|
75
|
+
// Determine the scope directory from the sourceRoot path
|
|
76
|
+
// Expected: unisphere/packages/<scope>/<name>
|
|
77
|
+
const parts = sourceRoot.split('/');
|
|
78
|
+
if (parts.length < 4)
|
|
79
|
+
continue;
|
|
80
|
+
const scope = parts[2]; // e.g. "local", "kaltura-corp", "unisphere"
|
|
81
|
+
if (!DOCUMENTED_SCOPES.includes(scope))
|
|
82
|
+
continue;
|
|
83
|
+
const packageName = findPackageName(tree, sourceRoot);
|
|
84
|
+
if (!packageName) {
|
|
85
|
+
devkit_1.logger.warn(`⚠️ Could not find npm package name for ${sourceRoot} — skipping in typedoc plugins`);
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
const short = shortName(packageName);
|
|
89
|
+
// Relative path from docs site root to the package
|
|
90
|
+
// docsProjectRoot: "unisphere/documentation/genie"
|
|
91
|
+
// sourceRoot: "unisphere/packages/kaltura-corp/shared-react"
|
|
92
|
+
const relativeBase = path.relative(docsProjectRoot, sourceRoot).replace(/\\/g, '/');
|
|
93
|
+
plugins.push({
|
|
94
|
+
id: `api-${short}`,
|
|
95
|
+
packageName,
|
|
96
|
+
entryPointsRelative: `${relativeBase}/src/index.ts`,
|
|
97
|
+
tsconfigRelative: `${relativeBase}/tsconfig.json`,
|
|
98
|
+
out: `docs/api/${short}/v1`,
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
return plugins;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Serialises the discovered plugin configs into a TypeScript source fragment
|
|
105
|
+
* suitable for injection into docusaurus.config.ts via EJS (<%- typedocPluginsConfig %>).
|
|
106
|
+
*/
|
|
107
|
+
function buildTypedocPluginsCode(plugins) {
|
|
108
|
+
if (plugins.length === 0)
|
|
109
|
+
return '[]';
|
|
110
|
+
const entries = plugins
|
|
111
|
+
.map((p) => `\n // ${p.packageName}\n` +
|
|
112
|
+
` [\n` +
|
|
113
|
+
` 'docusaurus-plugin-typedoc',\n` +
|
|
114
|
+
` {\n` +
|
|
115
|
+
` id: '${p.id}',\n` +
|
|
116
|
+
` entryPoints: ['${p.entryPointsRelative}'],\n` +
|
|
117
|
+
` tsconfig: '${p.tsconfigRelative}',\n` +
|
|
118
|
+
` out: '${p.out}',\n` +
|
|
119
|
+
` readme: 'none',\n` +
|
|
120
|
+
` excludePrivate: true,\n` +
|
|
121
|
+
` excludeProtected: true,\n` +
|
|
122
|
+
` excludeInternal: true,\n` +
|
|
123
|
+
` disableSources: true,\n` +
|
|
124
|
+
` },\n` +
|
|
125
|
+
` ]`)
|
|
126
|
+
.join(',');
|
|
127
|
+
return `[${entries},\n ]`;
|
|
128
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { themes as prismThemes } from 'prism-react-renderer';
|
|
2
2
|
import type { Config } from '@docusaurus/types';
|
|
3
3
|
import type * as Preset from '@docusaurus/preset-classic';
|
|
4
|
+
import typedocPlugins from './plugins/typedoc-plugins';
|
|
4
5
|
|
|
5
6
|
const config: Config = {
|
|
6
7
|
<% if (hasSubName) { -%>
|
|
@@ -47,7 +48,7 @@ const config: Config = {
|
|
|
47
48
|
} satisfies Preset.Options,
|
|
48
49
|
],
|
|
49
50
|
],
|
|
50
|
-
plugins:
|
|
51
|
+
plugins: typedocPlugins,
|
|
51
52
|
themes: [
|
|
52
53
|
'@docusaurus/theme-mermaid',
|
|
53
54
|
[
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
"serve": "docusaurus serve",
|
|
13
13
|
"write-translations": "docusaurus write-translations",
|
|
14
14
|
"write-heading-ids": "docusaurus write-heading-ids",
|
|
15
|
-
"typecheck": "tsc"
|
|
15
|
+
"typecheck": "tsc",
|
|
16
|
+
"discover-plugins": "node plugins/discover-typedoc-plugins.mjs"
|
|
16
17
|
},
|
|
17
18
|
"dependencies": {
|
|
18
19
|
"@docusaurus/core": "^3.8.1",
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Auto-discovers publishable packages from .unisphere config and regenerates
|
|
4
|
+
* plugins/typedoc-plugins.ts with updated docusaurus-plugin-typedoc entries.
|
|
5
|
+
*
|
|
6
|
+
* Run: npm run discover-plugins
|
|
7
|
+
*
|
|
8
|
+
* - Reads <workspace-root>/.unisphere for packages list
|
|
9
|
+
* - Reads <workspace-root>/tsconfig.base.json for npm package names
|
|
10
|
+
* - Writes plugins/typedoc-plugins.ts
|
|
11
|
+
*
|
|
12
|
+
* Packages under the "local" scope are excluded (internal-only packages).
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { readFileSync, writeFileSync, existsSync } from 'fs';
|
|
16
|
+
import { join, relative, dirname } from 'path';
|
|
17
|
+
import { fileURLToPath } from 'url';
|
|
18
|
+
|
|
19
|
+
const DOCUMENTED_SCOPES = [
|
|
20
|
+
'kaltura-corp',
|
|
21
|
+
'kaltura-apps',
|
|
22
|
+
'kaltura-ui',
|
|
23
|
+
'kaltura-sdk',
|
|
24
|
+
'unisphere',
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
// This script lives at <docs-site>/plugins/discover-typedoc-plugins.mjs
|
|
28
|
+
const pluginsDir = dirname(fileURLToPath(import.meta.url));
|
|
29
|
+
const docsSiteRoot = join(pluginsDir, '..');
|
|
30
|
+
|
|
31
|
+
// Walk up from docs site to find workspace root (where .unisphere lives)
|
|
32
|
+
function findWorkspaceRoot(startDir) {
|
|
33
|
+
let dir = startDir;
|
|
34
|
+
while (true) {
|
|
35
|
+
if (existsSync(join(dir, '.unisphere'))) return dir;
|
|
36
|
+
const parent = dirname(dir);
|
|
37
|
+
if (parent === dir) {
|
|
38
|
+
throw new Error(
|
|
39
|
+
'Could not find .unisphere — are you inside a Unisphere workspace?'
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
dir = parent;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const workspaceRoot = findWorkspaceRoot(docsSiteRoot);
|
|
47
|
+
|
|
48
|
+
// Parse workspace configs
|
|
49
|
+
const unisphere = JSON.parse(
|
|
50
|
+
readFileSync(join(workspaceRoot, '.unisphere'), 'utf-8')
|
|
51
|
+
);
|
|
52
|
+
const tsconfig = JSON.parse(
|
|
53
|
+
readFileSync(join(workspaceRoot, 'tsconfig.base.json'), 'utf-8')
|
|
54
|
+
);
|
|
55
|
+
const tsconfigPaths = tsconfig?.compilerOptions?.paths ?? {};
|
|
56
|
+
const packages = unisphere?.elements?.packages ?? {};
|
|
57
|
+
|
|
58
|
+
// Build reverse lookup: "sourceRoot/src/index.ts" → npm package name
|
|
59
|
+
const pathToPackageName = {};
|
|
60
|
+
for (const [pkgName, paths] of Object.entries(tsconfigPaths)) {
|
|
61
|
+
if (Array.isArray(paths)) {
|
|
62
|
+
for (const p of paths) {
|
|
63
|
+
pathToPackageName[p] = pkgName;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function findPackageName(sourceRoot) {
|
|
69
|
+
return pathToPackageName[`${sourceRoot}/src/index.ts`] ?? null;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function shortName(pkgName) {
|
|
73
|
+
return pkgName.split('/').pop();
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Discover plugins
|
|
77
|
+
const discovered = [];
|
|
78
|
+
for (const [, pkgConfig] of Object.entries(packages)) {
|
|
79
|
+
const sourceRoot = pkgConfig?.sourceRoot;
|
|
80
|
+
if (!sourceRoot) continue;
|
|
81
|
+
|
|
82
|
+
// Expected sourceRoot format: unisphere/packages/<scope>/<name>
|
|
83
|
+
const parts = sourceRoot.split('/');
|
|
84
|
+
if (parts.length < 4) continue;
|
|
85
|
+
const scope = parts[2];
|
|
86
|
+
|
|
87
|
+
if (!DOCUMENTED_SCOPES.includes(scope)) continue;
|
|
88
|
+
|
|
89
|
+
const pkgName = findPackageName(sourceRoot);
|
|
90
|
+
if (!pkgName) {
|
|
91
|
+
console.warn(`⚠️ No tsconfig path found for ${sourceRoot} — skipping`);
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const short = shortName(pkgName);
|
|
96
|
+
// Relative path from docs site root to the package folder
|
|
97
|
+
const relBase = relative(
|
|
98
|
+
docsSiteRoot,
|
|
99
|
+
join(workspaceRoot, sourceRoot)
|
|
100
|
+
).replace(/\\/g, '/');
|
|
101
|
+
|
|
102
|
+
discovered.push({
|
|
103
|
+
id: `api-${short}`,
|
|
104
|
+
packageName: pkgName,
|
|
105
|
+
entryPoints: `${relBase}/src/index.ts`,
|
|
106
|
+
tsconfig: `${relBase}/tsconfig.json`,
|
|
107
|
+
out: `docs/api/${short}/v1`,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Serialise to TypeScript
|
|
112
|
+
function pluginsToTs(plugins) {
|
|
113
|
+
if (plugins.length === 0) return '[]';
|
|
114
|
+
|
|
115
|
+
const entries = plugins
|
|
116
|
+
.map(
|
|
117
|
+
(p) =>
|
|
118
|
+
` // ${p.packageName}\n` +
|
|
119
|
+
` [\n` +
|
|
120
|
+
` 'docusaurus-plugin-typedoc',\n` +
|
|
121
|
+
` {\n` +
|
|
122
|
+
` id: '${p.id}',\n` +
|
|
123
|
+
` entryPoints: ['${p.entryPoints}'],\n` +
|
|
124
|
+
` tsconfig: '${p.tsconfig}',\n` +
|
|
125
|
+
` out: '${p.out}',\n` +
|
|
126
|
+
` readme: 'none',\n` +
|
|
127
|
+
` excludePrivate: true,\n` +
|
|
128
|
+
` excludeProtected: true,\n` +
|
|
129
|
+
` excludeInternal: true,\n` +
|
|
130
|
+
` disableSources: true,\n` +
|
|
131
|
+
` },\n` +
|
|
132
|
+
` ]`
|
|
133
|
+
)
|
|
134
|
+
.join(',\n');
|
|
135
|
+
|
|
136
|
+
return `[\n${entries},\n]`;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const content =
|
|
140
|
+
`// Auto-generated by plugins/discover-typedoc-plugins.mjs\n` +
|
|
141
|
+
`// Run "npm run discover-plugins" to regenerate\n` +
|
|
142
|
+
`\n` +
|
|
143
|
+
`// eslint-disable-next-line @typescript-eslint/no-explicit-any\n` +
|
|
144
|
+
`const typedocPlugins: any[] = ${pluginsToTs(discovered)};\n` +
|
|
145
|
+
`\n` +
|
|
146
|
+
`export default typedocPlugins;\n`;
|
|
147
|
+
|
|
148
|
+
const outPath = join(pluginsDir, 'typedoc-plugins.ts');
|
|
149
|
+
writeFileSync(outPath, content, 'utf-8');
|
|
150
|
+
|
|
151
|
+
console.log(
|
|
152
|
+
`✅ Discovered ${discovered.length} package(s) → plugins/typedoc-plugins.ts`
|
|
153
|
+
);
|
|
154
|
+
for (const p of discovered) {
|
|
155
|
+
console.log(` • ${p.packageName} → ${p.out}`);
|
|
156
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Auto-generated by plugins/discover-typedoc-plugins.mjs
|
|
2
|
+
// Run "npm run discover-plugins" to regenerate
|
|
3
|
+
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5
|
+
const typedocPlugins: any[] = <%- typedocPluginsConfig %>;
|
|
6
|
+
|
|
7
|
+
export default typedocPlugins;
|
|
@@ -67,6 +67,14 @@ const navIcons: Record<string, ReactNode> = {
|
|
|
67
67
|
<circle cx="12" cy="12" r="10" />
|
|
68
68
|
</svg>
|
|
69
69
|
),
|
|
70
|
+
'Examples': (
|
|
71
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
72
|
+
<rect x="3" y="3" width="7" height="7" />
|
|
73
|
+
<rect x="14" y="3" width="7" height="7" />
|
|
74
|
+
<rect x="3" y="14" width="7" height="7" />
|
|
75
|
+
<rect x="14" y="14" width="7" height="7" />
|
|
76
|
+
</svg>
|
|
77
|
+
),
|
|
70
78
|
};
|
|
71
79
|
|
|
72
80
|
function NavbarItemWithIcon({item, index}: {item: NavbarItemConfig; index: number}): ReactNode {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Change Package Scope Generator
|
|
3
|
+
*
|
|
4
|
+
* Changes a package's npm scope by:
|
|
5
|
+
* 1. Validating the package exists and target scope is valid
|
|
6
|
+
* 2. Parsing the package.json name to extract current scope and package name
|
|
7
|
+
* 3. Using Nx's built-in move generator to handle:
|
|
8
|
+
* - Directory and file moves
|
|
9
|
+
* - Import statement updates across the workspace
|
|
10
|
+
* - TypeScript path mappings in tsconfig.base.json
|
|
11
|
+
* 4. Performing Unisphere-specific cleanup:
|
|
12
|
+
* - Updating .unisphere configuration
|
|
13
|
+
* - Ensuring package.json name matches conventions
|
|
14
|
+
* - Updating package-lock.json path keys
|
|
15
|
+
* - Updating vite.config.ts cache directory paths
|
|
16
|
+
* - Updating project.json lintFilePatterns and comments
|
|
17
|
+
* - Updating README.md with new package name
|
|
18
|
+
*/
|
|
19
|
+
import { Tree } from '@nx/devkit';
|
|
20
|
+
import { ChangePackageScopeGeneratorSchema } from './schema';
|
|
21
|
+
export declare function changePackageScopeGenerator(tree: Tree, options: ChangePackageScopeGeneratorSchema): Promise<void>;
|
|
22
|
+
export default changePackageScopeGenerator;
|
|
23
|
+
//# sourceMappingURL=change-package-scope.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"change-package-scope.d.ts","sourceRoot":"","sources":["../../../src/generators/change-package-scope/change-package-scope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EACL,IAAI,EAIL,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,iCAAiC,EAAE,MAAM,UAAU,CAAC;AAiW7D,wBAAsB,2BAA2B,CAC/C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,iCAAiC,iBAoH3C;AAED,eAAe,2BAA2B,CAAC"}
|