From 5bbb9edc6df9195addb915cdb826b7fb50406c9d Mon Sep 17 00:00:00 2001 From: Christopher Allford <6451942+ObliviousHarmony@users.noreply.github.com> Date: Mon, 23 Oct 2023 13:16:16 -0700 Subject: [PATCH] Renamed WooCommerce Plugin Package In order to prevent supply-chain attacks we have renamed the package. The new name is `@woocommerce/plugin-woocommerce`. --- .github/CONTRIBUTING.md | 4 ++-- .../setup-local-test-environment/action.yml | 4 ++-- .../hpos-build-and-e2e-tests-daily.yml | 4 ++-- .../non-cot-pr-build-and-e2e-tests.yml | 4 ++-- .github/workflows/pr-build-and-e2e-tests.yml | 6 +++--- DEVELOPMENT.md | 4 ++-- packages/js/e2e-environment/external.md | 2 +- plugins/woocommerce-admin/package.json | 2 +- plugins/woocommerce/README.md | 2 +- plugins/woocommerce/bin/build-zip.sh | 4 ++-- .../includes/class-woocommerce.php | 2 +- plugins/woocommerce/package.json | 2 +- .../tests/api-core-tests/README.md | 2 +- plugins/woocommerce/tests/e2e-pw/README.md | 2 +- plugins/woocommerce/tests/e2e/README.md | 20 +++++++++---------- .../woocommerce/tests/performance/README.md | 4 ++-- .../commands/changelog/lib/index.ts | 2 +- tools/storybook/package.json | 2 +- 18 files changed, 36 insertions(+), 36 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index f5050d06562..9c8c2b34388 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -35,7 +35,7 @@ Please take a moment to review the [project readme](https://github.com/woocommer - Ensure you stick to the [WordPress Coding Standards](https://make.wordpress.org/core/handbook/best-practices/coding-standards/php/). - Run our build process described in the document on [how to set up WooCommerce development environment](https://github.com/woocommerce/woocommerce/wiki/How-to-set-up-WooCommerce-development-environment), it will install our pre-commit hook, code sniffs, dependencies, and more. -- Before pushing commits to GitHub, check your code against our code standards. For PHP code in the WooCommerce Core project you can do this by running `pnpm --filter=woocommerce run lint:php:changes:branch`. +- Before pushing commits to GitHub, check your code against our code standards. For PHP code in the WooCommerce Core project you can do this by running `pnpm --filter=@woocommerce/plugin-woocommerce run lint:php:changes:branch`. - Whenever possible, please fix pre-existing code standards errors in code that you change. - Please consider adding appropriate tests related to your change if applicable such as unit, API and E2E tests. You can check the following guides for this purpose: - [Writing unit tests](https://github.com/woocommerce/woocommerce/blob/trunk/plugins/woocommerce/tests/README.md#guide-for-writing-unit-tests). @@ -46,7 +46,7 @@ Please take a moment to review the [project readme](https://github.com/woocommer - Ensure that your code supports the minimum supported versions of PHP and WordPress; this is shown at the top of the `readme.txt` file. - Push the changes to your fork and submit a pull request on the trunk branch of the WooCommerce repository. - Make sure to write good and detailed commit messages (see [this post](https://chris.beams.io/posts/git-commit/) for more on this) and follow all the applicable sections of the pull request template. -- Please create a change file for your changes by running `pnpm --filter= changelog add`. For example, a change file for the WooCommerce Core project would be added by running `pnpm --filter=woocommerce changelog add`. +- Please create a change file for your changes by running `pnpm --filter= changelog add`. For example, a change file for the WooCommerce Core project would be added by running `pnpm --filter=@woocommerce/plugin-woocommerce changelog add`. - Please avoid modifying the changelog directly or updating the .pot files. These will be updated by the WooCommerce team. If you are contributing code to our (Javascript-driven) Gutenberg blocks, please note that they are developed in their [own repository](https://github.com/woocommerce/woocommerce-gutenberg-products-block) and have their [own issue tracker](https://github.com/woocommerce/woocommerce-gutenberg-products-block/issues). diff --git a/.github/actions/tests/setup-local-test-environment/action.yml b/.github/actions/tests/setup-local-test-environment/action.yml index c5386a32c77..c04e44ce50f 100644 --- a/.github/actions/tests/setup-local-test-environment/action.yml +++ b/.github/actions/tests/setup-local-test-environment/action.yml @@ -25,5 +25,5 @@ runs: working-directory: plugins/woocommerce shell: bash run: | - pnpm env:dev --filter=woocommerce - pnpm env:performance-init --filter=woocommerce + pnpm env:dev --filter=@woocommerce/plugin-woocommerce + pnpm env:performance-init --filter=@woocommerce/plugin-woocommerce diff --git a/.github/workflows/hpos-build-and-e2e-tests-daily.yml b/.github/workflows/hpos-build-and-e2e-tests-daily.yml index f7230198e2a..efb9f81ed3a 100644 --- a/.github/workflows/hpos-build-and-e2e-tests-daily.yml +++ b/.github/workflows/hpos-build-and-e2e-tests-daily.yml @@ -29,7 +29,7 @@ jobs: working-directory: plugins/woocommerce env: ENABLE_HPOS: 1 - run: pnpm env:test:cot --filter=woocommerce + run: pnpm env:test:cot --filter=@woocommerce/plugin-woocommerce - name: Download and install Chromium browser. working-directory: plugins/woocommerce @@ -85,7 +85,7 @@ jobs: working-directory: plugins/woocommerce env: ENABLE_HPOS: 1 - run: pnpm env:test:cot --filter=woocommerce + run: pnpm env:test:cot --filter=@woocommerce/plugin-woocommerce - name: Run Playwright API tests. id: run_playwright_api_tests diff --git a/.github/workflows/non-cot-pr-build-and-e2e-tests.yml b/.github/workflows/non-cot-pr-build-and-e2e-tests.yml index f54fc1dce89..5582fc82bb6 100644 --- a/.github/workflows/non-cot-pr-build-and-e2e-tests.yml +++ b/.github/workflows/non-cot-pr-build-and-e2e-tests.yml @@ -26,7 +26,7 @@ jobs: - name: Load docker images and start containers working-directory: plugins/woocommerce - run: pnpm env:test --filter=woocommerce + run: pnpm env:test --filter=@woocommerce/plugin-woocommerce - name: Download and install Chromium browser. working-directory: plugins/woocommerce @@ -81,7 +81,7 @@ jobs: - name: Load docker images and start containers working-directory: plugins/woocommerce - run: pnpm env:test --filter=woocommerce + run: pnpm env:test --filter=@woocommerce/plugin-woocommerce - name: Run Playwright API tests. id: run_playwright_api_tests diff --git a/.github/workflows/pr-build-and-e2e-tests.yml b/.github/workflows/pr-build-and-e2e-tests.yml index 0a2b8d2ae60..bcc60092bf5 100644 --- a/.github/workflows/pr-build-and-e2e-tests.yml +++ b/.github/workflows/pr-build-and-e2e-tests.yml @@ -99,7 +99,7 @@ jobs: working-directory: plugins/woocommerce env: ENABLE_HPOS: 0 - run: pnpm env:test --filter=woocommerce + run: pnpm env:test --filter=@woocommerce/plugin-woocommerce - name: Run Playwright API tests. id: run_playwright_api_tests @@ -150,8 +150,8 @@ jobs: env: ENABLE_HPOS: 0 run: | - pnpm env:dev --filter=woocommerce - pnpm env:performance-init --filter=woocommerce + pnpm env:dev --filter=@woocommerce/plugin-woocommerce + pnpm env:performance-init --filter=@woocommerce/plugin-woocommerce - name: Install k6 run: | diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index cb3671f4066..02c76088a30 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -66,10 +66,10 @@ Here are some examples of the commands you will make use of. ```bash # Add a changelog entry for WooCommerce Core -pnpm --filter=woocommerce run changelog add +pnpm --filter=@woocommerce/plugin-woocommerce run changelog add # Create the woocommerce.zip file -pnpm --filter=woocommerce run build:zip +pnpm --filter=@woocommerce/plugin-woocommerce run build:zip ``` ## Plugin Development Environments diff --git a/packages/js/e2e-environment/external.md b/packages/js/e2e-environment/external.md index 66a6cd1c9a1..f2100ea5a07 100644 --- a/packages/js/e2e-environment/external.md +++ b/packages/js/e2e-environment/external.md @@ -38,7 +38,7 @@ Again, if you don't have shell access to your test site, through WP Admin ensure 3. You have an admin user set up (if their credentials differ from u/ `admin` and p/ `password` be sure to update `/plugins/woocommerce/tests/e2e/config/default.json`) 4. You have a customer user set up named 'Jane Smith'. This user should be a `subscriber` and again make sure their username and password are reflected in `/plugins/woocommerce/tests/e2e/config/default.json`. -You should then be able to run the e2e tests by running `pnpm run e2e --filter=woocommerce`. +You should then be able to run the e2e tests by running `pnpm run e2e --filter=@woocommerce/plugin-woocommerce`. ### Test Sequencer Setup diff --git a/plugins/woocommerce-admin/package.json b/plugins/woocommerce-admin/package.json index 1fa19de94a2..d15a04596a7 100644 --- a/plugins/woocommerce-admin/package.json +++ b/plugins/woocommerce-admin/package.json @@ -10,7 +10,7 @@ "url": "https://github.com:woocommerce/woocommerce.git" }, "scripts": { - "changelog": "pnpm --filter=woocommerce -r run changelog ", + "changelog": "pnpm --filter=@woocommerce/plugin-woocommerce -r run changelog ", "turbo:build": "pnpm run clean && cross-env NODE_ENV=production WC_ADMIN_PHASE=core webpack", "turbo:test": "pnpm run test:client", "analyze": "cross-env NODE_ENV=production ANALYZE=true webpack", diff --git a/plugins/woocommerce/README.md b/plugins/woocommerce/README.md index 8842a74c471..05dd9b65f45 100644 --- a/plugins/woocommerce/README.md +++ b/plugins/woocommerce/README.md @@ -16,7 +16,7 @@ Please make sure you follow the [repository's getting started guide](../../READM ```bash # Make sure that WooCommerce Core and all of its dependencies are built -pnpm run --filter=woocommerce build +pnpm run --filter=@woocommerce/plugin-woocommerce build # Make sure you're in the WooCommerce Core directory cd plugins/woocommerce # Start the development environment diff --git a/plugins/woocommerce/bin/build-zip.sh b/plugins/woocommerce/bin/build-zip.sh index 86e53d51aa4..0d65485d714 100755 --- a/plugins/woocommerce/bin/build-zip.sh +++ b/plugins/woocommerce/bin/build-zip.sh @@ -15,11 +15,11 @@ find "$PROJECT_PATH/assets/css/." ! -name '.gitkeep' -type f -exec rm -f {} + && echo "Installing PHP and JS dependencies..." pnpm install echo "Running JS Build..." -pnpm -w run build --filter=woocommerce || exit "$?" +pnpm -w run build --filter=@woocommerce/plugin-woocommerce || exit "$?" echo "Cleaning up PHP dependencies..." composer install --no-dev || exit "$?" echo "Run makepot..." -pnpm -r --filter=woocommerce run makepot || exit "$?" +pnpm -r --filter=@woocommerce/plugin-woocommerce run makepot || exit "$?" echo "Syncing files..." rsync -rc --exclude-from="$PROJECT_PATH/.distignore" "$PROJECT_PATH/" "$DEST_PATH/" --delete --delete-excluded diff --git a/plugins/woocommerce/includes/class-woocommerce.php b/plugins/woocommerce/includes/class-woocommerce.php index f56b733dc6d..719af0e1d19 100644 --- a/plugins/woocommerce/includes/class-woocommerce.php +++ b/plugins/woocommerce/includes/class-woocommerce.php @@ -1028,7 +1028,7 @@ final class WooCommerce { return; } - $message_one = __( 'You have installed a development version of WooCommerce which requires files to be built and minified. From the plugin directory, run pnpm install and then pnpm run build --filter=woocommerce to build and minify assets.', 'woocommerce' ); + $message_one = __( 'You have installed a development version of WooCommerce which requires files to be built and minified. From the plugin directory, run pnpm install and then pnpm run build --filter=@woocommerce/plugin-woocommerce to build and minify assets.', 'woocommerce' ); $message_two = sprintf( /* translators: 1: URL of WordPress.org Repository 2: URL of the GitHub Repository release page */ __( 'Or you can download a pre-built version of the plugin from the WordPress.org repository or by visiting the releases page in the GitHub repository.', 'woocommerce' ), diff --git a/plugins/woocommerce/package.json b/plugins/woocommerce/package.json index f45461fd5c6..4d81f2f05e5 100644 --- a/plugins/woocommerce/package.json +++ b/plugins/woocommerce/package.json @@ -1,5 +1,5 @@ { - "name": "woocommerce", + "name": "@woocommerce/plugin-woocommerce", "title": "WooCommerce", "version": "8.3.0", "homepage": "https://woo.com/", diff --git a/plugins/woocommerce/tests/api-core-tests/README.md b/plugins/woocommerce/tests/api-core-tests/README.md index 747e672b086..f43b75ebeee 100644 --- a/plugins/woocommerce/tests/api-core-tests/README.md +++ b/plugins/woocommerce/tests/api-core-tests/README.md @@ -38,7 +38,7 @@ WooCommerce's `api-core-tests` are powered by Playwright. The test site is spun - `nvm use` - `pnpm install` -- `pnpm run build --filter=woocommerce` +- `pnpm run build --filter=@woocommerce/plugin-woocommerce` - `cd plugins/woocommerce` - `pnpm env:test` - `pnpm test:api-pw` diff --git a/plugins/woocommerce/tests/e2e-pw/README.md b/plugins/woocommerce/tests/e2e-pw/README.md index d80d8db6992..469c76538c4 100644 --- a/plugins/woocommerce/tests/e2e-pw/README.md +++ b/plugins/woocommerce/tests/e2e-pw/README.md @@ -36,7 +36,7 @@ End-to-end tests are powered by Playwright. The test site is spinned up using `w - `nvm use` (uses the default node version you have set in NVM) - `pnpm install` (installs dependencies) -- `pnpm run build --filter=woocommerce` (builds WooCommerce locally) +- `pnpm run build --filter=@woocommerce/plugin-woocommerce` (builds WooCommerce locally) - `cd plugins/woocommerce` (changes into the WooCommerce plugin folder) - `npx playwright install` (installs the latest Playwright version) - `pnpm env:start` (starts the local environment) diff --git a/plugins/woocommerce/tests/e2e/README.md b/plugins/woocommerce/tests/e2e/README.md index 397d0a592fa..1f70c074cdc 100644 --- a/plugins/woocommerce/tests/e2e/README.md +++ b/plugins/woocommerce/tests/e2e/README.md @@ -120,11 +120,11 @@ Run the following in a terminal/command line window - `pnpm install` -- `pnpm run build --filter=woocommerce` +- `pnpm run build --filter=@woocommerce/plugin-woocommerce` - `npm install jest --global` (this only needs to be done once) -- `pnpm docker:up --filter=woocommerce` (this will build the test site using Docker) +- `pnpm docker:up --filter=@woocommerce/plugin-woocommerce` (this will build the test site using Docker) - Use `docker ps` to confirm that the Docker containers are running. You should see a log similar to one below indicating that everything had been built as expected: @@ -150,16 +150,16 @@ Username: admin PW: password ``` -- Run `pnpm docker:down --filter=woocommerce` when you are done with running e2e tests and before making any changes to test site configuration. +- Run `pnpm docker:down --filter=@woocommerce/plugin-woocommerce` when you are done with running e2e tests and before making any changes to test site configuration. -Note that running `pnpm docker:down --filter=woocommerce` and then `pnpm docker:up --filter=woocommerce` re-initializes the test container. +Note that running `pnpm docker:down --filter=@woocommerce/plugin-woocommerce` and then `pnpm docker:up --filter=@woocommerce/plugin-woocommerce` re-initializes the test container. ### How to run tests in headless mode To run e2e tests in headless mode use the following command: ```bash -pnpm run e2e --filter=woocommerce +pnpm run e2e --filter=@woocommerce/plugin-woocommerce ``` ### How to run tests in non-headless mode @@ -167,7 +167,7 @@ pnpm run e2e --filter=woocommerce Tests run in headless mode by default. However, sometimes it's useful to observe the browser while running or developing tests. To do so, you can run tests in a non-headless (dev) mode: ```bash -pnpm run e2e:dev --filter=woocommerce +pnpm run e2e:dev --filter=@woocommerce/plugin-woocommerce ``` The dev mode also enables SlowMo mode. SlowMo slows down Puppeteer’s operations. This makes it easier to see what is happening in the browser. @@ -175,7 +175,7 @@ The dev mode also enables SlowMo mode. SlowMo slows down Puppeteer’s operation By default, SlowMo mode adds a 50 millisecond delay between test steps. If you'd like to override the length of the delay and have the tests run faster or slower in the `-dev` mode, pass `PUPPETEER_SLOWMO` variable when running tests as shown below: ``` -PUPPETEER_SLOWMO=10 pnpm run e2e:dev --filter=woocommerce +PUPPETEER_SLOWMO=10 pnpm run e2e:dev --filter=@woocommerce/plugin-woocommerce ``` The faster you want the tests to run, the lower the value should be of `PUPPETEER_SLOWMO` should be. @@ -199,7 +199,7 @@ E2E_RETRY_TIMES=2 pnpm exec wc-e2e test:e2e Tests run in headless mode by default. While writing tests it may be useful to have the debugger loaded while running a test in non-headless mode. To run tests in debug mode: ```bash -pnpm run e2e:debug --filter=woocommerce +pnpm run e2e:debug --filter=@woocommerce/plugin-woocommerce ``` When all tests have been completed the debugger remains active. Control doesn't return to the command line until the debugger is closed. Otherwise, debug mode functions the same as non-headless mode. @@ -270,7 +270,7 @@ The following variables can be used to specify the versions of WordPress, PHP an The full command to build the site will look as follows: ``` -TRAVIS_MARIADB_VERSION=10.5.3 TRAVIS_PHP_VERSION=7.4.5 WP_VERSION=5.4.1 pnpm docker:up --filter=woocommerce +TRAVIS_MARIADB_VERSION=10.5.3 TRAVIS_PHP_VERSION=7.4.5 WP_VERSION=5.4.1 pnpm docker:up --filter=@woocommerce/plugin-woocommerce ``` ## Guide for writing e2e tests @@ -378,6 +378,6 @@ The [WooCommerce E2E Tests Boilerplate repo](https://github.com/woocommerce/wooc ## Debugging tests -The test sequencer (`pnpm run e2e --filter=woocommerce`) includes support for saving [screenshots on test errors](https://github.com/woocommerce/woocommerce/tree/trunk/packages/js/e2e-environment#test-screenshots) which can be sent to a Slack channel via a [Slackbot](https://github.com/woocommerce/woocommerce/tree/trunk/packages/js/e2e-environment#slackbot-setup). +The test sequencer (`pnpm run e2e --filter=@woocommerce/plugin-woocommerce`) includes support for saving [screenshots on test errors](https://github.com/woocommerce/woocommerce/tree/trunk/packages/js/e2e-environment#test-screenshots) which can be sent to a Slack channel via a [Slackbot](https://github.com/woocommerce/woocommerce/tree/trunk/packages/js/e2e-environment#slackbot-setup). For Puppeteer debugging, follow [Google's documentation](https://developers.google.com/web/tools/puppeteer/debugging). diff --git a/plugins/woocommerce/tests/performance/README.md b/plugins/woocommerce/tests/performance/README.md index 2364ed7df08..70d2d765a6d 100644 --- a/plugins/woocommerce/tests/performance/README.md +++ b/plugins/woocommerce/tests/performance/README.md @@ -57,8 +57,8 @@ Before using the tests a test environment is needed to run against. We first spin up an environment using `wp-env` and configure that environment with the necessary plugins and data using the Initialization Script [`init-sample-products.sh`](https://github.com/woocommerce/woocommerce/tree/trunk/plugins/woocommerce/tests/performance/bin/init-sample-products.sh) that will set up a shop with sample products imported and the shop settings (payment method, permalinks, address etc) needed for the tests already set. It is recommended using this to just see the tests in action. ```sh -pnpm run env:dev --filter=woocommerce -pnpm run env:performance-init --filter=woocommerce +pnpm run env:dev --filter=@woocommerce/plugin-woocommerce +pnpm run env:performance-init --filter=@woocommerce/plugin-woocommerce ``` If using a different environment the details can be changed in `config.js`. diff --git a/tools/monorepo-utils/src/code-freeze/commands/changelog/lib/index.ts b/tools/monorepo-utils/src/code-freeze/commands/changelog/lib/index.ts index 63a7d78a550..c1618ae2326 100644 --- a/tools/monorepo-utils/src/code-freeze/commands/changelog/lib/index.ts +++ b/tools/monorepo-utils/src/code-freeze/commands/changelog/lib/index.ts @@ -113,7 +113,7 @@ export const updateReleaseBranchChangelogs = async ( Logger.notice( `Running the changelog script in ${ tmpRepoPath }` ); execSync( - `pnpm --filter=woocommerce run changelog write --add-pr-num -n -vvv --use-version ${ version }`, + `pnpm --filter=@woocommerce/plugin-woocommerce run changelog write --add-pr-num -n -vvv --use-version ${ version }`, { cwd: tmpRepoPath, stdio: 'inherit', diff --git a/tools/storybook/package.json b/tools/storybook/package.json index d6d5e2d8b5f..3e7b40a4a32 100644 --- a/tools/storybook/package.json +++ b/tools/storybook/package.json @@ -20,7 +20,7 @@ "scripts": { "build-storybook": "build-storybook -c ./.storybook", "preinstall": "npx only-allow pnpm", - "build-woocommerce": "pnpm --filter=woocommerce run build", + "build-woocommerce": "pnpm --filter=@woocommerce/plugin-woocommerce run build", "storybook": "pnpm run build-woocommerce && ./import-wp-css-storybook.sh && BABEL_ENV=storybook STORYBOOK=true start-storybook -c ./.storybook -p 6007 --ci", "storybook-rtl": "USE_RTL_STYLE=true pnpm run storybook" },