Pluto uses the awesome codemirror 6, but Pluto is 'buildelss', which means that we need to import dependencies directly from the jsdelivr CDN. Codemirror 6 is not meant to work in this setup. Using tools such as https://esm.sh/ , https://www.jsdelivr.com/esm or https://www.skypack.dev/ does not work in our case, because:
- downstream dependencies cannot be version-pinned easily. For pluto we want to version-pin everything.
- the modular design of codemirror 6 requires multiple modules to use the same version/instance of shared dependencies, such as
@codemirror/state. This is hard/impossible with ES building CDNs.
This is why we have this repository to manage our dependencies and to export a single .es.js and .d.ts file.
You need:
➜ codemirror-pluto-setup git:(main) ✗ node --version
v19.1.0
➜ codemirror-pluto-setup git:(main) ✗ yarn --version
3.2.4
(Fons: you need to do brew install corepack, corepack enable every time you reboot your computer for some reason.)
yarn install- Change the
basic-setup.tsfile. yarn run bundle
yarn plugin import interactive-toolsyarn upgrade-interactiveyarn dedupeyarn run bundle
Updating indirect packages is difficult... Easiest is to just remove yarn.lock and run yarn install.
This package is not on NPM, but we use jsdelivr.com to get the source file directly from a git tag.
yarn run bundle- Change the
package.jsonpatch version number +1 - git commit etc
- Go here: https://github.com/JuliaPluto/codemirror-pluto-setup/releases/new
- For tag name, type in the new version number (without
v) and select "create new tag on publish" - Type version name (without
v) as release title - Release
- In Pluto: update
frontend/imports/CodemirrorPlutoSetup.jswith the new version number. - Copy the contents of
dist/index.d.tsand In Pluto: paste intofrontend/imports/CodemirrorPlutoSetup.d.ts. Save without formatting. - git commit etc
npm run bundleand commit to a new branch. Get the commit hash, e.g.bab65fc- In Pluto, use the commit hash as your version number, e.g.
import { ... } from "https://cdn.jsdelivr.net/gh/JuliaPluto/codemirror-pluto-setup@bab65fc/dist/index.es.min.js"@dralletje also knows a way to do this locally, without having to commit & copy the patch number.