Skip to content
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

feat: phase-2 p.o.c: break the app into packages #81

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

jasonbahl
Copy link
Collaborator

@jasonbahl jasonbahl commented Mar 15, 2024

This PR is currently not fully functional, but does show the general concept of how we might want to consider architecting the codebase when we work on making it pluggable.

This is largely based on how Gutenberg does things (in fact the webpack and bin scripts are about 90%+ identical to the Gutenberg repo at the moment).

Anyway, to get an idea of how this works, from the root of the plugin run:

  • npm install
  • npm run build

Then re-load the WordPress dashboard. The new IDE won't work anymore (that's expected at this state of this PR), but, what you will see now is that all of the packages are now added to the window under wpgraphqlIde.

You can see this in the browser console:
CleanShot 2024-03-15 at 14 47 30

Much like Gutenberg packages are all added to the window under wp.:

CleanShot 2024-03-15 at 14 48 15

With this architecture, we will be able to build the application using React and following standard practices for building with Components, but will allow for inter-operability between packages, as functions we export will now be available on the window and 3rd parties can interact with the packages without needing to be bundled together.

I wrote up a rough idea on how I see the packages being broken up in the /packages/README.md file (see: https://github.com/wp-graphql/wpgraphql-ide/tree/phase2/implement-packages/packages/README.md)

@jasonbahl jasonbahl requested a review from josephfusco March 15, 2024 20:50
@jasonbahl jasonbahl marked this pull request as draft March 15, 2024 20:51
- pin chalk to 4.1.1 based on gutenberg's implementation
- install fast-glob, node-watch, progress as dev deps
- ignore blocksConfig from webpack for now
- define module in package.json for each package
- add .npmrc files to packages (see: https://github.com/WordPress/gutenberg/blob/f1af91a70a9140d569a92b29107b118f5cd91871/packages/README.md?plain=1#L39)
- add initial state for packages/app
@josephfusco josephfusco changed the title phase-2 p.o.c: break the app into packages feat: phase-2 p.o.c: break the app into packages Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant