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

Using one instance of wp-scripts to work with all blocks #89

Open
flexseth opened this issue Apr 3, 2024 · 3 comments
Open

Using one instance of wp-scripts to work with all blocks #89

flexseth opened this issue Apr 3, 2024 · 3 comments

Comments

@flexseth
Copy link
Contributor

flexseth commented Apr 3, 2024

Description

In order to take a look at blocks in this repo, there are a couple of steps needed:

  • Clone the repo
  • Move all files from the repo's /plugins folder to wp-content/plugins for your local installation
  • Build the NPM packages for each block (takes running/installing multiple times)

Proposal

Is there a way to save @wordpress/scripts in the wp-content/plugins directory, and build this one time?

Otherwise, if you had a local copy of wp-scripts at a source folder, let's say
~/users/username/dev/wp-scripts

To access all builds from one wp-scripts package?

Caveats

I realize you can do this by bootstrapping multiple plugins, but I'm thinking of never having to re-install the wp-scripts package again... just update it for one copy on your machine.

Also realize there can be some dependency issues here, and also some issues with needing extra packages such as useDebounce ..

@ryanwelcher
Copy link
Collaborator

ryanwelcher commented Apr 30, 2024

This repo uses pnpm to build all of the blocks, have a look at the instructions in the Development section in the Wiki for set up instructions.

@flexseth
Copy link
Contributor Author

flexseth commented May 5, 2024

Thank you for pointing that out, @ryanwelcher

Getting Started is a good place, seeing a lot of potential in the repo!

This wp-block-development-examples repo is a monorepo multipackage because it contains several packages (plugins)

Going to submit a PR to indicate that wp-scripts is "bundled" when scaffolding new plugins/blocks with the instructions provided to use the repo

@juanmaguitar
Copy link
Collaborator

juanmaguitar commented May 10, 2024

Hi @flexseth,

First of all, thanks a lot for your issues and PRs on this repo 🙏

In order to take a look at blocks in this repo, there are a couple of steps needed:

I want to provide a broader perspective of what can be done with the examples of this repo.
We value any feedback you can provide on the guidelines provided in this repository. Your input is highly appreciated.

Note

TL;DR: The examples are prepared to work with them as a batch or individually, to work with them under this repo itself or your own WP installation, to clone the repo and copy and paste the examples or your own WP installation, or to download the examples and install them directly as plugins or your own WP installation without cloning the repo

Clone the repo

You can actually check the examples without cloning the repo. WIth the links provided for each example you can check the example online (with WP playground) or download the .zip and uncompress it at the plugins folder of your own WP installation.

Move all files from the repo's /plugins folder to wp-content/plugins for your local installation

You can just move those examples you're interested in

Build the NPM packages for each block (takes running/installing multiple times)

Again, you can just build the NPM packages for the blocks you're interested in.

As you already mention, the Getting Started guide is a great place to start working with the examples of this repo. Some of the things mentioned in this page about how to work locally with these examples are:

  • Run npm run env:start from the root folder to use wp-env to get a local development environment with ALL the examples (each example can be located by their ID)
  • Run pnpm -- wp-env start from any plugin folder to use wp-env to get a local development environment with that example
  • Run npx @wp-now/wp-now start from any plugin folder to use wp-now to quickly launch a WordPress installation with that specific plugin installed.

The Local Development Guide is another good resource to learn more about how to work locally with the examples of this repo

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

No branches or pull requests

3 participants