Skip to content

[RFC] Consolidate packages and update names to hypergraph approach #85

@cmwhited

Description

@cmwhited

Description

The repo is currently split into very separated and siloed packages:

Utility/helper packages

  • graph-framework-utils
  • graph-framework-identity
  • graph-framework-key
  • graph-framework-schema
  • graph-framework-messages
  • graph-framework-space-events

Top-level export

  • graph-framework
    • reexports from the utility helper packages

This approach creates a bit of a dependency and tree-shaking problem for apps using the framework.

Potential approaches:

  1. Put all code under the graph-framework package and rename to hypergraph with the publishable package name as @graphprotocol/hypergraph with sub-directories in the package for the utility/helpers above:
packages/
- hypergraph/
  - src/
    - index.ts -> barrel-file exports
    - utils/ -> contains code from graph-framework-utils package
    - key/ -> contains code from graph-framework-key package
    - schema/ -> contains code from graph-framework-schema package
    - messages/ -> contains code from graph-framework-messages package
    - space-events/ -> contains code from graph-framework-space-events package

Update package.json so that can import from sub-directories:

import { encodeBase58 } from '@graphprotocol/hypergraph/utils'
  1. Very similar to approach 1, but with a caveat that @graphprotocol/hypergraph is framework-agnostic; just a TS lib. Some of the sub-packages have a requirement on react, meaning the top-level graph-framework has a requirement on react. IMO, the @graphprotocol/hypergraph package should not not have a requirement on react (or any framework) and then additional, extending, packages can be created for a react (and next, vue, angular, svelte, etc)
packages/
- hypergraph/
  - src/
    - index.ts -> barrel-file exports
    - utils/ -> contains code from graph-framework-utils package
    - key/ -> contains code from graph-framework-key package
    - schema/ -> contains code from graph-framework-schema package
    - messages/ -> contains code from graph-framework-messages package
    - space-events/ -> contains code from graph-framework-space-events package
- react/ -> contains react-specific logic for hypergraph. contexts, react-query, state, etc
  - src/ 

With this, rename from graph-framework to hypergraph

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions