sciencefair icon indicating copy to clipboard operation
sciencefair copied to clipboard

Package management system

Open blahah opened this issue 8 years ago • 4 comments

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.

blahah avatar Apr 29 '16 08:04 blahah

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:
    1. asynchronously: sciencefair globally emits scoped events when things happen, and packages can add listeners to these events, accessing a global shared state store.
    2. 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?

blahah avatar May 12 '16 12:05 blahah

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

blahah avatar May 23 '16 21:05 blahah

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

max-mapper avatar May 27 '16 12:05 max-mapper

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.

blahah avatar May 27 '16 13:05 blahah