shikijs / twoslash

You take some Shiki, add a hint of TypeScript compiler, and 🎉 incredible static code samples
https://shikijs.github.io/twoslash/
MIT License
1.09k stars 53 forks source link

Uses the PnP API to derive a safe cache folder #115

Closed arcanis closed 3 years ago

arcanis commented 3 years ago

When installed under Yarn w/ PnP, packages are mounted as readonly zip archives. As a result, the remark caching logic that currently tries to locate the node_modules from __dirname results in the artifacts being written into the (read-only) archive, thus failing.

This diff fixes that by checking whether the current process operates under PnP mode, and using the PnP API in that case (which is a sounder way to get the project root anyway).

changeset-bot[bot] commented 3 years ago

🦋 Changeset detected

Latest commit: e5ecfea448ae9242a34fb8d5ae76de564df18aba

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages | Name | Type | | -------------------------------- | ----- | | remark-shiki-twoslash | Patch | | docusaurus-preset-shiki-twoslash | Patch | | eleventy-plugin-shiki-twoslash | Patch | | gatsby-remark-shiki-twoslash | Patch | | hexo-shiki-twoslash | Patch | | markdown-it-shiki-twoslash | Patch | | twoslash-cli | Patch | | vuepress-plugin-shiki-twoslash | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

orta commented 3 years ago

I agree, this all makes sense - thanks, will make a build

arcanis commented 3 years ago

Wait I made a typo (not bc-breaking, it just prevents my change to be applied 🤦‍♀️)

orta commented 3 years ago

hahaha :D