Skip to content

Commit 93fe666

Browse files
committed
chore: copy generated docs to new docs content
1 parent e8f5c49 commit 93fe666

File tree

3 files changed

+22
-9
lines changed

3 files changed

+22
-9
lines changed

copy-generated-component-docs.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,19 +62,19 @@ fs.readdir(generatedDocsPath, (err: any, files: string[]) => {
6262
const propertiesContent = extractProperties(generatedFileContent);
6363

6464
fs.readFile(
65-
`${componentDocsPath}/${file}x`,
65+
`${componentDocsPath}/${file}`,
6666
'utf8',
6767
(err: any, docFile: any) => {
6868
if (err)
6969
throw new Error(
70-
`${componentDocsPath}/${file}x couldn't be opened, error: ${err}, make sure that this file exists`
70+
`${componentDocsPath}/${file} couldn't be opened, error: ${err}, make sure that this file exists`
7171
);
7272

7373
if (file !== '_category_.json') {
7474
const result = insertGeneratedParts(docFile, propertiesContent);
7575

7676
fs.writeFile(
77-
`${componentDocsPath}/${file}x`,
77+
`${componentDocsPath}/${file}`,
7878
result,
7979
'utf8',
8080
(err: any) => {

copy-generated-service-docs.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,27 @@ fs.readdir(sourcePath, (err: any, files: string[]) => {
3131
}
3232

3333
// Remove the thre prefix from the title
34-
const result = data
35-
.replace(/# Class:/g, '#')
36-
.replace('<T\\>', '')
37-
.replace('\\', '');
34+
const result =
35+
`---` +
36+
`\n` +
37+
`title: ${file.replace('.md', '')}` +
38+
`\n` +
39+
`slug: /chat/docs/sdk/angular/services/${file.replace('.md', '')}/` +
40+
`\n` +
41+
`---` +
42+
'\n\n' +
43+
data
44+
.replace(`# Class: ${file.replace('.md', '')}`, '')
45+
.replace('<T\\>', '')
46+
.replace('\\', '');
3847

3948
fs.writeFile(`${sourcePath}/${file}`, result, 'utf8', (err: any) => {
4049
if (err) {
4150
throw err;
4251
}
4352
fs.copyFile(
4453
`${sourcePath}/${file}`,
45-
`${serviceDocsTargetPath}/${file}x`,
54+
`${serviceDocsTargetPath}/${file}`,
4655
(err: any) => {
4756
if (err) {
4857
throw err;

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@
2525
"build:sample-app": "npm run config:prod && ng build --stats-json --project sample-app",
2626
"preanalyze:sample-app": "npm run build:sample-app",
2727
"analyze:sample-app": "webpack-bundle-analyzer dist/sample-app/stats.json",
28-
"copy-css": "rm -rf projects/stream-chat-angular/src/assets/styles && copyfiles --up 5 \"node_modules/@stream-io/stream-chat-css/dist/v2/**/*\" projects/stream-chat-angular/src/assets/styles && copyfiles --up 5 \"node_modules/@stream-io/stream-chat-css/dist/assets/**/*\" projects/stream-chat-angular/src/assets/assets"
28+
"copy-css": "rm -rf projects/stream-chat-angular/src/assets/styles && copyfiles --up 5 \"node_modules/@stream-io/stream-chat-css/dist/v2/**/*\" projects/stream-chat-angular/src/assets/styles && copyfiles --up 5 \"node_modules/@stream-io/stream-chat-css/dist/assets/**/*\" projects/stream-chat-angular/src/assets/assets",
29+
"generate-docs": "npm run typedoc:services && npm run typedoc:components && npm run copy-docs:v5",
30+
"typedoc:services": "typedoc --plugin typedoc-plugin-markdown --plugin typedoc-plugin-reference-excluder --cleanOutputDir true --excludeConstructors true --hideBreadcrumbs true --hideInPageTOC true --excludePrivate true --out temp-service-docs --exclude '!**/*service.ts' --excludeNotDocumented --tsconfig projects/stream-chat-angular/tsconfig.lib.json projects/stream-chat-angular/src/public-api.ts",
31+
"typedoc:components": "typedoc --plugin typedoc-plugin-markdown --plugin typedoc-plugin-reference-excluder --cleanOutputDir true --excludeConstructors true --sort source-order --hideBreadcrumbs true --hideInPageTOC true --excludePrivate true --excludeNotDocumented --out temp-component-docs --exclude '!**/*component.ts' --tsconfig projects/stream-chat-angular/tsconfig.lib.json projects/stream-chat-angular/src/public-api.ts",
32+
"copy-docs:v5": "ts-node copy-generated-service-docs.ts ../docs/data/docs/chat-sdk/angular/v5-latest/06-services & (ts-node remove-generated-component-docs-content ../docs/data/docs/chat-sdk/angular/v5-latest/05-components && ts-node copy-generated-component-docs.ts ../docs/data/docs/chat-sdk/angular/v5-latest/05-components)"
2933
},
3034
"lint-staged": {
3135
"**/*": [

0 commit comments

Comments
 (0)