Merge branch 'add/experiment-subscriptions-admin-menu-1' into add/experiment-subscriptions-admin-menu-eligibility
# Conflicts: # plugins/woocommerce/src/Internal/Admin/WcPaySubscriptionsPage.php
This commit is contained in:
commit
68142596bb
|
@ -8,8 +8,12 @@ coverage:
|
|||
range: "50...100"
|
||||
|
||||
status:
|
||||
project: off
|
||||
patch: off
|
||||
project:
|
||||
default:
|
||||
informational: true
|
||||
patch:
|
||||
default:
|
||||
informational: true
|
||||
changes: off
|
||||
|
||||
parsers:
|
||||
|
|
|
@ -9,19 +9,38 @@ on:
|
|||
jobs:
|
||||
build:
|
||||
name: Build release zip file
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
- name: Checkout code.
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Get cached composer and pnpm directories
|
||||
uses: actions/cache@v3
|
||||
id: cache-deps
|
||||
with:
|
||||
ref: ${{ github.event.inputs.ref || github.ref }}
|
||||
- name: Build the zip file
|
||||
id: build
|
||||
uses: woocommerce/action-build@trunk
|
||||
path: |
|
||||
~/.pnpm-store
|
||||
plugins/woocommerce/packages
|
||||
plugins/woocommerce/**/vendor
|
||||
key: ${{ runner.os }}-npm-composer-${{ hashFiles('**/composer.lock', '**/pnpm-lock.yaml') }}
|
||||
|
||||
- name: Install PNPM
|
||||
run: npm install -g pnpm@^6.24.2
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '7.4'
|
||||
|
||||
- name: Build zip
|
||||
working-directory: plugins/woocommerce
|
||||
run: bash bin/build-zip.sh
|
||||
|
||||
- name: Unzip the file (prevents double zip problem)
|
||||
run: unzip ${{ steps.build.outputs.zip_path }} -d zipfile
|
||||
run: unzip plugins/woocommerce/woocommerce.zip -d zipfile
|
||||
|
||||
- name: Upload the zip file as an artifact
|
||||
uses: actions/upload-artifact@v2
|
||||
uses: actions/upload-artifact@v3
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
|
|
|
@ -5,27 +5,47 @@ on:
|
|||
jobs:
|
||||
build:
|
||||
name: Build release asset
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
- name: Build
|
||||
id: build
|
||||
uses: woocommerce/action-build@trunk
|
||||
- name: Checkout code.
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Get cached composer and pnpm directories
|
||||
uses: actions/cache@v3
|
||||
id: cache-deps
|
||||
with:
|
||||
path: |
|
||||
~/.pnpm-store
|
||||
plugins/woocommerce/packages
|
||||
plugins/woocommerce/**/vendor
|
||||
key: ${{ runner.os }}-npm-composer-${{ hashFiles('**/composer.lock', '**/pnpm-lock.yaml') }}
|
||||
|
||||
- name: Install PNPM
|
||||
run: npm install -g pnpm@^6.24.2
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '7.4'
|
||||
|
||||
- name: Build zip
|
||||
working-directory: plugins/woocommerce
|
||||
run: bash bin/build-zip.sh
|
||||
|
||||
- name: Upload release asset
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ github.event.release.upload_url }}
|
||||
asset_path: ${{ steps.build.outputs.zip_path }}
|
||||
asset_path: plugins/woocommerce/woocommerce.zip
|
||||
asset_name: woocommerce.zip
|
||||
asset_content_type: application/zip
|
||||
update-code-reference:
|
||||
if: github.event.release.prerelease == false && github.event.release.draft == false && github.repository_owner == 'woocommerce'
|
||||
name: Update Code Reference
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Invoke Code Reference build and deploy workflow
|
||||
uses: aurelien-baudet/workflow-dispatch@v2
|
||||
|
@ -38,7 +58,7 @@ jobs:
|
|||
run-release-smoke-tests:
|
||||
name: Execute Smoke test release
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Invoke release smoke testing workflow
|
||||
uses: aurelien-baudet/workflow-dispatch@v2
|
||||
|
|
|
@ -7,12 +7,14 @@ on:
|
|||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
working-directory: plugins/woocommerce
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
jobs:
|
||||
test:
|
||||
name: PHP ${{ matrix.php }} WP ${{ matrix.wp }}
|
||||
timeout-minutes: 20
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-20.04
|
||||
continue-on-error: ${{ matrix.wp == 'nightly' }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
|
@ -36,7 +38,7 @@ jobs:
|
|||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
|
@ -51,29 +53,33 @@ jobs:
|
|||
php --version
|
||||
composer --version
|
||||
|
||||
- name: Get cached composer directories
|
||||
uses: actions/cache@v2
|
||||
- name: Get cached composer and pnpm directories
|
||||
uses: actions/cache@v3
|
||||
id: cache-deps
|
||||
with:
|
||||
path: |
|
||||
./packages
|
||||
./vendor
|
||||
key: ${{ runner.os }}-${{ hashFiles('./composer.lock') }}
|
||||
~/.pnpm-store
|
||||
plugins/woocommerce/packages
|
||||
plugins/woocommerce/**/vendor
|
||||
key: ${{ runner.os }}-npm-composer-${{ hashFiles('**/composer.lock', '**/pnpm-lock.yaml') }}
|
||||
|
||||
- name: Install PNPM and install dependencies
|
||||
run: |
|
||||
npm install -g pnpm
|
||||
pnpm install
|
||||
- name: Install PNPM
|
||||
run: npm install -g pnpm@^6.24.2
|
||||
|
||||
- name: Setup and install composer
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
|
||||
- name: Install Composer dependencies
|
||||
if: steps.cache-deps.outputs.cache-hit != 'true'
|
||||
run: pnpm nx composer-install woocommerce
|
||||
|
||||
- name: Build Admin feature config
|
||||
working-directory: ./
|
||||
run: pnpm nx build:feature-config woocommerce
|
||||
|
||||
- name: Add PHP8 Compatibility.
|
||||
run: |
|
||||
if [ "$(php -r "echo version_compare(PHP_VERSION,'8.0','>=');")" ]; then
|
||||
cd plugins/woocommerce
|
||||
curl -L https://github.com/woocommerce/phpunit/archive/add-compatibility-with-php8-to-phpunit-7.zip -o /tmp/phpunit-7.5-fork.zip
|
||||
unzip -d /tmp/phpunit-7.5-fork /tmp/phpunit-7.5-fork.zip
|
||||
composer bin phpunit config --unset platform
|
||||
|
@ -84,6 +90,7 @@ jobs:
|
|||
fi
|
||||
|
||||
- name: Init DB and WP
|
||||
working-directory: plugins/woocommerce
|
||||
run: ./tests/bin/install.sh woo_test root root 127.0.0.1 ${{ matrix.wp }}
|
||||
|
||||
- name: Run tests
|
||||
|
|
|
@ -6,42 +6,67 @@ jobs:
|
|||
build:
|
||||
if: github.repository == 'woocommerce/woocommerce'
|
||||
name: Build WooCommerce zip
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
- name: Build
|
||||
id: build
|
||||
uses: woocommerce/action-build@trunk
|
||||
env:
|
||||
BUILD_ENV: mirrors
|
||||
- name: Upload PR zip
|
||||
uses: actions/upload-artifact@v2
|
||||
- name: Checkout code.
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Cache modules
|
||||
uses: actions/cache@v3
|
||||
id: cache-deps
|
||||
with:
|
||||
path: |
|
||||
~/.pnpm-store
|
||||
plugins/woocommerce/packages
|
||||
plugins/woocommerce/**/vendor
|
||||
key: ${{ runner.os }}-npm-composer-${{ hashFiles('**/composer.lock', '**/pnpm-lock.yaml') }}
|
||||
|
||||
- name: Install PNPM
|
||||
run: npm install -g pnpm@^6.24.2
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '7.4'
|
||||
|
||||
- name: Build zip
|
||||
working-directory: plugins/woocommerce
|
||||
run: bash bin/build-zip.sh
|
||||
|
||||
- name: Upload the zip file as an artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
name: woocommerce
|
||||
path: ${{ steps.build.outputs.zip_path }}
|
||||
path: plugins/woocommerce/woocommerce.zip
|
||||
retention-days: 7
|
||||
|
||||
mirror:
|
||||
if: github.repository == 'woocommerce/woocommerce'
|
||||
name: Push to Mirror
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build]
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Create directories
|
||||
run: |
|
||||
mkdir -p tmp/woocommerce-build
|
||||
mkdir -p monorepo
|
||||
|
||||
- name: Checkout monorepo
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: monorepo
|
||||
|
||||
- name: Copy Composer over to production
|
||||
run: cp monorepo/plugins/woocommerce/composer.json tmp/woocommerce-build
|
||||
|
||||
- name: Download WooCommerce ZIP
|
||||
uses: actions/download-artifact@v2
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: woocommerce
|
||||
path: tmp/woocommerce-build
|
||||
|
||||
- name: Extract and replace WooCommerce zip.
|
||||
working-directory: tmp/woocommerce-build
|
||||
run: |
|
||||
|
@ -49,11 +74,13 @@ jobs:
|
|||
unzip woocommerce.zip -d woocommerce/woocommerce-production
|
||||
mv woocommerce/woocommerce-production/woocommerce/* woocommerce/woocommerce-production
|
||||
rm -rf woocommerce/woocommerce-production/woocommerce
|
||||
|
||||
- name: Set up mirror
|
||||
working-directory: tmp/woocommerce-build
|
||||
run: |
|
||||
touch mirrors.txt
|
||||
echo "woocommerce/woocommerce-production" >> mirrors.txt
|
||||
|
||||
- name: Push to mirror
|
||||
uses: Automattic/action-push-to-mirrors@v1
|
||||
with:
|
||||
|
|
|
@ -10,15 +10,35 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
build: [trunk]
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ matrix.build }}
|
||||
- name: Build
|
||||
id: build
|
||||
uses: woocommerce/action-build@trunk
|
||||
|
||||
- name: Get cached composer and pnpm directories
|
||||
uses: actions/cache@v3
|
||||
id: cache-deps
|
||||
with:
|
||||
path: |
|
||||
~/.pnpm-store
|
||||
plugins/woocommerce/packages
|
||||
plugins/woocommerce/**/vendor
|
||||
key: ${{ runner.os }}-npm-composer-${{ hashFiles('**/composer.lock', '**/pnpm-lock.yaml') }}
|
||||
|
||||
- name: Install PNPM
|
||||
run: npm install -g pnpm@^6.24.2
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '7.4'
|
||||
|
||||
- name: Build zip
|
||||
working-directory: plugins/woocommerce
|
||||
run: bash bin/build-zip.sh
|
||||
|
||||
- name: Deploy nightly build
|
||||
uses: WebFreak001/deploy-nightly@v1.1.0
|
||||
env:
|
||||
|
@ -26,13 +46,13 @@ jobs:
|
|||
with:
|
||||
upload_url: https://uploads.github.com/repos/${{ github.repository }}/releases/25945111/assets{?name,label}
|
||||
release_id: 25945111
|
||||
asset_path: ${{ steps.build.outputs.zip_path }}
|
||||
asset_path: plugins/woocommerce/woocommerce.zip
|
||||
asset_name: woocommerce-${{ matrix.build }}-nightly.zip
|
||||
asset_content_type: application/zip
|
||||
max_releases: 1
|
||||
update:
|
||||
name: Update nightly tag commit ref
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Update nightly tag
|
||||
uses: richardsimko/github-tag-action@v1.0.5
|
||||
|
|
|
@ -1,196 +1,165 @@
|
|||
name: Build zip for PR
|
||||
name: Run tests against PR
|
||||
on: pull_request
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build zip for PR
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Cancel Previous Runs
|
||||
uses: styfle/cancel-workflow-action@0.7.0
|
||||
with:
|
||||
access_token: ${{ github.token }}
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Build
|
||||
id: build
|
||||
uses: woocommerce/action-build@trunk
|
||||
env:
|
||||
BUILD_ENV: e2e
|
||||
|
||||
- name: Upload PR zip
|
||||
uses: actions/upload-artifact@v2
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
name: woocommerce
|
||||
path: ${{ steps.build.outputs.zip_path }}
|
||||
retention-days: 7
|
||||
|
||||
e2e-tests-run:
|
||||
name: Runs E2E tests.
|
||||
runs-on: ubuntu-18.04
|
||||
needs: [build]
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Create dirs.
|
||||
run: |
|
||||
mkdir -p code/woocommerce
|
||||
mkdir -p package/woocommerce
|
||||
mkdir -p tmp/woocommerce
|
||||
mkdir -p node_modules
|
||||
|
||||
- name: Checkout code.
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Cache modules
|
||||
uses: actions/cache@v3
|
||||
id: cache-deps
|
||||
with:
|
||||
path: package/woocommerce
|
||||
path: |
|
||||
~/.pnpm-store
|
||||
plugins/woocommerce/packages
|
||||
plugins/woocommerce/**/vendor
|
||||
key: ${{ runner.os }}-npm-composer-${{ hashFiles('**/composer.lock', '**/pnpm-lock.yaml') }}
|
||||
|
||||
- name: Move current directory to code. We will install zip file in this dir later.
|
||||
run: mv ./package/woocommerce/plugins/woocommerce/* ./code/woocommerce
|
||||
|
||||
- name: Download WooCommerce ZIP.
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: woocommerce
|
||||
path: tmp
|
||||
|
||||
- name: Extract and replace WooCommerce zip.
|
||||
working-directory: tmp
|
||||
run: |
|
||||
unzip woocommerce.zip -d woocommerce
|
||||
mv woocommerce/woocommerce/* ../package/woocommerce/plugins/woocommerce/
|
||||
- name: Install PNPM
|
||||
run: npm install -g pnpm@^6.24.2
|
||||
|
||||
- name: Install dependencies
|
||||
working-directory: package/woocommerce
|
||||
run: |
|
||||
npm install -g pnpm
|
||||
pnpm install
|
||||
run: pnpm install
|
||||
|
||||
- name: Install Composer dependencies
|
||||
if: steps.cache-deps.outputs.cache-hit != 'true'
|
||||
run: pnpm nx composer-install-no-dev woocommerce
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '7.4'
|
||||
|
||||
- name: Run build
|
||||
run: pnpm nx build woocommerce
|
||||
|
||||
- name: Load docker images and start containers.
|
||||
working-directory: package/woocommerce/plugins/woocommerce
|
||||
run: pnpx wc-e2e docker:up
|
||||
working-directory: plugins/woocommerce
|
||||
run: pnpm exec wc-e2e docker:up
|
||||
|
||||
- name: Run tests command.
|
||||
working-directory: package/woocommerce/plugins/woocommerce
|
||||
working-directory: plugins/woocommerce
|
||||
env:
|
||||
WC_E2E_SCREENSHOTS: 1
|
||||
E2E_SLACK_TOKEN: ${{ secrets.E2E_SLACK_TOKEN }}
|
||||
E2E_SLACK_CHANNEL: ${{ secrets.E2E_SLACK_CHANNEL }}
|
||||
run: pnpx wc-e2e test:e2e
|
||||
run: pnpm exec wc-e2e test:e2e
|
||||
|
||||
- name: Archive E2E test screenshots
|
||||
uses: actions/upload-artifact@v2
|
||||
uses: actions/upload-artifact@v3
|
||||
if: always()
|
||||
with:
|
||||
name: E2E Screenshots
|
||||
path: package/woocommerce/plugins/woocommerce/tests/e2e/screenshots
|
||||
path: plugins/woocommerce/tests/e2e/screenshots
|
||||
if-no-files-found: ignore
|
||||
retention-days: 5
|
||||
|
||||
api-tests-run:
|
||||
name: Runs API tests.
|
||||
runs-on: ubuntu-18.04
|
||||
needs: [build]
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Create dirs.
|
||||
run: |
|
||||
mkdir -p code/woocommerce
|
||||
mkdir -p package/woocommerce
|
||||
mkdir -p tmp/woocommerce
|
||||
mkdir -p node_modules
|
||||
|
||||
- name: Checkout code.
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Cache modules
|
||||
uses: actions/cache@v3
|
||||
id: cache-deps
|
||||
with:
|
||||
path: package/woocommerce
|
||||
path: |
|
||||
~/.pnpm-store
|
||||
plugins/woocommerce/packages
|
||||
plugins/woocommerce/**/vendor
|
||||
key: ${{ runner.os }}-npm-composer-${{ hashFiles('**/composer.lock', '**/pnpm-lock.yaml') }}
|
||||
|
||||
- name: Move current directory to code. We will install zip file in this dir later.
|
||||
run: mv ./package/woocommerce/plugins/woocommerce/* ./code/woocommerce
|
||||
|
||||
- name: Download WooCommerce ZIP.
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: woocommerce
|
||||
path: tmp
|
||||
|
||||
- name: Extract and replace WooCommerce zip.
|
||||
working-directory: tmp
|
||||
run: |
|
||||
unzip woocommerce.zip -d woocommerce
|
||||
mv woocommerce/woocommerce/* ../package/woocommerce/plugins/woocommerce/
|
||||
- name: Install PNPM
|
||||
run: npm install -g pnpm@^6.24.2
|
||||
|
||||
- name: Install dependencies
|
||||
working-directory: package/woocommerce
|
||||
run: |
|
||||
npm install -g pnpm
|
||||
pnpm install
|
||||
run: pnpm install
|
||||
|
||||
- name: Install Composer dependencies
|
||||
if: steps.cache-deps.outputs.cache-hit != 'true'
|
||||
run: pnpm nx composer-install woocommerce
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '7.4'
|
||||
|
||||
- name: Run build
|
||||
run: pnpm nx build woocommerce
|
||||
|
||||
- name: Load docker images and start containers.
|
||||
working-directory: package/woocommerce/plugins/woocommerce
|
||||
run: pnpx wc-e2e docker:up
|
||||
working-directory: plugins/woocommerce
|
||||
run: pnpm exec wc-e2e docker:up
|
||||
|
||||
- name: Run tests command.
|
||||
working-directory: package/woocommerce/plugins/woocommerce
|
||||
working-directory: plugins/woocommerce
|
||||
env:
|
||||
BASE_URL: http://localhost:8084
|
||||
BASE_URL: http://localhost:8086
|
||||
USER_KEY: admin
|
||||
USER_SECRET: password
|
||||
run: pnpx wc-api-tests test api
|
||||
run: pnpm exec wc-api-tests test api
|
||||
|
||||
- name: Upload API test report
|
||||
uses: actions/upload-artifact@v2
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: api-test-report---pr-${{ github.event.number }}
|
||||
path: |
|
||||
package/woocommerce/packages/js/api-core-tests/allure-results
|
||||
package/woocommerce/packages/js/api-core-tests/allure-report
|
||||
packages/js/api-core-tests/allure-results
|
||||
packages/js/api-core-tests/allure-report
|
||||
retention-days: 7
|
||||
|
||||
k6-tests-run:
|
||||
name: Runs k6 Performance tests
|
||||
runs-on: ubuntu-18.04
|
||||
needs: [build]
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Create dirs.
|
||||
run: |
|
||||
mkdir -p code/woocommerce
|
||||
mkdir -p package/woocommerce
|
||||
mkdir -p tmp/woocommerce
|
||||
mkdir -p node_modules
|
||||
- name: Checkout code.
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Cache modules
|
||||
uses: actions/cache@v3
|
||||
id: cache-deps
|
||||
with:
|
||||
path: package/woocommerce
|
||||
path: |
|
||||
~/.pnpm-store
|
||||
plugins/woocommerce/packages
|
||||
plugins/woocommerce/**/vendor
|
||||
key: ${{ runner.os }}-npm-composer-${{ hashFiles('**/composer.lock', '**/pnpm-lock.yaml') }}
|
||||
|
||||
- name: Move current directory to code. We will install zip file in this dir later.
|
||||
run: mv ./package/woocommerce/plugins/woocommerce/* ./code/woocommerce
|
||||
|
||||
- name: Download WooCommerce ZIP.
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: woocommerce
|
||||
path: tmp
|
||||
|
||||
- name: Extract and replace WooCommerce zip.
|
||||
working-directory: tmp
|
||||
run: |
|
||||
unzip woocommerce.zip -d woocommerce
|
||||
mv woocommerce/woocommerce/* ../package/woocommerce/plugins/woocommerce/
|
||||
- name: Install PNPM
|
||||
run: npm install -g pnpm@^6.24.2
|
||||
|
||||
- name: Install dependencies
|
||||
working-directory: package/woocommerce
|
||||
run: |
|
||||
npm install -g pnpm
|
||||
pnpm install
|
||||
|
||||
run: pnpm install
|
||||
|
||||
- name: Install Composer dependencies
|
||||
if: steps.cache-deps.outputs.cache-hit != 'true'
|
||||
run: pnpm nx composer-install woocommerce
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '7.4'
|
||||
|
||||
- name: Run build
|
||||
run: pnpm nx build woocommerce
|
||||
|
||||
- name: Workaround to use initialization file with prepopulated data.
|
||||
working-directory: package/woocommerce/plugins/woocommerce/tests/e2e/docker
|
||||
working-directory: plugins/woocommerce/tests/e2e/docker
|
||||
run: |
|
||||
cp init-sample-products.sh initialize.sh
|
||||
|
||||
|
||||
- name: Load docker images and start containers.
|
||||
working-directory: package/woocommerce/plugins/woocommerce
|
||||
run: pnpx wc-e2e docker:up
|
||||
working-directory: plugins/woocommerce
|
||||
run: pnpm exec wc-e2e docker:up
|
||||
|
||||
- name: Install k6
|
||||
run: |
|
||||
|
@ -198,4 +167,4 @@ jobs:
|
|||
|
||||
- name: Run k6 tests
|
||||
run: |
|
||||
./k6 run package/woocommerce/plugins/woocommerce/tests/performance/tests/gh-action-pr-requests.js
|
||||
./k6 run plugins/woocommerce/tests/performance/tests/gh-action-pr-requests.js
|
||||
|
|
|
@ -4,12 +4,14 @@ on:
|
|||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
working-directory: plugins/woocommerce
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
jobs:
|
||||
test:
|
||||
name: Code coverage (PHP 7.4, WP Latest)
|
||||
timeout-minutes: 20
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-20.04
|
||||
services:
|
||||
database:
|
||||
image: mysql:5.6
|
||||
|
@ -19,13 +21,8 @@ jobs:
|
|||
- 3306:3306
|
||||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5
|
||||
steps:
|
||||
- name: Cancel Previous Runs
|
||||
uses: styfle/cancel-workflow-action@0.7.0
|
||||
with:
|
||||
access_token: ${{ github.token }}
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 100
|
||||
|
||||
|
@ -42,24 +39,27 @@ jobs:
|
|||
php --version
|
||||
composer --version
|
||||
|
||||
- name: Get cached composer directories
|
||||
uses: actions/cache@v2
|
||||
- name: Get cached composer and pnpm directories
|
||||
uses: actions/cache@v3
|
||||
id: cache-deps
|
||||
with:
|
||||
path: |
|
||||
./packages
|
||||
./vendor
|
||||
key: ${{ runner.os }}-${{ hashFiles('./composer.lock') }}
|
||||
~/.pnpm-store
|
||||
plugins/woocommerce/packages
|
||||
plugins/woocommerce/**/vendor
|
||||
key: ${{ runner.os }}-npm-composer-${{ hashFiles('**/composer.lock', '**/pnpm-lock.yaml') }}
|
||||
|
||||
- name: Install PNPM and install dependencies
|
||||
run: |
|
||||
npm install -g pnpm
|
||||
pnpm install
|
||||
- name: Install PNPM
|
||||
run: npm install -g pnpm@^6.24.2
|
||||
|
||||
- name: Setup and install composer
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
|
||||
- name: Install Composer dependencies
|
||||
if: steps.cache-deps.outputs.cache-hit != 'true'
|
||||
run: pnpm nx composer-install woocommerce
|
||||
|
||||
- name: Build Admin feature config
|
||||
working-directory: ./
|
||||
run: |
|
||||
pnpm nx build:feature-config woocommerce
|
||||
|
||||
|
|
|
@ -4,20 +4,17 @@ on:
|
|||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
working-directory: plugins/woocommerce
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
jobs:
|
||||
test:
|
||||
name: Code sniff (PHP 7.4, WP Latest)
|
||||
timeout-minutes: 15
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Cancel Previous Runs
|
||||
uses: styfle/cancel-workflow-action@0.7.0
|
||||
with:
|
||||
access_token: ${{ github.token }}
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 100
|
||||
|
||||
|
@ -32,25 +29,31 @@ jobs:
|
|||
php --version
|
||||
composer --version
|
||||
|
||||
- name: Get cached composer directories
|
||||
uses: actions/cache@v2
|
||||
- name: Get cached composer and pnpm directories
|
||||
uses: actions/cache@v3
|
||||
id: cache-deps
|
||||
with:
|
||||
path: |
|
||||
./packages
|
||||
./vendor
|
||||
key: ${{ runner.os }}-${{ hashFiles('./composer.lock') }}
|
||||
~/.pnpm-store
|
||||
plugins/woocommerce/packages
|
||||
plugins/woocommerce/**/vendor
|
||||
key: ${{ runner.os }}-npm-composer-${{ hashFiles('**/composer.lock', '**/pnpm-lock.yaml') }}
|
||||
|
||||
- name: Install PNPM and install dependencies
|
||||
run: |
|
||||
npm install -g pnpm
|
||||
pnpm install
|
||||
- name: Install PNPM
|
||||
run: npm install -g pnpm@^6.24.2
|
||||
|
||||
- name: Setup and install composer
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
|
||||
- name: Install Composer dependencies
|
||||
if: steps.cache-deps.outputs.cache-hit != 'true'
|
||||
run: pnpm nx composer-install woocommerce
|
||||
|
||||
- name: Run code sniff
|
||||
continue-on-error: true
|
||||
working-directory: plugins/woocommerce
|
||||
run: ./tests/bin/phpcs.sh "${{ github.event.pull_request.base.sha }}" "${{ github.event.after }}"
|
||||
|
||||
- name: Show PHPCS results in PR
|
||||
working-directory: plugins/woocommerce
|
||||
run: cs2pr ./phpcs-report.xml
|
||||
|
|
|
@ -6,7 +6,7 @@ concurrency:
|
|||
jobs:
|
||||
changelogger_used:
|
||||
name: Changelogger use
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-20.04
|
||||
timeout-minutes: 5
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
|
|
@ -6,29 +6,38 @@ on:
|
|||
- 'packages/js/**/**'
|
||||
- 'plugins/woocommerce-admin/client/**'
|
||||
- '!**.md'
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
lint-test-js:
|
||||
name: Lint and Test JS
|
||||
runs-on: ubuntu-18.04
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Cancel Previous Runs
|
||||
uses: styfle/cancel-workflow-action@0.7.0
|
||||
with:
|
||||
access_token: ${{ github.token }}
|
||||
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '16'
|
||||
|
||||
- name: Install PNPM and install dependencies
|
||||
run: npm install -g pnpm && pnpm install
|
||||
- name: Cache modules
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.pnpm-store
|
||||
key: ${{ runner.os }}-npm-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||
|
||||
- name: Install PNPM
|
||||
run: npm install -g pnpm@^6.24.2
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
|
||||
- name: Lint
|
||||
run: |
|
||||
pnpm nx build woocommerce-admin
|
||||
pnpm nx lint woocommerce-admin
|
||||
pnpm nx lint:js-packages woocommerce-admin
|
||||
|
||||
|
|
|
@ -4,16 +4,14 @@ on:
|
|||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
label_project:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Cancel Previous Runs
|
||||
uses: styfle/cancel-workflow-action@0.7.0
|
||||
with:
|
||||
access_token: ${{ github.token }}
|
||||
|
||||
- uses: actions/labeler@v3
|
||||
with:
|
||||
repo-token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
|
|
|
@ -1,110 +1,127 @@
|
|||
name: Run smoke tests against pull request.
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- trunk
|
||||
types:
|
||||
- labeled
|
||||
pull_request:
|
||||
branches:
|
||||
- trunk
|
||||
types:
|
||||
- labeled
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
prcheck:
|
||||
name: Smoke test a pull request.
|
||||
if: "${{ contains(github.event.label.name, 'run: smoke tests') }}"
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- name: Cancel Previous Runs
|
||||
uses: styfle/cancel-workflow-action@0.7.0
|
||||
with:
|
||||
access_token: ${{ github.token }}
|
||||
prcheck:
|
||||
name: Smoke test a pull request.
|
||||
if: "${{ contains(github.event.label.name, 'run: smoke tests') }}"
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Create dirs.
|
||||
run: |
|
||||
mkdir -p code/woocommerce
|
||||
mkdir -p package/woocommerce
|
||||
mkdir -p tmp/woocommerce
|
||||
|
||||
- name: Create dirs.
|
||||
run: |
|
||||
mkdir -p code/woocommerce
|
||||
mkdir -p package/woocommerce
|
||||
mkdir -p tmp/woocommerce
|
||||
mkdir -p node_modules
|
||||
- name: Checkout code.
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: package/woocommerce
|
||||
|
||||
- name: Checkout code.
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
path: package/woocommerce
|
||||
- name: Get cached composer and pnpm directories
|
||||
uses: actions/cache@v3
|
||||
id: cache-deps
|
||||
with:
|
||||
path: |
|
||||
~/.pnpm-store
|
||||
package/woocommerce/plugins/woocommerce/packages
|
||||
package/woocommerce/plugins/woocommerce/**/vendor
|
||||
key: ${{ runner.os }}-smoke-test-npm-composer-${{ hashFiles('**/composer.lock', '**/pnpm-lock.yaml') }}
|
||||
|
||||
- name: Install prerequisites.
|
||||
working-directory: package/woocommerce/plugins/woocommerce
|
||||
id: installation
|
||||
run: |
|
||||
npm install -g pnpm
|
||||
pnpm install
|
||||
pnpm nx composer-install-no-dev woocommerce
|
||||
pnpm nx build-assets woocommerce
|
||||
pnpm install jest
|
||||
- name: Install PNPM
|
||||
run: npm install -g pnpm@^6.24.2
|
||||
|
||||
- name: Run smoke test.
|
||||
working-directory: package/woocommerce/plugins/woocommerce
|
||||
if: always()
|
||||
env:
|
||||
SMOKE_TEST_URL: ${{ secrets.SMOKE_TEST_URL }}
|
||||
SMOKE_TEST_ADMIN_USER: ${{ secrets.SMOKE_TEST_ADMIN_USER }}
|
||||
SMOKE_TEST_ADMIN_PASSWORD: ${{ secrets.SMOKE_TEST_ADMIN_PASSWORD }}
|
||||
SMOKE_TEST_ADMIN_USER_EMAIL: ${{ secrets.SMOKE_TEST_ADMIN_USER_EMAIL }}
|
||||
SMOKE_TEST_CUSTOMER_USER: ${{ secrets.SMOKE_TEST_CUSTOMER_USER }}
|
||||
SMOKE_TEST_CUSTOMER_PASSWORD: ${{ secrets.SMOKE_TEST_CUSTOMER_PASSWORD }}
|
||||
WC_E2E_SCREENSHOTS: 1
|
||||
E2E_RETEST: 1
|
||||
E2E_SLACK_TOKEN: ${{ secrets.SMOKE_TEST_SLACK_TOKEN }}
|
||||
E2E_SLACK_CHANNEL: ${{ secrets.SMOKE_TEST_SLACK_CHANNEL }}
|
||||
UPDATE_WC: 1
|
||||
DEFAULT_TIMEOUT_OVERRIDE: 120000
|
||||
run: |
|
||||
pnpx wc-e2e test:e2e tests/e2e/specs/smoke-tests/update-woocommerce.js
|
||||
- name: Install dependencies
|
||||
working-directory: package/woocommerce/plugins/woocommerce
|
||||
run: pnpm install
|
||||
|
||||
- name: Post Smoke tests results comment on PR
|
||||
if: always()
|
||||
uses: actions/github-script@v5
|
||||
env:
|
||||
TITLE: 'Smoke Test Results'
|
||||
SMOKE_TEST_URL: ${{ secrets.SMOKE_TEST_URL }}
|
||||
with:
|
||||
github-token: ${{secrets.GITHUB_TOKEN}}
|
||||
script: |
|
||||
const script = require( './package/woocommerce/packages/js/e2e-environment/bin/post-results-to-github-pr.js' )
|
||||
await script({github, context})
|
||||
- name: Install Composer dependencies
|
||||
working-directory: package/woocommerce/plugins/woocommerce
|
||||
if: steps.cache-deps.outputs.cache-hit != 'true'
|
||||
run: pnpm nx composer-install-no-dev woocommerce
|
||||
|
||||
- name: Run E2E tests.
|
||||
working-directory: package/woocommerce/plugins/woocommerce
|
||||
if: always()
|
||||
env:
|
||||
SMOKE_TEST_URL: ${{ secrets.SMOKE_TEST_URL }}
|
||||
SMOKE_TEST_ADMIN_USER: ${{ secrets.SMOKE_TEST_ADMIN_USER }}
|
||||
SMOKE_TEST_ADMIN_PASSWORD: ${{ secrets.SMOKE_TEST_ADMIN_PASSWORD }}
|
||||
SMOKE_TEST_ADMIN_USER_EMAIL: ${{ secrets.SMOKE_TEST_ADMIN_USER_EMAIL }}
|
||||
SMOKE_TEST_CUSTOMER_USER: ${{ secrets.SMOKE_TEST_CUSTOMER_USER }}
|
||||
SMOKE_TEST_CUSTOMER_PASSWORD: ${{ secrets.SMOKE_TEST_CUSTOMER_PASSWORD }}
|
||||
WC_E2E_SCREENSHOTS: 1
|
||||
E2E_RETEST: 1
|
||||
E2E_SLACK_TOKEN: ${{ secrets.SMOKE_TEST_SLACK_TOKEN }}
|
||||
E2E_SLACK_CHANNEL: ${{ secrets.SMOKE_TEST_SLACK_CHANNEL }}
|
||||
UPDATE_WC: 1
|
||||
DEFAULT_TIMEOUT_OVERRIDE: 120000
|
||||
run: |
|
||||
pnpx wc-e2e test:e2e
|
||||
- name: Install prerequisites.
|
||||
working-directory: package/woocommerce/plugins/woocommerce
|
||||
id: installation
|
||||
run: |
|
||||
pnpm nx build-assets woocommerce
|
||||
pnpm install jest
|
||||
|
||||
- name: Post E2E tests results comment on PR
|
||||
if: always()
|
||||
uses: actions/github-script@v5
|
||||
env:
|
||||
TITLE: 'E2E Test Results'
|
||||
SMOKE_TEST_URL: ${{ secrets.SMOKE_TEST_URL }}
|
||||
with:
|
||||
github-token: ${{secrets.GITHUB_TOKEN}}
|
||||
script: |
|
||||
const script = require( './package/woocommerce/packages/js/e2e-environment/bin/post-results-to-github-pr.js' )
|
||||
await script({github, context})
|
||||
- name: Run smoke test.
|
||||
working-directory: package/woocommerce/plugins/woocommerce
|
||||
if: always()
|
||||
env:
|
||||
SMOKE_TEST_URL: ${{ secrets.SMOKE_TEST_URL }}
|
||||
SMOKE_TEST_ADMIN_USER: ${{ secrets.SMOKE_TEST_ADMIN_USER }}
|
||||
SMOKE_TEST_ADMIN_PASSWORD: ${{ secrets.SMOKE_TEST_ADMIN_PASSWORD }}
|
||||
SMOKE_TEST_ADMIN_USER_EMAIL: ${{ secrets.SMOKE_TEST_ADMIN_USER_EMAIL }}
|
||||
SMOKE_TEST_CUSTOMER_USER: ${{ secrets.SMOKE_TEST_CUSTOMER_USER }}
|
||||
SMOKE_TEST_CUSTOMER_PASSWORD: ${{ secrets.SMOKE_TEST_CUSTOMER_PASSWORD }}
|
||||
WC_E2E_SCREENSHOTS: 1
|
||||
E2E_RETEST: 1
|
||||
E2E_SLACK_TOKEN: ${{ secrets.SMOKE_TEST_SLACK_TOKEN }}
|
||||
E2E_SLACK_CHANNEL: ${{ secrets.SMOKE_TEST_SLACK_CHANNEL }}
|
||||
UPDATE_WC: 1
|
||||
DEFAULT_TIMEOUT_OVERRIDE: 120000
|
||||
run: |
|
||||
pnpm exec wc-e2e test:e2e tests/e2e/specs/smoke-tests/update-woocommerce.js
|
||||
|
||||
- name: Remove label from pull request.
|
||||
if: |
|
||||
always()
|
||||
&& contains( github.event.pull_request.labels.*.name, format('run{0} smoke tests', ':'))
|
||||
uses: actions-ecosystem/action-remove-labels@v1
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
labels: 'run: smoke tests'
|
||||
- name: Post Smoke tests results comment on PR
|
||||
if: always()
|
||||
uses: actions/github-script@v5
|
||||
env:
|
||||
TITLE: 'Smoke Test Results'
|
||||
SMOKE_TEST_URL: ${{ secrets.SMOKE_TEST_URL }}
|
||||
with:
|
||||
github-token: ${{secrets.GITHUB_TOKEN}}
|
||||
script: |
|
||||
const script = require( './package/woocommerce/packages/js/e2e-environment/bin/post-results-to-github-pr.js' )
|
||||
await script({github, context})
|
||||
|
||||
- name: Run E2E tests.
|
||||
working-directory: package/woocommerce/plugins/woocommerce
|
||||
if: always()
|
||||
env:
|
||||
SMOKE_TEST_URL: ${{ secrets.SMOKE_TEST_URL }}
|
||||
SMOKE_TEST_ADMIN_USER: ${{ secrets.SMOKE_TEST_ADMIN_USER }}
|
||||
SMOKE_TEST_ADMIN_PASSWORD: ${{ secrets.SMOKE_TEST_ADMIN_PASSWORD }}
|
||||
SMOKE_TEST_ADMIN_USER_EMAIL: ${{ secrets.SMOKE_TEST_ADMIN_USER_EMAIL }}
|
||||
SMOKE_TEST_CUSTOMER_USER: ${{ secrets.SMOKE_TEST_CUSTOMER_USER }}
|
||||
SMOKE_TEST_CUSTOMER_PASSWORD: ${{ secrets.SMOKE_TEST_CUSTOMER_PASSWORD }}
|
||||
WC_E2E_SCREENSHOTS: 1
|
||||
E2E_RETEST: 1
|
||||
E2E_SLACK_TOKEN: ${{ secrets.SMOKE_TEST_SLACK_TOKEN }}
|
||||
E2E_SLACK_CHANNEL: ${{ secrets.SMOKE_TEST_SLACK_CHANNEL }}
|
||||
UPDATE_WC: 1
|
||||
DEFAULT_TIMEOUT_OVERRIDE: 120000
|
||||
run: |
|
||||
pnpm exec wc-e2e test:e2e
|
||||
|
||||
- name: Post E2E tests results comment on PR
|
||||
if: always()
|
||||
uses: actions/github-script@v5
|
||||
env:
|
||||
TITLE: 'E2E Test Results'
|
||||
SMOKE_TEST_URL: ${{ secrets.SMOKE_TEST_URL }}
|
||||
with:
|
||||
github-token: ${{secrets.GITHUB_TOKEN}}
|
||||
script: |
|
||||
const script = require( './package/woocommerce/packages/js/e2e-environment/bin/post-results-to-github-pr.js' )
|
||||
await script({github, context})
|
||||
|
||||
- name: Remove label from pull request.
|
||||
if: |
|
||||
always()
|
||||
&& contains( github.event.pull_request.labels.*.name, format('run{0} smoke tests', ':'))
|
||||
uses: actions-ecosystem/action-remove-labels@v1
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
labels: 'run: smoke tests'
|
||||
|
|
|
@ -4,12 +4,15 @@ on:
|
|||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
working-directory: plugins/woocommerce
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: PHP ${{ matrix.php }} WP ${{ matrix.wp }}
|
||||
timeout-minutes: 20
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-20.04
|
||||
continue-on-error: ${{ matrix.wp == 'nightly' }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
|
@ -32,11 +35,6 @@ jobs:
|
|||
- 3306:3306
|
||||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5
|
||||
steps:
|
||||
- name: Cancel Previous Runs
|
||||
uses: styfle/cancel-workflow-action@0.7.0
|
||||
with:
|
||||
access_token: ${{ github.token }}
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
|
@ -53,37 +51,45 @@ jobs:
|
|||
php --version
|
||||
composer --version
|
||||
|
||||
- name: Get cached composer directories
|
||||
uses: actions/cache@v2
|
||||
- name: Get cached composer and pnpm directories
|
||||
uses: actions/cache@v3
|
||||
id: cache-deps
|
||||
with:
|
||||
path: |
|
||||
./packages
|
||||
./vendor
|
||||
key: ${{ runner.os }}-${{ hashFiles('./composer.lock') }}
|
||||
~/.pnpm-store
|
||||
plugins/woocommerce/packages
|
||||
plugins/woocommerce/**/vendor
|
||||
key: ${{ runner.os }}-npm-composer-${{ hashFiles('**/composer.lock', '**/pnpm-lock.yaml') }}
|
||||
|
||||
- name: Install PNPM
|
||||
run: npm install -g pnpm@^6.24.2
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
|
||||
- name: Install Composer dependencies
|
||||
if: steps.cache-deps.outputs.cache-hit != 'true'
|
||||
run: pnpm nx composer-install woocommerce
|
||||
|
||||
- name: Install PNPM and install dependencies
|
||||
run: |
|
||||
npm install -g pnpm
|
||||
pnpm install
|
||||
pnpm nx composer-install woocommerce
|
||||
- name: Build Admin feature config
|
||||
working-directory: ./
|
||||
run: |
|
||||
pnpm nx build:feature-config woocommerce
|
||||
|
||||
- name: Add PHP8 Compatibility.
|
||||
run: |
|
||||
if [ "$(php -r "echo version_compare(PHP_VERSION,'8.0','>=');")" ]; then
|
||||
cd plugins/woocommerce
|
||||
curl -L https://github.com/woocommerce/phpunit/archive/add-compatibility-with-php8-to-phpunit-7.zip -o /tmp/phpunit-7.5-fork.zip
|
||||
unzip -d /tmp/phpunit-7.5-fork /tmp/phpunit-7.5-fork.zip
|
||||
composer bin phpunit config --unset platform
|
||||
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/
|
||||
composer dump-autoload
|
||||
pnpm nx composer-dump-autoload woocommerce
|
||||
fi
|
||||
|
||||
- name: Init DB and WP
|
||||
working-directory: plugins/woocommerce
|
||||
run: ./tests/bin/install.sh woo_test root root 127.0.0.1 ${{ matrix.wp }}
|
||||
|
||||
- name: Run tests
|
||||
|
|
|
@ -7,7 +7,7 @@ jobs:
|
|||
process-pull-request-after-merge:
|
||||
name: "Process a pull request after it's merged"
|
||||
if: github.event.pull_request.merged == true
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: "Get the action scripts"
|
||||
run: |
|
||||
|
|
|
@ -6,7 +6,7 @@ on:
|
|||
jobs:
|
||||
maybe-create-next-milestone-and-release-branch:
|
||||
name: "Maybe create next milestone and release branch"
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: "Get the action script"
|
||||
run: |
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
name: Check daily smoke test site status.
|
||||
on:
|
||||
schedule:
|
||||
- cron: '25 7 * * *'
|
||||
|
||||
jobs:
|
||||
ping_site:
|
||||
runs-on: ubuntu-20.04
|
||||
name: Check site and notify if not found
|
||||
steps:
|
||||
- name: Check site status
|
||||
id: sitecheck
|
||||
uses: srt32/uptime@958231f4d95c117f08eb0fc70907e80d0dfedf2b
|
||||
with:
|
||||
url-to-hit: "${{ secrets.SMOKE_TEST_URL }}ready/"
|
||||
expected-statuses: "200,301"
|
||||
- name: Send message to Slack API
|
||||
if: failure()
|
||||
uses: archive/github-actions-slack@deecc2edc496dc642d643de1d7cf3a47f51fb27a
|
||||
id: notify
|
||||
with:
|
||||
slack-bot-user-oauth-access-token: ${{ secrets.SMOKE_TEST_SLACK_TOKEN }}
|
||||
slack-channel: ${{ secrets.SMOKE_TEST_SLACK_CHANNEL }}
|
||||
slack-text: ':warning: <!subteam^${{ secrets.SMOKE_TEST_SLACK_GROUP }}> FYI the URL ${{ secrets.SMOKE_TEST_URL }}ready/ appears to be returning `404 not found` :x:'
|
|
@ -1,154 +1,167 @@
|
|||
name: Smoke test daily
|
||||
on:
|
||||
schedule:
|
||||
- cron: '25 3 * * *'
|
||||
schedule:
|
||||
- cron: '25 3 * * *'
|
||||
jobs:
|
||||
login-run:
|
||||
name: Daily smoke test on trunk.
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
login-run:
|
||||
name: Daily smoke test on trunk.
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Create dirs.
|
||||
run: |
|
||||
mkdir -p code/woocommerce
|
||||
mkdir -p package/woocommerce
|
||||
mkdir -p tmp/woocommerce
|
||||
|
||||
- name: Create dirs.
|
||||
run: |
|
||||
mkdir -p code/woocommerce
|
||||
mkdir -p package/woocommerce
|
||||
mkdir -p tmp/woocommerce
|
||||
mkdir -p node_modules
|
||||
- name: Checkout code.
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: package/woocommerce
|
||||
ref: trunk
|
||||
|
||||
- name: Checkout code.
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
path: package/woocommerce
|
||||
ref: trunk
|
||||
- name: Install prerequisites.
|
||||
working-directory: package/woocommerce/plugins/woocommerce
|
||||
run: |
|
||||
npm install -g pnpm@^6.24.2
|
||||
pnpm install
|
||||
pnpm nx composer-install-no-dev woocommerce
|
||||
pnpm nx build-assets woocommerce
|
||||
pnpm install jest
|
||||
|
||||
- name: Install prerequisites.
|
||||
working-directory: package/woocommerce/plugins/woocommerce
|
||||
run: |
|
||||
npm install -g pnpm
|
||||
pnpm install
|
||||
pnpm nx composer-install-no-dev woocommerce
|
||||
pnpm nx build-assets woocommerce
|
||||
pnpm install jest
|
||||
|
||||
- name: Run smoke test.
|
||||
working-directory: package/woocommerce/plugins/woocommerce
|
||||
env:
|
||||
SMOKE_TEST_URL: ${{ secrets.SMOKE_TEST_URL }}
|
||||
SMOKE_TEST_ADMIN_USER: ${{ secrets.SMOKE_TEST_ADMIN_USER }}
|
||||
SMOKE_TEST_ADMIN_PASSWORD: ${{ secrets.SMOKE_TEST_ADMIN_PASSWORD }}
|
||||
SMOKE_TEST_ADMIN_USER_EMAIL: ${{ secrets.SMOKE_TEST_ADMIN_USER_EMAIL }}
|
||||
SMOKE_TEST_CUSTOMER_USER: ${{ secrets.SMOKE_TEST_CUSTOMER_USER }}
|
||||
SMOKE_TEST_CUSTOMER_PASSWORD: ${{ secrets.SMOKE_TEST_CUSTOMER_PASSWORD }}
|
||||
WC_E2E_SCREENSHOTS: 1
|
||||
E2E_RETEST: 1
|
||||
E2E_SLACK_TOKEN: ${{ secrets.SMOKE_TEST_SLACK_TOKEN }}
|
||||
E2E_SLACK_CHANNEL: ${{ secrets.SMOKE_TEST_SLACK_CHANNEL }}
|
||||
UPDATE_WC: 1
|
||||
DEFAULT_TIMEOUT_OVERRIDE: 120000
|
||||
BASE_URL: ${{ secrets.SMOKE_TEST_URL }}
|
||||
USER_KEY: ${{ secrets.SMOKE_TEST_ADMIN_USER }}
|
||||
USER_SECRET: ${{ secrets.SMOKE_TEST_ADMIN_PASSWORD }}
|
||||
run: |
|
||||
pnpx wc-e2e test:e2e tests/e2e/specs/smoke-tests/update-woocommerce.js
|
||||
pnpx wc-e2e test:e2e
|
||||
pnpx wc-api-tests test api
|
||||
- name: Run smoke test.
|
||||
working-directory: package/woocommerce/plugins/woocommerce
|
||||
env:
|
||||
SMOKE_TEST_URL: ${{ secrets.SMOKE_TEST_URL }}
|
||||
SMOKE_TEST_ADMIN_USER: ${{ secrets.SMOKE_TEST_ADMIN_USER }}
|
||||
SMOKE_TEST_ADMIN_PASSWORD: ${{ secrets.SMOKE_TEST_ADMIN_PASSWORD }}
|
||||
SMOKE_TEST_ADMIN_USER_EMAIL: ${{ secrets.SMOKE_TEST_ADMIN_USER_EMAIL }}
|
||||
SMOKE_TEST_CUSTOMER_USER: ${{ secrets.SMOKE_TEST_CUSTOMER_USER }}
|
||||
SMOKE_TEST_CUSTOMER_PASSWORD: ${{ secrets.SMOKE_TEST_CUSTOMER_PASSWORD }}
|
||||
WC_E2E_SCREENSHOTS: 1
|
||||
E2E_RETEST: 1
|
||||
E2E_SLACK_TOKEN: ${{ secrets.SMOKE_TEST_SLACK_TOKEN }}
|
||||
E2E_SLACK_CHANNEL: 'C01U0H617MY'
|
||||
UPDATE_WC: 1
|
||||
DEFAULT_TIMEOUT_OVERRIDE: 120000
|
||||
BASE_URL: ${{ secrets.SMOKE_TEST_URL }}
|
||||
USER_KEY: ${{ secrets.SMOKE_TEST_ADMIN_USER }}
|
||||
USER_SECRET: ${{ secrets.SMOKE_TEST_ADMIN_PASSWORD }}
|
||||
run: |
|
||||
pnpm exec wc-e2e test:e2e tests/e2e/specs/smoke-tests/update-woocommerce.js
|
||||
pnpm exec wc-e2e test:e2e
|
||||
pnpm exec wc-api-tests test api
|
||||
|
||||
build:
|
||||
name: Build zip for PR
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
build:
|
||||
name: Build zip for PR
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Build
|
||||
id: build
|
||||
uses: woocommerce/action-build@trunk
|
||||
env:
|
||||
BUILD_ENV: e2e
|
||||
- name: Get cached composer and pnpm directories
|
||||
uses: actions/cache@v3
|
||||
id: cache-deps
|
||||
with:
|
||||
path: |
|
||||
~/.pnpm-store
|
||||
plugins/woocommerce/packages
|
||||
plugins/woocommerce/**/vendor
|
||||
key: ${{ runner.os }}-npm-composer-${{ hashFiles('**/composer.lock', '**/pnpm-lock.yaml') }}
|
||||
|
||||
- name: Upload PR zip
|
||||
uses: actions/upload-artifact@v2
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
name: woocommerce
|
||||
path: ${{ steps.build.outputs.zip_path }}
|
||||
retention-days: 7
|
||||
|
||||
test-plugins:
|
||||
name: Smoke tests with ${{ matrix.plugin }} plugin installed
|
||||
runs-on: ubuntu-18.04
|
||||
needs: [build]
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- plugin: 'WooCommerce Payments'
|
||||
repo: 'automattic/woocommerce-payments'
|
||||
- plugin: 'WooCommerce PayPal Payments'
|
||||
repo: 'woocommerce/woocommerce-paypal-payments'
|
||||
- plugin: 'WooCommerce Shipping & Tax'
|
||||
repo: 'automattic/woocommerce-services'
|
||||
- plugin: 'WooCommerce Subscriptions'
|
||||
repo: WC_SUBSCRIPTIONS_REPO
|
||||
private: true
|
||||
- plugin: 'WordPress SEO' # Yoast SEO in the UI, but the slug is wordpress-seo
|
||||
repo: 'Yoast/wordpress-seo'
|
||||
- plugin: 'Contact Form 7'
|
||||
repo: 'takayukister/contact-form-7'
|
||||
steps:
|
||||
- name: Create dirs.
|
||||
run: |
|
||||
mkdir -p code/woocommerce
|
||||
mkdir -p package/woocommerce
|
||||
mkdir -p tmp/woocommerce
|
||||
mkdir -p node_modules
|
||||
- name: Install PNPM
|
||||
run: npm install -g pnpm@^6.24.2
|
||||
|
||||
- name: Checkout code.
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
path: package/woocommerce
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '7.4'
|
||||
|
||||
- name: Install PNPM and install dependencies
|
||||
working-directory: package/woocommerce
|
||||
run: |
|
||||
npm install -g pnpm
|
||||
pnpm install
|
||||
- name: Build zip
|
||||
working-directory: plugins/woocommerce
|
||||
run: bash bin/build-zip.sh
|
||||
|
||||
- name: Load docker images and start containers.
|
||||
working-directory: package/woocommerce/plugins/woocommerce
|
||||
run: pnpx wc-e2e docker:up
|
||||
- name: Upload PR zip
|
||||
uses: actions/upload-artifact@v3
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
name: woocommerce
|
||||
path: plugins/woocommerce/woocommerce.zip
|
||||
retention-days: 7
|
||||
|
||||
- name: Move current directory to code. We will install zip file in this dir later.
|
||||
run: mv ./package/woocommerce/plugins/woocommerce/* ./code/woocommerce
|
||||
test-plugins:
|
||||
name: Smoke tests with ${{ matrix.plugin }} plugin installed
|
||||
runs-on: ubuntu-20.04
|
||||
needs: [build]
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- plugin: 'WooCommerce Payments'
|
||||
repo: 'automattic/woocommerce-payments'
|
||||
- plugin: 'WooCommerce PayPal Payments'
|
||||
repo: 'woocommerce/woocommerce-paypal-payments'
|
||||
- plugin: 'WooCommerce Shipping & Tax'
|
||||
repo: 'automattic/woocommerce-services'
|
||||
- plugin: 'WooCommerce Subscriptions'
|
||||
repo: WC_SUBSCRIPTIONS_REPO
|
||||
private: true
|
||||
- plugin: 'WordPress SEO' # Yoast SEO in the UI, but the slug is wordpress-seo
|
||||
repo: 'Yoast/wordpress-seo'
|
||||
- plugin: 'Contact Form 7'
|
||||
repo: 'takayukister/contact-form-7'
|
||||
steps:
|
||||
- name: Create dirs.
|
||||
run: |
|
||||
mkdir -p code/woocommerce
|
||||
mkdir -p package/woocommerce
|
||||
mkdir -p tmp/woocommerce
|
||||
|
||||
- name: Download WooCommerce ZIP.
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: woocommerce
|
||||
path: tmp
|
||||
- name: Checkout code.
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: package/woocommerce
|
||||
|
||||
- name: Extract and replace WooCommerce zip.
|
||||
working-directory: tmp
|
||||
run: |
|
||||
unzip woocommerce.zip -d woocommerce
|
||||
mv woocommerce/woocommerce/* ../package/woocommerce/plugins/woocommerce/
|
||||
- name: Install PNPM and install dependencies
|
||||
working-directory: package/woocommerce
|
||||
run: |
|
||||
npm install -g pnpm@^6.24.2
|
||||
pnpm install
|
||||
|
||||
- name: Install dependencies again
|
||||
working-directory: package/woocommerce
|
||||
run: |
|
||||
npm install -g pnpm
|
||||
pnpm install
|
||||
- name: Load docker images and start containers.
|
||||
working-directory: package/woocommerce/plugins/woocommerce
|
||||
run: pnpm exec wc-e2e docker:up
|
||||
|
||||
- name: Run tests command.
|
||||
working-directory: package/woocommerce/plugins/woocommerce
|
||||
env:
|
||||
WC_E2E_SCREENSHOTS: 1
|
||||
E2E_SLACK_TOKEN: ${{ secrets.SMOKE_TEST_SLACK_TOKEN }}
|
||||
E2E_SLACK_CHANNEL: ${{ secrets.RELEASE_TEST_SLACK_CHANNEL }}
|
||||
PLUGIN_REPOSITORY: ${{ matrix.private && secrets[matrix.repo] || matrix.repo }}
|
||||
PLUGIN_NAME: ${{ matrix.plugin }}
|
||||
GITHUB_TOKEN: ${{ secrets.E2E_GH_TOKEN }}
|
||||
run: |
|
||||
pnpx wc-e2e test:e2e tests/e2e/specs/smoke-tests/upload-plugin.js
|
||||
pnpx wc-e2e test:e2e
|
||||
- name: Move current directory to code. We will install zip file in this dir later.
|
||||
run: mv ./package/woocommerce/plugins/woocommerce/* ./code/woocommerce
|
||||
|
||||
- name: Download WooCommerce ZIP.
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: woocommerce
|
||||
path: tmp
|
||||
|
||||
- name: Extract and replace WooCommerce zip.
|
||||
working-directory: tmp
|
||||
run: |
|
||||
unzip woocommerce.zip -d woocommerce
|
||||
mv woocommerce/woocommerce/* ../package/woocommerce/plugins/woocommerce/
|
||||
|
||||
- name: Install dependencies again
|
||||
working-directory: package/woocommerce
|
||||
run: |
|
||||
npm install -g pnpm@^6.24.2
|
||||
pnpm install
|
||||
|
||||
- name: Run tests command.
|
||||
working-directory: package/woocommerce/plugins/woocommerce
|
||||
env:
|
||||
WC_E2E_SCREENSHOTS: 1
|
||||
E2E_SLACK_TOKEN: ${{ secrets.SMOKE_TEST_SLACK_TOKEN }}
|
||||
E2E_SLACK_CHANNEL: ${{ secrets.RELEASE_TEST_SLACK_CHANNEL }}
|
||||
PLUGIN_REPOSITORY: ${{ matrix.private && secrets[matrix.repo] || matrix.repo }}
|
||||
PLUGIN_NAME: ${{ matrix.plugin }}
|
||||
GITHUB_TOKEN: ${{ secrets.E2E_GH_TOKEN }}
|
||||
run: |
|
||||
pnpm exec wc-e2e test:e2e tests/e2e/specs/smoke-tests/upload-plugin.js
|
||||
pnpm exec wc-e2e test:e2e
|
||||
|
|
|
@ -1,199 +1,197 @@
|
|||
name: Smoke test release
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
release_id:
|
||||
description: 'WooCommerce Release Id'
|
||||
required: true
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
release_id:
|
||||
description: 'WooCommerce Release Id'
|
||||
required: true
|
||||
jobs:
|
||||
login-run:
|
||||
name: Daily smoke test on release.
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
login-run:
|
||||
name: Daily smoke test on release.
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Create dirs.
|
||||
run: |
|
||||
mkdir -p code/woocommerce
|
||||
mkdir -p package/woocommerce
|
||||
mkdir -p tmp/woocommerce
|
||||
mkdir -p node_modules
|
||||
|
||||
- name: Create dirs.
|
||||
run: |
|
||||
mkdir -p code/woocommerce
|
||||
mkdir -p package/woocommerce
|
||||
mkdir -p tmp/woocommerce
|
||||
mkdir -p node_modules
|
||||
- name: Checkout code.
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: package/woocommerce
|
||||
ref: trunk
|
||||
|
||||
- name: Checkout code.
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
path: package/woocommerce
|
||||
ref: trunk
|
||||
- name: Install prerequisites.
|
||||
working-directory: package/woocommerce/plugins/woocommerce
|
||||
run: |
|
||||
npm install -g pnpm@^6.24.2
|
||||
pnpm install
|
||||
pnpm nx composer-install-no-dev woocommerce
|
||||
pnpm nx build-assets woocommerce
|
||||
pnpm install jest
|
||||
|
||||
- name: Install prerequisites.
|
||||
working-directory: package/woocommerce/plugins/woocommerce
|
||||
run: |
|
||||
npm install -g pnpm
|
||||
pnpm install
|
||||
pnpm nx composer-install-no-dev woocommerce
|
||||
pnpm nx build-assets woocommerce
|
||||
pnpm install jest
|
||||
|
||||
- name: Run smoke test.
|
||||
working-directory: package/woocommerce/plugins/woocommerce
|
||||
env:
|
||||
SMOKE_TEST_URL: ${{ secrets.RELEASE_TEST_URL }}
|
||||
SMOKE_TEST_ADMIN_USER: ${{ secrets.RELEASE_TEST_ADMIN_USER }}
|
||||
SMOKE_TEST_ADMIN_PASSWORD: ${{ secrets.RELEASE_TEST_ADMIN_PASSWORD }}
|
||||
SMOKE_TEST_ADMIN_USER_EMAIL: ${{ secrets.RELEASE_TEST_ADMIN_USER_EMAIL }}
|
||||
SMOKE_TEST_CUSTOMER_USER: ${{ secrets.RELEASE_TEST_CUSTOMER_USER }}
|
||||
SMOKE_TEST_CUSTOMER_PASSWORD: ${{ secrets.RELEASE_TEST_CUSTOMER_PASSWORD }}
|
||||
WC_E2E_SCREENSHOTS: 1
|
||||
E2E_RETEST: 1
|
||||
E2E_SLACK_TOKEN: ${{ secrets.SMOKE_TEST_SLACK_TOKEN }}
|
||||
E2E_SLACK_CHANNEL: ${{ secrets.RELEASE_TEST_SLACK_CHANNEL }}
|
||||
TEST_RELEASE: 1
|
||||
UPDATE_WC: 1
|
||||
DEFAULT_TIMEOUT_OVERRIDE: 120000
|
||||
BASE_URL: ${{ secrets.RELEASE_TEST_URL }}
|
||||
USER_KEY: ${{ secrets.RELEASE_TEST_ADMIN_USER }}
|
||||
USER_SECRET: ${{ secrets.RELEASE_TEST_ADMIN_PASSWORD }}
|
||||
run: |
|
||||
pnpx wc-e2e test:e2e tests/e2e/specs/smoke-tests/update-woocommerce.js
|
||||
pnpx wc-e2e test:e2e
|
||||
pnpx wc-api-tests test api
|
||||
test-wp-version:
|
||||
name: Smoke test on L-${{ matrix.wp }} WordPress version
|
||||
runs-on: ubuntu-18.04
|
||||
strategy:
|
||||
matrix:
|
||||
wp: [ '1', '2' ]
|
||||
steps:
|
||||
- name: Run smoke test.
|
||||
working-directory: package/woocommerce/plugins/woocommerce
|
||||
env:
|
||||
SMOKE_TEST_URL: ${{ secrets.RELEASE_TEST_URL }}
|
||||
SMOKE_TEST_ADMIN_USER: ${{ secrets.RELEASE_TEST_ADMIN_USER }}
|
||||
SMOKE_TEST_ADMIN_PASSWORD: ${{ secrets.RELEASE_TEST_ADMIN_PASSWORD }}
|
||||
SMOKE_TEST_ADMIN_USER_EMAIL: ${{ secrets.RELEASE_TEST_ADMIN_USER_EMAIL }}
|
||||
SMOKE_TEST_CUSTOMER_USER: ${{ secrets.RELEASE_TEST_CUSTOMER_USER }}
|
||||
SMOKE_TEST_CUSTOMER_PASSWORD: ${{ secrets.RELEASE_TEST_CUSTOMER_PASSWORD }}
|
||||
WC_E2E_SCREENSHOTS: 1
|
||||
E2E_RETEST: 1
|
||||
E2E_SLACK_TOKEN: ${{ secrets.SMOKE_TEST_SLACK_TOKEN }}
|
||||
E2E_SLACK_CHANNEL: 'C02DS4NE72S'
|
||||
TEST_RELEASE: 1
|
||||
UPDATE_WC: 1
|
||||
DEFAULT_TIMEOUT_OVERRIDE: 120000
|
||||
BASE_URL: ${{ secrets.RELEASE_TEST_URL }}
|
||||
USER_KEY: ${{ secrets.RELEASE_TEST_ADMIN_USER }}
|
||||
USER_SECRET: ${{ secrets.RELEASE_TEST_ADMIN_PASSWORD }}
|
||||
run: |
|
||||
pnpm exec wc-e2e test:e2e tests/e2e/specs/smoke-tests/update-woocommerce.js
|
||||
pnpm exec wc-e2e test:e2e
|
||||
pnpm exec wc-api-tests test api
|
||||
test-wp-version:
|
||||
name: Smoke test on L-${{ matrix.wp }} WordPress version
|
||||
runs-on: ubuntu-20.04
|
||||
strategy:
|
||||
matrix:
|
||||
wp: ['1', '2']
|
||||
steps:
|
||||
- name: Create dirs.
|
||||
run: |
|
||||
mkdir -p code/woocommerce
|
||||
mkdir -p package/woocommerce
|
||||
mkdir -p tmp/woocommerce
|
||||
mkdir -p node_modules
|
||||
|
||||
- name: Create dirs.
|
||||
run: |
|
||||
mkdir -p code/woocommerce
|
||||
mkdir -p package/woocommerce
|
||||
mkdir -p tmp/woocommerce
|
||||
mkdir -p node_modules
|
||||
- name: Checkout code.
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: package/woocommerce
|
||||
- name: Fetch Asset ID
|
||||
id: fetch_asset_id
|
||||
uses: actions/github-script@v5
|
||||
env:
|
||||
RELEASE_ID: ${{ github.event.inputs.release_id }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
REPO: ${{ github.repository }}
|
||||
with:
|
||||
script: |
|
||||
const script = require( './package/woocommerce/.github/workflows/scripts/fetch-asset-id.js' )
|
||||
await script({github, context, core})
|
||||
|
||||
- name: Checkout code.
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
path: package/woocommerce
|
||||
- name: Fetch Asset ID
|
||||
id: fetch_asset_id
|
||||
uses: actions/github-script@v5
|
||||
env:
|
||||
RELEASE_ID: ${{ github.event.inputs.release_id }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
REPO: ${{ github.repository }}
|
||||
with:
|
||||
script: |
|
||||
const script = require( './package/woocommerce/.github/workflows/scripts/fetch-asset-id.js' )
|
||||
await script({github, context, core})
|
||||
- name: Install PNPM and install dependencies
|
||||
working-directory: package/woocommerce
|
||||
run: |
|
||||
npm install -g pnpm@^6.24.2
|
||||
pnpm install
|
||||
|
||||
- name: Install PNPM and install dependencies
|
||||
working-directory: package/woocommerce
|
||||
run: |
|
||||
npm install -g pnpm
|
||||
pnpm install
|
||||
- name: Load docker images and start containers.
|
||||
working-directory: package/woocommerce/plugins/woocommerce
|
||||
env:
|
||||
LATEST_WP_VERSION_MINUS: ${{ matrix.wp }}
|
||||
run: pnpm nx docker-up woocommerce
|
||||
|
||||
- name: Load docker images and start containers.
|
||||
working-directory: package/woocommerce/plugins/woocommerce
|
||||
env:
|
||||
LATEST_WP_VERSION_MINUS: ${{ matrix.wp }}
|
||||
run: pnpm nx docker-up woocommerce
|
||||
- name: Move current directory to code. We will install zip file in this dir later.
|
||||
run: mv ./package/woocommerce/plugins/woocommerce/* ./code/woocommerce
|
||||
|
||||
- name: Move current directory to code. We will install zip file in this dir later.
|
||||
run: mv ./package/woocommerce/plugins/woocommerce/* ./code/woocommerce
|
||||
- name: Download WooCommerce release zip
|
||||
working-directory: tmp
|
||||
run: |
|
||||
curl https://api.github.com/repos/${{ github.repository }}/releases/assets/${{ steps.fetch_asset_id.outputs.asset_id }} -LJOH 'Accept: application/octet-stream'
|
||||
|
||||
- name: Download WooCommerce release zip
|
||||
working-directory: tmp
|
||||
run: |
|
||||
curl https://api.github.com/repos/${{ github.repository }}/releases/assets/${{ steps.fetch_asset_id.outputs.asset_id }} -LJOH 'Accept: application/octet-stream'
|
||||
unzip woocommerce.zip -d woocommerce
|
||||
mv woocommerce/woocommerce/* ../package/woocommerce/plugins/woocommerce/
|
||||
|
||||
unzip woocommerce.zip -d woocommerce
|
||||
mv woocommerce/woocommerce/* ../package/woocommerce/plugins/woocommerce/
|
||||
- name: Run tests command.
|
||||
working-directory: package/woocommerce/plugins/woocommerce
|
||||
env:
|
||||
WC_E2E_SCREENSHOTS: 1
|
||||
E2E_SLACK_TOKEN: ${{ secrets.SMOKE_TEST_SLACK_TOKEN }}
|
||||
E2E_SLACK_CHANNEL: ${{ secrets.RELEASE_TEST_SLACK_CHANNEL }}
|
||||
run: pnpm nx test-e2e woocommerce
|
||||
|
||||
- name: Run tests command.
|
||||
working-directory: package/woocommerce/plugins/woocommerce
|
||||
env:
|
||||
WC_E2E_SCREENSHOTS: 1
|
||||
E2E_SLACK_TOKEN: ${{ secrets.SMOKE_TEST_SLACK_TOKEN }}
|
||||
E2E_SLACK_CHANNEL: ${{ secrets.RELEASE_TEST_SLACK_CHANNEL }}
|
||||
run: pnpm nx test-e2e woocommerce
|
||||
test-plugins:
|
||||
name: Smoke tests with ${{ matrix.plugin }} plugin installed
|
||||
runs-on: ubuntu-20.04
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- plugin: 'WooCommerce Payments'
|
||||
repo: 'automattic/woocommerce-payments'
|
||||
- plugin: 'WooCommerce PayPal Payments'
|
||||
repo: 'woocommerce/woocommerce-paypal-payments'
|
||||
- plugin: 'WooCommerce Shipping & Tax'
|
||||
repo: 'automattic/woocommerce-services'
|
||||
- plugin: 'WooCommerce Subscriptions'
|
||||
repo: WC_SUBSCRIPTIONS_REPO
|
||||
private: true
|
||||
- plugin: 'WordPress SEO' # Yoast SEO in the UI, but the slug is wordpress-seo
|
||||
repo: 'Yoast/wordpress-seo'
|
||||
- plugin: 'Contact Form 7'
|
||||
repo: 'takayukister/contact-form-7'
|
||||
steps:
|
||||
- name: Create dirs.
|
||||
run: |
|
||||
mkdir -p code/woocommerce
|
||||
mkdir -p package/woocommerce
|
||||
mkdir -p tmp/woocommerce
|
||||
mkdir -p node_modules
|
||||
|
||||
test-plugins:
|
||||
name: Smoke tests with ${{ matrix.plugin }} plugin installed
|
||||
runs-on: ubuntu-18.04
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- plugin: 'WooCommerce Payments'
|
||||
repo: 'automattic/woocommerce-payments'
|
||||
- plugin: 'WooCommerce PayPal Payments'
|
||||
repo: 'woocommerce/woocommerce-paypal-payments'
|
||||
- plugin: 'WooCommerce Shipping & Tax'
|
||||
repo: 'automattic/woocommerce-services'
|
||||
- plugin: 'WooCommerce Subscriptions'
|
||||
repo: WC_SUBSCRIPTIONS_REPO
|
||||
private: true
|
||||
- plugin: 'WordPress SEO' # Yoast SEO in the UI, but the slug is wordpress-seo
|
||||
repo: 'Yoast/wordpress-seo'
|
||||
- plugin: 'Contact Form 7'
|
||||
repo: 'takayukister/contact-form-7'
|
||||
steps:
|
||||
- name: Create dirs.
|
||||
run: |
|
||||
mkdir -p code/woocommerce
|
||||
mkdir -p package/woocommerce
|
||||
mkdir -p tmp/woocommerce
|
||||
mkdir -p node_modules
|
||||
- name: Checkout code.
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
path: package/woocommerce
|
||||
- name: Fetch Asset ID
|
||||
id: fetch_asset_id
|
||||
uses: actions/github-script@v5
|
||||
env:
|
||||
RELEASE_ID: ${{ github.event.inputs.release_id }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
REPO: ${{ github.repository }}
|
||||
with:
|
||||
script: |
|
||||
const script = require( './package/woocommerce/.github/workflows/scripts/fetch-asset-id.js' )
|
||||
await script({github, context, core})
|
||||
|
||||
- name: Checkout code.
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
path: package/woocommerce
|
||||
- name: Fetch Asset ID
|
||||
id: fetch_asset_id
|
||||
uses: actions/github-script@v5
|
||||
env:
|
||||
RELEASE_ID: ${{ github.event.inputs.release_id }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
REPO: ${{ github.repository }}
|
||||
with:
|
||||
script: |
|
||||
const script = require( './package/woocommerce/.github/workflows/scripts/fetch-asset-id.js' )
|
||||
await script({github, context, core})
|
||||
- name: Install PNPM and install dependencies
|
||||
working-directory: package/woocommerce
|
||||
run: |
|
||||
npm install -g pnpm@^6.24.2
|
||||
pnpm install
|
||||
|
||||
- name: Install PNPM and install dependencies
|
||||
working-directory: package/woocommerce
|
||||
run: |
|
||||
npm install -g pnpm
|
||||
pnpm install
|
||||
- name: Load docker images and start containers.
|
||||
working-directory: package/woocommerce/plugins/woocommerce
|
||||
env:
|
||||
LATEST_WP_VERSION_MINUS: ${{ matrix.wp }}
|
||||
run: pnpm nx docker-up woocommerce
|
||||
|
||||
- name: Load docker images and start containers.
|
||||
working-directory: package/woocommerce/plugins/woocommerce
|
||||
env:
|
||||
LATEST_WP_VERSION_MINUS: ${{ matrix.wp }}
|
||||
run: pnpm nx docker-up woocommerce
|
||||
- name: Move current directory to code. We will install zip file in this dir later.
|
||||
run: mv ./package/woocommerce/plugins/woocommerce/* ./code/woocommerce
|
||||
|
||||
- name: Move current directory to code. We will install zip file in this dir later.
|
||||
run: mv ./package/woocommerce/plugins/woocommerce/* ./code/woocommerce
|
||||
- name: Download WooCommerce release zip
|
||||
working-directory: tmp
|
||||
run: |
|
||||
curl https://api.github.com/repos/${{ github.repository }}/releases/assets/${{ steps.fetch_asset_id.outputs.asset_id }} -LJOH 'Accept: application/octet-stream'
|
||||
|
||||
- name: Download WooCommerce release zip
|
||||
working-directory: tmp
|
||||
run: |
|
||||
curl https://api.github.com/repos/${{ github.repository }}/releases/assets/${{ steps.fetch_asset_id.outputs.asset_id }} -LJOH 'Accept: application/octet-stream'
|
||||
unzip woocommerce.zip -d woocommerce
|
||||
mv woocommerce/woocommerce/* ../package/woocommerce/plugins/woocommerce/
|
||||
|
||||
unzip woocommerce.zip -d woocommerce
|
||||
mv woocommerce/woocommerce/* ../package/woocommerce/plugins/woocommerce/
|
||||
|
||||
- name: Run tests command.
|
||||
working-directory: package/woocommerce/plugins/woocommerce
|
||||
env:
|
||||
WC_E2E_SCREENSHOTS: 1
|
||||
E2E_SLACK_TOKEN: ${{ secrets.SMOKE_TEST_SLACK_TOKEN }}
|
||||
E2E_SLACK_CHANNEL: ${{ secrets.RELEASE_TEST_SLACK_CHANNEL }}
|
||||
PLUGIN_REPOSITORY: ${{ matrix.private && secrets[matrix.repo] || matrix.repo }}
|
||||
PLUGIN_NAME: ${{ matrix.plugin }}
|
||||
GITHUB_TOKEN: ${{ secrets.E2E_GH_TOKEN }}
|
||||
run: |
|
||||
pnpx wc-e2e test:e2e tests/e2e/specs/smoke-tests/upload-plugin.js
|
||||
pnpx wc-e2e test:e2e
|
||||
- name: Run tests command.
|
||||
working-directory: package/woocommerce/plugins/woocommerce
|
||||
env:
|
||||
WC_E2E_SCREENSHOTS: 1
|
||||
E2E_SLACK_TOKEN: ${{ secrets.SMOKE_TEST_SLACK_TOKEN }}
|
||||
E2E_SLACK_CHANNEL: ${{ secrets.RELEASE_TEST_SLACK_CHANNEL }}
|
||||
PLUGIN_REPOSITORY: ${{ matrix.private && secrets[matrix.repo] || matrix.repo }}
|
||||
PLUGIN_NAME: ${{ matrix.plugin }}
|
||||
GITHUB_TOKEN: ${{ secrets.E2E_GH_TOKEN }}
|
||||
run: |
|
||||
pnpm exec wc-e2e test:e2e tests/e2e/specs/smoke-tests/upload-plugin.js
|
||||
pnpm exec wc-e2e test:e2e
|
||||
|
|
|
@ -7,12 +7,12 @@ jobs:
|
|||
stale:
|
||||
if: |
|
||||
! contains(github.event.issue.labels.*.name, 'type: enhancement')
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/stale@v3
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
stale-issue-message: "As a part of this repository’s maintenance, this issue is being marked as stale due to inactivity. Please feel free to comment on it in case we missed something.\n\n###### After 7 days with no activity this issue will be automatically be closed."
|
||||
stale-issue-message: "As a part of this repository's maintenance, this issue is being marked as stale due to inactivity. Please feel free to comment on it in case we missed something.\n\n###### After 7 days with no activity this issue will be automatically be closed."
|
||||
close-issue-message: 'This issue was closed because it has been 14 days with no activity.'
|
||||
days-before-issue-stale: 7
|
||||
days-before-issue-close: 7
|
||||
|
|
|
@ -6,9 +6,9 @@ on:
|
|||
|
||||
jobs:
|
||||
add_label:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions-ecosystem/action-add-labels@v1
|
||||
if: github.event.issue.labels[0] == null
|
||||
with:
|
||||
|
|
|
@ -6,7 +6,7 @@ on:
|
|||
jobs:
|
||||
add-dev-comment:
|
||||
if: "github.event.label.name == 'needs: developer feedback'"
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-20.04
|
||||
permissions:
|
||||
issues: write
|
||||
steps:
|
||||
|
@ -26,7 +26,7 @@ jobs:
|
|||
})
|
||||
add-reproduction-comment:
|
||||
if: "github.event.label.name == 'status: reproduction'"
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-20.04
|
||||
permissions:
|
||||
issues: write
|
||||
steps:
|
||||
|
@ -45,7 +45,7 @@ jobs:
|
|||
})
|
||||
add-support-comment:
|
||||
if: "github.event.label.name == 'type: support request'"
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-20.04
|
||||
permissions:
|
||||
issues: write
|
||||
steps:
|
||||
|
@ -85,7 +85,7 @@ jobs:
|
|||
})
|
||||
add-votes-comment:
|
||||
if: "github.event.label.name == 'needs: votes'"
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-20.04
|
||||
permissions:
|
||||
issues: write
|
||||
steps:
|
||||
|
@ -120,7 +120,7 @@ jobs:
|
|||
})
|
||||
fill-template-comment:
|
||||
if: "github.event.label.name == 'needs: template'"
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-20.04
|
||||
permissions:
|
||||
issues: write
|
||||
steps:
|
||||
|
|
|
@ -9,7 +9,7 @@ jobs:
|
|||
github.event.issue &&
|
||||
github.event.issue.state == 'open' &&
|
||||
contains(github.event.issue.labels.*.name, 'needs: author feedback')
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Add has feedback
|
||||
uses: actions-ecosystem/action-add-labels@v1
|
||||
|
|
9
nx.json
9
nx.json
|
@ -9,8 +9,7 @@
|
|||
"build",
|
||||
"test",
|
||||
"lint",
|
||||
"package",
|
||||
"prepare"
|
||||
"package"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -22,12 +21,6 @@
|
|||
"projects": "dependencies"
|
||||
}
|
||||
],
|
||||
"prepare": [
|
||||
{
|
||||
"target": "prepare",
|
||||
"projects": "dependencies"
|
||||
}
|
||||
],
|
||||
"package": [
|
||||
{
|
||||
"target": "package",
|
||||
|
|
131
package.json
131
package.json
|
@ -1,51 +1,84 @@
|
|||
{
|
||||
"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"
|
||||
},
|
||||
"author": "Automattic",
|
||||
"license": "GPL-3.0-or-later",
|
||||
"bugs": {
|
||||
"url": "https://github.com/woocommerce/woocommerce/issues"
|
||||
},
|
||||
"scripts": {
|
||||
"preinstall": "npx only-allow pnpm",
|
||||
"postinstall": "pnpm git:update-hooks",
|
||||
"git:update-hooks": "rm -r .git/hooks && mkdir -p .git/hooks && husky install"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@automattic/nx-composer": "^0.1.0",
|
||||
"@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",
|
||||
"@types/node": "14.14.33",
|
||||
"@woocommerce/eslint-plugin": "workspace:*",
|
||||
"@wordpress/eslint-plugin": "^11.0.0",
|
||||
"@wordpress/prettier-config": "^1.1.1",
|
||||
"chalk": "^4.1.2",
|
||||
"glob": "^7.2.0",
|
||||
"husky": "^7.0.4",
|
||||
"jest": "^27.3.1",
|
||||
"lint-staged": "^12.3.7",
|
||||
"mkdirp": "^1.0.4",
|
||||
"node-stream-zip": "^1.15.0",
|
||||
"prettier": "npm:wp-prettier@^2.2.1-beta-1",
|
||||
"request": "^2.88.2",
|
||||
"typescript": "4.2.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/core": "7.12.9",
|
||||
"@wordpress/babel-plugin-import-jsx-pragma": "^3.1.0",
|
||||
"@wordpress/babel-preset-default": "^6.4.1",
|
||||
"lodash": "^4.17.21",
|
||||
"wp-textdomain": "1.0.1"
|
||||
}
|
||||
"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"
|
||||
},
|
||||
"author": "Automattic",
|
||||
"license": "GPL-3.0-or-later",
|
||||
"bugs": {
|
||||
"url": "https://github.com/woocommerce/woocommerce/issues"
|
||||
},
|
||||
"scripts": {
|
||||
"build-storybook": "build-storybook -c ./tools/storybook/.storybook",
|
||||
"preinstall": "npx only-allow pnpm",
|
||||
"postinstall": "pnpm git:update-hooks",
|
||||
"git:update-hooks": "rm -r .git/hooks && mkdir -p .git/hooks && husky install",
|
||||
"storybook": "./tools/storybook/import-wp-css-storybook.sh && BABEL_ENV=storybook STORYBOOK=true start-storybook -c ./tools/storybook/.storybook -p 6007 --ci",
|
||||
"storybook-rtl": "USE_RTL_STYLE=true pnpm run storybook",
|
||||
"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",
|
||||
"@storybook/addon-controls": "^6.4.19",
|
||||
"@storybook/addon-docs": "^6.4.19",
|
||||
"@storybook/addon-knobs": "^6.4.0",
|
||||
"@storybook/addon-links": "^6.4.19",
|
||||
"@storybook/addon-storysource": "^6.4.19",
|
||||
"@storybook/addon-viewport": "^6.4.19",
|
||||
"@storybook/addons": "^6.4.19",
|
||||
"@storybook/api": "^6.4.19",
|
||||
"@storybook/builder-webpack5": "^6.4.19",
|
||||
"@storybook/components": "^6.4.19",
|
||||
"@storybook/core-events": "^6.4.19",
|
||||
"@storybook/manager-webpack5": "^6.4.19",
|
||||
"@storybook/react": "^6.4.19",
|
||||
"@storybook/theming": "^6.4.19",
|
||||
"@types/node": "14.14.33",
|
||||
"@woocommerce/eslint-plugin": "workspace:*",
|
||||
"@wordpress/data": "^6.3.0",
|
||||
"@wordpress/eslint-plugin": "^11.0.0",
|
||||
"@wordpress/prettier-config": "^1.1.1",
|
||||
"babel-loader": "^8.2.3",
|
||||
"chalk": "^4.1.2",
|
||||
"core-js": "^3.21.1",
|
||||
"css-loader": "^6.7.0",
|
||||
"glob": "^7.2.0",
|
||||
"husky": "^7.0.4",
|
||||
"jest": "^27.3.1",
|
||||
"lint-staged": "^12.3.7",
|
||||
"moment": "^2.29.1",
|
||||
"mkdirp": "^1.0.4",
|
||||
"node-stream-zip": "^1.15.0",
|
||||
"prettier": "npm:wp-prettier@^2.2.1-beta-1",
|
||||
"postcss-loader": "^3.0.0",
|
||||
"regenerator-runtime": "^0.13.9",
|
||||
"request": "^2.88.2",
|
||||
"sass": "^1.49.9",
|
||||
"sass-loader": "^10.2.1",
|
||||
"typescript": "4.2.4",
|
||||
"webpack": "^5.70.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/core": "7.12.9",
|
||||
"@wordpress/babel-plugin-import-jsx-pragma": "^3.1.0",
|
||||
"@wordpress/babel-preset-default": "^6.4.1",
|
||||
"lodash": "^4.17.21",
|
||||
"wp-textdomain": "1.0.1"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
module.exports = {
|
||||
extends: [ 'plugin:@woocommerce/eslint-plugin/recommended' ],
|
||||
extends: [
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
'plugin:@woocommerce/eslint-plugin/recommended',
|
||||
],
|
||||
root: true,
|
||||
};
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
Significance: minor
|
||||
Type: dev
|
||||
|
||||
Add Jetpack Changelogger
|
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: dev
|
||||
|
||||
Standardize lint scripts: add lint:fix
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"name": "woocommerce/admin-e2e-tests",
|
||||
"description": "WooCommerce Admin end to end tests",
|
||||
"type": "library",
|
||||
"license": "GPL-3.0-or-later",
|
||||
"minimum-stability": "dev",
|
||||
"require-dev": {
|
||||
"automattic/jetpack-changelogger": "3.0.2"
|
||||
},
|
||||
"extra": {
|
||||
"changelogger": {
|
||||
"formatter": {
|
||||
"filename": "../../../tools/changelogger/PackageFormatter.php"
|
||||
},
|
||||
"types": {
|
||||
"fix": "Fixes an existing bug",
|
||||
"add": "Adds functionality",
|
||||
"update": "Update existing functionality",
|
||||
"dev": "Development related task",
|
||||
"tweak": "A minor adjustment to the codebase",
|
||||
"performance": "Address performance issues",
|
||||
"enhancement": "Improve existing functionality"
|
||||
},
|
||||
"changelog": "NEXT_CHANGELOG.md"
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -37,7 +37,7 @@
|
|||
"@types/puppeteer": "^5.4.5",
|
||||
"@typescript-eslint/eslint-plugin": "^5.14.0",
|
||||
"@woocommerce/api": "^0.2.0",
|
||||
"@wordpress/eslint-plugin": "^11.0.0",
|
||||
"@woocommerce/eslint-plugin": "workspace:*",
|
||||
"eslint": "^8.12.0",
|
||||
"jest": "^27.5.1",
|
||||
"jest-cli": "^27.5.1",
|
||||
|
@ -50,16 +50,17 @@
|
|||
"access": "public"
|
||||
},
|
||||
"scripts": {
|
||||
"prepare": "pnpm run build",
|
||||
"postinstall": "composer install",
|
||||
"build": "tsc --build",
|
||||
"start": "tsc --build --watch",
|
||||
"start": "tsc --build --watch",
|
||||
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
|
||||
"lint": "eslint src",
|
||||
"lint:fix": "eslint src --fix",
|
||||
"prepack": "pnpm run clean && pnpm run build"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.(t|j)s?(x)": [
|
||||
"eslint --fix"
|
||||
"pnpm lint:fix"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,13 +3,6 @@
|
|||
"sourceRoot": "packages/js/admin-e2e-tests/src",
|
||||
"projectType": "library",
|
||||
"targets": {
|
||||
"changelog": {
|
||||
"executor": "./tools/executors/changelogger:changelog",
|
||||
"options": {
|
||||
"action": "add",
|
||||
"cwd": "packages/js/admin-e2e-tests"
|
||||
}
|
||||
},
|
||||
"build": {
|
||||
"executor": "@nrwl/workspace:run-script",
|
||||
"options": {
|
||||
|
@ -33,12 +26,6 @@
|
|||
"options": {
|
||||
"script": "clean"
|
||||
}
|
||||
},
|
||||
"prepare": {
|
||||
"executor": "@nrwl/workspace:run-script",
|
||||
"options": {
|
||||
"script": "prepare"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ export class WcSettings extends BasePage {
|
|||
|
||||
async paymentMethodIsEnabled( method = '' ): Promise< boolean > {
|
||||
await this.navigate( 'checkout' );
|
||||
await waitForElementByText( 'h2', 'Payment methods' );
|
||||
await waitForElementByText( 'th', 'Method' );
|
||||
const className = await getAttribute(
|
||||
`tr[data-gateway_id=${ method }] .woocommerce-input-toggle`,
|
||||
'className'
|
||||
|
@ -58,7 +58,7 @@ export class WcSettings extends BasePage {
|
|||
|
||||
async cleanPaymentMethods(): Promise< void > {
|
||||
await this.navigate( 'checkout' );
|
||||
await waitForElementByText( 'h2', 'Payment methods' );
|
||||
await waitForElementByText( 'th', 'Method' );
|
||||
const paymentMethods = await page.$$( 'span.woocommerce-input-toggle' );
|
||||
for ( const method of paymentMethods ) {
|
||||
if (
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = {
|
||||
extends: [ 'plugin:@woocommerce/eslint-plugin/recommended' ],
|
||||
};
|
|
@ -38,7 +38,7 @@ report() {
|
|||
if [[ $REPORT_EXIT_CODE -eq 0 && $GITHUB_ACTIONS != "true" ]]; then
|
||||
echo "To view the report on your browser, run:"
|
||||
echo ""
|
||||
echo "pnpx allure open \"$ALLURE_REPORT_DIR\""
|
||||
echo "pnpm dlx allure open \"$ALLURE_REPORT_DIR\""
|
||||
echo ""
|
||||
fi
|
||||
}
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
Significance: minor
|
||||
Type: dev
|
||||
|
||||
Add Jetpack Changelogger
|
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: dev
|
||||
|
||||
Standardize linting: Ensure e2e packages are lintable
|
|
@ -0,0 +1,5 @@
|
|||
Significance: patch
|
||||
Type: dev
|
||||
Comment: This is only updating monorepo infrastructure.
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
const { customerBilling, customerShipping } = require('./shared');
|
||||
const { customerBilling, customerShipping } = require( './shared' );
|
||||
|
||||
/**
|
||||
* A basic order.
|
||||
|
@ -53,10 +53,10 @@ const couponLines = {
|
|||
/**
|
||||
* Builds an example order request.
|
||||
*
|
||||
* @returns {Object} Sample Order payload.
|
||||
* @return {Object} Sample Order payload.
|
||||
*/
|
||||
const getOrderExample = () => {
|
||||
let orderExample = {
|
||||
const orderExample = {
|
||||
id: 0,
|
||||
payment_method: 'cod',
|
||||
payment_method_title: 'Cash on Delivery',
|
||||
|
@ -73,7 +73,7 @@ const getOrderExample = () => {
|
|||
coupon_lines: [ couponLines ],
|
||||
};
|
||||
return orderExample;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
order,
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -3,12 +3,12 @@
|
|||
*
|
||||
* Note that by default the update endpoint is limited to 100 objects to be created, updated, or deleted.
|
||||
*
|
||||
* @param {string} action Batch action. Must be one of: create, update, or delete.
|
||||
* @param {Array} resources A list of resource objects. For the delete action, this will be a list of IDs.
|
||||
* @param {Object} payload The batch payload object. Defaults to an empty object.
|
||||
* @returns {Object} The payload to send to the batch endpoint.
|
||||
* @param {string} action Batch action. Must be one of: create, update, or delete.
|
||||
* @param {Array} resources A list of resource objects. For the delete action, this will be a list of IDs.
|
||||
* @param {Object} payload The batch payload object. Defaults to an empty object.
|
||||
* @return {Object} The payload to send to the batch endpoint.
|
||||
*/
|
||||
const batch = ( action, resources = [], payload = {} ) => {
|
||||
const batch = ( action, resources = [], payload = {} ) => {
|
||||
if ( ! [ 'create', 'update', 'delete' ].includes( action ) ) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ const errorResponse = {
|
|||
code: '',
|
||||
message: '',
|
||||
data: {
|
||||
status: 400
|
||||
status: 400,
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
const { customerBilling, customerShipping } = require('./customer');
|
||||
const {
|
||||
batch,
|
||||
getBatchPayloadExample
|
||||
} = require('./batch-update');
|
||||
const { errorResponse } = require('./error-response');
|
||||
const { customerBilling, customerShipping } = require( './customer' );
|
||||
const { batch, getBatchPayloadExample } = require( './batch-update' );
|
||||
const { errorResponse } = require( './error-response' );
|
||||
|
||||
module.exports = {
|
||||
customerBilling,
|
||||
|
|
|
@ -6,7 +6,9 @@
|
|||
* - `flat_rate`
|
||||
* - `local_pickup`
|
||||
*
|
||||
* @returns shipping method object that can serve as a request payload for adding a shipping method to a shipping zone.
|
||||
* @param methodId
|
||||
* @param cost
|
||||
* @return shipping method object that can serve as a request payload for adding a shipping method to a shipping zone.
|
||||
*/
|
||||
const getShippingMethodExample = ( methodId, cost ) => {
|
||||
const shippingMethodExample = {
|
||||
|
@ -15,7 +17,7 @@ const getShippingMethodExample = ( methodId, cost ) => {
|
|||
|
||||
if ( cost !== undefined ) {
|
||||
shippingMethodExample.settings = {
|
||||
cost: cost,
|
||||
cost,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ const shippingZone = {
|
|||
/**
|
||||
* Constructs a default shipping zone object.
|
||||
*
|
||||
* @returns default shipping zone
|
||||
* @return default shipping zone
|
||||
*/
|
||||
const getShippingZoneExample = () => {
|
||||
return shippingZone;
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
const { getRequest, postRequest, putRequest, deleteRequest } = require('../utils/request');
|
||||
const { coupon, shared } = require('../data');
|
||||
const {
|
||||
getRequest,
|
||||
postRequest,
|
||||
putRequest,
|
||||
deleteRequest,
|
||||
} = require( '../utils/request' );
|
||||
const { coupon, shared } = require( '../data' );
|
||||
|
||||
/**
|
||||
* WooCommerce Coupon endpoints.
|
||||
|
@ -17,14 +22,15 @@ const couponsApi = {
|
|||
path: 'coupons',
|
||||
responseCode: 201,
|
||||
payload: coupon,
|
||||
coupon: async ( couponDetails ) => postRequest( 'coupons', couponDetails ),
|
||||
coupon: async ( couponDetails ) =>
|
||||
postRequest( 'coupons', couponDetails ),
|
||||
},
|
||||
retrieve: {
|
||||
name: 'Retrieve a coupon',
|
||||
method: 'GET',
|
||||
path: 'coupons/<id>',
|
||||
responseCode: 200,
|
||||
coupon: async ( couponId ) => getRequest( `coupons/${couponId}` ),
|
||||
coupon: async ( couponId ) => getRequest( `coupons/${ couponId }` ),
|
||||
},
|
||||
listAll: {
|
||||
name: 'List all coupons',
|
||||
|
@ -39,7 +45,8 @@ const couponsApi = {
|
|||
path: 'coupons/<id>',
|
||||
responseCode: 200,
|
||||
payload: coupon,
|
||||
coupon: async ( couponId, couponDetails ) => putRequest( `coupons/${couponId}`, couponDetails ),
|
||||
coupon: async ( couponId, couponDetails ) =>
|
||||
putRequest( `coupons/${ couponId }`, couponDetails ),
|
||||
},
|
||||
delete: {
|
||||
name: 'Delete a coupon',
|
||||
|
@ -47,9 +54,10 @@ const couponsApi = {
|
|||
path: 'coupons/<id>',
|
||||
responseCode: 200,
|
||||
payload: {
|
||||
force: false
|
||||
force: false,
|
||||
},
|
||||
coupon: async ( couponId, deletePermanently ) => deleteRequest( `coupons/${couponId}`, deletePermanently ),
|
||||
coupon: async ( couponId, deletePermanently ) =>
|
||||
deleteRequest( `coupons/${ couponId }`, deletePermanently ),
|
||||
},
|
||||
batch: {
|
||||
name: 'Batch update coupons',
|
||||
|
@ -57,8 +65,9 @@ const couponsApi = {
|
|||
path: 'coupons/batch',
|
||||
responseCode: 200,
|
||||
payload: shared.getBatchPayloadExample( coupon ),
|
||||
coupons: async ( batchUpdatePayload ) => postRequest( `coupons/batch`, batchUpdatePayload ),
|
||||
coupons: async ( batchUpdatePayload ) =>
|
||||
postRequest( `coupons/batch`, batchUpdatePayload ),
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = { couponsApi };
|
||||
module.exports = { couponsApi };
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
const { getRequest, postRequest, putRequest, deleteRequest } = require('../utils/request');
|
||||
const {
|
||||
getRequest,
|
||||
postRequest,
|
||||
putRequest,
|
||||
deleteRequest,
|
||||
} = require( '../utils/request' );
|
||||
|
||||
/**
|
||||
* WooCommerce Products endpoints.
|
||||
|
@ -15,28 +20,31 @@ const productsApi = {
|
|||
method: 'POST',
|
||||
path: 'products',
|
||||
responseCode: 201,
|
||||
product: async ( productDetails ) => postRequest( 'products', productDetails ),
|
||||
product: async ( productDetails ) =>
|
||||
postRequest( 'products', productDetails ),
|
||||
},
|
||||
retrieve: {
|
||||
name: 'Retrieve a product',
|
||||
method: 'GET',
|
||||
path: 'products/<id>',
|
||||
responseCode: 200,
|
||||
product: async ( productId ) => getRequest( `products/${productId}` ),
|
||||
product: async ( productId ) => getRequest( `products/${ productId }` ),
|
||||
},
|
||||
listAll: {
|
||||
name: 'List all products',
|
||||
method: 'GET',
|
||||
path: 'products',
|
||||
responseCode: 200,
|
||||
products: async ( productsQuery = {} ) => getRequest( 'products', productsQuery ),
|
||||
products: async ( productsQuery = {} ) =>
|
||||
getRequest( 'products', productsQuery ),
|
||||
},
|
||||
update: {
|
||||
name: 'Update a product',
|
||||
method: 'PUT',
|
||||
path: 'products/<id>',
|
||||
responseCode: 200,
|
||||
product: async ( productId, productDetails ) => putRequest( `products/${productId}`, productDetails ),
|
||||
product: async ( productId, productDetails ) =>
|
||||
putRequest( `products/${ productId }`, productDetails ),
|
||||
},
|
||||
delete: {
|
||||
name: 'Delete a product',
|
||||
|
@ -44,16 +52,18 @@ const productsApi = {
|
|||
path: 'products/<id>',
|
||||
responseCode: 200,
|
||||
payload: {
|
||||
force: false
|
||||
force: false,
|
||||
},
|
||||
product: async ( productId, deletePermanently ) => deleteRequest( `products/${productId}`, deletePermanently ),
|
||||
product: async ( productId, deletePermanently ) =>
|
||||
deleteRequest( `products/${ productId }`, deletePermanently ),
|
||||
},
|
||||
batch: {
|
||||
name: 'Batch update products',
|
||||
method: 'POST',
|
||||
path: 'products/batch',
|
||||
responseCode: 200,
|
||||
products: async ( batchUpdatePayload ) => postRequest( `products/batch`, batchUpdatePayload ),
|
||||
products: async ( batchUpdatePayload ) =>
|
||||
postRequest( `products/batch`, batchUpdatePayload ),
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -55,5 +55,5 @@ const refundsApi = {
|
|||
};
|
||||
|
||||
module.exports = {
|
||||
refundsApi: refundsApi,
|
||||
refundsApi,
|
||||
};
|
||||
|
|
|
@ -1,42 +1,49 @@
|
|||
{
|
||||
"name": "@woocommerce/api-core-tests",
|
||||
"version": "0.1.0",
|
||||
"description": "API tests for WooCommerce",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "jest",
|
||||
"test:api": "jest --group=api",
|
||||
"test:hello": "jest --group=hello",
|
||||
"make:collection": "node utils/api-collection/build-collection.js",
|
||||
"report": "allure generate --clean && allure serve"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/woocommerce/woocommerce.git"
|
||||
},
|
||||
"license": "GPL-3.0+",
|
||||
"bugs": {
|
||||
"url": "https://github.com/woocommerce/woocommerce/issues"
|
||||
},
|
||||
"homepage": "https://github.com/woocommerce/woocommerce#readme",
|
||||
"dependencies": {
|
||||
"allure-commandline": "^2.17.2",
|
||||
"dotenv": "^10.0.0",
|
||||
"jest": "^25.1.0",
|
||||
"jest-allure": "^0.1.3",
|
||||
"jest-runner-groups": "^2.1.0",
|
||||
"postman-collection": "^4.1.0",
|
||||
"supertest": "^6.1.4"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"bin": {
|
||||
"wc-api-tests": "bin/wc-api-tests.sh"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.(t|j)s?(x)": [
|
||||
"eslint --fix"
|
||||
]
|
||||
}
|
||||
"name": "@woocommerce/api-core-tests",
|
||||
"version": "0.1.0",
|
||||
"description": "API tests for WooCommerce",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"postinstall": "composer install",
|
||||
"test": "jest",
|
||||
"test:api": "jest --group=api",
|
||||
"test: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",
|
||||
"lint:fix": "eslint data endpoints tests utils --ext=js,ts,tsx --fix"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/woocommerce/woocommerce.git"
|
||||
},
|
||||
"license": "GPL-3.0+",
|
||||
"bugs": {
|
||||
"url": "https://github.com/woocommerce/woocommerce/issues"
|
||||
},
|
||||
"homepage": "https://github.com/woocommerce/woocommerce#readme",
|
||||
"dependencies": {
|
||||
"allure-commandline": "^2.17.2",
|
||||
"dotenv": "^10.0.0",
|
||||
"jest": "^25.1.0",
|
||||
"jest-allure": "^0.1.3",
|
||||
"jest-runner-groups": "^2.1.0",
|
||||
"postman-collection": "^4.1.0",
|
||||
"supertest": "^6.1.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@woocommerce/eslint-plugin": "workspace:*",
|
||||
"eslint": "^8.12.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"bin": {
|
||||
"wc-api-tests": "bin/wc-api-tests.sh"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.(t|j)s?(x)": [
|
||||
"eslint --fix"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
const { getRequest } = require('../../utils/request');
|
||||
const { getRequest } = require( '../../utils/request' );
|
||||
|
||||
/**
|
||||
* Tests to verify connection to the API.
|
||||
|
@ -6,16 +6,14 @@ const { getRequest } = require('../../utils/request');
|
|||
* @group hello
|
||||
*
|
||||
*/
|
||||
describe('Test API connectivity', () => {
|
||||
|
||||
it('can access a non-authenticated endpoint', async () => {
|
||||
describe( 'Test API connectivity', () => {
|
||||
it( 'can access a non-authenticated endpoint', async () => {
|
||||
const result = await getRequest( '' );
|
||||
expect( result.statusCode ).toEqual( 200 );
|
||||
});
|
||||
} );
|
||||
|
||||
it('can access an authenticated endpoint', async () => {
|
||||
it( 'can access an authenticated endpoint', async () => {
|
||||
const result = await getRequest( 'system_status' );
|
||||
expect( result.statusCode ).toEqual( 200 );
|
||||
});
|
||||
|
||||
});
|
||||
} );
|
||||
} );
|
||||
|
|
|
@ -341,39 +341,36 @@ describe( 'Orders API tests', () => {
|
|||
};
|
||||
|
||||
const verifyOrderPrecision = ( order, dp ) => {
|
||||
expectPrecisionToMatch( order[ 'discount_total' ], dp );
|
||||
expectPrecisionToMatch( order[ 'discount_tax' ], dp );
|
||||
expectPrecisionToMatch( order[ 'shipping_total' ], dp );
|
||||
expectPrecisionToMatch( order[ 'shipping_tax' ], dp );
|
||||
expectPrecisionToMatch( order[ 'cart_tax' ], dp );
|
||||
expectPrecisionToMatch( order[ 'total' ], dp );
|
||||
expectPrecisionToMatch( order[ 'total_tax' ], dp );
|
||||
expectPrecisionToMatch( order.discount_total, dp );
|
||||
expectPrecisionToMatch( order.discount_tax, dp );
|
||||
expectPrecisionToMatch( order.shipping_total, dp );
|
||||
expectPrecisionToMatch( order.shipping_tax, dp );
|
||||
expectPrecisionToMatch( order.cart_tax, dp );
|
||||
expectPrecisionToMatch( order.total, dp );
|
||||
expectPrecisionToMatch( order.total_tax, dp );
|
||||
|
||||
order[ 'line_items' ].forEach( ( lineItem ) => {
|
||||
expectPrecisionToMatch( lineItem[ 'total' ], dp );
|
||||
expectPrecisionToMatch( lineItem[ 'total_tax' ], dp );
|
||||
order.line_items.forEach( ( lineItem ) => {
|
||||
expectPrecisionToMatch( lineItem.total, dp );
|
||||
expectPrecisionToMatch( lineItem.total_tax, dp );
|
||||
} );
|
||||
|
||||
order[ 'tax_lines' ].forEach( ( taxLine ) => {
|
||||
expectPrecisionToMatch( taxLine[ 'tax_total' ], dp );
|
||||
expectPrecisionToMatch(
|
||||
taxLine[ 'shipping_tax_total' ],
|
||||
dp
|
||||
);
|
||||
order.tax_lines.forEach( ( taxLine ) => {
|
||||
expectPrecisionToMatch( taxLine.tax_total, dp );
|
||||
expectPrecisionToMatch( taxLine.shipping_tax_total, dp );
|
||||
} );
|
||||
|
||||
order[ 'shipping_lines' ].forEach( ( shippingLine ) => {
|
||||
expectPrecisionToMatch( shippingLine[ 'total' ], dp );
|
||||
expectPrecisionToMatch( shippingLine[ 'total_tax' ], dp );
|
||||
order.shipping_lines.forEach( ( shippingLine ) => {
|
||||
expectPrecisionToMatch( shippingLine.total, dp );
|
||||
expectPrecisionToMatch( shippingLine.total_tax, dp );
|
||||
} );
|
||||
|
||||
order[ 'fee_lines' ].forEach( ( feeLine ) => {
|
||||
expectPrecisionToMatch( feeLine[ 'total' ], dp );
|
||||
expectPrecisionToMatch( feeLine[ 'total_tax' ], dp );
|
||||
order.fee_lines.forEach( ( feeLine ) => {
|
||||
expectPrecisionToMatch( feeLine.total, dp );
|
||||
expectPrecisionToMatch( feeLine.total_tax, dp );
|
||||
} );
|
||||
|
||||
order[ 'refunds' ].forEach( ( refund ) => {
|
||||
expectPrecisionToMatch( refund[ 'total' ], dp );
|
||||
order.refunds.forEach( ( refund ) => {
|
||||
expectPrecisionToMatch( refund.total, dp );
|
||||
} );
|
||||
};
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,12 +1,7 @@
|
|||
const fs = require('fs');
|
||||
const { Collection, ItemGroup, Item } = require('postman-collection');
|
||||
require('dotenv').config();
|
||||
const {
|
||||
BASE_URL,
|
||||
USER_KEY,
|
||||
USER_SECRET,
|
||||
USE_INDEX_PERMALINKS
|
||||
} = process.env;
|
||||
const fs = require( 'fs' );
|
||||
const { Collection, ItemGroup, Item } = require( 'postman-collection' );
|
||||
require( 'dotenv' ).config();
|
||||
const { BASE_URL, USER_KEY, USER_SECRET, USE_INDEX_PERMALINKS } = process.env;
|
||||
|
||||
/**
|
||||
* Build a Postman collection using the API testing objects.
|
||||
|
@ -17,10 +12,10 @@ const {
|
|||
|
||||
// Set up our empty collection
|
||||
if ( typeof USER_KEY === 'undefined' ) {
|
||||
console.log('No USER_KEY was defined.');
|
||||
console.log( 'No USER_KEY was defined.' );
|
||||
}
|
||||
if ( typeof USER_SECRET === 'undefined' ) {
|
||||
console.log('No USER_SECRET was defined.');
|
||||
console.log( 'No USER_SECRET was defined.' );
|
||||
}
|
||||
|
||||
const postmanCollection = new Collection( {
|
||||
|
@ -30,74 +25,72 @@ const postmanCollection = new Collection( {
|
|||
{
|
||||
key: 'username',
|
||||
value: USER_KEY,
|
||||
type: 'string'
|
||||
type: 'string',
|
||||
},
|
||||
{
|
||||
key: 'password',
|
||||
value: USER_SECRET,
|
||||
type: 'string'
|
||||
type: 'string',
|
||||
},
|
||||
]
|
||||
],
|
||||
},
|
||||
info: {
|
||||
name: 'WooCommerce API - v3'
|
||||
name: 'WooCommerce API - v3',
|
||||
},
|
||||
} );
|
||||
|
||||
// Get the API url
|
||||
if ( typeof BASE_URL === 'undefined' ) {
|
||||
console.log('No BASE_URL was defined.');
|
||||
console.log( 'No BASE_URL was defined.' );
|
||||
}
|
||||
|
||||
// Update the API path if the `USE_INDEX_PERMALINKS` flag is set
|
||||
const useIndexPermalinks = ( USE_INDEX_PERMALINKS === 'true' );
|
||||
let apiPath = `${BASE_URL}/?rest_route=/wc/v3`;
|
||||
const useIndexPermalinks = USE_INDEX_PERMALINKS === 'true';
|
||||
let apiPath = `${ BASE_URL }/?rest_route=/wc/v3`;
|
||||
if ( useIndexPermalinks ) {
|
||||
apiPath = `${BASE_URL}/wp-json/wc/v3`;
|
||||
apiPath = `${ BASE_URL }/wp-json/wc/v3`;
|
||||
}
|
||||
// Set this here for use in `request.js`
|
||||
global.API_PATH = `${apiPath}/`;
|
||||
global.API_PATH = `${ apiPath }/`;
|
||||
|
||||
// Add the API path has a collection variable
|
||||
postmanCollection.variables.add({
|
||||
postmanCollection.variables.add( {
|
||||
id: 'apiBaseUrl',
|
||||
value: apiPath,
|
||||
type: 'string',
|
||||
});
|
||||
} );
|
||||
|
||||
// Get the API request data
|
||||
const resources = require('../../endpoints');
|
||||
const resources = require( '../../endpoints' );
|
||||
resourceKeys = Object.keys( resources );
|
||||
|
||||
// Add the requests to folders in the collection
|
||||
for ( const key in resources ) {
|
||||
|
||||
const folder = new ItemGroup( {
|
||||
name: resources[key].name,
|
||||
items: []
|
||||
name: resources[ key ].name,
|
||||
items: [],
|
||||
} );
|
||||
|
||||
for ( const endpoint in resources[key] ) {
|
||||
|
||||
let api = resources[key][endpoint];
|
||||
for ( const endpoint in resources[ key ] ) {
|
||||
const api = resources[ key ][ endpoint ];
|
||||
|
||||
// If there is no name defined, continue
|
||||
if ( !api.name ) {
|
||||
if ( ! api.name ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const request = new Item( {
|
||||
name: api.name,
|
||||
request: {
|
||||
url: `{{apiBaseUrl}}/${api.path}`,
|
||||
method: api.method,
|
||||
body: {
|
||||
mode: 'raw',
|
||||
raw: JSON.stringify( api.payload ),
|
||||
options: {
|
||||
raw: { language: 'json' }
|
||||
}
|
||||
},
|
||||
url: `{{apiBaseUrl}}/${ api.path }`,
|
||||
method: api.method,
|
||||
body: {
|
||||
mode: 'raw',
|
||||
raw: JSON.stringify( api.payload ),
|
||||
options: {
|
||||
raw: { language: 'json' },
|
||||
},
|
||||
},
|
||||
},
|
||||
} );
|
||||
folder.items.add( request );
|
||||
|
@ -110,9 +103,13 @@ for ( const key in resources ) {
|
|||
const collectionJSON = postmanCollection.toJSON();
|
||||
|
||||
// Create a colleciton.json file. It can be imported to postman
|
||||
fs.writeFile('./collection.json', JSON.stringify( collectionJSON ), ( err ) => {
|
||||
if ( err ) {
|
||||
console.log( err );
|
||||
fs.writeFile(
|
||||
'./collection.json',
|
||||
JSON.stringify( collectionJSON ),
|
||||
( err ) => {
|
||||
if ( err ) {
|
||||
console.log( err );
|
||||
}
|
||||
console.log( 'File saved!' );
|
||||
}
|
||||
console.log('File saved!');
|
||||
});
|
||||
);
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
require('dotenv').config();
|
||||
require( 'dotenv' ).config();
|
||||
const { USER_KEY, USER_SECRET } = process.env;
|
||||
const request = require('supertest')( API_PATH );
|
||||
const request = require( 'supertest' )( API_PATH );
|
||||
|
||||
/**
|
||||
* Make a GET request.
|
||||
*
|
||||
* @param {string} requestPath The path of the request.
|
||||
* @param {object} queryString Optional. An object of one or more `key: value` query string parameters.
|
||||
* @returns {Response}
|
||||
* @param {Object} queryString Optional. An object of one or more `key: value` query string parameters.
|
||||
* @return {Response}
|
||||
*/
|
||||
const getRequest = async ( requestPath, queryString = {} ) => {
|
||||
const response = await request
|
||||
|
@ -22,8 +22,8 @@ const getRequest = async ( requestPath, queryString = {} ) => {
|
|||
* Make a POST request.
|
||||
*
|
||||
* @param {string} requestPath The path of the request.
|
||||
* @param {object} requestBody The body of the request to submit.
|
||||
* @returns {Response}
|
||||
* @param {Object} requestBody The body of the request to submit.
|
||||
* @return {Response}
|
||||
*/
|
||||
const postRequest = async ( requestPath, requestBody ) => {
|
||||
const response = await request
|
||||
|
@ -38,8 +38,8 @@ const postRequest = async ( requestPath, requestBody ) => {
|
|||
* Make a PUT request.
|
||||
*
|
||||
* @param {string} requestPath The path of the request.
|
||||
* @param {object} requestBody The body of the request to submit.
|
||||
* @returns {Request}
|
||||
* @param {Object} requestBody The body of the request to submit.
|
||||
* @return {Request}
|
||||
*/
|
||||
const putRequest = async ( requestPath, requestBody ) => {
|
||||
const response = await request
|
||||
|
@ -53,12 +53,12 @@ const putRequest = async ( requestPath, requestBody ) => {
|
|||
/**
|
||||
* Make a DELETE request, optionally deleting the resource permanently.
|
||||
*
|
||||
* @param {string} requestPath The path of the request.
|
||||
* @param {string} requestPath The path of the request.
|
||||
* @param {boolean} deletePermanently Flag to permanently delete the resource.
|
||||
* @returns {Response}
|
||||
* @return {Response}
|
||||
*/
|
||||
const deleteRequest = async ( requestPath, deletePermanently = false ) => {
|
||||
const requestBody = deletePermanently ? { force: true } : {}
|
||||
const requestBody = deletePermanently ? { force: true } : {};
|
||||
const response = await request
|
||||
.delete( requestPath )
|
||||
.set( 'Accept', 'application/json' )
|
||||
|
@ -67,4 +67,4 @@ const deleteRequest = async ( requestPath, deletePermanently = false ) => {
|
|||
return response;
|
||||
};
|
||||
|
||||
module.exports = { getRequest, postRequest, putRequest, deleteRequest }
|
||||
module.exports = { getRequest, postRequest, putRequest, deleteRequest };
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: dev
|
||||
|
||||
Standardize lint scripts: add lint:fix
|
|
@ -0,0 +1,5 @@
|
|||
Significance: patch
|
||||
Type: dev
|
||||
Comment: This is only updating monorepo infrastructure commands.
|
||||
|
||||
|
|
@ -1,61 +1,63 @@
|
|||
{
|
||||
"name": "@woocommerce/api",
|
||||
"version": "0.2.0",
|
||||
"author": "Automattic",
|
||||
"description": "A simple interface for interacting with a WooCommerce installation.",
|
||||
"homepage": "https://github.com/woocommerce/woocommerce/tree/trunk/packages/js/api/README.md",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/woocommerce/woocommerce.git"
|
||||
},
|
||||
"keywords": [
|
||||
"woocommerce",
|
||||
"e2e"
|
||||
],
|
||||
"license": "GPL-3.0+",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"files": [
|
||||
"/dist/",
|
||||
"!*.ts.map",
|
||||
"!*.tsbuildinfo",
|
||||
"!/dist/**/__tests__/",
|
||||
"!/dist/**/__mocks__/",
|
||||
"!/dist/**/__snapshops__/",
|
||||
"!/dist/**/__test_data__/"
|
||||
],
|
||||
"sideEffects": false,
|
||||
"scripts": {
|
||||
"clean": "rm -rf ./dist ./tsconfig.tsbuildinfo",
|
||||
"compile": "tsc -b",
|
||||
"build": "pnpm run clean && npm run compile",
|
||||
"prepare": "pnpm run build",
|
||||
"lint": "eslint src",
|
||||
"test": "jest"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "^0.24.0",
|
||||
"create-hmac": "1.1.7",
|
||||
"oauth-1.0a": "2.2.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/create-hmac": "1.1.0",
|
||||
"@types/jest": "^27.0.2",
|
||||
"@types/node": "13.13.5",
|
||||
"@typescript-eslint/eslint-plugin": "^5.3.1",
|
||||
"@typescript-eslint/parser": "^5.3.1",
|
||||
"axios-mock-adapter": "^1.20.0",
|
||||
"eslint": "^8.2.0",
|
||||
"jest": "^25",
|
||||
"ts-jest": "^25",
|
||||
"typescript": "^4.4.4"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.(t|j)s?(x)": [
|
||||
"eslint --fix"
|
||||
]
|
||||
}
|
||||
"name": "@woocommerce/api",
|
||||
"version": "0.2.0",
|
||||
"author": "Automattic",
|
||||
"description": "A simple interface for interacting with a WooCommerce installation.",
|
||||
"homepage": "https://github.com/woocommerce/woocommerce/tree/trunk/packages/js/api/README.md",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/woocommerce/woocommerce.git"
|
||||
},
|
||||
"keywords": [
|
||||
"woocommerce",
|
||||
"e2e"
|
||||
],
|
||||
"license": "GPL-3.0+",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"files": [
|
||||
"/dist/",
|
||||
"!*.ts.map",
|
||||
"!*.tsbuildinfo",
|
||||
"!/dist/**/__tests__/",
|
||||
"!/dist/**/__mocks__/",
|
||||
"!/dist/**/__snapshops__/",
|
||||
"!/dist/**/__test_data__/"
|
||||
],
|
||||
"sideEffects": false,
|
||||
"scripts": {
|
||||
"postinstall": "composer install",
|
||||
"clean": "rm -rf ./dist ./tsconfig.tsbuildinfo",
|
||||
"compile": "tsc -b",
|
||||
"build": "pnpm run clean && npm run compile",
|
||||
"prepack": "pnpm run build",
|
||||
"lint": "eslint src",
|
||||
"lint:fix": "eslint src --fix",
|
||||
"test": "jest"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "^0.24.0",
|
||||
"create-hmac": "1.1.7",
|
||||
"oauth-1.0a": "2.2.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/create-hmac": "1.1.0",
|
||||
"@types/jest": "^27.0.2",
|
||||
"@types/node": "13.13.5",
|
||||
"@typescript-eslint/eslint-plugin": "^5.3.1",
|
||||
"@typescript-eslint/parser": "^5.3.1",
|
||||
"axios-mock-adapter": "^1.20.0",
|
||||
"eslint": "^8.2.0",
|
||||
"jest": "^25",
|
||||
"ts-jest": "^25",
|
||||
"typescript": "^4.4.4"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.(t|j)s?(x)": [
|
||||
"pnpm lint:fix"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,12 +28,6 @@
|
|||
"script": "compile"
|
||||
}
|
||||
},
|
||||
"prepare": {
|
||||
"executor": "@nrwl/workspace:run-script",
|
||||
"options": {
|
||||
"script": "prepare"
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"executor": "@nrwl/workspace:run-script",
|
||||
"options": {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
- Update dependency `@wordpress/hooks` to ^3.5.0
|
||||
- Update dependency `@wordpress/icons` to ^8.1.0
|
||||
- Add `className` prop for Pill component. #32605
|
||||
- Update `StepperProps` prop types. #32712
|
||||
|
||||
# 10.0.0
|
||||
- Replace deprecated wp.compose.withState with wp.element.useState. #8338
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
Significance: minor
|
||||
Type: dev
|
||||
|
||||
Add Jetpack Changelogger
|
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: dev
|
||||
|
||||
Standardize lint scripts: add lint:fix
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"name": "woocommerce/components",
|
||||
"description": "WooCommerce JS component library",
|
||||
"type": "library",
|
||||
"license": "GPL-3.0-or-later",
|
||||
"minimum-stability": "dev",
|
||||
"require-dev": {
|
||||
"automattic/jetpack-changelogger": "3.0.2"
|
||||
},
|
||||
"extra": {
|
||||
"changelogger": {
|
||||
"formatter": {
|
||||
"filename": "../../../tools/changelogger/PackageFormatter.php"
|
||||
},
|
||||
"types": {
|
||||
"fix": "Fixes an existing bug",
|
||||
"add": "Adds functionality",
|
||||
"update": "Update existing functionality",
|
||||
"dev": "Development related task",
|
||||
"tweak": "A minor adjustment to the codebase",
|
||||
"performance": "Address performance issues",
|
||||
"enhancement": "Improve existing functionality"
|
||||
},
|
||||
"changelog": "NEXT_CHANGELOG.md"
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -94,9 +94,9 @@
|
|||
"@testing-library/jest-dom": "^5.16.2",
|
||||
"@testing-library/react": "^12.1.3",
|
||||
"@testing-library/user-event": "^13.5.0",
|
||||
"@woocommerce/eslint-plugin": "workspace:*",
|
||||
"@woocommerce/style-build": "workspace:*",
|
||||
"@wordpress/browserslist-config": "^4.1.1",
|
||||
"@wordpress/eslint-plugin": "^11.0.0",
|
||||
"@wordpress/scripts": "^12.6.1",
|
||||
"concurrently": "^7.0.0",
|
||||
"css-loader": "^3.6.0",
|
||||
|
@ -112,11 +112,13 @@
|
|||
"webpack-cli": "^3.3.12"
|
||||
},
|
||||
"scripts": {
|
||||
"postinstall": "composer install",
|
||||
"build": "pnpm run build:js && pnpm run build:css",
|
||||
"build:js": "tsc --build ./tsconfig.json ./tsconfig-cjs.json",
|
||||
"build:css": "webpack",
|
||||
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
|
||||
"lint": "eslint src --ext=js,ts,tsx",
|
||||
"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",
|
||||
|
@ -126,7 +128,7 @@
|
|||
},
|
||||
"lint-staged": {
|
||||
"*.(t|j)s?(x)": [
|
||||
"eslint --fix",
|
||||
"pnpm lint:fix",
|
||||
"pnpm test-staged"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -32,9 +32,9 @@ interface StepperProps {
|
|||
onClick?: ( key: string ) => void;
|
||||
} >;
|
||||
/** If the stepper is vertical instead of horizontal. */
|
||||
isVertical: boolean;
|
||||
isVertical?: boolean;
|
||||
/** Optionally mark the current step as pending to show a spinner. */
|
||||
isPending: boolean;
|
||||
isPending?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
Significance: minor
|
||||
Type: dev
|
||||
|
||||
Add Jetpack Changelogger
|
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: dev
|
||||
|
||||
Standardize lint scripts: add lint:fix
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"name": "woocommerce/csv-export",
|
||||
"description": "WooCommerce CSV export package",
|
||||
"type": "library",
|
||||
"license": "GPL-3.0-or-later",
|
||||
"minimum-stability": "dev",
|
||||
"require-dev": {
|
||||
"automattic/jetpack-changelogger": "3.0.2"
|
||||
},
|
||||
"extra": {
|
||||
"changelogger": {
|
||||
"formatter": {
|
||||
"filename": "../../../tools/changelogger/PackageFormatter.php"
|
||||
},
|
||||
"types": {
|
||||
"fix": "Fixes an existing bug",
|
||||
"add": "Adds functionality",
|
||||
"update": "Update existing functionality",
|
||||
"dev": "Development related task",
|
||||
"tweak": "A minor adjustment to the codebase",
|
||||
"performance": "Address performance issues",
|
||||
"enhancement": "Improve existing functionality"
|
||||
},
|
||||
"changelog": "NEXT_CHANGELOG.md"
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -28,18 +28,20 @@
|
|||
"access": "public"
|
||||
},
|
||||
"scripts": {
|
||||
"postinstall": "composer install",
|
||||
"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-staged": "jest --bail --config ./jest.config.json --findRelatedTests"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.17.5",
|
||||
"@wordpress/eslint-plugin": "^11.0.0",
|
||||
"@woocommerce/eslint-plugin": "workspace:*",
|
||||
"eslint": "^8.12.0",
|
||||
"jest": "^27.5.1",
|
||||
"jest-cli": "^27.5.1",
|
||||
|
@ -49,7 +51,7 @@
|
|||
},
|
||||
"lint-staged": {
|
||||
"*.(t|j)s?(x)": [
|
||||
"eslint --fix",
|
||||
"pnpm lint:fix",
|
||||
"pnpm test-staged"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
Significance: minor
|
||||
Type: dev
|
||||
|
||||
Add Jetpack Changelogger
|
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: dev
|
||||
|
||||
Standardize lint scripts: add lint:fix
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"name": "woocommerce/currency",
|
||||
"description": "WooCommerce JS currency utils",
|
||||
"type": "library",
|
||||
"license": "GPL-3.0-or-later",
|
||||
"minimum-stability": "dev",
|
||||
"require-dev": {
|
||||
"automattic/jetpack-changelogger": "3.0.2"
|
||||
},
|
||||
"extra": {
|
||||
"changelogger": {
|
||||
"formatter": {
|
||||
"filename": "../../../tools/changelogger/PackageFormatter.php"
|
||||
},
|
||||
"types": {
|
||||
"fix": "Fixes an existing bug",
|
||||
"add": "Adds functionality",
|
||||
"update": "Update existing functionality",
|
||||
"dev": "Development related task",
|
||||
"tweak": "A minor adjustment to the codebase",
|
||||
"performance": "Address performance issues",
|
||||
"enhancement": "Improve existing functionality"
|
||||
},
|
||||
"changelog": "NEXT_CHANGELOG.md"
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -31,18 +31,20 @@
|
|||
"access": "public"
|
||||
},
|
||||
"scripts": {
|
||||
"postinstall": "composer install",
|
||||
"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-staged": "jest --bail --config ./jest.config.json --findRelatedTests"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.17.5",
|
||||
"@wordpress/eslint-plugin": "^11.0.0",
|
||||
"@woocommerce/eslint-plugin": "workspace:*",
|
||||
"eslint": "^8.12.0",
|
||||
"jest": "^27.5.1",
|
||||
"jest-cli": "^27.5.1",
|
||||
|
@ -52,7 +54,7 @@
|
|||
},
|
||||
"lint-staged": {
|
||||
"*.(t|j)s?(x)": [
|
||||
"eslint --fix",
|
||||
"pnpm lint:fix",
|
||||
"pnpm test-staged"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
Significance: minor
|
||||
Type: dev
|
||||
|
||||
Add Jetpack Changelogger
|
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: dev
|
||||
|
||||
Standardize lint scripts: add lint:fix
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"name": "woocommerce/customer-effort-score",
|
||||
"description": "WooCommerce utility to measure user effort.",
|
||||
"type": "library",
|
||||
"license": "GPL-3.0-or-later",
|
||||
"minimum-stability": "dev",
|
||||
"require-dev": {
|
||||
"automattic/jetpack-changelogger": "3.0.2"
|
||||
},
|
||||
"extra": {
|
||||
"changelogger": {
|
||||
"formatter": {
|
||||
"filename": "../../../tools/changelogger/PackageFormatter.php"
|
||||
},
|
||||
"types": {
|
||||
"fix": "Fixes an existing bug",
|
||||
"add": "Adds functionality",
|
||||
"update": "Update existing functionality",
|
||||
"dev": "Development related task",
|
||||
"tweak": "A minor adjustment to the codebase",
|
||||
"performance": "Address performance issues",
|
||||
"enhancement": "Improve existing functionality"
|
||||
},
|
||||
"changelog": "NEXT_CHANGELOG.md"
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -40,8 +40,8 @@
|
|||
"@types/prop-types": "^15.7.4",
|
||||
"@types/wordpress__components": "^9.8.6",
|
||||
"@woocommerce/style-build": "workspace:*",
|
||||
"@woocommerce/eslint-plugin": "workspace:*",
|
||||
"@wordpress/browserslist-config": "^4.1.1",
|
||||
"@wordpress/eslint-plugin": "^11.0.0",
|
||||
"concurrently": "^7.0.0",
|
||||
"css-loader": "^3.6.0",
|
||||
"eslint": "^8.12.0",
|
||||
|
@ -60,6 +60,7 @@
|
|||
"react-dom": "^17.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"postinstall": "composer install",
|
||||
"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",
|
||||
|
@ -67,13 +68,14 @@
|
|||
"start": "concurrently \"tsc --build --watch\" \"webpack --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-staged": "jest --bail --config ./jest.config.json --findRelatedTests"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.(t|j)s?(x)": [
|
||||
"eslint --fix",
|
||||
"pnpm lint:fix",
|
||||
"pnpm test-staged"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -3,13 +3,16 @@
|
|||
- Update dependency `@wordpress/hooks` to ^3.5.0
|
||||
- Add `is_offline` attribute for `Plugin` type. #32467
|
||||
- Added Typescript type declarations. #32615
|
||||
- Update type definitions. #32683, #32695
|
||||
- Update type definitions. #32683, #32695, #32698, #32712
|
||||
- Make `isResolving` param `args` optional.
|
||||
- Update `Plugin` type to reflect the latest changes.
|
||||
- Maps "raw" payment `ActionDispatchers` to the registered actions.
|
||||
- Add `getTaskListsByIds` selector type
|
||||
- Export `getTaskListsByIds`, `getTaskLists`, `getTaskList`, `getFreeExtensions` onboarding selector types
|
||||
- Update `TaskType` & `TaskListType` types
|
||||
- Export `InstallPluginsResponse` type
|
||||
- Convert `use-user-preferences.js` to TS. #32695
|
||||
- Added PaymentGateway type to exports #32697
|
||||
- Add `@types/wordpress__compose`, `@types/wordpress__data`, `redux` types and fix related type errors. #32735
|
||||
|
||||
## Breaking change
|
||||
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
Significance: minor
|
||||
Type: dev
|
||||
|
||||
Add Jetpack Changelogger
|
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: dev
|
||||
|
||||
Standardize lint scripts: add lint:fix
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"name": "woocommerce/data",
|
||||
"description": "WooCommerce Admin data store and utilities",
|
||||
"type": "library",
|
||||
"license": "GPL-3.0-or-later",
|
||||
"minimum-stability": "dev",
|
||||
"require-dev": {
|
||||
"automattic/jetpack-changelogger": "3.0.2"
|
||||
},
|
||||
"extra": {
|
||||
"changelogger": {
|
||||
"formatter": {
|
||||
"filename": "../../../tools/changelogger/PackageFormatter.php"
|
||||
},
|
||||
"types": {
|
||||
"fix": "Fixes an existing bug",
|
||||
"add": "Adds functionality",
|
||||
"update": "Update existing functionality",
|
||||
"dev": "Development related task",
|
||||
"tweak": "A minor adjustment to the codebase",
|
||||
"performance": "Address performance issues",
|
||||
"enhancement": "Improve existing functionality"
|
||||
},
|
||||
"changelog": "NEXT_CHANGELOG.md"
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -48,12 +48,15 @@
|
|||
"@babel/runtime": "^7.17.2",
|
||||
"@testing-library/react": "^12.1.3",
|
||||
"@testing-library/react-hooks": "^7.0.2",
|
||||
"@types/wordpress__compose": "^4.0.1",
|
||||
"@types/wordpress__core-data": "^2.4.5",
|
||||
"@types/wordpress__data": "^6.0.0",
|
||||
"@types/wordpress__data-controls": "^2.2.0",
|
||||
"@wordpress/eslint-plugin": "^11.0.0",
|
||||
"@woocommerce/eslint-plugin": "workspace:*",
|
||||
"eslint": "^8.12.0",
|
||||
"jest": "^27.5.1",
|
||||
"jest-cli": "^27.5.1",
|
||||
"redux": "^4.1.0",
|
||||
"rimraf": "^3.0.2",
|
||||
"ts-jest": "^27.1.3",
|
||||
"typescript": "^4.6.2"
|
||||
|
@ -65,18 +68,20 @@
|
|||
"react-dom": "^17.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"postinstall": "composer install",
|
||||
"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-staged": "jest --bail --config ./jest.config.json --findRelatedTests"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.(t|j)s?(x)": [
|
||||
"eslint --fix",
|
||||
"pnpm lint:fix",
|
||||
"pnpm test-staged"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -7,28 +7,35 @@ import { RestApiError } from '../types';
|
|||
|
||||
export function getLocalesSuccess( locales: Locales ) {
|
||||
return {
|
||||
type: TYPES.GET_LOCALES_SUCCESS,
|
||||
type: TYPES.GET_LOCALES_SUCCESS as const,
|
||||
locales,
|
||||
};
|
||||
}
|
||||
|
||||
export function getLocalesError( error: RestApiError ) {
|
||||
return {
|
||||
type: TYPES.GET_LOCALES_ERROR,
|
||||
type: TYPES.GET_LOCALES_ERROR as const,
|
||||
error,
|
||||
};
|
||||
}
|
||||
|
||||
export function getCountriesSuccess( countries: Country[] ) {
|
||||
return {
|
||||
type: TYPES.GET_COUNTRIES_SUCCESS,
|
||||
type: TYPES.GET_COUNTRIES_SUCCESS as const,
|
||||
countries,
|
||||
};
|
||||
}
|
||||
|
||||
export function getCountriesError( error: RestApiError ) {
|
||||
return {
|
||||
type: TYPES.GET_COUNTRIES_ERROR,
|
||||
type: TYPES.GET_COUNTRIES_ERROR as const,
|
||||
error,
|
||||
};
|
||||
}
|
||||
|
||||
export type Action = ReturnType<
|
||||
| typeof getLocalesSuccess
|
||||
| typeof getLocalesError
|
||||
| typeof getCountriesSuccess
|
||||
| typeof getCountriesError
|
||||
>;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
|
||||
import { registerStore } from '@wordpress/data';
|
||||
import { controls } from '@wordpress/data-controls';
|
||||
|
||||
import { SelectFromMap, DispatchFromMap } from '@automattic/data-stores';
|
||||
import { Reducer, AnyAction } from 'redux';
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
|
@ -12,10 +12,13 @@ import { STORE_NAME } from './constants';
|
|||
import * as selectors from './selectors';
|
||||
import * as actions from './actions';
|
||||
import * as resolvers from './resolvers';
|
||||
import reducer from './reducer';
|
||||
import reducer, { State } from './reducer';
|
||||
import { WPDataSelectors } from '../types';
|
||||
export * from './types';
|
||||
export type { State };
|
||||
|
||||
registerStore( STORE_NAME, {
|
||||
reducer,
|
||||
registerStore< State >( STORE_NAME, {
|
||||
reducer: reducer as Reducer< State, AnyAction >,
|
||||
actions,
|
||||
controls,
|
||||
selectors,
|
||||
|
@ -23,3 +26,13 @@ registerStore( STORE_NAME, {
|
|||
} );
|
||||
|
||||
export const COUNTRIES_STORE_NAME = STORE_NAME;
|
||||
|
||||
declare module '@wordpress/data' {
|
||||
// TODO: convert action.js to TS
|
||||
function dispatch(
|
||||
key: typeof STORE_NAME
|
||||
): DispatchFromMap< typeof actions >;
|
||||
function select(
|
||||
key: typeof STORE_NAME
|
||||
): SelectFromMap< typeof selectors > & WPDataSelectors;
|
||||
}
|
||||
|
|
|
@ -1,32 +1,29 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
|
||||
import type { Reducer } from 'redux';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
import TYPES from './action-types';
|
||||
import { CountriesState, Locales, Country } from './types';
|
||||
import { Action } from './actions';
|
||||
import { CountriesState } from './types';
|
||||
|
||||
const reducer = (
|
||||
state: CountriesState = {
|
||||
const reducer: Reducer< CountriesState, Action > = (
|
||||
state = {
|
||||
errors: {},
|
||||
locales: {},
|
||||
countries: [],
|
||||
},
|
||||
{
|
||||
type,
|
||||
error,
|
||||
locales,
|
||||
countries,
|
||||
}: {
|
||||
type: string;
|
||||
error: string;
|
||||
locales: Locales;
|
||||
countries: Country[];
|
||||
}
|
||||
): CountriesState => {
|
||||
switch ( type ) {
|
||||
action
|
||||
) => {
|
||||
switch ( action.type ) {
|
||||
case TYPES.GET_LOCALES_SUCCESS:
|
||||
state = {
|
||||
...state,
|
||||
locales,
|
||||
locales: action.locales,
|
||||
};
|
||||
break;
|
||||
case TYPES.GET_LOCALES_ERROR:
|
||||
|
@ -34,14 +31,14 @@ const reducer = (
|
|||
...state,
|
||||
errors: {
|
||||
...state.errors,
|
||||
locales: error,
|
||||
locales: action.error,
|
||||
},
|
||||
};
|
||||
break;
|
||||
case TYPES.GET_COUNTRIES_SUCCESS:
|
||||
state = {
|
||||
...state,
|
||||
countries,
|
||||
countries: action.countries,
|
||||
};
|
||||
break;
|
||||
case TYPES.GET_COUNTRIES_ERROR:
|
||||
|
@ -49,7 +46,7 @@ const reducer = (
|
|||
...state,
|
||||
errors: {
|
||||
...state.errors,
|
||||
countries: error,
|
||||
countries: action.error,
|
||||
},
|
||||
};
|
||||
break;
|
||||
|
@ -57,4 +54,5 @@ const reducer = (
|
|||
return state;
|
||||
};
|
||||
|
||||
export type State = ReturnType< typeof reducer >;
|
||||
export default reducer;
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
import { RestApiError } from '../types';
|
||||
|
||||
export type SettingProperties = {
|
||||
label?: string;
|
||||
label_class?: string[];
|
||||
|
@ -7,6 +12,7 @@ export type SettingProperties = {
|
|||
priority?: number;
|
||||
required?: boolean;
|
||||
type?: string;
|
||||
hidden?: boolean;
|
||||
};
|
||||
|
||||
export type Locale = {
|
||||
|
@ -35,7 +41,7 @@ export type Locales = {
|
|||
|
||||
export type CountriesState = {
|
||||
errors: {
|
||||
[ key: string ]: string;
|
||||
[ key: string ]: string | RestApiError | undefined;
|
||||
};
|
||||
locales: Locales;
|
||||
countries: Country[];
|
||||
|
|
|
@ -3,6 +3,71 @@
|
|||
*/
|
||||
import '@wordpress/core-data';
|
||||
|
||||
// Export store names
|
||||
export { SETTINGS_STORE_NAME } from './settings';
|
||||
export { PLUGINS_STORE_NAME } from './plugins';
|
||||
export { ONBOARDING_STORE_NAME } from './onboarding';
|
||||
export { USER_STORE_NAME } from './user';
|
||||
export { REVIEWS_STORE_NAME } from './reviews';
|
||||
export { NOTES_STORE_NAME } from './notes';
|
||||
export { REPORTS_STORE_NAME } from './reports';
|
||||
export { COUNTRIES_STORE_NAME } from './countries';
|
||||
export { NAVIGATION_STORE_NAME } from './navigation';
|
||||
export { OPTIONS_STORE_NAME } from './options';
|
||||
export { ITEMS_STORE_NAME } from './items';
|
||||
export { PAYMENT_GATEWAYS_STORE_NAME } from './payment-gateways';
|
||||
export { PaymentGateway } from './payment-gateways/types';
|
||||
|
||||
// Export hooks
|
||||
export { withSettingsHydration } from './settings/with-settings-hydration';
|
||||
export { withOnboardingHydration } from './onboarding/with-onboarding-hydration';
|
||||
export { withCurrentUserHydration } from './user/with-current-user-hydration';
|
||||
export { withNavigationHydration } from './navigation/with-navigation-hydration';
|
||||
export { withPluginsHydration } from './plugins/with-plugins-hydration';
|
||||
export {
|
||||
withOptionsHydration,
|
||||
useOptionsHydration,
|
||||
} from './options/with-options-hydration';
|
||||
export { useSettings } from './settings/use-settings';
|
||||
export { useUserPreferences } from './user/use-user-preferences';
|
||||
export { useUser } from './user/use-user';
|
||||
|
||||
// Export utils
|
||||
export { getVisibleTasks } from './onboarding/utils';
|
||||
export { getLeaderboard, searchItemsByString } from './items/utils';
|
||||
export {
|
||||
getFilterQuery,
|
||||
getSummaryNumbers,
|
||||
getReportTableData,
|
||||
getReportTableQuery,
|
||||
getReportChartData,
|
||||
getTooltipValueFormat,
|
||||
} from './reports/utils';
|
||||
|
||||
// Export constants
|
||||
export { pluginNames } from './plugins/constants';
|
||||
export { EXPORT_STORE_NAME } from './export';
|
||||
export { IMPORT_STORE_NAME } from './import';
|
||||
export {
|
||||
MAX_PER_PAGE,
|
||||
QUERY_DEFAULTS,
|
||||
NAMESPACE,
|
||||
WC_ADMIN_NAMESPACE,
|
||||
WCS_NAMESPACE,
|
||||
SECOND,
|
||||
MINUTE,
|
||||
HOUR,
|
||||
DAY,
|
||||
WEEK,
|
||||
MONTH,
|
||||
} from './constants';
|
||||
|
||||
// Export types
|
||||
export * from './types';
|
||||
export * from './countries/types';
|
||||
export * from './onboarding/types';
|
||||
export * from './plugins/types';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
|
@ -18,80 +83,6 @@ import type { REPORTS_STORE_NAME } from './reports';
|
|||
import type { ITEMS_STORE_NAME } from './items';
|
||||
import type { COUNTRIES_STORE_NAME } from './countries';
|
||||
import type { PAYMENT_GATEWAYS_STORE_NAME } from './payment-gateways';
|
||||
import { OnboardingSelectors } from './onboarding/selectors';
|
||||
import { PaymentSelectors } from './payment-gateways/selectors';
|
||||
import { WPDataSelectors } from './types';
|
||||
import { PluginSelectors } from './plugins/selectors';
|
||||
|
||||
export * from './types';
|
||||
export { SETTINGS_STORE_NAME } from './settings';
|
||||
export { withSettingsHydration } from './settings/with-settings-hydration';
|
||||
export { useSettings } from './settings/use-settings';
|
||||
|
||||
export { PLUGINS_STORE_NAME } from './plugins';
|
||||
export type { Plugin } from './plugins/types';
|
||||
export { ActionDispatchers as PluginsStoreActions } from './plugins/actions';
|
||||
export { pluginNames } from './plugins/constants';
|
||||
export { withPluginsHydration } from './plugins/with-plugins-hydration';
|
||||
|
||||
export { ONBOARDING_STORE_NAME } from './onboarding';
|
||||
export { withOnboardingHydration } from './onboarding/with-onboarding-hydration';
|
||||
export { getVisibleTasks } from './onboarding/utils';
|
||||
export type { TaskType, TaskListType } from './onboarding/types';
|
||||
|
||||
export { USER_STORE_NAME } from './user';
|
||||
export { withCurrentUserHydration } from './user/with-current-user-hydration';
|
||||
export { useUser } from './user/use-user';
|
||||
export { useUserPreferences } from './user/use-user-preferences';
|
||||
|
||||
export { OPTIONS_STORE_NAME } from './options';
|
||||
export {
|
||||
withOptionsHydration,
|
||||
useOptionsHydration,
|
||||
} from './options/with-options-hydration';
|
||||
|
||||
export { REVIEWS_STORE_NAME } from './reviews';
|
||||
|
||||
export { NOTES_STORE_NAME } from './notes';
|
||||
|
||||
export { REPORTS_STORE_NAME } from './reports';
|
||||
|
||||
export { ITEMS_STORE_NAME } from './items';
|
||||
export { getLeaderboard, searchItemsByString } from './items/utils';
|
||||
|
||||
export { COUNTRIES_STORE_NAME } from './countries';
|
||||
|
||||
export { NAVIGATION_STORE_NAME } from './navigation';
|
||||
export { withNavigationHydration } from './navigation/with-navigation-hydration';
|
||||
|
||||
export { PAYMENT_GATEWAYS_STORE_NAME } from './payment-gateways';
|
||||
|
||||
export {
|
||||
getFilterQuery,
|
||||
getSummaryNumbers,
|
||||
getReportTableData,
|
||||
getReportTableQuery,
|
||||
getReportChartData,
|
||||
getTooltipValueFormat,
|
||||
} from './reports/utils';
|
||||
|
||||
export {
|
||||
MAX_PER_PAGE,
|
||||
QUERY_DEFAULTS,
|
||||
NAMESPACE,
|
||||
WC_ADMIN_NAMESPACE,
|
||||
WCS_NAMESPACE,
|
||||
SECOND,
|
||||
MINUTE,
|
||||
HOUR,
|
||||
DAY,
|
||||
WEEK,
|
||||
MONTH,
|
||||
} from './constants';
|
||||
|
||||
export { EXPORT_STORE_NAME } from './export';
|
||||
|
||||
export { IMPORT_STORE_NAME } from './import';
|
||||
|
||||
export type WCDataStoreName =
|
||||
| typeof REVIEWS_STORE_NAME
|
||||
|
@ -107,6 +98,14 @@ export type WCDataStoreName =
|
|||
| typeof COUNTRIES_STORE_NAME
|
||||
| typeof PAYMENT_GATEWAYS_STORE_NAME;
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
import { WPDataSelectors } from './types';
|
||||
import { PaymentSelectors } from './payment-gateways/selectors';
|
||||
import { PluginSelectors } from './plugins/selectors';
|
||||
import { OnboardingSelectors } from './onboarding/selectors';
|
||||
|
||||
// As we add types to all the package selectors we can fill out these unknown types with real ones. See one
|
||||
// of the already typed selectors for an example of how you can do this.
|
||||
export type WCSelectorType< T > = T extends typeof REVIEWS_STORE_NAME
|
||||
|
@ -138,6 +137,6 @@ export type WCSelectorType< T > = T extends typeof REVIEWS_STORE_NAME
|
|||
export interface WCDataSelector {
|
||||
< T extends WCDataStoreName >( storeName: T ): WCSelectorType< T >;
|
||||
}
|
||||
export * from './onboarding/selectors';
|
||||
export * from './onboarding/types';
|
||||
export * from './countries/types';
|
||||
|
||||
// Other exports
|
||||
export { ActionDispatchers as PluginsStoreActions } from './plugins/actions';
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
|
||||
import { registerStore } from '@wordpress/data';
|
||||
import { controls } from '@wordpress/data-controls';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
import { STORE_NAME } from './constants';
|
||||
import * as selectors from './selectors';
|
||||
import * as actions from './actions';
|
||||
import * as resolvers from './resolvers';
|
||||
import reducer from './reducer';
|
||||
|
||||
registerStore( STORE_NAME, {
|
||||
reducer,
|
||||
actions,
|
||||
controls,
|
||||
selectors,
|
||||
resolvers,
|
||||
} );
|
||||
|
||||
export const ONBOARDING_STORE_NAME = STORE_NAME;
|
|
@ -0,0 +1,38 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
|
||||
import { registerStore } from '@wordpress/data';
|
||||
import { controls } from '@wordpress/data-controls';
|
||||
import { SelectFromMap, DispatchFromMap } from '@automattic/data-stores';
|
||||
import { Reducer, AnyAction } from 'redux';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
import { STORE_NAME } from './constants';
|
||||
import * as selectors from './selectors';
|
||||
import * as actions from './actions';
|
||||
import * as resolvers from './resolvers';
|
||||
import reducer from './reducer';
|
||||
import { WPDataSelectors } from '../types';
|
||||
|
||||
registerStore( STORE_NAME, {
|
||||
reducer: reducer as Reducer< ReturnType< Reducer >, AnyAction >,
|
||||
actions,
|
||||
controls,
|
||||
selectors,
|
||||
resolvers,
|
||||
} );
|
||||
|
||||
export const ONBOARDING_STORE_NAME = STORE_NAME;
|
||||
|
||||
export type OnboardingSelector = SelectFromMap< typeof selectors >;
|
||||
|
||||
declare module '@wordpress/data' {
|
||||
// TODO: convert action.js to TS
|
||||
function dispatch( key: typeof STORE_NAME ): DispatchFromMap< AnyAction >;
|
||||
function select(
|
||||
key: typeof STORE_NAME
|
||||
): SelectFromMap< typeof selectors > & WPDataSelectors;
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue