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

Update plugin building #1008

Closed

Conversation

thelovekesh
Copy link
Member

@thelovekesh thelovekesh commented Feb 22, 2024

Summary

Fixes #893

Relevant technical choices

Checklist

  • PR has either [Focus] or Infrastructure label.
  • PR has a [Type] label.
  • PR has a milestone or the no milestone label.

@thelovekesh thelovekesh added [Type] Enhancement A suggestion for improvement of an existing feature no milestone PRs that do not have a defined milestone for release [Plugin] Optimization Detective Issues for the Optimization Detective plugin [Focus] Ecosystem Tools labels Feb 22, 2024

const from = path.resolve( __dirname );
const to = path.resolve( __dirname, 'build' );
const pluginDistIncludes = [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this list essentially the inverse of the current .gitattributes? Since this is an allowlist it will have to be manually updated. But then there is also a pluginDistIgnores which is essentially the same as the .gitattributes? Wouldn't this be simpler to just rather go with .distignore instead of the .gitattributes?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Humm, I agree with the negation thing since it's replicating the behavior of .gitattributes. TBH I wasn't much aware of .distignore but after exploring it I understand it's just "another" ignore file but creating distribution builds.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since CopyWebpackPlugin uses globby which provides support for such ignore files, I have switched it to use .distignore which is pretty much neat.

Copy link
Member

@westonruter westonruter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the scope of this PR needs to be pulled back because this branch is still working with modules and without the standalone plugins. In the feature/modules-to-plugins branch which will hopefully soon get merged, it has a build script for plugins already:

"build-plugins": "./bin/plugin/cli.js build-plugins",

See the build-plugins command.

But then there's another PR #1000 which is branched off of that which goes further for supporting standalone plugins.

So I think all that should be done in the immediate term is to switch from .gitattributes to .distignore. But we should perhaps wait altogether until we we finally get the feature/modules-to-plugins branch merged into trunk, as otherwise it's likely there will be re-work needed or merge conflicts.

@thelovekesh
Copy link
Member Author

it has a build script for plugins already:

IMO instead of developing CLI scripts, which frequently need to be modified for new use cases, we should utilize a tool like Webpack, which is ideally equipped and made to handle such use cases. Also, it gives us the flexibility to consume WP Scripts configurations which includes better presets for such cases.

@thelovekesh
Copy link
Member Author

#1024 (comment)

Pulling this conversation for bundling plugins here.

cc @felixarntz

Copy link
Member

@felixarntz felixarntz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thelovekesh I am unsure what is the purpose of this PR, it looks like it is mixing concerns a bit.

I know it started as a PR for #897, which makes sense given it's targeting the feature/image-loading-optimization branch.

I don't think we should use this PR as a solution for the problem of ignoring development files and assets for the standalone plugins. That should be in its own PR against trunk. If you already have something in mind that can fix that problem, it would be great if you could open a new PR against trunk so we can consider it separately. This work shouldn't be coupled to a specific module.

Comment on lines 31 to 33
"build": "wp-scripts build",
"build-plugin": "wp-scripts build --env build=plugin",
"build-plugins": "./bin/plugin/cli.js build-plugins",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is confusing to me. What is the purpose of build-plugin and build? We already have build-plugins which is for the modules to be built into plugins (which can soon be removed). Do we really need build-plugin or can it be combined somehow? If not, let's use a different name that clarifies what this is for.

@thelovekesh
Copy link
Member Author

Yes @felixarntz. This PR is confusing from the global point of view since this was originally authored as a POC for the ILO plugin. Hence, I will raise a PR to solve this on the trunk and later ILO can rebase with trunk and thus it will be solved for all the WIP and upcoming plugins.

cc @westonruter

@thelovekesh thelovekesh closed this Mar 6, 2024
@thelovekesh thelovekesh deleted the update/plugin-build branch March 6, 2024 14:23
@felixarntz
Copy link
Member

@thelovekesh Sounds great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no milestone PRs that do not have a defined milestone for release [Plugin] Optimization Detective Issues for the Optimization Detective plugin [Type] Enhancement A suggestion for improvement of an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants