-
Notifications
You must be signed in to change notification settings - Fork 8
Closed
Description
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:
- Put all code under the
graph-framework
package and rename tohypergraph
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'
- 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
Labels
No labels