Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
goastler committed Mar 7, 2024
1 parent b7bf1f9 commit 2445da6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 19 deletions.
39 changes: 21 additions & 18 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 2445da6

Please sign in to comment.