hirosystems / docs

Hiro developer documentation website
https://docs.hiro.so/
32 stars 52 forks source link

chore: upgrade Docusaurus and some other deps. #610

Closed diwakergupta closed 5 months ago

diwakergupta commented 5 months ago

Docusaurus changelog: https://docusaurus.io/changelog/3.1.1

Note that while testing this, I uncovered many more broken anchors. This commit fixes some of them, rest need to be addressed in API docs. Tracking issue is: https://github.com/hirosystems/stacks-blockchain-api/issues/1860

vercel[bot] commented 5 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
hiro-systems-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 5, 2024 7:46pm
diwakergupta commented 5 months ago

Vercel build is failing with:

[13:10:49.860] Running "yarn run build"
[13:10:50.068] yarn run v1.22.17
[13:10:50.097] $ yarn update:cli-ref && yarn pull-openapi-definitions && docusaurus build
[13:10:50.326] $ stx docs > src/_data/cli-reference.json && node ./update-cli-ref.js ./src/_data/cli-reference.json -o ./docs/references/
[13:10:51.359] /vercel/path0/node_modules/cliui/build/index.cjs:293
[13:10:51.359] const wrap = require('wrap-ansi');
[13:10:51.360]              ^
[13:10:51.360] 
[13:10:51.360] Error [ERR_REQUIRE_ESM]: require() of ES Module /vercel/path0/node_modules/wrap-ansi/index.js from /vercel/path0/node_modules/cliui/build/index.cjs not supported.
[13:10:51.360] Instead change the require of index.js in /vercel/path0/node_modules/cliui/build/index.cjs to a dynamic import() which is available in all CommonJS modules.
[13:10:51.360]     at Object.<anonymous> (/vercel/path0/node_modules/cliui/build/index.cjs:293:14)
[13:10:51.360]     at Object.<anonymous> (/vercel/path0/node_modules/yargs/build/index.cjs:1:60678)
[13:10:51.360]     at Object.<anonymous> (/vercel/path0/node_modules/yargs/yargs:3:69)
[13:10:51.360]     at Object.<anonymous> (/vercel/path0/update-cli-ref.js:14:12) {
[13:10:51.360]   code: 'ERR_REQUIRE_ESM'
[13:10:51.360] }

I had a similar problem locally. But then I deleted my node_modules and yark.lock and tried again, then it worked. So this seems like an issue with some cached state? 🤷🏽

Anyone have ideas, maybe @janniks ?

janniks commented 5 months ago

Part of the yarn update:cli-ref && yarn pull-openapi-definitions && docusaurus build failing. I'm looking into it.

UPDATE: ~This seemed to work. 1. yarn set version latest, 2. yarn cache clean, 3. remove node_modules, remove yarn.lock, 4. yarn install. Also updated the parent package of the troublesome dependency~ Worked locally once, but still broke on Vercel 🤔

diwakergupta commented 5 months ago

Part of the yarn update:cli-ref && yarn pull-openapi-definitions && docusaurus build failing. I'm looking into it

Thanks Jannik! I don't know what wrap-ansi is used for, but earlier in the build there's this line that might give a clue:

warning Pattern ["wrap-ansi@^7.0.0"] is trying to unpack in the same destination
 "/vercel/.cache/yarn/v6/npm-wrap-ansi-cjs-7.0.0-67e145cff510a6a6984bdf1152911d69d2eb9e43-integrity/node_modules/wrap-ansi-cjs" as pattern 
["wrap-ansi-cjs@npm:wrap-ansi@^7.0.0"]. This could result in non-deterministic behavior, skipping.
ryanwaits commented 5 months ago

Part of the yarn update:cli-ref && yarn pull-openapi-definitions && docusaurus build failing. I'm looking into it

Thanks Jannik! I don't know what wrap-ansi is used for, but earlier in the build there's this line that might give a clue:

warning Pattern ["wrap-ansi@^7.0.0"] is trying to unpack in the same destination
 "/vercel/.cache/yarn/v6/npm-wrap-ansi-cjs-7.0.0-67e145cff510a6a6984bdf1152911d69d2eb9e43-integrity/node_modules/wrap-ansi-cjs" as pattern 
["wrap-ansi-cjs@npm:wrap-ansi@^7.0.0"]. This could result in non-deterministic behavior, skipping.

i think it has to do with rimraf and how we are using it to update the cli-reference.json. removing this line - yarn update:cli-ref in the build command locally gets rid of that error.

janniks commented 5 months ago

Solved by pegging the a single version of cliui (a nested dependency). Caused by yargs used in the cli ref script (should be good enough for now, for a better fix we would likely update the cli ref script at some point)