This repository has been archived by the owner on Feb 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Make codebase Deno-first #136
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Adjust GitHub CI setup for node & deno; drop node 12 and 14 for now since they don't work yet
[Deno] inline noble-ed25519 & make it use std/node/crypto in Deno
Use external noble/ed25519, fix coverage, remove config
Remove heap dependency
Use npx for depchart commands
pin noble-ed25519 version from raw.github so it's stable
Test that bundle runs in Deno
Hooray! Thanks for all this work, let's merge it. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This changes the codebase so that Deno is the primary runtime for building, bundling, typechecking, and running tests.
Motivation
I had two motivations for doing this work:
Producing many distributions
We have a unique problem in that we want Earthstar to not only run only different platforms, but also take advantage of different platforms’ capabilities, e.g. offering ways to persist data to SQLite in environments that offer it.
In this codebase this mostly takes the form of storage and cryptography drivers. For us to develop these ergonomically we need type-checking and tests. The tests should also preferably be run against many different environments.
My attempts to change the node-centric codebase to provide this always had significant tradeoffs and added a lot of userland glue.
In a nutshell:
Part of this is to do with Deno's position as underdog: there are far more actively developed tools for compatibility with the NPM ecosystem.
One of these is
dnt
, a tool for creating NPM packages from Deno codebases.dnt
produces a NPM package for us, type-checks the output, and it also runs all the tests we have against the outputted code.This gives us both a first-class NPM package and Deno distribution. We are also to very easily build a bundle meant for the browser.
Codebase ergonomics
Maintaining a codebase like this requires a lot of tooling for things like building, type-checking, bundling, formatting, testing. Previously we were using many different tools created by many different providers:
tsc
for building and type-checking,tap
for testing,esbuild
for bundling, etc. Sometimes it can be a lot of work to make these tools coordinate with each other.This branch puts all these responsibilities with Deno. Deno handles type-checking, bundling, testing, and formatting the code. Because all these responsibilities are in one place, it's easier to coordinate certain things (for example, running Deno tests against the NPM-ified version of the code). It also makes certain tasks much faster: running the test suites currently takes 10.5 seconds, but in this branch it takes 4 seconds.
There are also fewer things to configure: no tsconfig.json, no package.json.
I think the story of getting a user to experiment with Earthstar is much easier this way: once the user has Deno installed they can make a single
.ts
file, import Earthstar via URL, anddeno run ./my_earthstar_script.ts
. Without npm / yarn,node_modules
,tsc
,tsconfig.json
.Concessions
Some things got lost in the move.
browserify
+browser-run
. Down the road this will be something we can do directly with Deno.yarn print-platform-support
command.More
Todo
Superbus
,SuperbusMap