Skip to content
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

docs: add @shikiji/vitepress-twoslash #5483

Merged
merged 13 commits into from
Apr 8, 2024

Conversation

btea
Copy link
Contributor

@btea btea commented Apr 3, 2024

Description

refer to vitejs/vite#16168

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. If the feature is substantial or introduces breaking changes without a discussion, PR might be closed.
  • Ideally, include a test that fails without this PR but passes with it.
  • Please, don't make changes to pnpm-lock.yaml unless you introduce a new test example.

Tests

  • Run the tests with pnpm test:ci.

Documentation

  • If you introduce new functionality, document it. You can run documentation with pnpm run docs command.

Changesets

  • Changes in changelog are generated from PR name. Please, make sure that it explains your changes in an understandable manner. Please, prefix changeset messages with feat:, fix:, perf:, docs:, or chore:.

Copy link

netlify bot commented Apr 3, 2024

Deploy Preview for fastidious-cascaron-4ded94 ready!

Name Link
🔨 Latest commit 694c2be
🔍 Latest deploy log https://app.netlify.com/sites/fastidious-cascaron-4ded94/deploys/6613dca0ba4b720008966a2b
😎 Deploy Preview https://deploy-preview-5483--fastidious-cascaron-4ded94.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

antfu
antfu previously approved these changes Apr 3, 2024
docs/package.json Outdated Show resolved Hide resolved
Copy link
Member

@AriPerkkio AriPerkkio left a comment

Choose a reason for hiding this comment

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

Do these two lines need changes as well?

vitest/netlify.toml

Lines 3 to 4 in d400388

command = "pnpm docs:build"
ignore = "git diff --quiet $COMMIT_REF $CACHED_COMMIT_REF -- docs/ package.json pnpm-lock.yaml"

  • Before pnpm docs:build we need pnpm build so that types are available on file system, right?
  • The ignore part may now skip builds when types are changed

There's also plenty of errors on Netlify's logs. Likely related to these issues.

@btea
Copy link
Contributor Author

btea commented Apr 4, 2024

Do these two lines need changes as well?

vitest/netlify.toml

Lines 3 to 4 in d400388

command = "pnpm docs:build"
ignore = "git diff --quiet $COMMIT_REF $CACHED_COMMIT_REF -- docs/ package.json pnpm-lock.yaml"

  • Before pnpm docs:build we need pnpm build so that types are available on file system, right?

Yes, I tweaked the command a bit.

  • The ignore part may now skip builds when types are changed

I'm not sure and don't know exactly how to change this, can you give me some tips?

@AriPerkkio
Copy link
Member

I'm not sure and don't know exactly how to change this, can you give me some tips?

I guess right now it's checking whether there are changes in docs package.json pnpm-lock.yaml. In future we would want to rebuild docs if any public types changes. I don't think this is possible with the git diff command that is currently being used there. We would need to always check whether packages/*/dist/**.d.ts have changed, but those are not tracked in git.

Maybe it's fine to just remove the ignore condition there.

@btea
Copy link
Contributor Author

btea commented Apr 4, 2024

Maybe it's fine to just remove the ignore condition there.

OK, I removed it.

@sheremet-va
Copy link
Member

Maybe it's fine to just remove the ignore condition there.

I don't think it should be removed. For new releases, this line doesn't matter because the version in package.json is always updated. For new PRs it's generally meaningless to build new documentation unless there is a change inside the docs themselves - otherwise, it will just create a lot of noise.

@AriPerkkio
Copy link
Member

For new PRs it's generally meaningless to build new documentation unless there is a change inside the docs themselves - otherwise, it will just create a lot of noise.

With the current docs/ package.json pnpm-lock.yaml pattern there's no way to rebuild the documentation when an error in typings is fixed, e.g. change in packages/vitest/src/types/config.ts or some other files that ends up creating types or JSDoc in packages/*/dist/**.d.ts.

What pattern should we use in there?

@sheremet-va
Copy link
Member

With the current docs/ package.json pnpm-lock.yaml pattern there's no way to rebuild the documentation when an error in typings is fixed, e.g. change in packages/vitest/src/types/config.ts or some other files that ends up creating types or JSDoc in packages/*/dist/**.d.ts.

There is no way to rebuild documentation even now because it depends on the release cycle. If we need to rebuild it, we can always do so manually. Building documentation for every single PR sounds ridiculous to me. We added this line for a reason, and I'm not going back to times when we didn't have it.

package.json Outdated Show resolved Hide resolved
hi-ogawa
hi-ogawa previously approved these changes Apr 6, 2024
Copy link
Contributor

@hi-ogawa hi-ogawa left a comment

Choose a reason for hiding this comment

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

Thanks!

@sheremet-va
Copy link
Member

Can you resolve conflicts, please? 👀

@btea
Copy link
Contributor Author

btea commented Apr 7, 2024

Can you resolve conflicts, please? 👀

It has been solved, but it seems to cause some ci to fail.

@sheremet-va sheremet-va merged commit 20357e2 into vitest-dev:main Apr 8, 2024
17 of 19 checks passed
@sheremet-va
Copy link
Member

sheremet-va commented Apr 8, 2024

Thank you ❤️

@btea btea deleted the docs/add-shikijs-vitepress-twoslash branch April 8, 2024 12:21
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.

None yet

5 participants