Merge pull request #30945 from woocommerce/monorepo

Change WooCommerce Repository Into Monorepo
This commit is contained in:
Christopher Allford 2021-10-18 15:16:26 -07:00 committed by GitHub
commit 3611d46437
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1697 changed files with 50902 additions and 39392 deletions

View File

@ -22,3 +22,6 @@ trim_trailing_whitespace = false
trim_trailing_whitespace = false
indent_style = space
indent_size = 2
[*.json]
indent_style = tab

View File

@ -1,21 +1 @@
*.min.js
/assets/js/accounting/**
/assets/js/flexslider/**
/assets/js/jquery-blockui/**
/assets/js/jquery-cookie/**
/assets/js/jquery-flot/**
/assets/js/jquery-payment/**
/assets/js/jquery-qrcode/**
/assets/js/jquery-serializejson/**
/assets/js/jquery-tiptip/**
/assets/js/jquery-ui-touch-punch/**
/assets/js/js-cookie/**
/assets/js/photoswipe/**
/assets/js/prettyPhoto/**
/assets/js/round/**
/assets/js/select2/**
/assets/js/selectWoo/**
/assets/js/stupidtable/**
/assets/js/zeroclipboard/**
/assets/js/zoom/**
node_modules

View File

@ -1,31 +1,3 @@
/** @format */
module.exports = {
root: true,
env: {
browser: true,
es6: true,
node: true
},
globals: {
wp: true,
wpApiSettings: true,
wcSettings: true,
es6: true
},
rules: {
camelcase: 0,
indent: 0,
'max-len': [ 2, { 'code': 140 } ],
'no-console': 1
},
parser: 'babel-eslint',
parserOptions: {
ecmaVersion: 8,
ecmaFeatures: {
modules: true,
experimentalObjectRestSpread: true,
jsx: true
}
},
extends: ["plugin:@woocommerce/eslint-plugin/recommended"],
};

View File

@ -4,6 +4,10 @@ on:
branches:
- trunk
- 'release/**'
defaults:
run:
shell: bash
working-directory: plugins/woocommerce
jobs:
test:
name: PHP ${{ matrix.php }} WP ${{ matrix.wp }}

View File

@ -1,6 +1,5 @@
name: Build zip for PR
on:
pull_request
on: pull_request
jobs:
build:
name: Build zip for PR
@ -11,7 +10,7 @@ jobs:
- name: Build
id: build
uses: woocommerce/action-build@v2
uses: woocommerce/action-build@test-cd-after-npm-install
- name: Upload PR zip
uses: actions/upload-artifact@v2
@ -25,9 +24,8 @@ jobs:
e2e-tests-run:
name: Runs E2E tests.
runs-on: ubuntu-18.04
needs: [ build ]
needs: [build]
steps:
- name: Create dirs.
run: |
mkdir -p code/woocommerce
@ -41,15 +39,15 @@ jobs:
path: package/woocommerce
- name: Run npm install.
working-directory: package/woocommerce
working-directory: package/woocommerce/plugins/woocommerce
run: npm install
- name: Load docker images and start containers.
working-directory: package/woocommerce
working-directory: package/woocommerce/plugins/woocommerce
run: npx wc-e2e docker:up
- name: Move current directory to code. We will install zip file in this dir later.
run: mv ./package/woocommerce/* ./code/woocommerce
run: mv ./package/woocommerce/plugins/woocommerce/* ./code/woocommerce
- name: Download WooCommerce ZIP.
uses: actions/download-artifact@v2
@ -61,7 +59,7 @@ jobs:
working-directory: tmp
run: |
unzip woocommerce.zip -d woocommerce
mv woocommerce/woocommerce/* ../package/woocommerce/
mv woocommerce/woocommerce/* ../package/woocommerce/plugins/woocommerce/
- name: Run tests command.
working-directory: code/woocommerce

View File

@ -1,6 +1,10 @@
name: Run code coverage on PR
on:
pull_request
defaults:
run:
shell: bash
working-directory: plugins/woocommerce
jobs:
test:
name: Code coverage (PHP 7.4, WP Latest)

View File

@ -1,6 +1,10 @@
name: Run code sniff on PR
on:
pull_request
defaults:
run:
shell: bash
working-directory: plugins/woocommerce
jobs:
test:
name: Code sniff (PHP 7.4, WP Latest)

View File

@ -1,6 +1,10 @@
name: Run unit tests on PR
on:
pull_request
defaults:
run:
shell: bash
working-directory: plugins/woocommerce
jobs:
test:
name: PHP ${{ matrix.php }} WP ${{ matrix.wp }}

104
.gitignore vendored
View File

@ -1,84 +1,34 @@
# Editors
project.xml
project.properties
/nbproject/private/
.buildpath
.project
.settings*
.idea
.vscode
.eslintcache
*.sublime-project
*.sublime-workspace
.sublimelinterrc
*.swp
# Grunt
node_modules/
none
# Sass
.sass-cache/
# Compiled CSS
/assets/css/*.css
/assets/css/photoswipe/**/*.min.css
# Minified JS
/assets/js/**/*.min.js
# OS X metadata
# Operating System files
.DS_Store
# Windows junk
Thumbs.db
# Behat/CLI Tests
tests/cli/installer
tests/cli/composer.phar
tests/cli/composer.lock
tests/cli/composer.json
tests/cli/vendor
# IDE files
.idea
.vscode/
# Unit tests
/tmp
/tests/bin/tmp
/tests/e2e/config/local-*.json
/tests/e2e/config/local.json
/tests/e2e/config/default.json
/tests/e2e/env/config/default.json
/tests/e2e/docker
/tests/e2e/env/docker/wp-cli/initialize.sh
/tests/e2e/env/build/
/tests/e2e/env/build-module/
/tests/e2e/screenshots
/tests/e2e/plugins
/tests/e2e/utils/build/
/tests/e2e/utils/build-module/
# Environment files
wp-cli.local.yml
.wp-env.override.json
yarn-error.log
npm-debug.log
.pnpm-debug.log
# Logs
/logs
# Build files
*.sql
*.swp
*.zip
# Composer
/vendor/
/bin/composer/**/vendor/
/lib/vendor/
contributors.md
contributors.html
# Yarn
yarn.lock
# Packages
/packages/*
!/packages/README.md
# Screenshots for e2e tests failures
/screenshots/
# Language files
i18n/languages/woocommerce.pot
# Build
# Built packages
build/
woocommerce.zip
build-module/
build-style/
# Project files
node_modules/
vendor/
# TypeScript files
tsconfig.tsbuildinfo
# wp-env config
.wp-env.override.json

3
.prettierrc.js Normal file
View File

@ -0,0 +1,3 @@
// Import the default config file and expose it in the project root.
// Useful for editor integrations.
module.exports = require( '@wordpress/prettier-config' );

11
.wp-env.json Normal file
View File

@ -0,0 +1,11 @@
{
"phpVersion": "7.4",
"core": null,
"plugins": [ "./plugins/woocommerce" ],
"config": {
"JETPACK_AUTOLOAD_DEV": true,
"WP_DEBUG_LOG": true,
"WP_DEBUG_DISPLAY": true,
"ALTERNATE_WP_CRON": true
}
}

120
DEVELOPMENT.md Normal file
View File

@ -0,0 +1,120 @@
# WooCommerce Development Setup with WP-ENV
Docker development setup for WooCommerce with WP-ENV.
## Prerequisites
Please install WP-ENV before getting started. You can find more about WP-ENV on [here](https://github.com/WordPress/gutenberg/tree/master/packages/env).
The following command installs WP-ENV globally.
`npm -g i @wordpress/env`
## Starting WP-ENV
1. Navigate to the root of WooCommerce source code.
2. Start the docker container by running `wp-env start`
You should see the following output
```
WordPress development site started at http://localhost:8888/
WordPress test site started at http://localhost:8889/
MySQL is listening on port 55003
```
The port # might be different depending on your `.wp-env.override.json` configuration.
## Getting Started with Developing
Once you have WP-ENV container up, we need to run a few commands to start developing.
1. Run `npm install` to install npm modules.
2. Run `npm run dev`
3. Run `composer install` 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 `npm start` to watch your CSS and JS changes if you are working on the frontend.
You're now ready to develop!
## Using Xdebug
Please refer to [WP-ENV official README](https://github.com/WordPress/gutenberg/tree/master/packages/env#using-xdebug) section for setting up Xdebug.
## Overriding the Default Configuration
The default configuration comes with PHP 7.4, WooCommerce 5.0, and a few WordPress config values.
You can create `.wp-env.override.json` file and override the default configuration values.
You can find more about `.wp-env.override.json` configuration [here](https://github.com/WordPress/gutenberg/tree/master/packages/env#wp-envoverridejson).
**Example: Overriding PHP version to 8.0**
Create `.wp-env.override.json` in the root directory with the following content.
```json
{
"phpVersion": "8.0"
}
```
**Exampe: Adding a locally installed plugin**
Method 1 - Adding to the `plugins` array
Open the default `.wp-env.json` and copy `plugins` array and paste it into the `.wp-env.override.json` and add your locally installed plugin. Copying the default `plugins` is needed as WP-ENV does not merge the values of the `plugins`.
```json
{
"plugins": [
"./plugins/woocommerce",
"https://downloads.wordpress.org/plugin/wp-crontrol.1.10.0.zip"
]
}
```
Method 2 - Adding to the `mappings`
This method is simpler, but the plugin does not get activated on startup. You need to manually activate it yourself on the first startup.
```json
{
"mappings": {
"wp-content/plugins/wp-crontrol": "../woocommerce"
}
}
```
## Accessing MySQL
The MySQL port can change when you restart your container.
You can get the current MySQL port from the output of `wp-env start` command.
1. Open your choice of MySQL tool.
2. Use the following values to access the MySQL container.
3. You can omit the username and password.
| Name | Value |
| -------- | --------------------- |
| Host | 127.0.0.1 |
| Username | |
| Password | |
| Port | Port from the command |
## HOWTOs
##### How do I ssh into the container?
Run the following command to ssh into the container
`wp-env run wordpress /bin/bash`
You can run a command in the container with the following syntax. You can find more about on the `run` command [here](https://github.com/WordPress/gutenberg/tree/master/packages/env#wp-env-run-container-command)
Syntax:
`wp-env run :container-type :linux-command`

38816
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,147 +1,23 @@
{
"name": "woocommerce",
"title": "WooCommerce",
"version": "6.0.0",
"name": "woocommerce-monorepo",
"title": "WooCommerce Monorepo",
"description": "Monorepo for the WooCommerce ecosystem",
"homepage": "https://woocommerce.com/",
"private": true,
"repository": {
"type": "git",
"url": "https://github.com/woocommerce/woocommerce.git"
},
"license": "GPL-3.0+",
"main": "Gruntfile.js",
"config": {
"wp_org_slug": "woocommerce"
},
"scripts": {
"install": " if [ -z \"$SKIP_LERNA_BOOTSTRAP\" ]; then npx lerna bootstrap --hoist; fi",
"check:subset-installed": "npm list --depth 1 install-subset > /dev/null 2>&1",
"install:subset-only": "npm install --no-package-lock --no-save install-subset",
"install:no-e2e": "npm run check:subset-installed --silent || npm run install:subset-only && SKIP_LERNA_BOOTSTRAP=true npx install-subset i no-e2e",
"build": "./bin/build-zip.sh",
"build:core": "grunt && npm run makepot",
"build:dev": "npm run build:core && npm run build:packages",
"build-watch": "grunt watch",
"build:packages": "lerna run build",
"build:zip": "npm run build",
"build:assets": "grunt assets",
"lint:js": "eslint assets/js --ext=js",
"docker:down": "npx wc-e2e docker:down",
"docker:ssh": "npx wc-e2e docker:ssh",
"docker:up": "npx wc-e2e docker:up",
"test:api": "npx wc-api-tests test api",
"make:collection": "npx wc-api-tests make:collection",
"test:e2e": "npx wc-e2e test:e2e",
"test:e2e-debug": "npx wc-e2e test:e2e-debug",
"test:e2e-dev": "npx 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",
"publish-packages": "lerna publish from-package",
"git:update-hooks": "rm -r .git/hooks && mkdir -p .git/hooks && node ./node_modules/husky/husky.js install"
"author": "Automattic",
"license": "GPL-3.0-or-later",
"bugs": {
"url": "https://github.com/woocommerce/woocommerce/issues"
},
"devDependencies": {
"@babel/cli": "7.12.8",
"@babel/core": "7.12.9",
"@babel/polyfill": "7.12.1",
"@babel/preset-env": "7.12.7",
"@babel/register": "7.12.1",
"@typescript-eslint/eslint-plugin": "3.10.1",
"@typescript-eslint/experimental-utils": "3.10.1",
"@typescript-eslint/parser": "3.10.1",
"@woocommerce/admin-e2e-tests": "0.1.1",
"@woocommerce/api": "file:tests/e2e/api",
"@woocommerce/api-core-tests": "file:tests/e2e/api-core-tests",
"@woocommerce/e2e-core-tests": "file:tests/e2e/core-tests",
"@woocommerce/e2e-environment": "file:tests/e2e/env",
"@woocommerce/e2e-utils": "file:tests/e2e/utils",
"@wordpress/babel-plugin-import-jsx-pragma": "1.1.3",
"@wordpress/babel-preset-default": "3.0.2",
"@wordpress/eslint-plugin": "7.3.0",
"autoprefixer": "9.8.6",
"babel-eslint": "10.1.0",
"chai": "4.2.0",
"chai-as-promised": "7.1.1",
"commander": "4.1.1",
"config": "3.3.3",
"cross-env": "6.0.3",
"deasync": "0.1.21",
"eslint": "6.8.0",
"eslint-config-wpcalypso": "5.0.0",
"eslint-plugin-jest": "23.20.0",
"github-contributors-list": "https://github.com/woocommerce/github-contributors-list/tarball/master",
"grunt": "1.3.0",
"grunt-contrib-clean": "2.0.0",
"grunt-contrib-concat": "1.0.1",
"grunt-contrib-copy": "1.0.0",
"grunt-contrib-cssmin": "3.0.0",
"grunt-contrib-uglify": "4.0.1",
"grunt-contrib-watch": "1.1.0",
"grunt-newer": "^1.3.0",
"grunt-phpcs": "0.4.0",
"grunt-postcss": "0.9.0",
"grunt-rtlcss": "2.0.2",
"grunt-sass": "3.1.0",
"grunt-stylelint": "0.16.0",
"gruntify-eslint": "5.0.0",
"husky": "4.3.0",
"istanbul": "1.0.0-alpha.2",
"jest": "^25.1.0",
"lerna": "3.22.1",
"lint-staged": "9.5.0",
"mocha": "7.2.0",
"node-sass": "4.14.1",
"prettier": "npm:wp-prettier@2.0.5",
"stylelint": "^13.8.0",
"stylelint-config-wordpress": "17.0.0",
"typescript": "3.9.7",
"webpack": "4.44.2",
"webpack-cli": "3.3.12",
"wp-textdomain": "1.0.1"
},
"engines": {
"node": "^12.20.1",
"npm": "^6.14.6"
},
"husky": {
"hooks": {
"post-merge": "./bin/post-merge.sh",
"pre-commit": "lint-staged",
"pre-push": "./bin/pre-push.sh"
}
},
"lint-staged": {
"*.php": [
"php -d display_errors=1 -l",
"composer run-script phpcs-pre-commit"
],
"*.scss": [
"stylelint --syntax=scss --fix",
"git add"
],
"*.js": [
"eslint --fix",
"git add"
],
"*.ts": [
"eslint --fix",
"git add"
]
},
"browserslist": [
"> 0.1%",
"ie 8",
"ie 9"
],
"subsets": {
"no-e2e": {
"exclude": [
"@woocommerce/api",
"@woocommerce/api-core-tests",
"@woocommerce/e2e-core-tests",
"@woocommerce/e2e-environment",
"@woocommerce/e2e-utils",
"@wordpress/e2e-test-utils"
]
}
"@woocommerce/eslint-plugin": "^1.2.0",
"@wordpress/prettier-config": "^1.0.5",
"jest": "^27.0.6",
"prettier": "npm:wp-prettier@2.2.1-beta-1",
"typescript": "4.2.4"
}
}

0
packages/js/.gitkeep Normal file
View File

0
packages/php/.gitkeep Normal file
View File

View File

@ -0,0 +1,21 @@
*.min.js
/assets/js/accounting/**
/assets/js/flexslider/**
/assets/js/jquery-blockui/**
/assets/js/jquery-cookie/**
/assets/js/jquery-flot/**
/assets/js/jquery-payment/**
/assets/js/jquery-qrcode/**
/assets/js/jquery-serializejson/**
/assets/js/jquery-tiptip/**
/assets/js/jquery-ui-touch-punch/**
/assets/js/js-cookie/**
/assets/js/photoswipe/**
/assets/js/prettyPhoto/**
/assets/js/round/**
/assets/js/select2/**
/assets/js/selectWoo/**
/assets/js/stupidtable/**
/assets/js/zeroclipboard/**
/assets/js/zoom/**

View File

@ -0,0 +1,31 @@
/** @format */
module.exports = {
root: true,
env: {
browser: true,
es6: true,
node: true,
},
globals: {
wp: true,
wpApiSettings: true,
wcSettings: true,
es6: true,
},
rules: {
camelcase: 0,
indent: 0,
'max-len': [ 2, { code: 140 } ],
'no-console': 1,
},
parser: 'babel-eslint',
parserOptions: {
ecmaVersion: 8,
ecmaFeatures: {
modules: true,
experimentalObjectRestSpread: true,
jsx: true,
},
},
};

84
plugins/woocommerce/.gitignore vendored Normal file
View File

@ -0,0 +1,84 @@
# Editors
project.xml
project.properties
/nbproject/private/
.buildpath
.project
.settings*
.idea
.vscode
.eslintcache
*.sublime-project
*.sublime-workspace
.sublimelinterrc
*.swp
# Grunt
node_modules/
none
# Sass
.sass-cache/
# Compiled CSS
/assets/css/*.css
/assets/css/photoswipe/**/*.min.css
# Minified JS
/assets/js/**/*.min.js
# OS X metadata
.DS_Store
# Windows junk
Thumbs.db
# Behat/CLI Tests
tests/cli/installer
tests/cli/composer.phar
tests/cli/composer.lock
tests/cli/composer.json
tests/cli/vendor
# Unit tests
/tmp
/tests/bin/tmp
/tests/e2e/config/local-*.json
/tests/e2e/config/local.json
/tests/e2e/config/default.json
/tests/e2e/env/config/default.json
/tests/e2e/docker
/tests/e2e/env/docker/wp-cli/initialize.sh
/tests/e2e/env/build/
/tests/e2e/env/build-module/
/tests/e2e/screenshots
/tests/e2e/plugins
/tests/e2e/utils/build/
/tests/e2e/utils/build-module/
# Logs
/logs
# Composer
/vendor/
/bin/composer/**/vendor/
/lib/vendor/
contributors.md
contributors.html
# Yarn
yarn.lock
# Packages
/packages/*
!/packages/README.md
# Screenshots for e2e tests failures
/screenshots/
# Language files
i18n/languages/woocommerce.pot
# Build
build/
woocommerce.zip

View File

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

Before

Width:  |  Height:  |  Size: 225 KiB

After

Width:  |  Height:  |  Size: 225 KiB

View File

Before

Width:  |  Height:  |  Size: 289 KiB

After

Width:  |  Height:  |  Size: 289 KiB

View File

Before

Width:  |  Height:  |  Size: 197 KiB

After

Width:  |  Height:  |  Size: 197 KiB

View File

Before

Width:  |  Height:  |  Size: 182 KiB

After

Width:  |  Height:  |  Size: 182 KiB

View File

Before

Width:  |  Height:  |  Size: 303 KiB

After

Width:  |  Height:  |  Size: 303 KiB

View File

Before

Width:  |  Height:  |  Size: 279 KiB

After

Width:  |  Height:  |  Size: 279 KiB

View File

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

Before

Width:  |  Height:  |  Size: 547 B

After

Width:  |  Height:  |  Size: 547 B

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 866 B

After

Width:  |  Height:  |  Size: 866 B

View File

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 46 KiB

View File

Before

Width:  |  Height:  |  Size: 929 B

After

Width:  |  Height:  |  Size: 929 B

View File

Before

Width:  |  Height:  |  Size: 223 B

After

Width:  |  Height:  |  Size: 223 B

View File

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

Before

Width:  |  Height:  |  Size: 310 B

After

Width:  |  Height:  |  Size: 310 B

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 804 B

After

Width:  |  Height:  |  Size: 804 B

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

Before

Width:  |  Height:  |  Size: 768 B

After

Width:  |  Height:  |  Size: 768 B

Some files were not shown because too many files have changed in this diff Show More