Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/weak-actors-attend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@alauda/doom": patch
---

fix: pdf download link not displayed correctly
4 changes: 1 addition & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ jobs:
run: yarn --immutable

- name: Build and Lint
run: |
yarn build
yarn lint
run: yarn run-p build docs lint typecov
env:
PARSER_NO_WATCH: true
17 changes: 15 additions & 2 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,25 @@ jobs:
- name: Install Dependencies
run: yarn --immutable

- name: Build the project
run: yarn doom build -p doom
- name: Build and Export
run: |
# export the docs as pdf first
yarn docs:build -e -p doom
yarn docs:export -p doom
tempdir=$(mktemp -d)
# copy the pdf to the tempdir
cp -r ./dist/*.pdf $tempdir
# then build the docs with pdf download link
yarn docs:build -d -p doom
# copy the pdf back to the dist folder
cp -r $tempdir/*.pdf ./dist
# remove the tempdir
rm -rf $tempdir

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist
cname: doom.js.org
full_commit_message: ${{ github.event.head_commit.message }}
2 changes: 1 addition & 1 deletion .github/workflows/pkg-pr-new.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ jobs:
run: yarn build

- name: Publish
run: yarn dlx pkg-pr-new publish # --compact
run: yarn dlx pkg-pr-new publish --compact
11 changes: 10 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
{
"semi": false,
"singleQuote": true,
"plugins": ["prettier-plugin-pkg", "prettier-plugin-properties"]
"plugins": ["prettier-plugin-pkg", "prettier-plugin-properties"],
"overrides": [
{
"files": ["**/.changeset/*.md"],
"excludeFiles": ["README.md"],
"options": {
"singleQuote": false
}
}
]
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024-present Alauda.io

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
# Doom

[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/alauda/doom/ci.yml?branch=main)](https://github.com/alauda/doom/actions/workflows/ci.yml?query=branch%3Amain)
[![type-coverage](https://img.shields.io/badge/dynamic/json.svg?label=type-coverage&prefix=%E2%89%A5&suffix=%&query=$.typeCoverage.atLeast&uri=https%3A%2F%2Fraw.githubusercontent.com%2Falauda%2Fdoom%2Fmain%2Fpackage.json)](https://github.com/plantain-00/type-coverage)
[![CodeRabbit Pull Request Reviews](https://img.shields.io/coderabbit/prs/github/alauda/doom)](https://coderabbit.ai)
[![npm](https://img.shields.io/npm/v/@alauda/doom.svg)](https://www.npmjs.com/package/@alauda/doom)
[![GitHub Release](https://img.shields.io/github/release/alauda/doom)](https://github.com/alauda/doom/releases)

[![Conventional Commits](https://img.shields.io/badge/conventional%20commits-1.0.0-yellow.svg)](https://conventionalcommits.org)
[![Renovate enabled](https://img.shields.io/badge/renovate-enabled-brightgreen.svg)](https://renovatebot.com)
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
[![Code Style: Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
[![changesets](https://img.shields.io/badge/maintained%20with-changesets-176de3.svg)](https://github.com/changesets/changesets)

Doctor Doom making docs.

Please view <https://doom.alauda.cn/> for its documents.
Please view <https://doom.js.org/> for its documents.

## Changelog

Detailed changes for each release are documented in [CHANGELOG.md](./CHANGELOG.md).

## License

[MIT][] © [Alauda][]

[alauda]: https://www.alauda.io
[MIT]: http://opensource.org/licenses/MIT
29 changes: 28 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"repository": "git+https://github.com/alauda/Doom.git",
"homepage": "https://github.com/alauda/Doom#readme",
"funding": "https://opencollective.com/alauda",
"license": "MIT",
"packageManager": "yarn@4.9.1",
"engines": {
"node": ">=18.17.0 <20 || >=20.1.0"
Expand All @@ -25,12 +26,22 @@
"styles",
"!lib/*.tsbuildinfo"
],
"keywords": [
"document",
"documentation",
"docs",
"mdx",
"rspress",
"rspress-plugins"
],
"scripts": {
"build": "tsc -b src",
"clean": "tsc -b src --clean",
"dev": "yarn swc-node --watch-path src/cli --watch-path src/plugins src/cli/index.ts",
"docs": "run-s docs:build docs:export",
"docs:build": "yarn doom build",
"docs:export": "yarn doom export",
"doom": "yarn swc-node src/cli/index.ts",
"export": "yarn doom export",
"fixture": "yarn dev fixture-docs",
"format": "prettier --write .",
"lint": "run-p 'lint:*'",
Expand All @@ -41,6 +52,7 @@
"serve": "yarn doom serve",
"swc-node": "node --enable-source-maps --import @swc-node/register/esm-register",
"translate": "yarn doom translate fixture-docs",
"typecov": "type-coverage",
"version": "changeset version && yarn --no-immutable"
},
"dependencies": {
Expand Down Expand Up @@ -104,12 +116,27 @@
"prettier-plugin-pkg": "^0.19.0",
"prettier-plugin-properties": "^0.3.0",
"simple-git-hooks": "^2.13.0",
"type-coverage": "^2.29.7",
"typescript": "^5.8.3",
"typescript-eslint": "^8.32.0",
"yarn-berry-deduplicate": "^6.1.3"
},
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org"
},
"typeCoverage": {
"atLeast": 100,
"cache": true,
"detail": true,
"ignoreAsAssertion": true,
"ignoreFiles": [
"lib/**/*.d.ts",
"pyodide/**/*.d.ts"
],
"ignoreNonNullAssertion": true,
"showRelativePath": true,
"strict": true,
"update": true
}
}
2 changes: 1 addition & 1 deletion src/cli/merge-pdfs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export async function mergePDFs(entries: string[]) {
pyodide.FS.mkdirTree(MOUNT_DIR)
pyodide.FS.mount(
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
pyodide.FS.filesystems.NODEFS,
pyodide.FS.filesystems.NODEFS, // type-coverage:ignore-line -- out of control
{ root: pyodideDir },
MOUNT_DIR,
)
Expand Down
9 changes: 7 additions & 2 deletions src/global/VersionsNav/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,20 @@ const VersionsNav_ = () => {

// hack way to detect nav menu recreation on theme change
useEffect(() => {
if (!navMenu?.parentNode) {
if (!navMenu) {
return
}
const observer = new MutationObserver((mutations) => {
if (mutations.some((m) => m.removedNodes.length)) {
setNavMenu(getNavMenu)
}
})
observer.observe(navMenu.parentNode, { childList: true })
const newNavMenu = getNavMenu()
if (newNavMenu !== navMenu) {
setNavMenu(newNavMenu)
} else if (navMenu.parentNode) {
observer.observe(navMenu.parentNode, { childList: true })
}
return () => {
observer.disconnect()
}
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/replace/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export const replacePlugin = ({

for (const result of results) {
if (result.status === 'rejected') {
logger.error(result.reason)
logger.error(result.reason) // type-coverage:ignore-line -- out of control
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/replace/resolve-reference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const resolveReference_ = async (

const source = items[refName]

let publicBase
let publicBase: string
let sourcePath = source.path
if (source.repo) {
const repoFolder = await resolveRepo(source.repo, force, source.branch)
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/replace/resolve-release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,9 @@ const resolveRelease_ = async (
))
} catch (err) {
if (err instanceof ResponseError) {
const error = err as ResponseError<unknown>
logger.error(
`Failed to fetch release notes for query \`${red(releaseQuery)}\` with status \`${err.response.status}\` and ${err.data ? `data ${JSON.stringify(data, null, 2)}` : `message \`${err.message}\``}`,
`Failed to fetch release notes for query \`${red(releaseQuery)}\` with status \`${error.response.status}\` and ${error.data ? `data ${JSON.stringify(data, null, 2)}` : `message \`${error.message}\``}`,
)
}
return
Expand Down
6 changes: 3 additions & 3 deletions src/runtime/components/OpenAPIPath.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,9 @@ const getRefsForPath = (
schema = resolveRef(openapi, schema.$ref)
}
}
for (const value of Object.values(schema)) {
if (typeof value === 'object') {
collectRefs(value as object)
for (const value of Object.values(schema) as unknown[]) {
if (value && typeof value === 'object') {
collectRefs(value)
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/runtime/components/OpenAPIRef.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ const getRefsForSchema = (
schema = resolveRef(openapi, schema.$ref)
}
}
for (const value of Object.values(schema)) {
if (typeof value === 'object') {
collectRefs(value as object)
for (const value of Object.values(schema) as unknown[]) {
if (value && typeof value === 'object') {
collectRefs(value)
}
}
}
Expand Down
Loading