Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release #582

Merged
merged 41 commits into from
Jul 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
2b06ca7
Add PHPStan
HardeepAsrani Jun 14, 2023
f10a639
Undo some changes
HardeepAsrani Jun 20, 2023
5b05def
Merge branch 'development' into phpstan
HardeepAsrani Jun 20, 2023
73cd90b
Rebase
HardeepAsrani Jun 20, 2023
2f56008
fix missing change
HardeepAsrani Jun 20, 2023
0789770
Add support link for Premium users
HardeepAsrani Jun 21, 2023
b6aac83
Fix review issues
HardeepAsrani Jun 21, 2023
1aca02a
Final fixes
HardeepAsrani Jun 21, 2023
3a1c60c
Remove redundant argument
HardeepAsrani Jun 21, 2023
e4615dd
chore(deps): bump codeinwp/themeisle-sdk from 3.2.41 to 3.3.1
dependabot[bot] Jun 26, 2023
b41a949
Review changes
HardeepAsrani Jun 26, 2023
a3528ed
chore: removed native lazyload fallback
GrigoreMihai Jun 26, 2023
42934e5
chore: updated tests
GrigoreMihai Jun 26, 2023
2a434d3
Add compatibility for Spectra
HardeepAsrani Jun 29, 2023
e7765db
chore: fix phpcs
HardeepAsrani Jun 29, 2023
35ea809
fix: ensure service is connected before loading compatibilities [clos…
abaicus Jun 29, 2023
7302643
Merge pull request #581 from Codeinwp/fix-compat-loading
abaicus Jun 30, 2023
950aa5b
Merge pull request #573 from Codeinwp/fix/issue-754
abaicus Jun 30, 2023
dc06c87
Merge pull request #577 from Codeinwp/native_lazy_update
abaicus Jun 30, 2023
056d012
Merge pull request #576 from Codeinwp/dependabot/composer/development…
abaicus Jun 30, 2023
60224a4
Merge pull request #568 from Codeinwp/phpstan
abaicus Jun 30, 2023
3bc6327
Merge pull request #580 from Codeinwp/issue/fix-571
abaicus Jun 30, 2023
322e4f9
chore: clearer description for cloud library browsing [closes #537]
abaicus Jul 3, 2023
a117893
fix: add error when filter length is not 3 or more characters [closes…
abaicus Jul 3, 2023
712e038
Merge pull request #585 from Codeinwp/enh/exclusions-length-notice
abaicus Jul 3, 2023
46b8a7b
Add dev build and development.php file
HardeepAsrani Jul 3, 2023
4717a11
fix spacing issues
HardeepAsrani Jul 3, 2023
11f0b4f
fix gh workflow
HardeepAsrani Jul 3, 2023
9d129fa
Add dev js build
HardeepAsrani Jul 3, 2023
f17608e
exclude react src code from build
HardeepAsrani Jul 3, 2023
440aedf
include development.php file in dev build
HardeepAsrani Jul 3, 2023
2bb39dd
chore: fix spaces/tabs inconsistency
HardeepAsrani Jul 3, 2023
acfaaa6
Merge pull request #586 from Codeinwp/fix/issue-567
abaicus Jul 4, 2023
5259b88
fix: sites not being removed from cloud library whitelist
HardeepAsrani Jul 4, 2023
5835628
fix: Optimole banner appearing in the admin inside widget iframes [cl…
abaicus Jul 5, 2023
dfd5633
remove wpinc check from dev file
HardeepAsrani Jul 5, 2023
dbf7719
Merge pull request #591 from Codeinwp/fix/banner-widgets
abaicus Jul 5, 2023
1f14954
Change type from bool to string
HardeepAsrani Jul 6, 2023
004ddcc
fix: dev build [closes #592]
abaicus Jul 6, 2023
48f60e5
Merge pull request #589 from Codeinwp/fix/issue-588
abaicus Jul 6, 2023
4c8abb9
Merge pull request #593 from Codeinwp/fix-dev-build
abaicus Jul 6, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .distignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ package.json
package-lock.json
composer.json
composer.lock
assets/js/bundle.js
npm-debug.log
bin
key.enc
Expand All @@ -33,7 +32,13 @@ grunt
tests
dist
artifact
assets/vue
assets/src
.wporg
.nvmrc
.github
cypress.config.js
.eslintrc
postcss.config.js
tailwind.config.js
phpstan.neon
development.php
12 changes: 9 additions & 3 deletions .github/workflows/build-dev-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,15 @@ jobs:
npm ci
composer install --no-dev --prefer-dist --no-progress --no-suggest
- name: Make build
run: |
npm run build
run: yarn run build
- name: Create zip
run: yarn run dist
- name: Remove build folder
run: rm -rf assets/build
- name: Make build
run: yarn run build-dev
- name: Create dev zip
run: yarn run dist --dev
- name: Retrieve branch name
id: retrieve-branch-name
run: echo "::set-output name=branch_name::$(REF=${GITHUB_HEAD_REF:-$GITHUB_REF} && echo ${REF#refs/heads/} | sed 's/\//-/g')"
Expand Down Expand Up @@ -90,7 +95,8 @@ jobs:
id: get-comment-body
run: |
body="Plugin build for ${{ github.event.pull_request.head.sha }} is ready :bellhop_bell:!
- Download [build](https://verti-artifacts.s3.amazonaws.com/${{ github.event.pull_request.base.repo.name }}-${{ needs.dev-zip.outputs.branch-name }}-${{ needs.dev-zip.outputs.git-sha-8 }}/optimole-wp.zip)"
- Download [build](https://verti-artifacts.s3.amazonaws.com/${{ github.event.pull_request.base.repo.name }}-${{ needs.dev-zip.outputs.branch-name }}-${{ needs.dev-zip.outputs.git-sha-8 }}/optimole-wp.zip)
- Download [dev](https://verti-artifacts.s3.amazonaws.com/${{ github.event.pull_request.base.repo.name }}-${{ needs.dev-zip.outputs.branch-name }}-${{ needs.dev-zip.outputs.git-sha-8 }}/optimole-wp-dev.zip)"
body="${body//$'\n'/'%0A'}"
echo "::set-output name=body::$body"
- name: Create comment on PR with links to plugin builds
Expand Down
28 changes: 27 additions & 1 deletion .github/workflows/test-php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,30 @@ jobs:
- name: Install composer
run: composer install --prefer-dist --no-progress --no-suggest --no-dev
- name: Run phpunit
run: phpunit
run: phpunit
phpstan:
name: PHPStan
runs-on: ubuntu-latest
steps:
- name: Setup PHP version
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
extensions: simplexml, mysql
- name: Checkout source code
uses: actions/checkout@v2
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Setup Composer cache
uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install composer
run: composer install --prefer-dist --no-progress --no-suggest
- name: PHPStan Static Analysis
run: composer phpstan
18 changes: 16 additions & 2 deletions assets/src/parts/connected/Sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import {

import { useSelect } from '@wordpress/data';

import { addQueryArgs } from '@wordpress/url';

const reasons = [
optimoleDashboardApp.strings.upgrade.reason_1,
optimoleDashboardApp.strings.upgrade.reason_2,
Expand Down Expand Up @@ -69,7 +71,7 @@ const Sidebar = () => {
/>
</div>

{ 'free' === plan && (
{ 'free' === plan ? (
<div
className="bg-info flex flex-col text-white border-0 rounded-lg shadow-md p-8 bg-promo bg-no-repeat"
style={ {
Expand All @@ -90,7 +92,6 @@ const Sidebar = () => {
) ) }
</ul>


<Button
variant="link"
className="optml__button flex w-full justify-center font-bold min-h-40 !no-underline !text-white !bg-opaque-black !rounded"
Expand All @@ -100,6 +101,19 @@ const Sidebar = () => {
{ optimoleDashboardApp.strings.upgrade.cta }
</Button>
</div>
) : (
<Button
variant="default"
className="bg-white flex font-bold border-0 rounded-lg shadow-md p-8 text-sm justify-center"
href={ addQueryArgs( 'https://optimole.com/contact/', {
contact_name: window.optimoleDashboardApp.user_data.display_name,
contact_email: optimoleDashboardApp.user_data.user_email,
contact_website: optimoleDashboardApp.home_url
}) }
target="_blank"
>
{ optimoleDashboardApp.strings.premium_support }
</Button>
) }
</div>
);
Expand Down
14 changes: 13 additions & 1 deletion assets/src/parts/connected/settings/FilterControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ const FilterControl = ({
const [ filterOperator, setFilterOperator ] = useState( optimoleDashboardApp.strings.options_strings.filter_operator_contains );
const [ filterValue, setFilterValue ] = useState( '' );
const [ filterMatchType, setFilterMatchType ] = useState( optimoleDashboardApp.strings.options_strings.filter_operator_contains );
const [ lengthError, setLengthError ] = useState( false );

const changeFilterType = value => {
let selectedValue = '';
Expand All @@ -122,12 +123,20 @@ const FilterControl = ({
setFilterOperator( optimoleDashboardApp.strings.options_strings.filter_operator_contains );
}

setLengthError( false );
setFilterValue( selectedValue );
setFilterType( value );
};

const updateFilterValue = value => {
setFilterValue( value );
setLengthError( false );
};

const addFilter = () => {
if ( 3 > filterValue.length ) {
setLengthError( true );

return;
}

Expand Down Expand Up @@ -255,7 +264,7 @@ const FilterControl = ({
<TextControl
value={ filterValue }
placeholder={ 'matches' === filterMatchType ? 'path' : 'word' }
onChange={ setFilterValue }
onChange={ updateFilterValue }
className="optml__input"
/>
) }
Expand All @@ -271,6 +280,9 @@ const FilterControl = ({
{ optimoleDashboardApp.strings.options_strings.add_filter }
</Button>
</div>
{ lengthError && (
<p className="text-red-500 bg-red-100 p-2 rounded-md border border-solid border-red-200">{ optimoleDashboardApp.strings.options_strings.filter_length_error }</p>
)}
</BaseControl>

{ hasItems && (
Expand Down
22 changes: 9 additions & 13 deletions assets/src/parts/connected/settings/OffloadMedia.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ import {
useState
} from '@wordpress/element';

import { addAction } from '@wordpress/hooks';

/**
* Internal dependencies.
*/
Expand Down Expand Up @@ -142,13 +140,19 @@ const OffloadMedia = ({
const data = { ...settings };

if ( 0 === value.length ) {
sites.all = true;
sites.all = 'true';
} else {
value.forEach( ( site ) => {
sites[ site ] = true;
sites[ site ] = 'true';
});
}

Object.keys( data[ 'cloud_sites' ]).forEach( ( site ) => {
if ( ! Object.prototype.hasOwnProperty.call( sites, site ) ) {
sites[ site ] = 'false';
}
});

data[ 'cloud_sites' ] = sites;
setSettings( data );
};
Expand Down Expand Up @@ -190,14 +194,6 @@ const OffloadMedia = ({
});
};

addAction(
'optimole.settings.save',
'optimole/rollback',
() => {
console.log( 'Trigger save!!!' );
}
);

return (
<>
<ToggleControl
Expand All @@ -223,7 +219,7 @@ const OffloadMedia = ({
>
<div className="optml__token__base flex p-6 bg-light-blue border border-blue-300 rounded-md items-center gap-8">
<FormTokenField
value={ Object.keys( settings['cloud_sites']).filter( site => 'all' !== site ).map( site => site ) || []}
value={ Object.keys( settings['cloud_sites']).filter( site => 'all' !== site && 'false' !== settings['cloud_sites'][ site ]).map( site => site ) || []}
suggestions={ whitelistedDomains }
onChange={ updateSites }
__experimentalExpandOnFocus={ true }
Expand Down
31 changes: 27 additions & 4 deletions bin/dist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,38 @@ BUILD_NAME=$(node -pe "require('./package.json').name")
export BUILD_NAME

if [ ! -d "dist" ]; then
mkdir "dist"
mkdir "dist"
fi

if [ ! -d "artifact" ]; then
mkdir "artifact"
mkdir "artifact"
fi

rsync -rc --exclude-from ".distignore" "./" "dist/$BUILD_NAME"
if [ "$1" = "--dev" ]; then
DIST_FOLDER="$BUILD_NAME-dev"
else
DIST_FOLDER=$BUILD_NAME
fi

rsync -rc --exclude-from ".distignore" "./" "dist/$DIST_FOLDER"

if [ "$1" = "--dev" ]; then
cp -f "development.php" "dist/$DIST_FOLDER"
file="dist/$DIST_FOLDER/optimole-wp.php"

# Necessary for mac os.
if [[ $(uname -s) == 'Darwin' ]]; then
I_FLAG='-i.bak'
else
I_FLAG='-i'
fi

sed $I_FLAG "s/define( 'OPTML_BASEFILE', __FILE__ );/define( 'OPTML_BASEFILE', __FILE__ );\nrequire_once OPTML_PATH . '\/development.php';/" $file

fi

cd dist
zip -r "../artifact/$BUILD_NAME" "./$BUILD_NAME/"
zip -r "../artifact/$DIST_FOLDER" "./$DIST_FOLDER/"

echo "BUILD GENERATED: $DIST_FOLDER"
cd -
14 changes: 12 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,16 @@
"vendor/codeinwp/themeisle-sdk/load.php"
]
},
"autoload-dev": {
"files": [
"vendor/codeinwp/themeisle-sdk/load.php",
"development.php"
]
},
"config": {
"optimize-autoloader": true,
"platform": {
"php": "5.6"
"php": "7.4"
},
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
Expand All @@ -34,14 +40,18 @@
"squizlabs/php_codesniffer": "^3.3",
"wp-coding-standards/wpcs": "^2.3.0",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
"yoast/phpunit-polyfills": "^1.0"
"yoast/phpunit-polyfills": "^1.0",
"phpstan/phpstan": "^1.10",
"szepeviktor/phpstan-wordpress": "^1.3",
"php-stubs/wp-cli-stubs": "^2.8"
},
"scripts": {
"format": "phpcbf --standard=phpcs.xml --report-summary --report-source",
"phpcs": "phpcs --standard=phpcs.xml --extensions=php -s",
"phpmd": "phpmd inc text phpmd.xml",
"test": "phpunit --configuration=phpunit.xml",
"lint": "composer run-script phpcs",
"phpstan": "phpstan analyse --memory-limit 2G",
"install-wp-tests": "bash bin/install-wp-tests.sh wordpress_test root '' localhost latest"
},
"require": {
Expand Down
Loading
Loading