Skip to content

Update docusaurus and fix undefined tags #1451

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: staging
Choose a base branch
from

Conversation

jasagredo
Copy link
Contributor

@jasagredo jasagredo commented Apr 28, 2025

Checklist

  • I have read the How to Contribute.
  • I have run yarn build after adding my changes without getting any errors.
  • I have not committed any changes to yarn.lock (or have removed these changes) I am updating docusaurus, so this is necessary.

Updating documentation or Bugfix

When doing some changes to the documentation, I found that a new Docusaurus version was available:

Update available 3.6.3 → 3.7.0

These other errors showed up, for which I did the changes in this PR:

[WARNING] Tags [media, Developer Office Hours] used in 2025-01-17-january.md are not defined in tags.yml
[WARNING] Tags [media, Developer Office Hours] used in 2025-02-05-february.md are not defined in tags.yml
[WARNING] Tags [DeFi] used in 2025-02-03-february.md are not defined in tags.yml
[WARNING] Tags [DeFi] used in 2025-03-31-march.md are not defined in tags.yml
[WARNING] Docusaurus found blog posts without truncation markers:
- "blog/2025-02-05-february.md"
- "blog/2025-01-17-january.md"

We recommend using truncation markers (`<!-- truncate -->` or `{/* truncate */}`) in blog posts to create shorter previews on blog paginated lists.
Tip: turn this security off with the `onUntruncatedBlogPosts: 'ignore'` blog plugin option.
[WARNING] No docs found in "native-tokens/token-registry": can't auto-generate a sidebar.
[ERROR] Sidebars file at "C:\code\cardano\developer-portal\sidebars.js" failed to be loaded.
[WARNING] The image at "C:\code\cardano\developer-portal\static\img\nfts\overview_nfts.svg" can't be read correctly. Please
ensure it's a valid image.
unsupported file type: undefined (file: C:\code\cardano\developer-portal\static\img\nfts\overview_nfts.svg)

After the changes, the website can be loaded without warnings or errors:

❯ yarn start
yarn run v1.22.22
$ docusaurus start
[INFO] Starting the development server...
[SUCCESS] Docusaurus website is running at: http://localhost:3000/

√ Client
  Compiled successfully in 1.43s

client (webpack 5.99.7) compiled successfully

Copy link
Collaborator

@rphair rphair left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jasagredo for taking an interest. FYI this site generally does Docusaurus updates at intervals a lot more widely spaced than this. There are also long term integration issues that @katomm I think has the best view of.

In the meantime, the scripts used in this build I see are working in the GitHub CI environment but fail on my local machine after one or more of the version bumps in package.json:

$ yarn build
/home/rphair/archive/build/developer-portal/node_modules/ts-node/dist/index.js:851
            return old(m, filename);
                   ^
Error [ERR_REQUIRE_ESM]: ...

This (at the first step, the building of the Token Registry) can be confirmed in isolation with:

$ ./node_modules/.bin/ts-node scripts/token-registry.ts
/home/rphair/archive/build/developer-portal/node_modules/ts-node/dist/index.js:851
            return old(m, filename);
                   ^
Error [ERR_REQUIRE_ESM]: require() of ES Module /home/rphair/archive/build/developer-portal/node_modules/node-fetch/src/index.js from /home/rphair/archive/build/developer-portal/scripts/reusable.ts not supported.
Instead change the require of index.js in /home/rphair/archive/build/developer-portal/scripts/reusable.ts to a dynamic import() which is available in all CommonJS modules.
    at require.extensions.<computed> [as .js] (/home/rphair/archive/build/developer-portal/node_modules/ts-node/dist/index.js:851:20)
    at Object.<anonymous> (/home/rphair/archive/build/developer-portal/scripts/reusable.ts:13:22)
    at m._compile (/home/rphair/archive/build/developer-portal/node_modules/ts-node/dist/index.js:857:29)
    at require.extensions.<computed> [as .ts] (/home/rphair/archive/build/developer-portal/node_modules/ts-node/dist/index.js:859:16)
    at Object.<anonymous> (/home/rphair/archive/build/developer-portal/scripts/token-registry.ts:15:20)
    at m._compile (/home/rphair/archive/build/developer-portal/node_modules/ts-node/dist/index.js:857:29)
    at require.extensions.<computed> [as .ts] (/home/rphair/archive/build/developer-portal/node_modules/ts-node/dist/index.js:859:16)
    at phase4 (/home/rphair/archive/build/developer-portal/node_modules/ts-node/dist/bin.js:466:20)
    at bootstrap (/home/rphair/archive/build/developer-portal/node_modules/ts-node/dist/bin.js:54:12)
    at main (/home/rphair/archive/build/developer-portal/node_modules/ts-node/dist/bin.js:33:12)
    at Object.<anonymous> (/home/rphair/archive/build/developer-portal/node_modules/ts-node/dist/bin.js:579:5) {
  code: 'ERR_REQUIRE_ESM'

@jasagredo
Copy link
Contributor Author

Which Node and Yarn versions are you using?

❯ node --version
v23.5.0
❯ yarn --version
1.22.22

@rphair
Copy link
Collaborator

rphair commented Apr 29, 2025

I tested this with the baseline that we've already indicated to the public here (https://developers.cardano.org/docs/portal-contribute/#requirements): node 18 (some intermediate version, not LTS [edit: it also fails with LTS v18.20.8) and the same version of yarn you have (it also fails in latest yarn 3.x and 4.x).

Indeed the ts-node problem is solved on latest node LTS (v22.15.0). @katomm what would you think of a version bump for "Node.js version" in that Requirements section: even if not accepting this PR for the new Docusaurus minor release?

@rphair rphair requested a review from katomm April 29, 2025 08:04
Copy link
Collaborator

@rphair rphair left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@katomm @jasagredo I'll put out a PR to bump the node version to v22 here (as per #1451 (comment)) some time soon. I'll double check that the new ts-node requires at least this LTS to build the token registry (as I recall if failed on v20 but I'll check one more time).

@katomm
Copy link
Member

katomm commented May 2, 2025

Please note that the files .node-version and .yarn-version are the ones that define which version of node and yarn will be used to build the developer portal on the server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants