-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Repo Overhaul #607
base: main-perspectives-merge-with-debug
Are you sure you want to change the base?
Repo Overhaul #607
Conversation
O wow, this is a huge change. I'm really pleased to have your suggestions @nmn. My immediate concern is FYI it's the first I've heard of bun, and I've never used typescript before. Other questions that occur to me straight away:
|
Typescript uses
The
VSCode has Typescript built-in so it should "just work". Outside of that I've updated the Yes, this is a very big change and maybe it won't work out specially as the code is constantly changing. There might be one other way to make this move in smaller steps that might be worth trying. I wanted to see how far I could get in a couple of hours and while a lot is fixed a lot still isn't. |
@aaronpoweruser Are you up to taking a look at this and maybe trying to get it working for your plugin as a test? This stuff is way outside of my expertise, so I don't think there's much I can do to move this forward. |
Sure I can take a look but we need to come up with a way to effectively test all the plugins. |
Most of the code is the same as before but the location of everything has changed.
I'll try to find some time and put up another PR which is less drastic and makes a small change to start off with. In the meantime if this works then great, otherwise just close this PR. |
Starting to overhaul the entire repo to make it as simple as possible.
Here are the notable changes so far:
Move to Bun
bun
is an alternative toNode.js
,NPM
,rollup
,Babel
andJest
.This one tool should replace all of those individual tools and be significantly faster too.
Migrate from Flow to Typescript
Compilation
bun
understands Typescript natively without any custom configuration. It also supports all the of features that we used plugins with Rollup. It should be able to compile and bundle JS and TS and TSX code without any custom configuration out of the box.Typesystem
Typescript is not as strict as Flow, but it is a lot easier to use. Most of what you learned with Flow will continue to work, but you'll just get fewer errors. There are few small changes to be aware of:
empty
->never
mixed
->unknown
$ReadOnly<Obj>
->Readonly<Obj>
$ReadOnlyArray<T>
->ReadonlyArray<T>
type X = {...Y, z: string}
->type X = Y & {z: string}
function foo<T:string>(){}
->function foo<T extends string>(){}
return (x: string);
->return x as string
Additionally:
Mono-repo
The final big change is to create
plugin
folder at the top-level of the repo and move all the plugin folders under that. Additionally, every plugin folder (and other utility folders) now all have apackage.json
file with an explicit "name" for the package.With this setup, you can always import code from another package using the name defined in the
package.json
file. I followed a consistent pattern of naming where a package like:jgclark.NoteHelpers
has the name@jgclark/note-helper
Any folder that did not have a username prefix now has an
np.
and@np/
prefixes respectively.All of these imports "just work" for both Typescript and Bundling without manually setting up any aliases.
A lot more to do
This is a big overhaul, and I don't remember all of scripts that need to run. So I will need help getting it all to work.