Skip to content

Commit

Permalink
Merge branch 'trunk' into fix/84
Browse files Browse the repository at this point in the history
  • Loading branch information
dkotter committed Aug 12, 2024
2 parents 2379701 + 48978f1 commit 298eabb
Show file tree
Hide file tree
Showing 204 changed files with 14,720 additions and 39,511 deletions.
13 changes: 10 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
module.exports = {
extends: ['plugin:@woocommerce/eslint-plugin/recommended'],
extends: [ 'plugin:@woocommerce/eslint-plugin/recommended' ],
globals: {
_: false,
Backbone: false,
jQuery: false,
wp: false,
wc: false,
wcSquareSettings: false,
},
settings: {
Expand All @@ -20,7 +21,7 @@ module.exports = {
],
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
extensions: [ '.js', '.jsx', '.ts', '.tsx' ],
},
},
},
Expand All @@ -31,10 +32,16 @@ module.exports = {
'react-hooks/rules-of-hooks': 'off',
'@woocommerce/dependency-group': 'off',
camelcase: 'off',
'@wordpress/i18n-text-domain': [
'error',
{
allowedTextDomain: 'woocommerce-square',
},
],
},
overrides: [
{
files: ['**/assets/blocks/**/**.js'],
files: [ '**/assets/blocks/**/**.js' ],
globals: {
jQuery: true,
browser: true,
Expand Down
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ docs export-ignore
mode_modules export-ignore
wordpress-org-assets export-ignore
tests export-ignore
src export-ignore
test-plugins export-ignore

# Files
.distignore export-ignore
Expand Down
17 changes: 14 additions & 3 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
SQUARE_APPLICATION_ID: ${{ secrets.SQUARE_APPLICATION_ID }}
SQUARE_ACCESS_TOKEN: ${{ secrets.SQUARE_ACCESS_TOKEN }}
SQUARE_LOCATION_ID: ${{ secrets.SQUARE_LOCATION_ID }}
GH_TOKEN: ${{ secrets.BOT_GH_TOKEN }}
permissions:
pull-requests: write
steps:
Expand All @@ -37,18 +38,28 @@ jobs:
- name: Install playwright
run: npx playwright install

# Use compiled versions to avoid need for npm and composer installation and build step.
- name: Install required WP plugins
run: |
gh release download --repo woocommerce/woocommerce-pre-orders --pattern woocommerce-pre-orders.zip --dir ./test-plugins
gh release download --repo woocommerce/woocommerce-subscriptions --pattern woocommerce-subscriptions.zip --dir ./test-plugins
cd ./test-plugins
unzip -o woocommerce-pre-orders.zip
unzip -o woocommerce-subscriptions.zip
cd ..
- name: Set the core version
if: "${{ contains(github.event.pull_request.labels.*.name, 'needs: WP RC test') }}"
id: run-rc-test
run: ./tests/bin/set-core-version.js WordPress/WordPress#master

- name: Setup E2E environment
run: npm run test:env:start
run: npm run env:start

- name: Run E2E tests
id: square_e2e_tests
if: ${{ github.event_name == 'pull_request' }}
run: npm run test:e2e-run
run: npm run test:e2e

- name: Remove existing labels
uses: actions/github-script@v6
Expand Down Expand Up @@ -101,7 +112,7 @@ jobs:
- name: Run E2E Smoke Test
if: ${{ github.event_name == 'push' }}
run: npm run test:e2e-run
run: npm run test:e2e

- uses: actions/upload-artifact@v3
if: always()
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ docker/logs
/test-results/
/playwright-report/
/playwright/.cache/
tests/e2e/test-results
tests/e2e/test-results
test-plugins/
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v16
v20
7 changes: 3 additions & 4 deletions .wp-env.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
"plugins": [
"https://downloads.wordpress.org/plugin/woocommerce.zip",
"https://downloads.wordpress.org/plugin/email-log.zip",
"."
".",
"./test-plugins/woocommerce-subscriptions",
"./test-plugins/woocommerce-pre-orders"
],
"themes": [ "https://downloads.wordpress.org/theme/storefront.zip" ],
"env": {
Expand All @@ -16,8 +18,5 @@
"config": {
"WP_ALLOW_MULTISITE": true,
"ALTERNATE_WP_CRON": true
},
"lifecycleScripts": {
"afterStart": "bash ./tests/e2e/config/env-post-setup.sh"
}
}
169 changes: 77 additions & 92 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,57 +1,56 @@
/*jshint node:true */
module.exports = function( grunt ) {
module.exports = function (grunt) {
'use strict';

const sass = require('sass');

const isProduction = process.env.NODE_ENV === 'production';
const mode = isProduction ? 'production' : 'development';
const makeSourceMaps = mode === 'development';

grunt.initConfig({

grunt.initConfig({
// Gets the package vars
pkg: grunt.file.readJSON( 'package.json' ),
pkg: grunt.file.readJSON('package.json'),

// Setting folder templates
dirs: {
css: 'assets/css',
fonts: 'assets/fonts',
images: 'assets/images',
js: 'assets/js'
js: 'assets/js',
},

// Compile all .scss files.
sass: {
compile: {
options: {
sourceMap: makeSourceMaps,
implementation: sass
implementation: sass,
},
files: [{
expand: true,
cwd: '<%= dirs.css %>/',
src: ['**/*.scss'],
dest: '<%= dirs.css %>/',
ext: '.min.css'
}]
}
files: [
{
expand: true,
cwd: '<%= dirs.css %>/',
src: ['**/*.scss'],
dest: '<%= dirs.css %>/',
ext: '.min.css',
},
],
},
},

// Minify all .css files.
cssmin: {
options: {
sourceMap: makeSourceMaps
sourceMap: makeSourceMaps,
},
minify: {
expand: true,
cwd: '<%= dirs.css %>/',
src: [
'**/*.css',
],
src: ['**/*.css'],
dest: '<%= dirs.css %>/',
ext: '.min.css'
}
ext: '.min.css',
},
},

// Transpile ES6 to ES5
Expand All @@ -72,49 +71,49 @@ module.exports = function( grunt ) {
],
},
dist: {
files: [{
expand: true,
cwd: '<%= dirs.js %>/',
src: [
'**/*.js',
],
dest: '<%= dirs.js %>/',
ext: '.min.js'
}]
}
files: [
{
expand: true,
cwd: '<%= dirs.js %>/',
src: ['**/*.js'],
dest: '<%= dirs.js %>/',
ext: '.min.js',
},
],
},
},

// Watch changes for assets
watch: {
js: {
files: [
'<%= dirs.js %>/**/*.js',
'!<%= dirs.js %>/**/*.min.js'
'!<%= dirs.js %>/**/*.min.js',
],
tasks: ['babel']
tasks: ['babel'],
},
sass: {
files: ['<%= dirs.css %>/**/*.scss'],
tasks: ['sass', 'cssmin'],
}
},
},

// Shell scripts
shell: {
options: {
stdout: true,
stderr: true
stderr: true,
},
txpull: {
command: [
'tx pull -a -f', // Transifex download .po files
].join( '&&' )
].join('&&'),
},
txpush: {
command: [
'tx push -s' // Transifex - send .pot file
].join( '&&' )
}
'tx push -s', // Transifex - send .pot file
].join('&&'),
},
},

// Generate POT files.
Expand All @@ -123,25 +122,22 @@ module.exports = function( grunt ) {
type: 'wp-plugin',
domainPath: 'i18n/languages',
potHeaders: {
'report-msgid-bugs-to': 'https://wordpress.org/support/plugin/woocommerce-square',
'language-team': 'LANGUAGE <EMAIL@ADDRESS>'
}
'report-msgid-bugs-to':
'https://wordpress.org/support/plugin/woocommerce-square',
'language-team': 'LANGUAGE <EMAIL@ADDRESS>',
},
},
dist: {
options: {
potFilename: 'woocommerce-square.pot',
exclude: [
'apigen/.*',
'tests/.*',
'tmp/.*'
]
}
}
exclude: ['apigen/.*', 'tests/.*', 'tmp/.*'],
},
},
},

// Check textdomain errors.
checktextdomain: {
options:{
options: {
text_domain: 'woocommerce-square',
keywords: [
'__:1,2d',
Expand All @@ -157,56 +153,45 @@ module.exports = function( grunt ) {
'_n:1,2,4d',
'_nx:1,2,4c,5d',
'_n_noop:1,2,3d',
'_nx_noop:1,2,3c,4d'
]
'_nx_noop:1,2,3c,4d',
],
},
files: {
src: [
'**/*.php', // Include all files
'!apigen/**', // Exclude apigen/
src: [
'**/*.php', // Include all files
'!apigen/**', // Exclude apigen/
'!node_modules/**', // Exclude node_modules/
'!tests/**', // Exclude tests/
'!vendor/**', // Exclude vendor/
'!tmp/**' // Exclude tmp/
'!tests/**', // Exclude tests/
'!vendor/**', // Exclude vendor/
'!tmp/**', // Exclude tmp/
'!test-plugins/**', // Exclude test-plugins/
],
expand: true
}
expand: true,
},
},
});

// Load NPM tasks to be used here
grunt.loadNpmTasks( 'grunt-sass' );
grunt.loadNpmTasks( 'grunt-shell' );
grunt.loadNpmTasks( 'grunt-phpcs' );
grunt.loadNpmTasks( 'grunt-rtlcss' );
grunt.loadNpmTasks( 'grunt-postcss' );
grunt.loadNpmTasks( 'grunt-stylelint' );
grunt.loadNpmTasks( 'grunt-wp-i18n' );
grunt.loadNpmTasks( 'grunt-checktextdomain' );
grunt.loadNpmTasks( 'grunt-babel' );
grunt.loadNpmTasks( 'grunt-contrib-cssmin' );
grunt.loadNpmTasks( 'grunt-contrib-concat' );
grunt.loadNpmTasks( 'grunt-contrib-watch' );
grunt.loadNpmTasks( 'grunt-contrib-clean' );
grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-phpcs');
grunt.loadNpmTasks('grunt-rtlcss');
grunt.loadNpmTasks('grunt-postcss');
grunt.loadNpmTasks('grunt-stylelint');
grunt.loadNpmTasks('grunt-wp-i18n');
grunt.loadNpmTasks('grunt-checktextdomain');
grunt.loadNpmTasks('grunt-babel');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-clean');

// Register tasks
grunt.registerTask( 'default', [
'css',
'js',
'i18n'
]);

grunt.registerTask( 'js', [
'babel',
]);

grunt.registerTask( 'i18n', [
'checktextdomain',
'makepot'
]);

grunt.registerTask( 'css', [
'sass',
'cssmin'
]);
grunt.registerTask('default', ['css', 'js', 'i18n']);

grunt.registerTask('js', ['babel']);

grunt.registerTask('i18n', ['checktextdomain', 'makepot']);

grunt.registerTask('css', ['sass', 'cssmin']);
};
Loading

0 comments on commit 298eabb

Please sign in to comment.