sciencefair
sciencefair copied to clipboard
Package management system
Possibly we can just rip apm from electron?
Basically we just want a wrapper around npm, with ~/.sciencefair/packages
as the install location, and with a nice interface for finding, installing and managing the packages.
And we'll need to structure the API with extensibility in mind.
I'm starting to think about this in detail. Here's what I've got...
- We should choose between packages, extensions and plugins. These names are all used in the wild in different systems, and I think the choice probably affects how non-developer users will understand what they do.
- We use
npm
to handle publishing and installation, but with a custom install location e.g.~/.sciencefair/packages
- sciencefair packages are identifiable because they are scoped:
@sciencefair/packagename
- packages can interact with sciencefair in two key ways:
- asynchronously: sciencefair globally emits scoped events when things happen, and packages can add listeners to these events, accessing a global shared state store.
- synchronously at certain points in its execution sciencefair will run functional pipelines. Packages can use scoped hook addresses to add steps to these pipelines.
- sciencefair packages have some extra keys in their
package.json
that specify which async and sync hooks the package will use
We can then build out a simple interface for searching npm for @sciencefair
scoped packages and installing / removing them.
Longer term we could make a dat-backed distributed npm registry exclusively for handling sciencefair packages.
Thoughts?
Looking at the pre-post middleware hook pattern, for which there are a bunch of fairly simple packages:
- https://github.com/bnoguchi/hooks-js/
- https://github.com/indexzero/broadway
- https://github.com/bmeck/understudy
my two cents is this sounds hard to maintain and would add a lot of API surface area and therefore technical debt, seems more like a v2 kind of feature
I was hoping there would be a pluggable thing like apm we could use. But I can't find one.
Agree it's probably a v2 thing - and ideally an 'offload the problem to a separate project' thing.