I’ve recently gone the other route, and built a workflow that efficiently pushes to NPM. In large part, driven by wanting to use Typescript and extensive test cases.
My workflow looks roughly like this:
- Experiment a bit on Observable
- Copy my experiments over to WebSphere, convert to Typescript
- Write unit tests, docs, etc.
- Push to GitHub (https://github.com/BobKerns/physics-math)
- GitHub Actions builds it in 4 different environments. (Could also use Travis or CircleCI).
- Define a release on GitHub (I make this an explicit step rather than automatic)
- GitHub Actions publishes the package to NPM and the documentation to a GitHub page
- I go to https://observablehq.com/@bobkerns/testing-physics-math
- I select my new release, and I’m back to playing with Observable again.
- If I need to make experimental changes, I can run a local server (
npm run server
) and load from there instead of steps 4-7.
It ends up being fairly easy to switch back and forth, depending on whether I’m exploring or engineering, but it took a lot of infrastructure effort to get here. I really benefit from from Typescripts checking and from being able to debug unit tests, but as soon as I want to explore ideas, I’m back in Observable with little overhead.
I make Step 5 (defining a release on GitHub) manual to give my page a source of info about the releases (via their REST API), and allow me to select to compare behavior, etc.
But it’s taken way too much knowledge, time, and experimentation. I hope others can benefit from my efforts; I hope to write them up in a usable recipe form. I’d love to see this sort of two-camps workflow be simpler to set up and manage.
Your direct-to-zeit (now Vercel) approach would be perfect for every server-side bit I’ve wanted. The factors that pushed me toward offline/NPM involve complexity, documentation , testing, reusability.
But my server-side stuff is just “not in the browser” bits. Actually, I wonder if I could eliminate the server-side entirely with workers?
Being set up to load my package from a local server is a similar effort to reduce time out-of-Observable. I wonder if I could set up a page to serve an JS attachment and documents and cut out GitHub/GitHub Pages/NPM?
It probably wouldn’t save me anything at this point, but it would potentially be a lot easier to explain without invoking a dozen other technologies, just to deliver code to ObservableHQ pages!