Migrate From Nx to Turborepo (#33079)

This replaces all `nx` commands with `turbo` commands and removes Nx from the repository. All of the `project.json` files have been removed and any commands that broke with Turborepo have been adjusted.
This commit is contained in:
Christopher Allford 2022-06-09 14:40:07 -07:00 committed by GitHub
parent a3d42be6b0
commit b7931409f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
76 changed files with 1262 additions and 5564 deletions

View File

@ -25,7 +25,7 @@ Closes # .
- [ ] Have you added an explanation of what your changes do and why you'd like us to include them?
- [ ] Have you written new tests for your changes, as applicable?
- [ ] Have you successfully run tests with your changes locally?
- [ ] Have you created a changelog file for each project being changed, ie `pnpm nx changelog <project>`?
- [ ] Have you created a changelog file for each project being changed, ie `pnpm changelog add --filter=<project>`?
<!-- Mark completed items with an [x] -->

View File

@ -17,14 +17,9 @@ runs:
- name: Install dependencies
shell: bash
working-directory: ${{ inputs.working_directory }}
run: pnpm install
- name: Install Composer dependencies
shell: bash
working-directory: ${{ inputs.working_directory }}
run: pnpm nx composer-install-no-dev woocommerce
run: COMPOSER_NO_DEV=1 pnpm install
- name: Run build
shell: bash
working-directory: ${{ inputs.working_directory }}
run: pnpm nx build woocommerce
run: pnpm exec turbo run build --filter=woocommerce

View File

@ -63,7 +63,7 @@ jobs:
uses: ./.github/actions/install-build
- name: Build Admin feature config
run: pnpm nx build:feature-config woocommerce
run: pnpm build:feature-config --filter=woocommerce
- name: Add PHP8 Compatibility.
run: |
@ -75,7 +75,7 @@ jobs:
composer bin phpunit config repositories.0 '{"type": "path", "url": "/tmp/phpunit-7.5-fork/phpunit-add-compatibility-with-php8-to-phpunit-7", "options": {"symlink": false}}'
composer bin phpunit require --dev -W phpunit/phpunit:@dev --ignore-platform-reqs
rm -rf ./vendor/phpunit/
pnpm nx composer-dump-autoload woocommerce
composer dump-autoload
fi
- name: Init DB and WP
@ -83,4 +83,4 @@ jobs:
run: ./tests/bin/install.sh woo_test root root 127.0.0.1 ${{ matrix.wp }}
- name: Run tests
run: pnpm nx test-unit woocommerce
run: pnpm exec turbo run test --filter=woocommerce

View File

@ -49,14 +49,16 @@ jobs:
- name: Build Admin feature config
run: |
pnpm nx build:feature-config woocommerce
pnpm build:feature-config --filter=woocommerce
- name: Init DB and WP
run: pnpm nx install-unit-test-db woocommerce
working-directory: plugins/woocommerce
run: bash tests/bin/install.sh woo_test root root 127.0.0.1 latest
- name: Run unit tests with code coverage. Allow to fail.
working-directory: plugins/woocommerce
run: |
pnpm nx test-code-coverage woocommerce
RUN_CODE_COVERAGE=1 bash tests/bin/phpunit.sh
exit 0
- name: Send code coverage to Codecov.

View File

@ -14,7 +14,7 @@ jobs:
npm install -g pnpm@^6.24.2
npm -g i @wordpress/env
pnpm install
pnpm nx build:feature-config woocommerce
pnpm build:feature-config --filter=woocommerce
- name: Run analyzer
id: run
run: ./tools/code-analyzer/bin/dev analyzer "$GITHUB_HEAD_REF" -o github

View File

@ -35,13 +35,7 @@ jobs:
uses: ./.github/actions/install-build
- name: Lint
run: |
pnpm nx build woocommerce-admin
pnpm nx lint woocommerce-admin
pnpm nx lint:js-packages woocommerce-admin
run: pnpm exec turbo run lint --filter='@woocommerce/admin-library...' --filter='!@woocommerce/e2e*' --filter='!@woocommerce/api'
- name: Test
run: |
pnpm nx build woocommerce-admin
pnpm nx test woocommerce-admin
pnpm nx test:packages woocommerce-admin
run: pnpm exec turbo run test --filter='@woocommerce/admin-library...' --filter='!@woocommerce/e2e*' --filter='!@woocommerce/api'

View File

@ -60,7 +60,7 @@ jobs:
- name: Build Admin feature config
run: |
pnpm nx build:feature-config woocommerce
pnpm build:feature-config --filter=woocommerce
- name: Add PHP8 Compatibility.
run: |
@ -72,7 +72,7 @@ jobs:
composer bin phpunit config repositories.0 '{"type": "path", "url": "/tmp/phpunit-7.5-fork/phpunit-add-compatibility-with-php8-to-phpunit-7", "options": {"symlink": false}}'
composer bin phpunit require --dev -W phpunit/phpunit:@dev --ignore-platform-reqs
rm -rf ./vendor/phpunit/
pnpm nx composer-dump-autoload woocommerce
composer dump-autoload
fi
- name: Init DB and WP
@ -80,4 +80,4 @@ jobs:
run: ./tests/bin/install.sh woo_test root root 127.0.0.1 ${{ matrix.wp }}
- name: Run tests
run: pnpm nx test-unit woocommerce
run: pnpm exec turbo run test --filter=woocommerce

View File

@ -177,7 +177,7 @@ jobs:
- name: Load docker images and start containers.
working-directory: package/woocommerce
run: pnpm nx docker-up woocommerce
run: pnpm docker:up --filter=woocommerce
- name: Run tests command.
working-directory: package/woocommerce/plugins/woocommerce

View File

@ -109,7 +109,7 @@ jobs:
working-directory: package/woocommerce
env:
LATEST_WP_VERSION_MINUS: ${{ matrix.wp }}
run: pnpm nx docker-up woocommerce
run: pnpm docker:up --filter=woocommerce
- name: Run tests command.
working-directory: package/woocommerce/plugins/woocommerce
@ -188,7 +188,7 @@ jobs:
working-directory: package/woocommerce
env:
LATEST_WP_VERSION_MINUS: ${{ matrix.wp }}
run: pnpm nx docker-up woocommerce
run: pnpm docker:up --filter=woocommerce
- name: Run tests command.
working-directory: package/woocommerce/plugins/woocommerce

3
.gitignore vendored
View File

@ -92,3 +92,6 @@ allure-results
/plugins/woocommerce/e2e/output
/plugins/woocommerce/e2e/report
/plugins/woocommerce/e2e/storage
# Turborepo
.turbo

View File

@ -2,4 +2,3 @@
. "$(dirname "$0")/_/husky.sh"
pnpm install
pnpm nx affected --target="composer-install" --base=ORIG_HEAD --head=HEAD

View File

@ -34,14 +34,7 @@ The port # might be different depending on your `.wp-env.override.json` configur
Once you have WP-ENV container up, we need to run a few commands to start developing.
1. Run `pnpm install` to install npm modules.
2. Run `pnpm nx build woocommerce` to build core.
3. Run `pnpm nx composer-install woocommerce` to install PHP dependencies.
If you don't have Composer available locally, run the following command. It runs the command in WP-ENV container.
`wp-env run composer composer install`
You might also want to run `pnpm start` to watch your CSS and JS changes if you are working on the frontend.
2. Run `pnpm exec turbo run build --filter=woocommerce` to build core.
You're now ready to develop!

View File

@ -1,24 +1,55 @@
<p align="center"><a href="https://woocommerce.com/"><img src="https://woocommerce.com/wp-content/themes/woo/images/logo-woocommerce@2x.png" alt="WooCommerce"></a></p>
<p align="center">
<a href="https://packagist.org/packages/woocommerce/woocommerce"><img src="https://poser.pugx.org/woocommerce/woocommerce/license" alt="license"></a>
<a href="https://packagist.org/packages/woocommerce/woocommerce"><img src="https://poser.pugx.org/woocommerce/woocommerce/v/stable" alt="Latest Stable Version"></a>
<img src="https://img.shields.io/wordpress/plugin/dt/woocommerce.svg" alt="WordPress.org downloads">
<img src="https://img.shields.io/wordpress/plugin/r/woocommerce.svg" alt="WordPress.org rating">
<a href="https://github.com/woocommerce/woocommerce/actions/workflows/ci.yml"><img src="https://github.com/woocommerce/woocommerce/actions/workflows/ci.yml/badge.svg?branch=trunk" alt="Build Status"></a>
<a href="https://codecov.io/gh/woocommerce/woocommerce"><img src="https://codecov.io/gh/woocommerce/woocommerce/branch/trunk/graph/badge.svg" alt="codecov"></a>
</p>
Welcome to the WooCommerce Monorepo on GitHub. Here you can find all of the packages, plugins, and tools used in the development of the core WooCommerce plugin as well as WooCommerce extensions. You can browse the source, look at open issues, contribute code, and keep tracking of ongoing development.
Welcome to the WooCommerce repository on GitHub. Here you can browse the source, look at open issues and keep track of development. We recommend all developers to follow the [WooCommerce development blog](https://woocommerce.wordpress.com/) to stay up to date about everything happening in the project. You can also [follow @DevelopWC](https://twitter.com/DevelopWC) on Twitter for the latest development updates.
We recommend all developers to follow the [WooCommerce development blog](https://woocommerce.wordpress.com/) to stay up to date about everything happening in the project. You can also [follow @DevelopWC](https://twitter.com/DevelopWC) on Twitter for the latest development updates.
If you are not a developer, please use the [WooCommerce plugin page](https://wordpress.org/plugins/woocommerce/) on WordPress.org.
## Repository Structure
## Documentation
* [WooCommerce Documentation](https://docs.woocommerce.com/)
* [WooCommerce Developer Documentation](https://github.com/woocommerce/woocommerce/wiki)
* [WooCommerce Code Reference](https://docs.woocommerce.com/wc-apidocs/)
* [WooCommerce REST API Docs](https://woocommerce.github.io/woocommerce-rest-api-docs/)
* [Setting up a development environment](https://github.com/woocommerce/woocommerce/wiki/How-to-set-up-WooCommerce-development-environment)
* [**Plugins**](plugins): Our repository contains plugins that relate to or otherwise aid in the development of WooCommerce.
* [**WooCommerce Core**](plugins/woocommerce): The core WooCommerce plugin is available in the plugins directory.
* [**Packages**](packages): Contained within the packages directory are all of the [PHP](packages/php) and [JavaScript](packages/js) provided for the community. Some of these are internal dependencies and are marked with an `internal-` prefix.
* [**Tools**](tools): We also have a growing number of tools within our repository. Many of these are intended to be utilities and scripts for use in the monorepo, but, this directory may also contain external tools.
## Getting Started
To get up and running within the WooCommerce Monorepo, you will need to make sure that you have installed all of the prerequisites.
### Prerequisites
* [NVM](https://github.com/nvm-sh/nvm#installing-and-updating): While you can always install Node through other means, we recommend using NVM to ensure you're aligned with the version used by our development teams. Our repository contains [an `.nvmrc` file](.nvmrc) which helps ensure you are using the correct version of Node.
* [PNPM](https://pnpm.io/installation): Our repository utilizes PNPM to manage project dependencies and run various scripts involved in building and testing projects.
* [PHP 7.2+](https://www.php.net/manual/en/install.php): WooCommerce Core currently features a minimum PHP version of 7.2. While you don't need to use it to run a local development environment, you will need it to utilize Composer.
* [Composer](https://getcomposer.org/doc/00-intro.md): We use Composer to manage all of the dependencies for PHP packages and plugins.
Once you've installed all of the prerequisites, you can run the following commands.
```bash
# Ensure that you're using the correct version of Node
nvm use
# Install all of the NPM and Composer dependencies within the Monorepo
pnpm install
```
### Building, Linting, and Testing
Our repository uses [Turborepo](https://turborepo.org) for running `build`, `lint`, `test`, and `e2e` commands. This tool ensures that all dependencies of a package, plugin, or tool are prepared before running a command. It also provides caching for command outputs in order to ensure that work is not performed unnecessarily.
Without any additional flags, running a command will execute it against every project in the monorepo. For example, `pnpm exec turbo run build` will build all of the projects within the monorepo. `pnpm exec turbo run test` will run unit tests for all of the projects within the monorepo.
This behavior can be desireable, as the cache should ensure anything that has not changed is not rebuilt. There are times, however, that you may want to explicitly run a command against a specific project.
This can be done using the `--filter` flag. For example, running `pnpm exec turbo run build --filter=woocommerce` will build the WooCommerce plugin, as well as all of the dependencies required for the plugin to function.
The `--filter` syntax also supports paths, such as `--filter='./plugins/**'` to build all of the plugins in the monorepo. [You can read more about the filtering syntax in Turborepo's documentation](https://turborepo.org/docs/core-concepts/filtering).
### Project-Specific Commands
Outside of the above `turbo` commands, there may be times where you want to run a command on a specific project. This can _also_ be done using the `--filter` syntax, however, you will run these commands using `pnpm`. For example, `pnpm postinstall --filter=woocommerce` will run the `"postinstall"` script from `plugins/woocommerce/package.json`.
## Development Environments
Our repository makes use of [the `@wordpress/env` package](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-env/) for providing development environments out-of-the-box. Once you have installed the package and its related dependencies, you should be able to run `wp-env start` in any of the `plugins/` folders. This will start a development environment and provide you with a URL to begin testing code using.
## Reporting Security Issues
To disclose a security issue to our team, [please submit a report via HackerOne here](https://hackerone.com/automattic/).
@ -33,12 +64,3 @@ This repository is not suitable for support. Please don't use our issue tracker
* For customizations, you may want to check our list of [WooExperts](https://woocommerce.com/experts/) or [Codeable](https://codeable.io/).
Support requests in issues on this repository will be closed on sight.
## Contributing to WooCommerce
If you have a patch or have stumbled upon an issue with WooCommerce core, you can contribute this back to the code. Please read our [contributor guidelines](https://github.com/woocommerce/woocommerce/blob/trunk/.github/CONTRIBUTING.md) for more information how you can do this.
<p align="center">
<br/><br/>
Made with 💜 by <a href="https://woocommerce.com/">WooCommerce</a>.<br/>
<a href="https://woocommerce.com/careers/">We're hiring</a>! Come work with us!
</p>

34
nx.json
View File

@ -1,34 +0,0 @@
{
"extends": "@nrwl/workspace/presets/npm.json",
"npmScope": "woocommerce-monorepo",
"tasksRunnerOptions": {
"default": {
"runner": "@nrwl/workspace/tasks-runners/default",
"options": {
"cacheableOperations": [
"build",
"test",
"lint",
"package"
]
}
}
},
"targetDependencies": {
"build": [
{
"target": "build",
"projects": "dependencies"
}
],
"package": [
{
"target": "package",
"projects": "dependencies"
}
]
},
"affected": {
"defaultBase": "trunk"
}
}

View File

@ -23,15 +23,8 @@
"create-extension": "node ./tools/create-extension/index.js"
},
"devDependencies": {
"@automattic/nx-composer": "^0.1.0",
"@babel/preset-env": "^7.16.11",
"@babel/runtime": "^7.17.2",
"@nrwl/cli": "^13.3.4",
"@nrwl/devkit": "^13.1.4",
"@nrwl/linter": "^13.3.4",
"@nrwl/tao": "13.3.4",
"@nrwl/web": "^13.3.4",
"@nrwl/workspace": "^13.3.4",
"@storybook/addon-a11y": "^6.4.19",
"@storybook/addon-actions": "^6.4.19",
"@storybook/addon-console": "^1.2.3",
@ -72,6 +65,7 @@
"request": "^2.88.2",
"sass": "^1.49.9",
"sass-loader": "^10.2.1",
"turbo": "^1.2.9",
"typescript": "4.2.4",
"url-loader": "^1.1.2",
"webpack": "^5.70.0"

View File

@ -51,6 +51,7 @@
},
"scripts": {
"postinstall": "composer install",
"changelog": "composer exec -- changelogger",
"build": "tsc --build",
"start": "tsc --build --watch",
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",

View File

@ -1,31 +0,0 @@
{
"root": "packages/js/admin-e2e-tests",
"sourceRoot": "packages/js/admin-e2e-tests/src",
"projectType": "library",
"targets": {
"build": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "build"
}
},
"build-watch": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "start"
}
},
"test": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "test"
}
},
"clean": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "clean"
}
}
}
}

View File

@ -22,7 +22,7 @@ For local setup, create a `.env` file in this folder with the three required val
Alternatively, these values can be passed in via the command line. For example:
```shell
BASE_URL=http://localhost:8084 USER_KEY=admin USER_SECRET=password npm run test:api
BASE_URL=http://localhost:8084 USER_KEY=admin USER_SECRET=password npm run e2e:api
```
When using a username and password combination instead of a consumer secret and consumer key, make sure to have the [JSON Basic Authentication plugin](https://github.com/WP-API/Basic-Auth) installed and activated on the test site.
@ -43,7 +43,7 @@ The following optional variables can be set in your local `.env` file:
To verify that everything is configured correctly, the following test script is available:
```shell
npm run test:hello
npm run e2e:hello
```
This tests connectivity to the API by validating connection to the following:
@ -56,7 +56,7 @@ This tests connectivity to the API by validating connection to the following:
To run all of the API tests, you can use the following command:
```shell
npm run test:api
npm run e2e:api
```
### Running groups of tests
@ -66,7 +66,7 @@ To run a specific group of tests, you can use the `npm test -- --group=` command
For example, if you wanted to only run the orders API tests, you can use the following:
```shell
npm test -- --group=orders
npm e2e -- --group=orders
```
Alternatively, you can use `jest` to run test groups:

View File

@ -4,9 +4,9 @@
"description": "API tests for WooCommerce",
"main": "index.js",
"scripts": {
"test": "jest",
"test:api": "jest --group=api",
"test:hello": "jest --group=hello",
"e2e": "jest",
"e2e:api": "jest --group=api",
"e2e:hello": "jest --group=hello",
"make:collection": "node utils/api-collection/build-collection.js",
"report": "allure generate --clean && allure serve",
"lint": "eslint data endpoints tests utils --ext=js,ts,tsx",

View File

@ -1,38 +0,0 @@
{
"root": "packages/js/api-core-tests/",
"sourceRoot": "packages/js/api-core-tests",
"projectType": "library",
"targets": {
"changelog": {
"executor": "./tools/executors/changelogger:changelog",
"options": {
"action": "add",
"cwd": "packages/js/api-core-tests"
}
},
"test": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "test"
}
},
"test-hello": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "test:hello"
}
},
"make-collection": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "make:collection"
}
},
"test-api": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "test:api"
}
}
}
}

View File

@ -27,6 +27,7 @@
"sideEffects": false,
"scripts": {
"postinstall": "composer install",
"changelog": "composer exec -- changelogger",
"clean": "rm -rf ./dist ./tsconfig.tsbuildinfo",
"compile": "tsc -b",
"build": "pnpm run clean && npm run compile",

View File

@ -1,44 +0,0 @@
{
"root": "packages/js/api/",
"sourceRoot": "packages/js/api/src",
"projectType": "library",
"targets": {
"changelog": {
"executor": "./tools/executors/changelogger:changelog",
"options": {
"action": "add",
"cwd": "packages/js/api"
}
},
"build": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "build"
}
},
"clean": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "clean"
}
},
"compile": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "compile"
}
},
"lint": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "lint"
}
},
"test": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "test"
}
}
}
}

View File

@ -115,6 +115,7 @@
},
"scripts": {
"postinstall": "composer install",
"changelog": "composer exec -- changelogger",
"build": "pnpm run build:js && pnpm run build:css",
"build:js": "tsc --build ./tsconfig.json ./tsconfig-cjs.json",
"build:css": "webpack",
@ -123,9 +124,8 @@
"lint:fix": "eslint src --ext=js,ts,tsx --fix",
"prepack": "pnpm run clean && pnpm run build",
"start": "concurrently \"tsc --build ./tsconfig.json --watch\" \"webpack --watch\"",
"test": "pnpm run build && pnpm run test:nobuild",
"test:nobuild": "jest --config ./jest.config.json",
"test:update-snapshots": "pnpm run test:nobuild -- --updateSnapshot",
"test": "jest --config ./jest.config.json",
"test:update-snapshots": "pnpm run test -- --updateSnapshot",
"test-staged": "jest --bail --config ./jest.config.json --findRelatedTests"
},
"lint-staged": {

View File

@ -1,32 +0,0 @@
{
"root": "packages/js/components",
"sourceRoot": "packages/js/components/src",
"projectType": "library",
"targets": {
"changelog": {
"executor": "./tools/executors/changelogger:changelog",
"options": {
"action": "add",
"cwd": "packages/js/components"
}
},
"build": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "build"
}
},
"build-watch": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "start"
}
},
"test": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "test"
}
}
}
}

View File

@ -30,14 +30,14 @@
},
"scripts": {
"postinstall": "composer install",
"changelog": "composer exec -- changelogger",
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
"build": "tsc --build ./tsconfig.json ./tsconfig-cjs.json",
"start": "tsc --build --watch",
"prepack": "pnpm run clean && pnpm run build",
"lint": "eslint src",
"lint:fix": "eslint src --fix",
"test": "pnpm run build && pnpm run test:nobuild",
"test:nobuild": "jest --config ./jest.config.json",
"test": "jest --config ./jest.config.json",
"test-staged": "jest --bail --config ./jest.config.json --findRelatedTests"
},
"devDependencies": {

View File

@ -1,32 +0,0 @@
{
"root": "packages/js/csv-export",
"sourceRoot": "packages/js/csv-export/src",
"projectType": "library",
"targets": {
"changelog": {
"executor": "./tools/executors/changelogger:changelog",
"options": {
"action": "add",
"cwd": "packages/js/csv-export"
}
},
"build": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "build"
}
},
"build-watch": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "start"
}
},
"test": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "test"
}
}
}
}

View File

@ -33,14 +33,14 @@
},
"scripts": {
"postinstall": "composer install",
"changelog": "composer exec -- changelogger",
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
"build": "tsc --build ./tsconfig.json ./tsconfig-cjs.json",
"start": "tsc --build --watch",
"prepack": "pnpm run clean && pnpm run build",
"lint": "eslint src",
"lint:fix": "eslint src --fix",
"test": "pnpm run build && pnpm run test:nobuild",
"test:nobuild": "jest --config ./jest.config.json",
"test": "jest --config ./jest.config.json",
"test-staged": "jest --bail --config ./jest.config.json --findRelatedTests"
},
"devDependencies": {

View File

@ -1,32 +0,0 @@
{
"root": "packages/js/currency",
"sourceRoot": "packages/js/currency/src",
"projectType": "library",
"targets": {
"changelog": {
"executor": "./tools/executors/changelogger:changelog",
"options": {
"action": "add",
"cwd": "packages/js/currency"
}
},
"build": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "build"
}
},
"build-watch": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "start"
}
},
"test": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "test"
}
}
}
}

View File

@ -62,6 +62,7 @@
},
"scripts": {
"postinstall": "composer install",
"changelog": "composer exec -- changelogger",
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
"build": "pnpm run build:js && pnpm run build:css",
"build:js": "tsc --build ./tsconfig.json ./tsconfig-cjs.json",
@ -70,8 +71,7 @@
"prepack": "pnpm run clean && pnpm run build",
"lint": "eslint src",
"lint:fix": "eslint src --fix",
"test": "pnpm run build && pnpm run test:nobuild",
"test:nobuild": "jest --config ./jest.config.json",
"test": "jest --config ./jest.config.json",
"test-staged": "jest --bail --config ./jest.config.json --findRelatedTests"
},
"lint-staged": {

View File

@ -1,32 +0,0 @@
{
"root": "packages/js/customer-effort-score",
"sourceRoot": "packages/js/customer-effort-score/src",
"projectType": "library",
"targets": {
"changelog": {
"executor": "./tools/executors/changelogger:changelog",
"options": {
"action": "add",
"cwd": "packages/js/customer-effort-score"
}
},
"build": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "build"
}
},
"build-watch": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "start"
}
},
"test": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "test"
}
}
}
}

View File

@ -70,14 +70,14 @@
},
"scripts": {
"postinstall": "composer install",
"changelog": "composer exec -- changelogger",
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
"build": "tsc --build ./tsconfig.json ./tsconfig-cjs.json",
"start": "tsc --build --watch",
"prepack": "pnpm run clean && pnpm run build",
"lint": "eslint src",
"lint:fix": "eslint src --fix",
"test": "pnpm run build && pnpm run test:nobuild",
"test:nobuild": "jest --config ./jest.config.json",
"test": "jest --config ./jest.config.json",
"test-staged": "jest --bail --config ./jest.config.json --findRelatedTests"
},
"lint-staged": {

View File

@ -1,32 +0,0 @@
{
"root": "packages/js/data",
"sourceRoot": "packages/js/data/src",
"projectType": "library",
"targets": {
"changelog": {
"executor": "./tools/executors/changelogger:changelog",
"options": {
"action": "add",
"cwd": "packages/js/data"
}
},
"build": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "build"
}
},
"build-watch": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "start"
}
},
"test": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "test"
}
}
}
}

View File

@ -48,14 +48,14 @@
},
"scripts": {
"postinstall": "composer install",
"changelog": "composer exec -- changelogger",
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
"build": "tsc --build ./tsconfig.json ./tsconfig-cjs.json",
"start": "tsc --build --watch",
"prepack": "pnpm run clean && pnpm run build",
"lint": "eslint src",
"lint:fix": "eslint src --fix",
"test": "pnpm run build && pnpm run test:nobuild",
"test:nobuild": "jest --config ./jest.config.json",
"test": "jest --config ./jest.config.json",
"test-staged": "jest --bail --config ./jest.config.json --findRelatedTests"
},
"lint-staged": {

View File

@ -1,32 +0,0 @@
{
"root": "packages/js/date",
"sourceRoot": "packages/js/date/src",
"projectType": "library",
"targets": {
"changelog": {
"executor": "./tools/executors/changelogger:changelog",
"options": {
"action": "add",
"cwd": "packages/js/date"
}
},
"build": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "build"
}
},
"build-watch": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "start"
}
},
"test": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "test"
}
}
}
}

View File

@ -36,9 +36,10 @@
"webpack-cli": "^3.3.12"
},
"scripts": {
"postinstall": "composer install",
"changelog": "composer exec -- changelogger",
"lint": "eslint src",
"lint:fix": "eslint src --fix",
"postinstall": "composer install"
"lint:fix": "eslint src --fix"
},
"lint-staged": {
"*.(t|j)s?(x)": [

View File

@ -1,14 +0,0 @@
{
"root": "packages/js/dependency-extraction-webpack-plugin",
"sourceRoot": "packages/js/dependency-extraction-webpack-plugin/src",
"projectType": "library",
"targets": {
"changelog": {
"executor": "./tools/executors/changelogger:changelog",
"options": {
"action": "add",
"cwd": "packages/js/dependency-extraction-webpack-plugin"
}
}
}
}

View File

@ -1,38 +0,0 @@
{
"root": "packages/js/e2e-core-tests/",
"sourceRoot": "packages/js/e2e-core-tests",
"projectType": "library",
"targets": {
"changelog": {
"executor": "./tools/executors/changelogger:changelog",
"options": {
"action": "add",
"cwd": "packages/js/e2e-core-tests"
}
},
"build": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "build"
}
},
"clean": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "clean"
}
},
"compile": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "compile"
}
},
"lint": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "lint"
}
}
}
}

View File

@ -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 nx test-e2e woocommerce`.
You should then be able to run the e2e tests by running `pnpm exec turbo run e2e --filter=woocommerce`.
### Test Sequencer Setup

View File

@ -1,80 +0,0 @@
{
"root": "packages/js/e2e-environment/",
"sourceRoot": "packages/js/e2e-environment/src",
"projectType": "library",
"targets": {
"changelog": {
"executor": "./tools/executors/changelogger:changelog",
"options": {
"action": "add",
"cwd": "packages/js/e2e-environment"
}
},
"build": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "build"
}
},
"lint": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "lint"
}
},
"clean": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "clean"
}
},
"compile": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "compile"
}
},
"docker-up": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "docker:up"
}
},
"docker-down": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "docker:down"
}
},
"docker-clear-all": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "docker:clear-all"
}
},
"docker-ssh": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "docker:ssh"
}
},
"test-e2e": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "test:e2e"
}
},
"test-e2e-debug": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "test:e2e-debug"
}
},
"test-e2e-dev": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "test:e2e-dev"
}
}
}
}

View File

@ -1,38 +0,0 @@
{
"root": "packages/js/e2e-utils/",
"sourceRoot": "packages/js/e2e-utils/src",
"projectType": "library",
"targets": {
"changelog": {
"executor": "./tools/executors/changelogger:changelog",
"options": {
"action": "add",
"cwd": "packages/js/e2e-utils"
}
},
"build": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "build"
}
},
"clean": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "clean"
}
},
"compile": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "compile"
}
},
"lint": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "lint"
}
}
}
}

View File

@ -36,9 +36,10 @@
"access": "public"
},
"scripts": {
"postinstall": "composer install",
"changelog": "composer exec -- changelogger",
"lint": "eslint ./rules ./configs",
"lint:fix": "eslint ./rules ./configs --fix",
"postinstall": "composer install"
"lint:fix": "eslint ./rules ./configs --fix"
},
"devDependencies": {
"@babel/core": "^7.17.5",

View File

@ -1,14 +0,0 @@
{
"root": "packages/js/eslint-plugin",
"sourceRoot": "packages/js/eslint-plugin/src",
"projectType": "library",
"targets": {
"changelog": {
"executor": "./tools/executors/changelogger:changelog",
"options": {
"action": "add",
"cwd": "packages/js/eslint-plugin"
}
}
}
}

View File

@ -75,6 +75,7 @@
},
"scripts": {
"postinstall": "composer install",
"changelog": "composer exec -- changelogger",
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
"build": "pnpm run build:js && pnpm run build:css",
"build:js": "tsc --build ./tsconfig.json ./tsconfig-cjs.json",
@ -83,8 +84,7 @@
"prepack": "pnpm run clean && pnpm run build",
"lint": "eslint src",
"lint:fix": "eslint src --fix",
"test": "pnpm run build && pnpm run test:nobuild",
"test:nobuild": "jest --config ./jest.config.json",
"test": "jest --config ./jest.config.json",
"test-staged": "jest --bail --config ./jest.config.json --findRelatedTests"
},
"lint-staged": {

View File

@ -1,32 +0,0 @@
{
"root": "packages/js/experimental",
"sourceRoot": "packages/js/experimental/src",
"projectType": "library",
"targets": {
"changelog": {
"executor": "./tools/executors/changelogger:changelog",
"options": {
"action": "add",
"cwd": "packages/js/experimental"
}
},
"build": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "build"
}
},
"build-watch": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "start"
}
},
"test": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "test"
}
}
}
}

View File

@ -48,14 +48,14 @@
},
"scripts": {
"postinstall": "composer install",
"changelog": "composer exec -- changelogger",
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
"build": "tsc --build ./tsconfig.json ./tsconfig-cjs.json",
"start": "tsc --build --watch",
"prepack": "pnpm run clean && pnpm run build",
"lint": "eslint src",
"lint:fix": "eslint src --fix",
"test": "pnpm run build && pnpm run test:nobuild",
"test:nobuild": "jest --config ./jest.config.json",
"test": "jest --config ./jest.config.json",
"test-staged": "jest --bail --config ./jest.config.json --findRelatedTests"
},
"lint-staged": {

View File

@ -1,32 +0,0 @@
{
"root": "packages/js/explat",
"sourceRoot": "packages/js/explat/src",
"projectType": "library",
"targets": {
"changelog": {
"executor": "./tools/executors/changelogger:changelog",
"options": {
"action": "add",
"cwd": "packages/js/explat"
}
},
"build": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "build"
}
},
"build-watch": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "start"
}
},
"test": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "test"
}
}
}
}

View File

@ -1,6 +0,0 @@
{
"root": "packages/js/internal-style-build",
"sourceRoot": "packages/js/internal-style-build/src",
"projectType": "library",
"targets": {}
}

View File

@ -40,14 +40,14 @@
},
"scripts": {
"postinstall": "composer install",
"changelog": "composer exec -- changelogger",
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
"build": "tsc --build ./tsconfig.json ./tsconfig-cjs.json",
"start": "tsc --build --watch",
"prepack": "pnpm run clean && pnpm run build",
"lint": "eslint src",
"lint:fix": "eslint src --fix",
"test": "pnpm run build && pnpm run test:nobuild",
"test:nobuild": "jest --config ./jest.config.json",
"test": "jest --config ./jest.config.json",
"test-staged": "jest --bail --config ./jest.config.json --findRelatedTests"
},
"devDependencies": {

View File

@ -1,32 +0,0 @@
{
"root": "packages/js/navigation",
"sourceRoot": "packages/js/navigation/src",
"projectType": "library",
"targets": {
"changelog": {
"executor": "./tools/executors/changelogger:changelog",
"options": {
"action": "add",
"cwd": "packages/js/navigation"
}
},
"build": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "build"
}
},
"build-watch": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "start"
}
},
"test": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "test"
}
}
}
}

View File

@ -28,14 +28,14 @@
},
"scripts": {
"postinstall": "composer install",
"changelog": "composer exec -- changelogger",
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
"build": "tsc --build ./tsconfig.json ./tsconfig-cjs.json",
"start": "tsc --build --watch",
"prepack": "pnpm run clean && pnpm run build",
"lint": "eslint src",
"lint:fix": "eslint src --fix",
"test": "pnpm run build && pnpm run test:nobuild",
"test:nobuild": "jest --config ./jest.config.json",
"test": "jest --config ./jest.config.json",
"test-staged": "jest --bail --config ./jest.config.json --findRelatedTests"
},
"devDependencies": {

View File

@ -1,32 +0,0 @@
{
"root": "packages/js/number",
"sourceRoot": "packages/js/number/src",
"projectType": "library",
"targets": {
"changelog": {
"executor": "./tools/executors/changelogger:changelog",
"options": {
"action": "add",
"cwd": "packages/js/number"
}
},
"build": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "build"
}
},
"build-watch": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "start"
}
},
"test": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "test"
}
}
}
}

View File

@ -56,6 +56,7 @@
},
"scripts": {
"postinstall": "composer install",
"changelog": "composer exec -- changelogger",
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
"build": "pnpm run build:js && pnpm run build:css",
"build:js": "tsc --build ./tsconfig.json ./tsconfig-cjs.json",

View File

@ -1,32 +0,0 @@
{
"root": "packages/js/onboarding",
"sourceRoot": "packages/js/onboarding/src",
"projectType": "library",
"targets": {
"changelog": {
"executor": "./tools/executors/changelogger:changelog",
"options": {
"action": "add",
"cwd": "packages/js/onboarding"
}
},
"build": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "build"
}
},
"build-watch": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "start"
}
},
"test": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "test"
}
}
}
}

View File

@ -29,6 +29,7 @@
},
"scripts": {
"postinstall": "composer install",
"changelog": "composer exec -- changelogger",
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
"build": "tsc --build ./tsconfig.json ./tsconfig-cjs.json",
"start": "tsc --build --watch",

View File

@ -1,32 +0,0 @@
{
"root": "packages/js/tracks",
"sourceRoot": "packages/js/tracks/src",
"projectType": "library",
"targets": {
"changelog": {
"executor": "./tools/executors/changelogger:changelog",
"options": {
"action": "add",
"cwd": "packages/js/tracks"
}
},
"build": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "build"
}
},
"build-watch": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "start"
}
},
"test": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "test"
}
}
}
}

View File

@ -13,7 +13,7 @@ pnpm install
Build the example extension by running the pnpm script and passing the example name.
```bash
WC_EXT=<example> pnpm nx example woocommerce-admin
WC_EXT=<example> pnpm example --filter=@woocommerce/admin-library
```
Include the output plugin in your `.wp-env.json` and `.wp-env.override.json` and restart the WordPress instance. WooCommerce Analytics reports will now reflect the changes made by the example extension.

View File

@ -10,7 +10,7 @@ This feature is hidden behind a feature flag and can be turned on or off by visi
The fastest way to get started is by creating an example plugin from WooCommerce Admin. Enter the following command:
`WC_EXT=add-navigation-items pnpm nx example woocommerce-admin`
`WC_EXT=add-navigation-items pnpm example --filter=@woocommerce/admin-library`
This will create a new plugin that covers various features of the navigation and helps to register some intial items and categories within the new navigation menu. After running the command above, you can make edits directly to the files at `docs/examples/extensions/add-navigation-items` and they will be built and copied to your `wp-content/add-navigation-items` folder on save.

View File

@ -10,7 +10,7 @@ Gateway suggestions are retreived from a REST API and can be added via a remote
To quickly get started with an example plugin, run the following:
`WC_EXT=payment-gateway-suggestions pnpm nx example woocommerce-admin`
`WC_EXT=payment-gateway-suggestions pnpm example --filter=@woocommerce/admin-library`
This will create a new plugin that when activated will add two new gateway suggestions. The first is a simple gateway demonstrating how configuration fields can be pulled from the gateway class to create a configuration form. The second gateway shows a more customized approach via SlotFill.

View File

@ -42,7 +42,7 @@
"start": "pnpm run install-if-deps-outdated && cross-env WC_ADMIN_PHASE=development pnpm run build:packages && cross-env WC_ADMIN_PHASE=development pnpm run build:feature-config && concurrently \"cross-env WC_ADMIN_PHASE=development webpack --watch\" \"cross-env WC_ADMIN_PHASE=development pnpm run:packages -- start --parallel\"",
"start:package": "pnpm run:packages -- start --parallel",
"pretest": "pnpm run -s install-if-no-packages",
"test": "pnpm nx build @woocommerce/internal-js-tests && pnpm run test:client",
"test": "pnpm run test:client",
"test-staged": "pnpm run test:client -- --bail --findRelatedTests",
"test:client": "jest --config client/jest.config.js",
"test:debug": "node --inspect-brk ./node_modules/.bin/jest --config client/jest.config.js --watch --runInBand --no-cache",

View File

@ -1,43 +0,0 @@
{
"root": "plugins/woocommerce-admin/",
"sourceRoot": "plugins/woocommerce-admin",
"projectType": "application",
"targets": {
"changelog": {
"executor": "./tools/executors/changelogger:changelog",
"options": {
"action": "add",
"cwd": "plugins/woocommerce"
}
},
"build": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "build"
}
},
"build-watch": {
"executor": "@nrwl/workspace:run-commands",
"options": {
"commands": [
"WC_ADMIN_PHASE=development pnpm nx clean woocommerce-admin",
"WC_ADMIN_PHASE=development pnpm nx dev woocommerce-admin",
"pnpm nx watch woocommerce-admin"
],
"parallel": false
}
},
"watch": {
"executor": "@nrwl/workspace:run-commands",
"options": {
"command": "pnpm nx client:watch woocommerce-admin"
}
},
"lint": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "lint"
}
}
}
}

View File

@ -24,6 +24,7 @@
},
"scripts": {
"postinstall": "composer install",
"changelog": "composer exec -- changelogger",
"build": "pnpm run uglify",
"build:zip": "./bin/build-zip.sh",
"build:dev": "pnpm run lint:js && pnpm run uglify",

View File

@ -1,47 +0,0 @@
{
"root": "plugins/woocommerce-beta-tester/",
"sourceRoot": "plugins/woocommerce-beta-tester",
"projectType": "application",
"targets": {
"build": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "build"
}
},
"changelog": {
"executor": "./tools/executors/changelogger:changelog",
"options": {
"action": "add",
"cwd": "plugins/woocommerce-beta-tester"
}
},
"composer-install": {
"executor": "@nrwl/workspace:run-commands",
"options": {
"command": "composer install",
"cwd": "plugins/woocommerce-beta-tester"
}
},
"composer-install-no-dev": {
"executor": "@nrwl/workspace:run-commands",
"options": {
"command": "composer install --no-dev",
"cwd": "plugins/woocommerce-beta-tester"
}
},
"composer-dump-autoload": {
"executor": "@nrwl/workspace:run-commands",
"options": {
"command": "composer dump-autoload",
"cwd": "plugins/woocommerce-beta-tester"
}
},
"lint-js": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "lint:js"
}
}
}
}

View File

@ -0,0 +1,23 @@
<p align="center"><a href="https://woocommerce.com/"><img src="https://woocommerce.com/wp-content/themes/woo/images/logo-woocommerce@2x.png" alt="WooCommerce"></a></p>
<p align="center">
<a href="https://packagist.org/packages/woocommerce/woocommerce"><img src="https://poser.pugx.org/woocommerce/woocommerce/license" alt="license"></a>
<a href="https://packagist.org/packages/woocommerce/woocommerce"><img src="https://poser.pugx.org/woocommerce/woocommerce/v/stable" alt="Latest Stable Version"></a>
<img src="https://img.shields.io/wordpress/plugin/dt/woocommerce.svg" alt="WordPress.org downloads">
<img src="https://img.shields.io/wordpress/plugin/r/woocommerce.svg" alt="WordPress.org rating">
<a href="https://github.com/woocommerce/woocommerce/actions/workflows/ci.yml"><img src="https://github.com/woocommerce/woocommerce/actions/workflows/ci.yml/badge.svg?branch=trunk" alt="Build Status"></a>
<a href="https://codecov.io/gh/woocommerce/woocommerce"><img src="https://codecov.io/gh/woocommerce/woocommerce/branch/trunk/graph/badge.svg" alt="codecov"></a>
</p>
This is the WooCommerce Core plugin. Here you can browse the source and keep track of development. We recommend all developers to follow the [WooCommerce development blog](https://woocommerce.wordpress.com/) to stay up to date about everything happening in the project. You can also [follow @DevelopWC](https://twitter.com/DevelopWC) on Twitter for the latest development updates.
If you are not a developer, please use the [WooCommerce plugin page](https://wordpress.org/plugins/woocommerce/) on WordPress.org.
## Documentation
* [WooCommerce Documentation](https://docs.woocommerce.com/)
* [WooCommerce Developer Documentation](https://github.com/woocommerce/woocommerce/wiki)
* [WooCommerce Code Reference](https://docs.woocommerce.com/wc-apidocs/)
* [WooCommerce REST API Docs](https://woocommerce.github.io/woocommerce-rest-api-docs/)
## Reporting Security Issues
To disclose a security issue to our team, [please submit a report via HackerOne here](https://hackerone.com/automattic/).

View File

@ -11,13 +11,12 @@ mkdir -p "$DEST_PATH"
echo "Installing PHP and JS dependencies..."
pnpm install
pnpm nx composer-install woocommerce || exit "$?"
echo "Running JS Build..."
pnpm nx build woocommerce || exit "$?"
pnpm exec turbo run build --filter=woocommerce || exit "$?"
echo "Cleaning up PHP dependencies..."
pnpm nx composer-install-no-dev woocommerce || exit "$?"
composer install --no-dev || exit "$?"
echo "Run makepot..."
pnpm nx makepot woocommerce || exit "$?"
pnpm makepot --filter=woocommerce || exit "$?"
echo "Syncing files..."
rsync -rc --exclude-from="$PROJECT_PATH/.distignore" "$PROJECT_PATH/" "$DEST_PATH/" --delete --delete-excluded

View File

@ -971,7 +971,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 <code>pnpm install</code> and then <code>pnpm nx build woocommerce-legacy-assets</code> 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 <code>pnpm install</code> and then <code>pnpm exec turbo run build --filter=woocommerce</code> 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 <a href="%1$s">WordPress.org repository</a> or by visiting <a href="%2$s">the releases page in the GitHub repository</a>.', 'woocommerce' ),

View File

@ -5,6 +5,10 @@
"license": "GPL-2.0-or-later",
"private": true,
"main": "Gruntfile.js",
"scripts": {
"build": "grunt assets",
"lint": "grunt eslint stylelint --force"
},
"devDependencies": {
"@wordpress/stylelint-config": "19.1.0",
"autoprefixer": "9.8.6",

View File

@ -1,40 +0,0 @@
{
"root": "plugins/woocommerce/legacy",
"sourceRoot": "plugins/woocommerce/legacy",
"type": "application",
"implicitDependencies": [],
"targets": {
"build": {
"executor": "@nrwl/workspace:run-commands",
"options": {
"commands": [
{
"command": "pnpm exec grunt assets",
"forwardAllArgs": false
}
],
"cwd": "plugins/woocommerce/legacy"
},
"outputs": [
"plugins/woocommerce/assets/css",
"plugins/woocommerce/assets/js"
]
},
"lint": {
"executor": "@nrwl/workspace:run-commands",
"options": {
"commands": [
{
"command": "pnpm exec grunt eslint",
"forwardAllArgs": false
},
{
"command": "pnpm exec grunt stylelint",
"forwardAllArgs": false
}
],
"cwd": "plugins/woocommerce/legacy"
}
}
}
}

View File

@ -15,6 +15,7 @@
"scripts": {
"preinstall": "npx only-allow pnpm",
"postinstall": "composer install",
"changelog": "composer exec -- changelogger",
"build": "WC_ADMIN_PHASE=core pnpm run build:feature-config",
"build:feature-config": "php bin/generate-feature-config.php",
"build:zip": "./bin/build-zip.sh",
@ -29,9 +30,9 @@
"docker:up": "pnpm exec wc-e2e docker:up",
"test:api": "API_TEST_REPORT_DIR=\"$PWD/tests/api\" pnpm exec wc-api-tests test api",
"make:collection": "pnpm exec wc-api-tests make:collection",
"test:e2e": "pnpm exec wc-e2e test:e2e",
"test:e2e-debug": "pnpm exec wc-e2e test:e2e-debug",
"test:e2e-dev": "pnpm exec wc-e2e test:e2e-dev",
"e2e": "pnpm exec wc-e2e test:e2e",
"e2e:debug": "pnpm exec wc-e2e test:e2e-debug",
"e2e:dev": "pnpm exec wc-e2e test:e2e-dev",
"test:unit": "./vendor/bin/phpunit -c ./phpunit.xml",
"makepot": "composer run-script makepot",
"packages:fix:textdomain": "node ./bin/package-update-textdomain.js"

View File

@ -1,160 +0,0 @@
{
"root": "plugins/woocommerce/",
"sourceRoot": "plugins/woocommerce",
"projectType": "application",
"implicitDependencies": [
"woocommerce-legacy-assets",
"woocommerce-admin"
],
"targets": {
"changelog": {
"executor": "./tools/executors/changelogger:changelog",
"options": {
"action": "add",
"cwd": "plugins/woocommerce"
}
},
"composer-install": {
"executor": "@nrwl/workspace:run-commands",
"options": {
"command": "composer install",
"cwd": "plugins/woocommerce"
}
},
"composer-install-no-dev": {
"executor": "@nrwl/workspace:run-commands",
"options": {
"command": "composer install --no-dev",
"cwd": "plugins/woocommerce"
}
},
"composer-dump-autoload": {
"executor": "@nrwl/workspace:run-commands",
"options": {
"command": "composer dump-autoload",
"cwd": "plugins/woocommerce"
}
},
"build": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "build"
}
},
"build-zip": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "build:zip"
}
},
"build-watch": {
"executor": "@nrwl/workspace:run-commands",
"options": {
"commands": [
"pnpm nx build:feature-config woocommerce",
"pnpm nx watch-assets woocommerce"
]
}
},
"watch-assets": {
"executor": "@nrwl/workspace:run-commands",
"options": {
"command": "pnpm dlx grunt watch",
"cwd": "plugins/woocommerce/legacy"
}
},
"build-assets": {
"executor": "@nrwl/workspace:run-commands",
"options": {
"command": "pnpm nx build woocommerce-legacy-assets",
"cwd": "plugins/woocommerce"
}
},
"lint-js": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "lint:js"
}
},
"docker-up": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "docker:up"
}
},
"docker-down": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "docker:down"
}
},
"docker-ssh": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "docker:ssh"
}
},
"test-api": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "test:api"
}
},
"test-e2e": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "test:e2e"
}
},
"test-e2e-debug": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "test:e2e-debug"
}
},
"test-e2e-dev": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "test:e2e-dev"
}
},
"test-unit": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "test:unit"
}
},
"makepot": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "makepot"
}
},
"packages-fix-text-domain": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "packages:fix:textdomain"
}
},
"make-collection": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "make:collection"
}
},
"install-unit-test-db": {
"executor": "@nrwl/workspace:run-commands",
"options": {
"command": "bash tests/bin/install.sh woo_test root root 127.0.0.1 latest",
"cwd": "plugins/woocommerce"
}
},
"test-code-coverage": {
"executor": "@nrwl/workspace:run-commands",
"options": {
"command": "RUN_CODE_COVERAGE=1 bash tests/bin/phpunit.sh",
"cwd": "plugins/woocommerce"
}
}
}
}

View File

@ -122,13 +122,11 @@ Run the following in a terminal/command line window
- `pnpm install`
- `pnpm nx composer-install woocommerce`
- `pnpm nx build-assets woocommerce`
- `pnpm exec turbo run build --filter=woocommerce`
- `npm install jest --global` (this only needs to be done once)
- `pnpm nx docker-up woocommerce` (this will build the test site using Docker)
- `pnpm docker:up --filter=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:
@ -154,16 +152,16 @@ Username: admin
PW: password
```
- Run `pnpm nx docker-down woocommerce` when you are done with running e2e tests and before making any changes to test site configuration.
- Run `pnpm docker:down --filter=woocommerce` when you are done with running e2e tests and before making any changes to test site configuration.
Note that running `pnpm nx docker-down woocommerce` and then `pnpm nx docker-up woocommerce` re-initializes the test container.
Note that running `pnpm docker:down --filter=woocommerce` and then `pnpm docker:up --filter=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 nx test-e2e woocommerce
pnpm exec turbo run e2e --filter=woocommerce
```
### How to run tests in non-headless mode
@ -171,7 +169,7 @@ pnpm nx test-e2e 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 nx test-e2e-dev woocommerce
pnpm exec turbo run e2e:dev --filter=woocommerce
```
The dev mode also enables SlowMo mode. SlowMo slows down Puppeteers operations. This makes it easier to see what is happening in the browser.
@ -179,7 +177,7 @@ The dev mode also enables SlowMo mode. SlowMo slows down Puppeteers 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 nx test-e2e-dev woocommerce
PUPPETEER_SLOWMO=10 pnpm exec turbo run e2e:dev --filter=woocommerce
```
The faster you want the tests to run, the lower the value should be of `PUPPETEER_SLOWMO` should be.
@ -203,7 +201,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 nx test-e2e-debug woocommerce
pnpm exec turbo run e2e:debug --filter=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.
@ -274,7 +272,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 nx docker-up woocommerce
TRAVIS_MARIADB_VERSION=10.5.3 TRAVIS_PHP_VERSION=7.4.5 WP_VERSION=5.4.1 pnpm docker:up --filter=woocommerce
```
## Guide for writing e2e tests
@ -382,6 +380,6 @@ The [WooCommerce E2E Tests Boilerplate repo](https://github.com/woocommerce/wooc
## Debugging tests
The test sequencer (`pnpm nx test-e2e 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 exec turbo 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).
For Puppeteer debugging, follow [Google's documentation](https://developers.google.com/web/tools/puppeteer/debugging).

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,7 @@
packages:
- 'packages/js/**'
- 'plugins/**'
- 'packages/js/*'
- 'plugins/*'
- 'plugins/woocommerce/legacy'
- 'tools/monorepo-merge'
- 'tools/code-analyzer'
- 'tools/create-extension'

View File

@ -6,7 +6,10 @@
"outDir": "dist",
"rootDir": "src",
"strict": true,
"target": "es2019"
"target": "es2019",
"typeRoots": [
"./node_modules/@types"
],
},
"include": [
"src/**/*"

View File

@ -206,7 +206,7 @@ foreach ( $touched_projects as $slug => $files ) {
} elseif ( getenv( 'CI' ) ) {
printf( "---\n" ); // Bracket message containing newlines for better visibility in GH's logs.
printf(
"::error::Project %s is being changed, but no change file in %s is touched!%%0A%%0AUse `pnpm nx changelog %s` to add a change file.\n",
"::error::Project %s is being changed, but no change file in %s is touched!%%0A%%0AUse `pnpm changelog --filter=%s` to add a change file.\n",
$slug,
"$slug/{$changelogger_projects[ $slug ]['changes-dir']}/",
$slug
@ -224,7 +224,7 @@ foreach ( $touched_projects as $slug => $files ) {
}
}
if ( $exit && ! getenv( 'CI' ) && ! $list ) {
printf( "\e[32mUse `pnpm nx affected --target=changelog` to add a change file for each project.\e[0m\n" );
printf( "\e[32mUse `pnpm changelog --filter={project}` to add a change file for each project.\e[0m\n" );
}
exit( $exit );

71
turbo.json Normal file
View File

@ -0,0 +1,71 @@
{
"$schema": "https://turborepo.org/schema.json",
"baseBranch": "origin/trunk",
"pipeline": {
"lint": {
"cache": false
},
"lint:fix": {
"cache": false
},
"build": {
"dependsOn": [ "^build" ],
"inputs": [
"src/**.js",
"src/**.jsx",
"src/**.ts",
"src/**.tsx",
"src/**.php",
"includes/**.php"
],
"outputs": [
"dist/**",
"build/**",
"build-module/**",
"build-style/**",
"build-types/**"
]
},
"woocommerce#build": {
"dependsOn": [
"^build",
"@woocommerce/admin-library#build",
"woocommerce-legacy-assets#build"
],
"outputs": [],
"inputs": [
"src/**.php",
"includes/**.php",
"!legacy/**"
]
},
"test": {
"dependsOn": [ "build" ],
"inputs": [
"src/**.js",
"src/**.jsx",
"src/**.ts",
"src/**.tsx",
"src/**.php",
"includes/**.php"
],
"outputs": []
},
"e2e": {
"dependsOn": [ "build" ],
"cache": false
},
"e2e:debug": {
"dependsOn": [ "build" ],
"cache": false
},
"e2e:dev": {
"dependsOn": [ "build" ],
"cache": false
}
}
}

View File

@ -1,33 +0,0 @@
{
"version": 2,
"projects": {
"@woocommerce/api": "packages/js/api",
"@woocommerce/api-core-tests": "packages/js/api-core-tests",
"@woocommerce/internal-e2e-builds": "packages/js/internal-e2e-builds",
"@woocommerce/e2e-core-tests": "packages/js/e2e-core-tests",
"@woocommerce/e2e-environment": "packages/js/e2e-environment",
"@woocommerce/e2e-utils": "packages/js/e2e-utils",
"woocommerce": "plugins/woocommerce",
"woocommerce-admin": "plugins/woocommerce-admin",
"woocommerce-legacy-assets": "plugins/woocommerce/legacy",
"woocommerce-beta-tester": "plugins/woocommerce-beta-tester",
"@woocommerce/admin-e2e-tests": "packages/js/admin-e2e-tests",
"@woocommerce/components": "packages/js/components",
"@woocommerce/csv-export": "packages/js/csv-export",
"@woocommerce/currency": "packages/js/currency",
"@woocommerce/customer-effort-score": "packages/js/customer-effort-score",
"@woocommerce/data": "packages/js/data",
"@woocommerce/date": "packages/js/date",
"@woocommerce/dependency-extraction-webpack-plugin": "packages/js/dependency-extraction-webpack-plugin",
"@woocommerce/eslint-plugin": "packages/js/eslint-plugin",
"@woocommerce/experimental": "packages/js/experimental",
"@woocommerce/explat": "packages/js/explat",
"@woocommerce/internal-js-tests": "packages/js/internal-js-tests",
"@woocommerce/navigation": "packages/js/navigation",
"@woocommerce/notices": "packages/js/notices",
"@woocommerce/number": "packages/js/number",
"@woocommerce/onboarding": "packages/js/onboarding",
"@woocommerce/internal-style-build": "packages/js/internal-style-build",
"@woocommerce/tracks": "packages/js/tracks"
}
}