@unisphere/nx 4.5.8 → 4.7.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 +11 -0
- package/dist/generators/add-documentation/templates/docs/changelog/overview.md +2 -1
- package/dist/generators/add-documentation/templates/docs/documentations/overview.md +9 -0
- package/dist/generators/add-documentation/templates/docs/{api → reference}/overview.md +2 -1
- package/dist/generators/add-documentation/templates/docusaurus.config.ts.template +41 -24
- package/dist/generators/add-documentation/templates/sidebars.ts +3 -3
- package/dist/generators/add-documentation/templates/src/components/homepage-features/index.tsx +56 -154
- package/dist/generators/add-documentation/templates/src/components/homepage-start-now/index.tsx +1 -1
- package/dist/generators/add-documentation/templates/src/css/custom.css +223 -0
- package/dist/generators/add-documentation/templates/src/pages/index.tsx.template +33 -145
- package/dist/generators/add-documentation/templates/src/theme/Navbar/Content/index.tsx +61 -103
- package/dist/generators/add-documentation/templates/src/theme/Navbar/Content/styles.module.css +3 -126
- package/dist/migrations/4-6-0/templates/custom.css +710 -0
- package/dist/migrations/4-6-0/templates/navbar-content-styles.module.css +9 -0
- package/dist/migrations/4-6-0/templates/navbar-content.tsx +103 -0
- package/dist/migrations/4-6-0/templates/sidebars.ts.template +9 -0
- package/dist/migrations/4-6-0/update-documentation-structure.d.ts +3 -0
- package/dist/migrations/4-6-0/update-documentation-structure.d.ts.map +1 -0
- package/dist/migrations/4-6-0/update-documentation-structure.js +238 -0
- package/dist/migrations/4-6-1/add-documentation-workflow.d.ts +3 -0
- package/dist/migrations/4-6-1/add-documentation-workflow.d.ts.map +1 -0
- package/dist/migrations/4-6-1/add-documentation-workflow.js +49 -0
- package/dist/migrations/4-6-1/templates/documentation-workflow.template +68 -0
- package/migrations.json +27 -0
- package/package.json +1 -1
- package/dist/generators/add-documentation/templates/docs/getting-started/overview.md +0 -8
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import React, {type ReactNode} from 'react';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import {
|
|
4
|
+
useThemeConfig,
|
|
5
|
+
ErrorCauseBoundary,
|
|
6
|
+
ThemeClassNames,
|
|
7
|
+
} from '@docusaurus/theme-common';
|
|
8
|
+
import {
|
|
9
|
+
splitNavbarItems,
|
|
10
|
+
useNavbarMobileSidebar,
|
|
11
|
+
} from '@docusaurus/theme-common/internal';
|
|
12
|
+
import NavbarItem, {type Props as NavbarItemConfig} from '@theme/NavbarItem';
|
|
13
|
+
import NavbarColorModeToggle from '@theme/Navbar/ColorModeToggle';
|
|
14
|
+
import SearchBar from '@theme/SearchBar';
|
|
15
|
+
import NavbarMobileSidebarToggle from '@theme/Navbar/MobileSidebar/Toggle';
|
|
16
|
+
import NavbarSearch from '@theme/Navbar/Search';
|
|
17
|
+
import NavbarLogo from '@theme/Navbar/Logo';
|
|
18
|
+
|
|
19
|
+
import styles from './styles.module.css';
|
|
20
|
+
|
|
21
|
+
function useNavbarItems() {
|
|
22
|
+
return useThemeConfig().navbar.items as NavbarItemConfig[];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function NavbarItems({items}: {items: NavbarItemConfig[]}): ReactNode {
|
|
26
|
+
return (
|
|
27
|
+
<>
|
|
28
|
+
{items.map((item, i) => (
|
|
29
|
+
<ErrorCauseBoundary
|
|
30
|
+
key={i}
|
|
31
|
+
onError={(error) =>
|
|
32
|
+
new Error(
|
|
33
|
+
`A theme navbar item failed to render.
|
|
34
|
+
Please double-check the following navbar item (themeConfig.navbar.items) of your Docusaurus config:
|
|
35
|
+
${JSON.stringify(item, null, 2)}`,
|
|
36
|
+
{cause: error},
|
|
37
|
+
)
|
|
38
|
+
}>
|
|
39
|
+
<NavbarItem {...item} />
|
|
40
|
+
</ErrorCauseBoundary>
|
|
41
|
+
))}
|
|
42
|
+
</>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function NavbarContentLayout({
|
|
47
|
+
left,
|
|
48
|
+
right,
|
|
49
|
+
}: {
|
|
50
|
+
left: ReactNode;
|
|
51
|
+
right: ReactNode;
|
|
52
|
+
}) {
|
|
53
|
+
return (
|
|
54
|
+
<div className="navbar__inner">
|
|
55
|
+
<div
|
|
56
|
+
className={clsx(
|
|
57
|
+
ThemeClassNames.layout.navbar.containerLeft,
|
|
58
|
+
'navbar__items',
|
|
59
|
+
)}>
|
|
60
|
+
{left}
|
|
61
|
+
</div>
|
|
62
|
+
<div
|
|
63
|
+
className={clsx(
|
|
64
|
+
ThemeClassNames.layout.navbar.containerRight,
|
|
65
|
+
'navbar__items navbar__items--right',
|
|
66
|
+
)}>
|
|
67
|
+
{right}
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export default function NavbarContent(): ReactNode {
|
|
74
|
+
const mobileSidebar = useNavbarMobileSidebar();
|
|
75
|
+
|
|
76
|
+
const items = useNavbarItems();
|
|
77
|
+
const [leftItems, rightItems] = splitNavbarItems(items);
|
|
78
|
+
|
|
79
|
+
const searchBarItem = items.find((item) => item.type === 'search');
|
|
80
|
+
|
|
81
|
+
return (
|
|
82
|
+
<NavbarContentLayout
|
|
83
|
+
left={
|
|
84
|
+
<>
|
|
85
|
+
{!mobileSidebar.disabled && <NavbarMobileSidebarToggle />}
|
|
86
|
+
<NavbarLogo />
|
|
87
|
+
<NavbarItems items={leftItems} />
|
|
88
|
+
</>
|
|
89
|
+
}
|
|
90
|
+
right={
|
|
91
|
+
<>
|
|
92
|
+
<NavbarItems items={rightItems} />
|
|
93
|
+
<NavbarColorModeToggle className={styles.colorModeToggle} />
|
|
94
|
+
{!searchBarItem && (
|
|
95
|
+
<NavbarSearch>
|
|
96
|
+
<SearchBar />
|
|
97
|
+
</NavbarSearch>
|
|
98
|
+
)}
|
|
99
|
+
</>
|
|
100
|
+
}
|
|
101
|
+
/>
|
|
102
|
+
);
|
|
103
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { SidebarsConfig } from '@docusaurus/plugin-content-docs';
|
|
2
|
+
|
|
3
|
+
const sidebars: SidebarsConfig = {
|
|
4
|
+
documentations: [{ type: 'autogenerated', dirName: '.' }],
|
|
5
|
+
reference: [{ type: 'autogenerated', dirName: '.' }],
|
|
6
|
+
changelog: [{ type: 'autogenerated', dirName: '.' }],
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export default sidebars;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-documentation-structure.d.ts","sourceRoot":"","sources":["../../../src/migrations/4-6-0/update-documentation-structure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAwC,MAAM,YAAY,CAAC;AA0KxE,wBAA8B,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CA8F9D"}
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = update;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const fs_1 = require("fs");
|
|
6
|
+
const path_1 = require("path");
|
|
7
|
+
function moveDirectory(tree, from, to) {
|
|
8
|
+
if (!tree.exists(from))
|
|
9
|
+
return;
|
|
10
|
+
const children = tree.children(from);
|
|
11
|
+
for (const child of children) {
|
|
12
|
+
const childPath = `${from}/${child}`;
|
|
13
|
+
if (tree.isFile(childPath)) {
|
|
14
|
+
const content = tree.read(childPath);
|
|
15
|
+
if (content) {
|
|
16
|
+
tree.write(`${to}/${child}`, content);
|
|
17
|
+
}
|
|
18
|
+
tree.delete(childPath);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
moveDirectory(tree, childPath, `${to}/${child}`);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function generateDocusaurusConfig(experienceName, hasSubName, subNameKebab) {
|
|
26
|
+
const humanReadable = (0, devkit_1.names)(experienceName).className.replace(/([a-z])([A-Z])/g, '$1 $2');
|
|
27
|
+
const lowerDashCase = (0, devkit_1.names)(experienceName).fileName;
|
|
28
|
+
const title = hasSubName
|
|
29
|
+
? `${humanReadable} | ${subNameKebab} Documentation`
|
|
30
|
+
: `${humanReadable} Documentation`;
|
|
31
|
+
const navbarTitle = hasSubName
|
|
32
|
+
? `${humanReadable} | ${subNameKebab}`
|
|
33
|
+
: humanReadable;
|
|
34
|
+
const baseUrl = hasSubName
|
|
35
|
+
? `/_/${lowerDashCase}/${subNameKebab}`
|
|
36
|
+
: `/${lowerDashCase}`;
|
|
37
|
+
return `import { themes as prismThemes } from 'prism-react-renderer';
|
|
38
|
+
import type { Config } from '@docusaurus/types';
|
|
39
|
+
import type * as Preset from '@docusaurus/preset-classic';
|
|
40
|
+
import typedocPlugins from './plugins/typedoc-plugins';
|
|
41
|
+
|
|
42
|
+
const config: Config = {
|
|
43
|
+
title: '${title}',
|
|
44
|
+
tagline: '',
|
|
45
|
+
favicon: 'img/favicon.ico',
|
|
46
|
+
|
|
47
|
+
url: 'https://docs.kaltura.com',
|
|
48
|
+
baseUrl: '${baseUrl}',
|
|
49
|
+
|
|
50
|
+
onBrokenLinks: 'warn',
|
|
51
|
+
onBrokenMarkdownLinks: 'warn',
|
|
52
|
+
|
|
53
|
+
noIndex: true,
|
|
54
|
+
|
|
55
|
+
i18n: {
|
|
56
|
+
defaultLocale: 'en',
|
|
57
|
+
locales: ['en'],
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
presets: [
|
|
61
|
+
[
|
|
62
|
+
'classic',
|
|
63
|
+
{
|
|
64
|
+
docs: false,
|
|
65
|
+
blog: false,
|
|
66
|
+
theme: {
|
|
67
|
+
customCss: './src/css/custom.css',
|
|
68
|
+
},
|
|
69
|
+
sitemap: {
|
|
70
|
+
ignorePatterns: ['**'],
|
|
71
|
+
},
|
|
72
|
+
} satisfies Preset.Options,
|
|
73
|
+
],
|
|
74
|
+
],
|
|
75
|
+
plugins: [
|
|
76
|
+
[
|
|
77
|
+
'@docusaurus/plugin-content-docs',
|
|
78
|
+
{
|
|
79
|
+
path: 'docs/documentations',
|
|
80
|
+
routeBasePath: 'documentations',
|
|
81
|
+
sidebarPath: './sidebars.ts',
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
[
|
|
85
|
+
'@docusaurus/plugin-content-docs',
|
|
86
|
+
{
|
|
87
|
+
id: 'reference',
|
|
88
|
+
path: 'docs/reference',
|
|
89
|
+
routeBasePath: 'reference',
|
|
90
|
+
sidebarPath: './sidebars.ts',
|
|
91
|
+
},
|
|
92
|
+
],
|
|
93
|
+
[
|
|
94
|
+
'@docusaurus/plugin-content-docs',
|
|
95
|
+
{
|
|
96
|
+
id: 'changelog',
|
|
97
|
+
path: 'docs/changelog',
|
|
98
|
+
routeBasePath: 'changelog',
|
|
99
|
+
sidebarPath: './sidebars.ts',
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
...typedocPlugins,
|
|
103
|
+
],
|
|
104
|
+
themes: [
|
|
105
|
+
'@docusaurus/theme-mermaid',
|
|
106
|
+
[
|
|
107
|
+
'@easyops-cn/docusaurus-search-local',
|
|
108
|
+
{
|
|
109
|
+
hashed: true,
|
|
110
|
+
indexBlog: false,
|
|
111
|
+
forceIgnoreNoIndex: true,
|
|
112
|
+
docsRouteBasePath: ['documentations', 'reference', 'changelog'],
|
|
113
|
+
},
|
|
114
|
+
],
|
|
115
|
+
],
|
|
116
|
+
markdown: {
|
|
117
|
+
mermaid: true,
|
|
118
|
+
},
|
|
119
|
+
themeConfig: {
|
|
120
|
+
colorMode: {
|
|
121
|
+
defaultMode: 'light',
|
|
122
|
+
disableSwitch: false,
|
|
123
|
+
respectPrefersColorScheme: true,
|
|
124
|
+
},
|
|
125
|
+
image: 'img/social-card.png',
|
|
126
|
+
navbar: {
|
|
127
|
+
title: '${navbarTitle}',
|
|
128
|
+
logo: {
|
|
129
|
+
alt: 'Logo',
|
|
130
|
+
src: 'img/logo.svg',
|
|
131
|
+
srcDark: 'img/logo_dark.svg',
|
|
132
|
+
},
|
|
133
|
+
items: [
|
|
134
|
+
{
|
|
135
|
+
to: 'documentations/overview',
|
|
136
|
+
label: 'Documentations',
|
|
137
|
+
position: 'left',
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
to: 'reference/overview',
|
|
141
|
+
label: 'Reference',
|
|
142
|
+
position: 'left',
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
to: 'changelog/overview',
|
|
146
|
+
label: 'Changelog',
|
|
147
|
+
position: 'left',
|
|
148
|
+
},
|
|
149
|
+
],
|
|
150
|
+
},
|
|
151
|
+
prism: {
|
|
152
|
+
theme: prismThemes.github,
|
|
153
|
+
darkTheme: prismThemes.dracula,
|
|
154
|
+
},
|
|
155
|
+
} satisfies Preset.ThemeConfig,
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
export default config;
|
|
159
|
+
`;
|
|
160
|
+
}
|
|
161
|
+
async function update(tree) {
|
|
162
|
+
devkit_1.logger.info('🔄 Updating documentation sites to new multi-plugin structure...');
|
|
163
|
+
const docsBasePath = 'unisphere/documentation';
|
|
164
|
+
if (!tree.exists(docsBasePath)) {
|
|
165
|
+
devkit_1.logger.info('ℹ️ No documentation sites found, skipping');
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
const docsSites = tree.children(docsBasePath);
|
|
169
|
+
if (docsSites.length === 0) {
|
|
170
|
+
devkit_1.logger.info('ℹ️ No documentation sites found, skipping');
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
// Read .unisphere config for experience name
|
|
174
|
+
let experienceName = '';
|
|
175
|
+
if (tree.exists('.unisphere')) {
|
|
176
|
+
try {
|
|
177
|
+
const config = (0, devkit_1.readJson)(tree, '.unisphere');
|
|
178
|
+
experienceName = config.name || '';
|
|
179
|
+
}
|
|
180
|
+
catch {
|
|
181
|
+
devkit_1.logger.warn('⚠️ Could not read .unisphere config');
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
// Read migration template files
|
|
185
|
+
const sidebarsContent = (0, fs_1.readFileSync)((0, path_1.join)(__dirname, 'templates', 'sidebars.ts.template'), 'utf-8');
|
|
186
|
+
const cssContent = (0, fs_1.readFileSync)((0, path_1.join)(__dirname, 'templates', 'custom.css'), 'utf-8');
|
|
187
|
+
const navbarContent = (0, fs_1.readFileSync)((0, path_1.join)(__dirname, 'templates', 'navbar-content.tsx'), 'utf-8');
|
|
188
|
+
const navbarStylesContent = (0, fs_1.readFileSync)((0, path_1.join)(__dirname, 'templates', 'navbar-content-styles.module.css'), 'utf-8');
|
|
189
|
+
let updatedCount = 0;
|
|
190
|
+
for (const site of docsSites) {
|
|
191
|
+
const sitePath = `${docsBasePath}/${site}`;
|
|
192
|
+
try {
|
|
193
|
+
// Determine if this is a sub-documentation site
|
|
194
|
+
const experienceNameLower = experienceName ? (0, devkit_1.names)(experienceName).fileName : '';
|
|
195
|
+
const hasSubName = experienceNameLower !== '' && site !== experienceNameLower;
|
|
196
|
+
const subNameKebab = hasSubName ? site.replace(`${experienceNameLower}-`, '') : '';
|
|
197
|
+
// 1. Move docs/getting-started → docs/documentations
|
|
198
|
+
const gettingStartedPath = `${sitePath}/docs/getting-started`;
|
|
199
|
+
const documentationsPath = `${sitePath}/docs/documentations`;
|
|
200
|
+
if (tree.exists(gettingStartedPath) && !tree.exists(documentationsPath)) {
|
|
201
|
+
moveDirectory(tree, gettingStartedPath, documentationsPath);
|
|
202
|
+
devkit_1.logger.info(` ✅ Moved docs/getting-started → docs/documentations in ${site}`);
|
|
203
|
+
}
|
|
204
|
+
// 2. Move docs/api → docs/reference
|
|
205
|
+
const apiPath = `${sitePath}/docs/api`;
|
|
206
|
+
const referencePath = `${sitePath}/docs/reference`;
|
|
207
|
+
if (tree.exists(apiPath) && !tree.exists(referencePath)) {
|
|
208
|
+
moveDirectory(tree, apiPath, referencePath);
|
|
209
|
+
devkit_1.logger.info(` ✅ Moved docs/api → docs/reference in ${site}`);
|
|
210
|
+
}
|
|
211
|
+
// 3. Update docusaurus.config.ts
|
|
212
|
+
const configPath = `${sitePath}/docusaurus.config.ts`;
|
|
213
|
+
const nameToUse = experienceName || site;
|
|
214
|
+
const configContent = generateDocusaurusConfig(nameToUse, hasSubName, subNameKebab);
|
|
215
|
+
tree.write(configPath, configContent);
|
|
216
|
+
devkit_1.logger.info(` ✅ Updated docusaurus.config.ts in ${site}`);
|
|
217
|
+
// 4. Update sidebars.ts
|
|
218
|
+
tree.write(`${sitePath}/sidebars.ts`, sidebarsContent);
|
|
219
|
+
devkit_1.logger.info(` ✅ Updated sidebars.ts in ${site}`);
|
|
220
|
+
// 5. Update src/css/custom.css
|
|
221
|
+
tree.write(`${sitePath}/src/css/custom.css`, cssContent);
|
|
222
|
+
devkit_1.logger.info(` ✅ Updated src/css/custom.css in ${site}`);
|
|
223
|
+
// 6. Update src/theme/Navbar/Content/index.tsx
|
|
224
|
+
tree.write(`${sitePath}/src/theme/Navbar/Content/index.tsx`, navbarContent);
|
|
225
|
+
devkit_1.logger.info(` ✅ Updated Navbar Content in ${site}`);
|
|
226
|
+
// 7. Update src/theme/Navbar/Content/styles.module.css
|
|
227
|
+
tree.write(`${sitePath}/src/theme/Navbar/Content/styles.module.css`, navbarStylesContent);
|
|
228
|
+
devkit_1.logger.info(` ✅ Updated Navbar Content styles in ${site}`);
|
|
229
|
+
updatedCount++;
|
|
230
|
+
}
|
|
231
|
+
catch (error) {
|
|
232
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
233
|
+
devkit_1.logger.warn(`⚠️ Failed to update ${site}: ${errorMessage}`);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
devkit_1.logger.info(`✅ Updated ${updatedCount} documentation site(s) to new structure`);
|
|
237
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
238
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-documentation-workflow.d.ts","sourceRoot":"","sources":["../../../src/migrations/4-6-1/add-documentation-workflow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAoB,MAAM,YAAY,CAAC;AAWpD,wBAA8B,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAkD9D"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = update;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const fs_1 = require("fs");
|
|
6
|
+
const path_1 = require("path");
|
|
7
|
+
async function update(tree) {
|
|
8
|
+
devkit_1.logger.info('🔄 Adding GitHub documentation workflow...');
|
|
9
|
+
if (!tree.exists('.unisphere')) {
|
|
10
|
+
devkit_1.logger.info('⏭️ No .unisphere file found, skipping');
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const config = (0, devkit_1.readJson)(tree, '.unisphere');
|
|
14
|
+
const experienceName = config.name;
|
|
15
|
+
if (!experienceName) {
|
|
16
|
+
devkit_1.logger.info('⏭️ No experience name found in .unisphere, skipping');
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
if (!config.elements?.documentation || Object.keys(config.elements.documentation).length === 0) {
|
|
20
|
+
devkit_1.logger.info('⏭️ No documentation elements found in .unisphere, skipping');
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (!tree.exists('.github')) {
|
|
24
|
+
tree.write('.github/.gitkeep', '');
|
|
25
|
+
devkit_1.logger.info('✅ Created .github directory');
|
|
26
|
+
}
|
|
27
|
+
if (!tree.exists('.github/workflows')) {
|
|
28
|
+
tree.write('.github/workflows/.gitkeep', '');
|
|
29
|
+
devkit_1.logger.info('✅ Created .github/workflows directory');
|
|
30
|
+
}
|
|
31
|
+
try {
|
|
32
|
+
const workflowPath = '.github/workflows/documentation.yml';
|
|
33
|
+
const templatePath = (0, path_1.join)(__dirname, 'templates', 'documentation-workflow.template');
|
|
34
|
+
const templateContent = (0, fs_1.readFileSync)(templatePath, 'utf-8');
|
|
35
|
+
const workflowContent = templateContent.replace(/__EXPERIENCE_NAME__/g, experienceName);
|
|
36
|
+
const workflowExists = tree.exists(workflowPath);
|
|
37
|
+
tree.write(workflowPath, workflowContent);
|
|
38
|
+
if (workflowExists) {
|
|
39
|
+
devkit_1.logger.info(`✅ Updated ${workflowPath}`);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
devkit_1.logger.info(`✅ Created ${workflowPath}`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
devkit_1.logger.error(`❌ Failed to add documentation workflow: ${error?.message || 'Unknown error'}`);
|
|
47
|
+
throw error;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
name: Documentations
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
|
|
6
|
+
permissions:
|
|
7
|
+
id-token: write
|
|
8
|
+
contents: write
|
|
9
|
+
packages: write
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
deploy-to-aws:
|
|
13
|
+
runs-on:
|
|
14
|
+
- codebuild-ovp-unisphere-runner-${{ github.run_id }}-${{ github.attempt }}
|
|
15
|
+
strategy:
|
|
16
|
+
matrix:
|
|
17
|
+
envs_regions:
|
|
18
|
+
- env: nvp1
|
|
19
|
+
accountid: "583352821080"
|
|
20
|
+
region: us-east-1
|
|
21
|
+
|
|
22
|
+
steps:
|
|
23
|
+
- name: Checkout Repo at specific commit
|
|
24
|
+
uses: actions/checkout@v3
|
|
25
|
+
|
|
26
|
+
- name: Setup Node.js
|
|
27
|
+
uses: actions/setup-node@v4
|
|
28
|
+
with:
|
|
29
|
+
node-version: 24
|
|
30
|
+
|
|
31
|
+
- name: Setup JFrog
|
|
32
|
+
uses: jfrog/setup-jfrog-cli@v4
|
|
33
|
+
id: setup-jfrog
|
|
34
|
+
env:
|
|
35
|
+
JF_URL: https://kalturaa.jfrog.io
|
|
36
|
+
with:
|
|
37
|
+
oidc-provider-name: ovp-github-oidc
|
|
38
|
+
|
|
39
|
+
- name: Install dependencies
|
|
40
|
+
run: cd unisphere/documentation/__EXPERIENCE_NAME__ && npm ci --include=optional --ignore-scripts
|
|
41
|
+
env:
|
|
42
|
+
KALTURA_JFROG_TOKEN: ${{ steps.setup-jfrog.outputs.oidc-token }}
|
|
43
|
+
|
|
44
|
+
- name: Build documentation
|
|
45
|
+
run: cd unisphere/documentation/__EXPERIENCE_NAME__ && npm run build
|
|
46
|
+
env:
|
|
47
|
+
DOCUSAURUS_URL: 'https://docs.kaltura.ai/'
|
|
48
|
+
DOCUSAURUS_BASE_URL: '/__EXPERIENCE_NAME__/'
|
|
49
|
+
|
|
50
|
+
- name: Configure AWS credentials
|
|
51
|
+
run: |
|
|
52
|
+
aws sts assume-role \
|
|
53
|
+
--role-arn arn:aws:iam::${{ matrix.envs_regions.accountid }}:role/${{ matrix.envs_regions.env }}-unisphere-content-role \
|
|
54
|
+
--role-session-name github-actions-deployment \
|
|
55
|
+
--query 'Credentials.[AccessKeyId,SecretAccessKey,SessionToken]' \
|
|
56
|
+
--output text | \
|
|
57
|
+
while read access_key secret_key session_token; do
|
|
58
|
+
echo "AWS_ACCESS_KEY_ID=$access_key" >> $GITHUB_ENV
|
|
59
|
+
echo "AWS_SECRET_ACCESS_KEY=$secret_key" >> $GITHUB_ENV
|
|
60
|
+
echo "AWS_SESSION_TOKEN=$session_token" >> $GITHUB_ENV
|
|
61
|
+
done
|
|
62
|
+
echo "AWS_DEFAULT_REGION=${{ matrix.envs_regions.region }}" >> $GITHUB_ENV
|
|
63
|
+
|
|
64
|
+
- name: Sync dist/documentations to S3
|
|
65
|
+
run: |
|
|
66
|
+
aws s3 sync unisphere/documentation/__EXPERIENCE_NAME__/build s3://nvp1-kaltura-documentation/__EXPERIENCE_NAME__ \
|
|
67
|
+
--region ${{ matrix.envs_regions.region }} \
|
|
68
|
+
--delete
|
package/migrations.json
CHANGED
|
@@ -434,6 +434,22 @@
|
|
|
434
434
|
"cli": {
|
|
435
435
|
"postUpdateMessage": "✅ Security audit gate configured: allowlist seeded and CI step added"
|
|
436
436
|
}
|
|
437
|
+
},
|
|
438
|
+
"4-6-0-update-documentation-structure": {
|
|
439
|
+
"version": "4.6.0",
|
|
440
|
+
"description": "Updates documentation sites to new multi-plugin structure with Documentations/Reference/Changelog tabs",
|
|
441
|
+
"factory": "./dist/migrations/4-6-0/update-documentation-structure.js",
|
|
442
|
+
"cli": {
|
|
443
|
+
"postUpdateMessage": "✅ Documentation sites updated to new structure"
|
|
444
|
+
}
|
|
445
|
+
},
|
|
446
|
+
"4-6-1-add-documentation-workflow": {
|
|
447
|
+
"version": "4.6.1",
|
|
448
|
+
"description": "Adds .github/workflows/documentation.yml for deploying documentation sites to AWS",
|
|
449
|
+
"factory": "./dist/migrations/4-6-1/add-documentation-workflow.js",
|
|
450
|
+
"cli": {
|
|
451
|
+
"postUpdateMessage": "✅ GitHub documentation workflow added"
|
|
452
|
+
}
|
|
437
453
|
}
|
|
438
454
|
},
|
|
439
455
|
"packageJsonUpdates": {
|
|
@@ -745,6 +761,17 @@
|
|
|
745
761
|
"alwaysAddToPackageJson": false
|
|
746
762
|
}
|
|
747
763
|
}
|
|
764
|
+
},
|
|
765
|
+
"4.7.0": {
|
|
766
|
+
"version": "4.7.0",
|
|
767
|
+
"cli": "nx",
|
|
768
|
+
"postUpdateMessage": "🎉 Migration to @unisphere/nx 4.7.0 completed successfully!",
|
|
769
|
+
"packages": {
|
|
770
|
+
"@unisphere/cli": {
|
|
771
|
+
"version": "5.1.0",
|
|
772
|
+
"alwaysAddToPackageJson": false
|
|
773
|
+
}
|
|
774
|
+
}
|
|
748
775
|
}
|
|
749
776
|
}
|
|
750
777
|
}
|
package/package.json
CHANGED