Skip to content

Commit

Permalink
Merge pull request #262 from newfold-labs/release/2.1.0
Browse files Browse the repository at this point in the history
Release/2.1.0
  • Loading branch information
wpalani authored Jul 9, 2024
2 parents a7ce616 + b3f0986 commit c323b3b
Show file tree
Hide file tree
Showing 59 changed files with 4,937 additions and 5,729 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/cypress-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ jobs:
- '8.1'
- '8.2'
wpVersion:
- '6.2'
- '6.3'
- '6.4'
- '6.5'

steps:

Expand All @@ -55,18 +55,18 @@ jobs:
echo "DIST=${PWD}/dist" >> $GITHUB_OUTPUT
echo "PACKAGE=${REPO##*/}" >> $GITHUB_OUTPUT
- name: Use Node.js 16.x
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 16.x
node-version: 20.x
cache: 'npm'

- name: Get Composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache Composer vendor directory
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
Expand Down Expand Up @@ -123,7 +123,7 @@ jobs:

- name: Store screenshots of test failures
if: ${{ failure() }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: screenshots
path: ./tests/cypress/screenshots
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/cypress-tests-beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,18 @@ jobs:
mkdir dist
echo "DIST=${PWD}/dist" >> $GITHUB_OUTPUT
echo "PACKAGE=${REPO##*/}" >> $GITHUB_OUTPUT
- name: Use Node.js 16.x
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 16.x
node-version: 20.x
cache: 'npm'

- name: Get Composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache Composer vendor directory
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
Expand Down Expand Up @@ -104,7 +104,7 @@ jobs:

- name: Store screenshots of test failures
if: failure()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: screenshots
path: ./tests/cypress/screenshots
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,17 @@ jobs:
echo "DIST=${PWD}/dist" >> $GITHUB_OUTPUT
echo "PACKAGE=${REPO##*/}" >> $GITHUB_OUTPUT
- name: Use Node.js 16.x
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 16.x
node-version: 20.x

- name: Get npm cache directory
id: npm-cache
run: echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT

- name: Cache node modules
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
Expand All @@ -70,7 +70,7 @@ jobs:
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache Composer vendor directory
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
Expand Down Expand Up @@ -122,7 +122,7 @@ jobs:

- name: Store screenshots of test failures
if: ${{ failure() }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: screenshots
path: ./tests/cypress/screenshots
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint-php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
if: "!! env.GIT_DIFF"

- name: Cache Composer vendor directory
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/upload-artifact-on-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,17 @@ jobs:
echo "DIST=${PWD}/dist" >> $GITHUB_OUTPUT
echo "PACKAGE=${REPO##*/}" >> $GITHUB_OUTPUT
- name: Use Node.js 16.x
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 16.x
node-version: 20.x

- name: Get npm cache directory
id: npm-cache
run: echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT

- name: Cache node modules
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
Expand All @@ -64,7 +64,7 @@ jobs:
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache Composer vendor directory
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
Expand Down Expand Up @@ -100,7 +100,7 @@ jobs:
working-directory: ${{ steps.workflow.outputs.DIST }}
run: find .

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: ${{ steps.workflow.outputs.PACKAGE }}
path: ${{ steps.workflow.outputs.DIST }}
8 changes: 4 additions & 4 deletions .github/workflows/upload-asset-on-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,17 @@ jobs:
echo "DIST=${PWD}/dist" >> $GITHUB_OUTPUT
echo "PACKAGE=${REPO##*/}" >> $GITHUB_OUTPUT
- name: Set Node.js 16.x
- name: Set Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 16.x
node-version: 20.x

- name: Get npm cache directory
id: npm-cache
run: echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT

- name: Cache node modules
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
Expand All @@ -76,7 +76,7 @@ jobs:
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache Composer vendor directory
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
Expand Down
33 changes: 26 additions & 7 deletions .github/workflows/wp-i18n.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,24 @@ jobs:
with:
php-version: '8.1'
coverage: none
tools: composer
tools: composer, cs2pr

- name: Get Composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache Composer vendor directory
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
- name: Setup Node
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 16
node-version: 20.x

- name: Log debug information
run: |
Expand All @@ -64,25 +64,44 @@ jobs:
- name: Install PHP Dependencies
run: composer install --no-progress --optimize-autoloader

- name: Setup Registry
run: printf "\n//npm.pkg.github.com/:_authToken=${{ secrets.NEWFOLD_ACCESS_TOKEN }}" >> .npmrc

- name: NPM Install
run: npm install --legacy-peer-deps

- name: Build JavaScript
run: npm run build

- name: Remove token
run: git checkout -- '.npmrc'


- name: Add text domains
run: npx node-wp-i18n addtextdomain

- name: Generate POT file
run: vendor/bin/wp i18n make-pot . ./languages/${{ github.event.repository.name }}.pot --headers='{"Report-Msgid-Bugs-To":"https://github.com/${{ github.repository }}/issues","POT-Creation-Date":null}' --exclude=assets,storybook,tests
- name: Generate language files
run: composer run-script i18n

- name: Check if there are file changes
id: changes
continue-on-error: true
run: git diff --exit-code

- name: Warning if language files have changes
if: steps.changes.outcome == 'failure'
run: |
echo "i18n files are out of date"
echo "Please run command (composer run i18n) locally to update them and commit before releasing"
- name: Commit web files
if: steps.changes.outcome == 'failure'
run: |
git config --local user.name "${{ github.event.head_commit.author.name }}"
git config --local user.email "${{ github.event.head_commit.author.email }}"
git remote -v
git add -A
git commit -m "WordPress I18N triggered by commit ${{ github.sha }}"
git commit -m "WordPress i18n triggered by commit ${{ github.sha }}"
git status
- name: Push changes
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v16
v20
2 changes: 1 addition & 1 deletion .wp-env.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"core": "WordPress/WordPress#tags/6.4.1",
"core": "WordPress/WordPress#tags/6.5.5",
"config": {
"WP_DEBUG": true,
"WP_DEBUG_LOG": true,
Expand Down
22 changes: 13 additions & 9 deletions bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
use WP_Forge\UpgradeHandler\UpgradeHandler;
use NewfoldLabs\WP\ModuleLoader\Container;
use NewfoldLabs\WP\ModuleLoader\Plugin;
use NewfoldLabs\WP\Module\Features\Features;

use function NewfoldLabs\WP\ModuleLoader\container as setContainer;

// Composer autoloader
Expand All @@ -36,7 +38,7 @@
$web_module_container->set(
'plugin',
$web_module_container->service(
function() {
function () {
return new Plugin(
array(
'id' => 'web',
Expand Down Expand Up @@ -99,16 +101,16 @@ function() {
)
);
$pluginUpdater->setDataOverrides(
[
'banners' => [
array(
'banners' => array(
'2x' => 'https://cdn.hiive.space/marketplace/vendors-assets/web-banner.svg',
'1x' => 'https://cdn.hiive.space/marketplace/vendors-assets/web-banner.svg',
],
'icons' => [
),
'icons' => array(
'2x' => 'https://cdn.hiive.space/marketplace/vendors-assets/web-icon.svg',
'1x' => 'https://cdn.hiive.space/marketplace/vendors-assets/web-icon.svg',
],
]
),
)
);

// Handle any upgrade routines (only in the admin)
Expand Down Expand Up @@ -149,6 +151,8 @@ function() {

AdminBar::init();

// Instantiate the Features singleton
Features::getInstance();

/**
* Filter to add applicable BN code to paypal requests
Expand Down Expand Up @@ -187,7 +191,7 @@ function ( $tag, $handle, $source ) {
$replacement = ' data-partner-attribution-id="Yith_PCP"';
if ( stripos( $tag, 'partner-attribution-id' ) === false ) {
$tag = str_replace( ' src=', $replacement . ' src=', $tag );
} else if ( stripos( $tag, 'NEWFOLD' ) || stripos( $tag, 'YITH' ) ) {
} elseif ( stripos( $tag, 'NEWFOLD' ) || stripos( $tag, 'YITH' ) ) {
$tag = preg_replace( '/ data-partner-attribution-id="(.*?)"/', $replacement, $tag );
}
}
Expand All @@ -196,4 +200,4 @@ function ( $tag, $handle, $source ) {
25,
3
);
}
}
Loading

0 comments on commit c323b3b

Please sign in to comment.