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

Add wireit build config for woo-ai plugin #43769

Merged
merged 5 commits into from
Jan 26, 2024
Merged

Conversation

jonathansadowski
Copy link
Contributor

Submission Review Guidelines:

Changes proposed in this Pull Request:

This PR adds wireit config to @woocommerce/plugin-woo-ai project, along with configs for both build and build watch.

Closes # .

How to test the changes in this Pull Request:

Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:

  1. Try out pnpm --filter='@woocommerce/plugin-woo-ai' build
  2. Repeat the previous command without changes to verify output is cached and not re-run
  3. Try out pnpm --filter='@woocommerce/plugin-woo-ai' watch:build

Changelog entry

  • Automatically create a changelog entry from the details below.

Significance

  • Patch
  • Minor
  • Major

Type

  • Fix - Fixes an existing bug
  • Add - Adds functionality
  • Update - Update existing functionality
  • Dev - Development related task
  • Tweak - A minor adjustment to the codebase
  • Performance - Address performance issues
  • Enhancement - Improvement to existing functionality

Message

Comment

This PR only affects build tooling and no change entry is required.

@github-actions github-actions bot added the plugin: woo-ai Issues related to the Woo AI features plugin. label Jan 18, 2024
Copy link
Contributor

Hi @retrofox, @ObliviousHarmony, @woocommerce/vortex

Apart from reviewing the code changes, please make sure to review the testing instructions as well.

You can follow this guide to find out what good testing instructions should look like:
https://github.com/woocommerce/woocommerce/wiki/Writing-high-quality-testing-instructions

1 similar comment
Copy link
Contributor

Hi @retrofox, @ObliviousHarmony, @woocommerce/vortex

Apart from reviewing the code changes, please make sure to review the testing instructions as well.

You can follow this guide to find out what good testing instructions should look like:
https://github.com/woocommerce/woocommerce/wiki/Writing-high-quality-testing-instructions

Copy link
Contributor

github-actions bot commented Jan 18, 2024

Test Results Summary

Commit SHA: 7a6795c

Test 🧪Passed ✅Failed 🚨Broken 🚧Skipped ⏭️Unknown ❔Total 📊Duration ⏱️
API Tests25900202610m 37s
E2E Tests29600302996m 24s

To view the full API test report, click here.
To view the full E2E test report, click here.
To view all test reports, visit the WooCommerce Test Reports Dashboard.

Copy link
Contributor

@rrennick rrennick left a comment

Choose a reason for hiding this comment

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

LGTM but I'll leave for one of the other reviewers to approve.

Copy link
Contributor

@retrofox retrofox left a comment

Choose a reason for hiding this comment

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

LGTM!

Tested the first and next builds. Also, watch mode works as expected 🚀

Copy link
Contributor

@ObliviousHarmony ObliviousHarmony left a comment

Choose a reason for hiding this comment

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

Thanks for tackling this.

As an aside, it looks like I forgot to add the "ci" configuration to the Woo AI plugin. Would you mind adding that here too and then we can also see this in action in this PR?

@@ -39,9 +39,11 @@
"wireit": "0.14.3"
},
"scripts": {
"build": "pnpm build:admin && pnpm uglify",
"build": "pnpm --if-present --workspace-concurrency=Infinity --stream --filter=\"$npm_package_name...\" '/^build:project:.*$/'",
"build:admin": "wp-scripts build",
Copy link
Contributor

Choose a reason for hiding this comment

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

We should probably just remove this entirely.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure I follow, remove the build script, or something else?

Copy link
Contributor

Choose a reason for hiding this comment

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

I was highlighting the bottom build:admin line. We should remove build:admin and probably add the uglification step to the wireit build command.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I might be missing something here, but the uglify script is defined as:

"uglify": "rm -f $npm_package_assets_js_min && for f in $npm_package_assets_js_js; do file=${f%.js}; node_modules/.bin/uglifyjs $f -c -m > $file.min.js; done",

However, there's no config in the package.json for assets.js.min or assets.js.js. Is this step actually doing anything the way it's configured currently? cc @retrofox

Copy link
Contributor

Choose a reason for hiding this comment

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

Honestly since webpack is configured here we can just remove the uglification script entirely. Not only does the current command not actually do anything this is behavior that should just be configured in webpack.config.js if we want it.

plugins/woo-ai/package.json Show resolved Hide resolved
@jonathansadowski
Copy link
Contributor Author

As an aside, it looks like I forgot to add the "ci" configuration to the Woo AI plugin. Would you mind adding that here too and then we can also see this in action in this PR?

I added a config here as well, adding linting. There seem to be several issues with the style lint though. I was going to offer to try and tackle solving those, but then I realized that the changes to the scss would have to also be reflected elsewhere, and I'm not as familiar with the code in woo-ai. lint:fix was able to solve some of the issues, but not all of them.

@ObliviousHarmony can we perhaps break adding the config into a separate issue? The scope of the original PR was adding the build configuration. @retrofox would you be able to address the style linting issues in separate PR(s) so that I can add the lint config once those are resolved?

Copy link
Contributor

@ObliviousHarmony ObliviousHarmony left a comment

Choose a reason for hiding this comment

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

can we perhaps break adding the config into a separate issue? The scope of the original PR was adding the build configuration

You added the configuration for linting and I think that's totally fine here. Adding support for unit tests would be a much more involved process since this plugin isn't set up with wp-env for unit testing.

@jonathansadowski
Copy link
Contributor Author

You added the configuration for linting and I think that's totally fine here. Adding support for unit tests would be a much more involved process since this plugin isn't set up with wp-env for unit testing.

Sorry, maybe I wasn't clear. This PR is currently blocked because if I merged it there would be several failing style lint issues (see above), and therefore linting would fail whenever the entire set of jobs was returned. I was proposing stripping that out and starting a separate PR. This PR didn't originally aim to address the CI configuration.

@ObliviousHarmony
Copy link
Contributor

That's fine, do what you need to 😄

@jonathansadowski jonathansadowski merged commit 6f9e853 into trunk Jan 26, 2024
30 checks passed
@jonathansadowski jonathansadowski deleted the add/woo-ai-watch branch January 26, 2024 22:08
@jonathansadowski jonathansadowski mentioned this pull request Jan 26, 2024
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin: woo-ai Issues related to the Woo AI features plugin.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants