Skip to content

Commit

Permalink
Update Node and WP versions
Browse files Browse the repository at this point in the history
  • Loading branch information
jakejackson1 authored and kielllll committed Nov 26, 2024
1 parent b9ca0d1 commit 6b1908f
Show file tree
Hide file tree
Showing 229 changed files with 24,101 additions and 16,202 deletions.
25 changes: 0 additions & 25 deletions .babelrc

This file was deleted.

4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.cache
build
node_modules
vendor
27 changes: 0 additions & 27 deletions .eslintrc

This file was deleted.

35 changes: 35 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
module.exports = {
root: true,
extends: [
'plugin:@wordpress/eslint-plugin/recommended',
'plugin:jest/recommended',
],
globals: {
GFPDF: 'readonly',
Backbone: 'readonly',
jQuery: 'readonly',
gfpdf_migration_multisite_ids: 'readonly',
gf_vars: 'readonly',
tinyMCE: 'readonly',
gform: 'readonly',
ConditionalLogic: 'readonly',
GetFirstRuleField: 'readonly',
ToggleConditionalLogic: 'readonly',
GetRuleValuesDropDown: 'readonly',
QTags: 'readonly',
switchEditors: 'readonly',
getUserSetting: 'readonly',
wp: 'readonly',
gfMergeTagsObj: 'readonly',
form: 'readonly',
gform_initialize_tooltips: 'readonly',
_: 'readonly',
ClipboardJS: 'readonly',
},
rules: {
'no-alert': 'off',
'jest/no-done-callback': 'off',
camelcase: 'off',
'jsdoc/empty-tags': ['off', { tags: ['package'] }],
},
};
27 changes: 11 additions & 16 deletions .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ The Docker setup will create a fully functional development environment preconfi

1. Clone the repository using `git clone https://github.com/GravityPDF/gravity-pdf/` from the terminal
2. Copy and rename `.env.example` to `.env`, then replace `00000000000000000000000000000000` with a valid Gravity Forms license key
3. Run `yarn && yarn build:production`
4. Start Docker and then run `yarn env:install` to setup the local development environment
3. Run `composer install`
3. Run `yarn && yarn start`
5. Access a local development site at `http://localhost:8888` with the login `admin` and `password`.

If you shut down Docker and want to fire up the environment later, use `yarn wp-env start`. You can reset the database back to its original state with `yarn wp-env clean all`. When all else fails, delete everything and start again with `yarn wp-env destroy`.
You can reset the database back to its original state with `yarn wp-env clean all`. When all else fails, delete everything and start again with `yarn wp-env destroy`.

[See the WordPress Developer Handbook for more details about managing the docker environment](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-env/#wp-env-run-container-command).

Expand All @@ -39,26 +39,21 @@ X-Debug is enabled by default for step debugging and profiling. If you need to [

### Switch PHP Versions

The default version that will be configured is PHP8.0. If you want to change this you can adjust the `phpVersion` value in the `.wp-env.json` file and then stop and start the environment with `yarn wp-env start`.

## Setup without Docker

If you would rather use your own development environment, you can build Gravity PDF using the following commands.

1. Clone the repository using `git clone https://github.com/GravityPDF/gravity-pdf/`
1. Run `yarn && yarn build:production`
1. Run `composer install`
1. Run `composer run prefix`
The default version that will be configured is PHP8.3. If you want to change this you can adjust the `phpVersion` value in the `.wp-env.json` file and then stop and start the environment with `yarn wp-env start`.

## Building JavaScript

If you are making changes to any of the JavaScript or CSS, run `yarn build:dev` to ensure the files automatically gets built when you make changes on the file system.
If you are making changes to any of the JavaScript or CSS, run `yarn dev` to ensure the files automatically gets built when you make changes on the file system.

## Linting

To lint your JS code use `yarn lint:js`, and to try automatically fix it use `yarn lint:js:fix`.
To lint your:

1. JS code using `yarn lint:js`
2. CSS code using `yarn lint:css`
3. PHP code using `composer lint`

To lint your PHP code, use `composer lint`, and to try automatically fix it use `composer lint:fix`.
You can auto-fix many issues with `yarn format` and `composer lint:fix`.

## Automated Tests

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
- name: Install Composer dependencies
run: |
composer install --prefer-dist --no-suggest --no-progress --no-ansi --no-interaction
composer install --prefer-dist --no-suggest --no-progress --no-ansi --no-interaction --no-scripts
echo "${PWD}/vendor/bin" >> $GITHUB_PATH
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
13 changes: 10 additions & 3 deletions .github/workflows/end-to-end-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,23 @@ jobs:
php -i
locale -a
- name: Install Dependencies
- name: Install Composer dependencies
run: |
composer install --prefer-dist --no-suggest --no-progress --no-ansi --no-interaction --no-scripts
echo "${PWD}/vendor/bin" >> $GITHUB_PATH
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Install JS Dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install

- name: Build Gravity PDF
run: yarn build:production
run: yarn build

- name: Install / Setup Gravity PDF + WordPress
run: |
yarn env:install
yarn wp-env start
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down
17 changes: 12 additions & 5 deletions .github/workflows/phpunit.tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
${{ runner.os }}-yarn-
- name: Log debug information
run: |
Expand All @@ -103,21 +103,28 @@ jobs:
php -i
locale -a
- name: Install Dependencies
- name: Install Composer dependencies
run: |
yarn
composer install --prefer-dist --no-suggest --no-progress --no-ansi --no-interaction --no-scripts
echo "${PWD}/vendor/bin" >> $GITHUB_PATH
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Install JS Dependencies
if: steps.cache-nodemodules.outputs.cache-hit != 'true'
run: yarn install

- name: Install / Setup Gravity PDF + WordPress
if: ${{ ! matrix.report }}
run: |
yarn env:install
yarn wp-env start
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Install / Setup Gravity PDF + WordPress
if: ${{ matrix.report }}
run: |
PHP_ENABLE_XDEBUG=true yarn env:install
PHP_ENABLE_XDEBUG=true yarn wp-env start
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down
7 changes: 2 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,7 @@ node_modules/*
*.iws

## Plugin-specific files:
*.min.css
*.min.js
chunk-*.js
*.map
dist/*
build/assets/*

# Unit tests
/tmp
Expand All @@ -44,6 +40,7 @@ dist/*
# Coverage report
/coverage
/screenshots
/artifacts

# Others
_notes
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16
20
3 changes: 0 additions & 3 deletions .php-scoper/monolog.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
use Isolated\Symfony\Component\Finder\Finder;

$path = './';
if ( isset( $_SERVER['argv'][0] ) ) {
$path = dirname( $_SERVER['argv'][0] ) . '/';
}

return [

Expand Down
5 changes: 1 addition & 4 deletions .php-scoper/mpdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
use Isolated\Symfony\Component\Finder\Finder;

$path = './';
if ( isset( $_SERVER['argv'][0] ) ) {
$path = dirname( $_SERVER['argv'][0] ) . '/';
}

return [

Expand Down Expand Up @@ -71,7 +68,7 @@ function( string $filePath, string $prefix, string $content ): string {
];

if ( in_array( basename( $filePath ), $files, true ) ) {
$content = str_replace( "\\$prefix\\Psr\\Log\\LoggerInterface", '', $content );
$content = str_replace( '(LoggerInterface ', '(', $content );
}

/* Global polyfills */
Expand Down
8 changes: 0 additions & 8 deletions .php-scoper/querypath.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
use Isolated\Symfony\Component\Finder\Finder;

$path = './';
if ( isset( $_SERVER['argv'][0] ) ) {
$path = dirname( $_SERVER['argv'][0] ) . '/';
}

return [

Expand Down Expand Up @@ -37,11 +34,6 @@
*/
'patchers' => [
function( string $filePath, string $prefix, string $content ): string {

if ( basename( $filePath ) === 'DOMTraverser.php' ) {
$content = str_replace( "\\$prefix\SPLObjectStorage", '\SPLObjectStorage', $content );
}

return str_replace(
"'\\\\QueryPath\\\\",
"'\\\\$prefix\\\\QueryPath\\\\",
Expand Down
3 changes: 0 additions & 3 deletions .php-scoper/upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
use Isolated\Symfony\Component\Finder\Finder;

$path = './';
if ( isset( $_SERVER['argv'][0] ) ) {
$path = dirname( $_SERVER['argv'][0] ) . '/';
}

return [

Expand Down
3 changes: 0 additions & 3 deletions .php-scoper/url-signer.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
use Isolated\Symfony\Component\Finder\Finder;

$path = './';
if ( isset( $_SERVER['argv'][0] ) ) {
$path = dirname( $_SERVER['argv'][0] ) . '/';
}

return [

Expand Down
8 changes: 4 additions & 4 deletions .testcaferc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ module.exports = {
skipJsErrors: true,
screenshots: {
takeOnFails: true,
fullPage: true,
fullPage: true
},
hooks: {
test: {
before: async t => {
await t.useRole(admin)
}
},
},
}
}
}
}
12 changes: 9 additions & 3 deletions .wp-env.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,22 @@
"core": "https://wordpress.org/latest.zip",
"phpVersion": "8.3",
"plugins": [
"gravityforms/gravityformscli"
"gravityforms/gravityformscli",
"."
],
"lifecycleScripts": {
"afterStart": "bash bin/install.sh"
},
"mappings": {
"wp-content/plugins/gravity-pdf": "."
"wp-cli.yml": "./tools/wp-env/wp-cli.yml",
"wp-content/mu-plugins": "./tools/mu-plugins"
},
"env": {
"tests": {
"plugins": [
"gravityforms/gravityformscli",
"GravityPDF/gravity-pdf-test-suite"
"GravityPDF/gravity-pdf-test-suite",
"."
],
"config": {
"WP_DEBUG": true,
Expand Down
Loading

0 comments on commit 6b1908f

Please sign in to comment.