Skip to content

Commit

Permalink
feat: docs (#1080)
Browse files Browse the repository at this point in the history
  • Loading branch information
bang9 authored May 3, 2024
1 parent ece86e7 commit d3eadd5
Show file tree
Hide file tree
Showing 15 changed files with 330 additions and 303 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,7 @@ yarn-error.log*

.idea/

*storybook.log
*storybook.log

# docs
/docs
105 changes: 0 additions & 105 deletions docs/TOC.mdx

This file was deleted.

Empty file removed docs/core-components.mdx
Empty file.
2 changes: 0 additions & 2 deletions docs/features.mdx

This file was deleted.

120 changes: 0 additions & 120 deletions docs/introduction.mdx

This file was deleted.

Empty file removed docs/localization.mdx
Empty file.
Empty file removed docs/modules.mdx
Empty file.
Empty file removed docs/themes.mdx
Empty file.
Empty file removed docs/ui-components.mdx
Empty file.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"storybook": "storybook dev -p 6006",
"start:storybook": "yarn storybook",
"start:apps:testing": "yarn workspace @uikit-app/testing dev",
"build:docs": "node ./scripts/build_docs.mjs",
"build:storybook": "storybook build",
"build:apps:testing": "yarn workspace @uikit-app/testing build"
},
Expand Down Expand Up @@ -137,6 +138,7 @@
"stylelint": "^13.0.0",
"stylelint-config-sass-guidelines": "^7.0.0",
"ts-pattern": "^4.2.2",
"typedoc": "^0.25.13",
"typescript": "^5.4.5",
"vite": "^5.1.5",
"vite-plugin-svgr": "^4.2.0"
Expand Down
47 changes: 47 additions & 0 deletions scripts/build_docs.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { execSync } from 'child_process';
import { promises as fs } from 'fs';
import moduleExports from '../rollup.module-exports.mjs';

function removeDuplicates(items) {
return [...new Set(items)];
}
const order = [
'src/modules/App',
'src/modules/GroupChannel',
'src/modules/GroupChannelList',
'src/modules',
'src/ui',
'src/hooks',
'src/utils',
];
async function updateEntryPoints() {
const modulePaths = removeDuplicates(Object.values(moduleExports)).sort((a, b) => {
const aOrder = order.findIndex((o) => a.startsWith(o)) ?? -1;
const bOrder = order.findIndex((o) => b.startsWith(o)) ?? -1;
if (aOrder === -1) return 1;
if (bOrder === -1) return -1;
if (aOrder !== bOrder) return aOrder - bOrder;
return a.localeCompare(b);
});
const typedoc = JSON.parse(await fs.readFile('typedoc.json', 'utf-8'));
typedoc.entryPoints = modulePaths;
await fs.writeFile('typedoc.json', JSON.stringify(typedoc, null, 2));
}

function execTypedoc() {
execSync('npx typedoc', (error, stdout, stderr) => {
if (error) {
console.error(`exec error: ${error}`);
return;
}
console.log(`stdout: ${stdout}`);
console.error(`stderr: ${stderr}`);
});
}

async function run() {
await updateEntryPoints();
execTypedoc();
}

run();
2 changes: 0 additions & 2 deletions ts_debt/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
This directory has a list of remaining files to be migrated:
They are split into three categories:

* Source files (high priority)
* Story files (medium priority)
* Test files (low priority)

See the list in respective .yml files.
Expand Down
72 changes: 0 additions & 72 deletions ts_debt/story_files.yml

This file was deleted.

Loading

0 comments on commit d3eadd5

Please sign in to comment.