Working without Node: kits, preview and build from the sidebar #41
fcapolini
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Markout is pitched at people who write HTML — designers who code, backend
developers with a templating layer they'd rather not have, anyone maintaining a
server-rendered app. Almost none of them have Node, and none of them want it.
As of
markout-vscode0.6.1, none of them need it. Install the extension, opena folder of HTML files, and the Markout view in the activity bar installs
kits, previews your pages and builds your site. There is no terminal in that,
and no npm.
Write-up:
docs/design/without-node.md· the page for somebody using it: the Markout
sidebar
The gap this closes
Kits were the gap. A kit is an npm package, so installing one meant having npm.
There was a fallback for the no-project case that asked
npm root -g, and itdid not work for the audience it was built for: the language server is a child
of the extension host, an editor launched from the Dock has a
PATHwith noHomebrew, nvm, fnm or volta in it, and a Mac with two npms has two global roots
where
npm root -ganswers truthfully about the wrong one. Every failure lookedthe same — no kits, silently, and a page reporting every tag the kit defines as
unknown.
So the mechanism built for the non-npm audience required npm, on a
PATHtheydo not have, in a copy that might not be the one that answers.
What is there now
Kits, with checkboxes. Tick one and it is fetched and pinned; untick it and
it goes. No npm is involved and none is needed — a kit is
.htmand CSS,fetched over HTTPS and checked against the checksum the registry published.
Markout's own kits are offered first; searching the whole registry is a separate,
deliberate step, because a kit's code compiles into every page that imports it.
Preview serves your pages and reloads as you save. It runs on the copy of
Node your editor is already running, so nothing looks for
nodeon aPATHandnothing has to be there. Build writes the finished site to
dist/.Updates are offered, never applied. A newer version shows as
1.0.0 → 1.1.0with accept and decline beside it, declining is remembered for that version, and
the number still waiting is a badge on the icon rather than a notification for a
thing nobody has to act on today.
Installed kits go in
.markout/kits/, in the project, resolved by thecompiler.
discoverKitsalready walked up looking fornode_modulesdirectories, so this is one more rung on a walk that existed — which means the
CLI gets it for free, and a build driven from the sidebar is reproducible by
hand with
markout build. The extension only ever fetches; it never resolves.That is the property that matters: the editor cannot be more permissive than
the build.
Two alternatives lost.
npm i -gbehind a checkbox builds the no-npm experienceon npm, and puts a machine-wide toggle in a per-project sidebar. A store the
extension owns under
globalStorageUriis one the CLI cannot read, sodiagnostics go green on pages that will not build — found at deploy rather than
while typing.
The boundary, stated plainly
The sidebar builds pages that render in the browser, and it does not render on
a server. Both buttons work in that one delivery mode: Build compiles and
stops, Preview serves exactly what Build writes. Of Markout's three ways to
deliver a
page,
this is the third.
That follows from the premise rather than being a limitation. Prerendered and
served are both a render, and a render is Node executing your page — so a
button offering either would be offering something its user cannot deploy, and
would run a kit's code on their machine to do it.
The loss that is real is content in the HTML for a crawler that will not run
JavaScript.
markout prerenderis the answer, and it wants Node on the machinethat runs the build — a CI job will do, and it does not have to be yours.
The part we didn't expect
Kits are small enough to commit.
bootstrap-kitis 164 KB andstd-kitis28 KB —
.htmand CSS, text that diffs, no native binaries, no postinstall. Aproject that checks
.markout/kits/into git has no install step at all:clone, open, works, offline, and it keeps working when a registry does not.
Nobody commits
node_modules, so this option does not exist for any of theframeworks we benchmark against.
It is not the default, for the reason below. Deleting one line from
.markout/.gitignoreis the whole opt-in.The open questions, answered
The six this proposal opened with all have answers now, and the reasoning is in
the design doc:
different things, which is the failure this audience is least equipped to
diagnose. A range in
kits.jsonis refused with an error naming the rule,rather than resolved silently. Bumps are offered one click at a time instead.
.markout/kits/is supported, documented, and nobody'sdefault. This follows from pinning rather than competing with it: a pin
plus
markout restorealready makes a clone deterministic, which was theproperty committing was going to buy. What it gives up is clone, open,
works, offline becoming clone, restore, works, offline — and a shared
download cache under
~/.markout/cachemakes every project after the firstoffline again.
kits.jsonlists kits and nothing else, initially — under akitskeyrather than as the file's whole content, so the next thing the project wants
to record does not need the format to change shape.
markout restoreexists. It is the one command the whole arrangementneeds from a terminal, and it needs Node only on the machine that runs it.
markout add <kit>exists too, so the CLI does write.markout/. Thealternative was a manifest only the sidebar could satisfy, which puts CI in
the position of being unable to build a clone. The installer itself lives in
the CLI behind a subpath the extension imports, so the checkbox and the
command cannot drift.
the pages.
One thing not on that list turned out to be the largest single improvement to
the onboarding path, and it is a consequence of the manifest rather than of the
sidebar. A missing kit used to report "unknown tag
<bs-navbar>" — unactionablefor somebody who has never installed a package. Now the compiler knows the
difference between a tag nobody declared and a tag belonging to a kit the
project asked for and has not got, and says so:
That is the compiler's message, so the editor,
markout buildand CI all sayit.
What would help
If you are in the no-Node group this was built for: install it, tick a kit, and
tell us whether it worked on your machine. That is the report we cannot produce
ourselves, and every failure mode above was discovered by somebody's machine
behaving differently from ours.
And if you have built editor tooling that installs things on a user's behalf,
we'd still like to hear where it went wrong for you.
All reactions