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

Add cors options for vite wp react #235

Merged
merged 7 commits into from
Mar 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions .changeset/young-taxes-call.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@wpsocio/vite-wp-react": patch
---

Added corsOrigin option to vite-wp-react options to deal with latest Vite API
1 change: 0 additions & 1 deletion .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ jobs:
name: e2e-artifacts-wp-${{ matrix.wp }}-php-${{ matrix.php }}
path: |
artifacts/
!artifacts/test-results
if-no-files-found: ignore

- name: Stop WordPress Environment
Expand Down
2 changes: 1 addition & 1 deletion config/wpdev.base.project.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const getBundleConfig = ({ slug, key, version, textDomain }) => {
// When updating these values, also update them in the E2E test workflow
requiresPHP: '7.4',
requiresAtLeast: '6.4',
testedUpTo: '6.7.1',
testedUpTo: '6.7.2',
},
target: {
files: [
Expand Down
3 changes: 2 additions & 1 deletion packages/js/services/get-plugin-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ export const getPluginData = <
return dataKey
? // @ts-expect-error
pluginData?.[dataKey]
: pluginData;
: // @ts-ignore
pluginData;
};
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export const useOnSubmit = (
const path = `${rest_namespace}/settings`;

const submitForm = useSubmitForm<DataShape>({
// @ts-expect-error
form,
path,
// @ts-expect-error
Expand Down
26 changes: 6 additions & 20 deletions plugins/wptelegram-comments/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,7 @@
"bugs": {
"url": "https://github.com/wpsocio/wp-projects/issues"
},
"keywords": [
"telegram",
"comments",
"discuss",
"social",
"widget"
],
"keywords": ["telegram", "comments", "discuss", "social", "widget"],
"type": "module",
"scripts": {
"dev": "vite --port=5003",
Expand Down Expand Up @@ -54,7 +48,7 @@
"autoprefixer": "^10.4.20",
"tailwindcss": "^3.4.17",
"typescript": "^5.7.2",
"vite": "^6.0.5",
"vite": "^6.2.1",
"wireit": "^0.14.9"
},
"build-utils": {
Expand All @@ -72,9 +66,7 @@
]
},
{
"paths": [
"src/assets/build/dev-server.json"
],
"paths": ["src/assets/build/dev-server.json"],
"rules": [
{
"value": "NOT_EXISTS"
Expand All @@ -86,21 +78,15 @@
"wireit": {
"build": {
"command": "vite build && pnpm run validate-build",
"output": [
"src/assets/build"
]
"output": ["src/assets/build"]
},
"setup:php": {
"command": "composer install",
"dependencies": [
"unset-vendor-dir"
]
"dependencies": ["unset-vendor-dir"]
},
"setup:php:prod": {
"command": "composer install --no-dev && pnpm run unset-vendor-dir",
"dependencies": [
"set-prod-vendor"
]
"dependencies": ["set-prod-vendor"]
},
"set-prod-vendor": {
"command": "composer config vendor-dir src/vendor"
Expand Down
1 change: 1 addition & 0 deletions plugins/wptelegram-comments/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ export default defineConfig(
makePot: {
output: 'src/languages/js-translations.pot',
},
corsOrigin: true,
}),
);
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export const useOnSubmit = (
const path = `${rest_namespace}/settings/`;

const submitForm = useSubmitForm<DataShape>({
// @ts-expect-error
form,
path,
getErrorMessage,
Expand Down
18 changes: 5 additions & 13 deletions plugins/wptelegram-login/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"autoprefixer": "^10.4.20",
"tailwindcss": "^3.4.17",
"typescript": "^5.7.2",
"vite": "^6.0.5",
"vite": "^6.2.1",
"wireit": "^0.14.9"
},
"build-utils": {
Expand All @@ -72,9 +72,7 @@
]
},
{
"paths": [
"src/assets/build/dev-server.json"
],
"paths": ["src/assets/build/dev-server.json"],
"rules": [
{
"value": "NOT_EXISTS"
Expand All @@ -86,21 +84,15 @@
"wireit": {
"build": {
"command": "vite build && pnpm run validate-build",
"output": [
"src/assets/build"
]
"output": ["src/assets/build"]
},
"setup:php": {
"command": "composer install --ignore-platform-reqs",
"dependencies": [
"unset-vendor-dir"
]
"dependencies": ["unset-vendor-dir"]
},
"setup:php:prod": {
"command": "composer install --no-dev && pnpm run unset-vendor-dir",
"dependencies": [
"set-prod-vendor"
]
"dependencies": ["set-prod-vendor"]
},
"set-prod-vendor": {
"command": "composer config vendor-dir src/vendor"
Expand Down
1 change: 0 additions & 1 deletion plugins/wptelegram-login/src/shared/Shared.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ public static function login_shortcode( $atts = [] ) {
break;

case 'custom_url':
// Prevent redirect to login page.
if ( filter_var( WPTG_Login()->options()->get( 'redirect_url' ), FILTER_VALIDATE_URL ) ) {
$redirect_to = WPTG_Login()->options()->get( 'redirect_url' );
}
Expand Down
1 change: 1 addition & 0 deletions plugins/wptelegram-login/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ export default defineConfig(
makePot: {
output: 'src/languages/js-translations.pot',
},
corsOrigin: true,
}),
);
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export const useOnSubmit = (
const path = `${rest_namespace}/settings/`;

const submitForm = useSubmitForm<DataShape>({
// @ts-expect-error
form,
path,
// @ts-expect-error
Expand Down
18 changes: 5 additions & 13 deletions plugins/wptelegram-widget/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"autoprefixer": "^10.4.20",
"tailwindcss": "^3.4.17",
"typescript": "^5.7.2",
"vite": "^6.0.5",
"vite": "^6.2.1",
"wireit": "^0.14.9"
},
"build-utils": {
Expand All @@ -73,9 +73,7 @@
]
},
{
"paths": [
"src/assets/build/dev-server.json"
],
"paths": ["src/assets/build/dev-server.json"],
"rules": [
{
"value": "NOT_EXISTS"
Expand All @@ -87,21 +85,15 @@
"wireit": {
"build": {
"command": "vite build && pnpm run validate-build",
"output": [
"src/assets/build"
]
"output": ["src/assets/build"]
},
"setup:php": {
"command": "composer install",
"dependencies": [
"unset-vendor-dir"
]
"dependencies": ["unset-vendor-dir"]
},
"setup:php:prod": {
"command": "composer install --no-dev && pnpm run unset-vendor-dir",
"dependencies": [
"set-prod-vendor"
]
"dependencies": ["set-prod-vendor"]
},
"set-prod-vendor": {
"command": "composer config vendor-dir src/vendor"
Expand Down
1 change: 1 addition & 0 deletions plugins/wptelegram-widget/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ export default defineConfig(
makePot: {
output: 'src/languages/js-translations.pot',
},
corsOrigin: true,
}),
);
1 change: 0 additions & 1 deletion plugins/wptelegram/js/settings/services/useOnSubmit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export const useOnSubmit = (
const path = `${rest_namespace}/settings/`;

const submitForm = useSubmitForm({
// @ts-expect-error
form,
path,
// @ts-expect-error
Expand Down
18 changes: 5 additions & 13 deletions plugins/wptelegram/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"autoprefixer": "^10.4.20",
"tailwindcss": "^3.4.17",
"typescript": "^5.7.2",
"vite": "^6.0.5",
"vite": "^6.2.1",
"wireit": "^0.14.9"
},
"build-utils": {
Expand All @@ -75,9 +75,7 @@
]
},
{
"paths": [
"src/assets/build/dev-server.json"
],
"paths": ["src/assets/build/dev-server.json"],
"rules": [
{
"value": "NOT_EXISTS"
Expand All @@ -89,21 +87,15 @@
"wireit": {
"build": {
"command": "vite build && pnpm run validate-build",
"output": [
"src/assets/build"
]
"output": ["src/assets/build"]
},
"setup:php": {
"command": "composer install",
"dependencies": [
"unset-vendor-dir"
]
"dependencies": ["unset-vendor-dir"]
},
"setup:php:prod": {
"command": "composer install --no-dev && pnpm run unset-vendor-dir",
"dependencies": [
"set-prod-vendor"
]
"dependencies": ["set-prod-vendor"]
},
"set-prod-vendor": {
"command": "composer config vendor-dir src/vendor"
Expand Down
1 change: 1 addition & 0 deletions plugins/wptelegram/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ export default defineConfig(
makePot: {
output: 'src/languages/js-translations.pot',
},
corsOrigin: true,
}),
);
Loading
Loading