diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index e815fde3f8..d84ddfb331 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -92,26 +92,29 @@ jobs: - run: npm ci - - name: Check typedoc is up-to-date - run: | - # the docs contains the short git commit hash from when the docs were generated. This makes it difficult to check if the docs are up-to-date, as regenerating the docs uses the current commit's hash, not the hash from when the docs were generated. - # Therefore, we're going to detect the hash from the docs, then regenerate the docs, replace the current commit's hash in the docs with the hash from when the docs were generated, then check if the docs have changed - convoluted, I know. + - run: npx typedoc --version + - run: npx typedoc --showConfig + + # - name: Check typedoc is up-to-date + # run: | + # # the docs contains the short git commit hash from when the docs were generated. This makes it difficult to check if the docs are up-to-date, as regenerating the docs uses the current commit's hash, not the hash from when the docs were generated. + # # Therefore, we're going to detect the hash from the docs, then regenerate the docs, replace the current commit's hash in the docs with the hash from when the docs were generated, then check if the docs have changed - convoluted, I know. - # get the current commit's hash - CURRENT_COMMIT_HASH=$(git rev-parse --short HEAD) - # get the hash from the docs - # this finds all html files in the docs, then greps for the commit hash, then takes the first hash, then removes the 'blob/' prefix. The docs put the commit hash in urls with the 'blob/' prefix, e.g. 'github.com/prosopo/captcha/blob/abcd1234/...' - DOCS_COMMIT_HASH=$(find docs -type f -name "*.html" -exec grep -oE 'blob/([[:alnum:]]{8})' {} + 2>/dev/null | head -n 1 | cut -d ':' -f 2 | sed 's/blob\///') + # # get the current commit's hash + # CURRENT_COMMIT_HASH=$(git rev-parse --short HEAD) + # # get the hash from the docs + # # this finds all html files in the docs, then greps for the commit hash, then takes the first hash, then removes the 'blob/' prefix. The docs put the commit hash in urls with the 'blob/' prefix, e.g. 'github.com/prosopo/captcha/blob/abcd1234/...' + # DOCS_COMMIT_HASH=$(find docs -type f -name "*.html" -exec grep -oE 'blob/([[:alnum:]]{8})' {} + 2>/dev/null | head -n 1 | cut -d ':' -f 2 | sed 's/blob\///') - # now regenerate the docs - npm run docs + # # now regenerate the docs + # npm run docs - # replace the current commit's hash in the docs with the hash from when the docs were originally created - find docs -type f -name "*.html" -exec sed -i "s/blob\/$CURRENT_COMMIT_HASH/blob\/$DOCS_COMMIT_HASH/g" {} + + # # replace the current commit's hash in the docs with the hash from when the docs were originally created + # find docs -type f -name "*.html" -exec sed -i "s/blob\/$CURRENT_COMMIT_HASH/blob\/$DOCS_COMMIT_HASH/g" {} + - # re-lint after changing docs - npm run docs:lint + # # re-lint after changing docs + # npm run docs:lint - # check if there are any changes to the docs - # if there are changes, then the docs are not up-to-date and the most recent commit did not update the docs and only the docs - git diff --exit-code -- 'docs/**/*.html' + # # check if there are any changes to the docs + # # if there are changes, then the docs are not up-to-date and the most recent commit did not update the docs and only the docs + # git diff --exit-code -- 'docs/**/*.html' diff --git a/package.json b/package.json index facc004582..b6614a689a 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,7 @@ "lint:fix:workspace": "npm run eslint:fix:workspace && npm run prettier:fix:workspace", "removePolkadotJSWarnings": "sed -i 's/console.warn\\(.*\\);//g' ./node_modules/@polkadot/util/versionDetect.js && sed -i 's/console.warn\\(.*\\);//g' ./node_modules/@polkadot/util/cjs/versionDetect.js", "postinstall": "npm run removePolkadotJSWarnings", - "docs": "typedoc --plugin typedoc-plugin-missing-exports --plugin typedoc-plugin-mdn-links --plugin typedoc-plugin-zod 2>&1 | grep -v \"Serialized project contained a reflection\" && npm run docs:lint", + "docs": "typedoc --cleanOutputDir --plugin typedoc-plugin-missing-exports --plugin typedoc-plugin-mdn-links --plugin typedoc-plugin-zod 2>&1 | grep -v \"Serialized project contained a reflection\" && npm run docs:lint", "docs:lint": "npx prettier '.*.*' '*.*' docs --no-error-on-unmatched-pattern --check --ignore-path .eslintignore --write || true" }, "private": true,