Monorepo: rework deps patching in favour of built-in pnpm functionality (#49892)
* Monorepo: added pach. * Monorepo: added patch. * Monorepo: added patch. * Monorepo: added patch. * Monorepo: added patch. * Monorepo: cleanup. * Monorepo: cleanup. * Monorepo: changelog entry.
This commit is contained in:
parent
b796b90d68
commit
474b7624d0
|
@ -0,0 +1,44 @@
|
||||||
|
diff --git a/build-module/lock-unlock.js b/build-module/lock-unlock.js
|
||||||
|
index 2265f933ceec19f65ca6776c24c3f88b368d713f..e9e10980bfd1b584ab0a037c3b72edae29a2a26e 100644
|
||||||
|
--- a/build-module/lock-unlock.js
|
||||||
|
+++ b/build-module/lock-unlock.js
|
||||||
|
@@ -1,9 +1,34 @@
|
||||||
|
/**
|
||||||
|
- * WordPress dependencies
|
||||||
|
+ * External dependencies
|
||||||
|
*/
|
||||||
|
import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';
|
||||||
|
-export const {
|
||||||
|
- lock,
|
||||||
|
- unlock
|
||||||
|
-} = __dangerousOptInToUnstableAPIsOnlyForCoreModules('I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.', '@wordpress/edit-site');
|
||||||
|
+
|
||||||
|
+// Workaround for Gutenberg private API consent string differences between WP 6.3 and 6.4+
|
||||||
|
+// The modified version checks for the WP version and replaces the consent string with the correct one.
|
||||||
|
+// This can be removed once we drop support for WP 6.3 in the "Customize Your Store" task.
|
||||||
|
+// See this PR for details: https://github.com/woocommerce/woocommerce/pull/40884
|
||||||
|
+
|
||||||
|
+const wordPressConsentString = {
|
||||||
|
+ 6.4: 'I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.',
|
||||||
|
+ 6.5: 'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.',
|
||||||
|
+ 6.6: 'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+function optInToUnstableAPIs() {
|
||||||
|
+ let error;
|
||||||
|
+ for ( const optInString of Object.values( wordPressConsentString ) ) {
|
||||||
|
+ try {
|
||||||
|
+ return __dangerousOptInToUnstableAPIsOnlyForCoreModules(
|
||||||
|
+ optInString,
|
||||||
|
+ '@wordpress/edit-site'
|
||||||
|
+ );
|
||||||
|
+ } catch ( anError ) {
|
||||||
|
+ error = anError;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ throw error;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+export const { lock, unlock } = optInToUnstableAPIs();
|
||||||
|
//# sourceMappingURL=lock-unlock.js.map
|
|
@ -75,6 +75,9 @@
|
||||||
"@types/react": "^17.0.71",
|
"@types/react": "^17.0.71",
|
||||||
"react-resize-aware": "3.1.1",
|
"react-resize-aware": "3.1.1",
|
||||||
"@automattic/tour-kit>@wordpress/element": "4.4.1"
|
"@automattic/tour-kit>@wordpress/element": "4.4.1"
|
||||||
|
},
|
||||||
|
"patchedDependencies": {
|
||||||
|
"@wordpress/edit-site@5.15.0": "bin/patches/@wordpress__edit-site@5.15.0.patch"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,34 +0,0 @@
|
||||||
/**
|
|
||||||
* External dependencies
|
|
||||||
*/
|
|
||||||
import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';
|
|
||||||
|
|
||||||
// Workaround for Gutenberg private API consent string differences between WP 6.3 and 6.4+
|
|
||||||
// The modified version checks for the WP version and replaces the consent string with the correct one.
|
|
||||||
// This can be removed once we drop support for WP 6.3 in the "Customize Your Store" task.
|
|
||||||
// See this PR for details: https://github.com/woocommerce/woocommerce/pull/40884
|
|
||||||
|
|
||||||
const wordPressConsentString = {
|
|
||||||
6.4: 'I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.',
|
|
||||||
6.5: 'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.',
|
|
||||||
6.6: 'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',
|
|
||||||
};
|
|
||||||
|
|
||||||
function optInToUnstableAPIs() {
|
|
||||||
let error;
|
|
||||||
for ( const optInString of Object.values( wordPressConsentString ) ) {
|
|
||||||
try {
|
|
||||||
return __dangerousOptInToUnstableAPIsOnlyForCoreModules(
|
|
||||||
optInString,
|
|
||||||
'@wordpress/edit-site'
|
|
||||||
);
|
|
||||||
} catch ( anError ) {
|
|
||||||
error = anError;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const { lock, unlock } = optInToUnstableAPIs();
|
|
||||||
//# sourceMappingURL=lock-unlock.js.map
|
|
|
@ -16,7 +16,6 @@
|
||||||
"build": "pnpm --if-present --workspace-concurrency=Infinity --stream --filter=\"$npm_package_name...\" '/^build:project:.*$/'",
|
"build": "pnpm --if-present --workspace-concurrency=Infinity --stream --filter=\"$npm_package_name...\" '/^build:project:.*$/'",
|
||||||
"build:project": "pnpm --if-present '/^build:project:.*$/'",
|
"build:project": "pnpm --if-present '/^build:project:.*$/'",
|
||||||
"build:project:bundle": "wireit",
|
"build:project:bundle": "wireit",
|
||||||
"build:project:patch-dependecies": "cp ./bin/modified-editsite-lock-unlock.js ./node_modules/@wordpress/edit-site/build-module/lock-unlock.js",
|
|
||||||
"build:project:feature-config": "php ../woocommerce/bin/generate-feature-config.php",
|
"build:project:feature-config": "php ../woocommerce/bin/generate-feature-config.php",
|
||||||
"changelog": "XDEBUG_MODE=off composer install --quiet && composer exec -- changelogger",
|
"changelog": "XDEBUG_MODE=off composer install --quiet && composer exec -- changelogger",
|
||||||
"example": "webpack --config docs/examples/extensions/examples.config.js",
|
"example": "webpack --config docs/examples/extensions/examples.config.js",
|
||||||
|
@ -30,7 +29,6 @@
|
||||||
"watch:build": "pnpm --if-present --workspace-concurrency=Infinity --filter=\"$npm_package_name...\" --parallel '/^watch:build:project:.*$/'",
|
"watch:build": "pnpm --if-present --workspace-concurrency=Infinity --filter=\"$npm_package_name...\" --parallel '/^watch:build:project:.*$/'",
|
||||||
"watch:build:project": "pnpm --if-present run '/^watch:build:project:.*$/'",
|
"watch:build:project": "pnpm --if-present run '/^watch:build:project:.*$/'",
|
||||||
"watch:build:project:bundle": "wireit",
|
"watch:build:project:bundle": "wireit",
|
||||||
"watch:build:project:patch-dependecies": "cp ./bin/modified-editsite-lock-unlock.js ./node_modules/@wordpress/edit-site/build-module/lock-unlock.js",
|
|
||||||
"watch:build:project:feature-config": "WC_ADMIN_PHASE=development php ../woocommerce/bin/generate-feature-config.php",
|
"watch:build:project:feature-config": "WC_ADMIN_PHASE=development php ../woocommerce/bin/generate-feature-config.php",
|
||||||
"postinstall": "node ./bin/xstate5-react-script.js"
|
"postinstall": "node ./bin/xstate5-react-script.js"
|
||||||
},
|
},
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: patch
|
||||||
|
Type: dev
|
||||||
|
|
||||||
|
Monorepo: refine approach to patching dependecies in favour of built-in pnpm functionality.
|
|
@ -11,6 +11,11 @@ overrides:
|
||||||
|
|
||||||
pnpmfileChecksum: y3ex4x7shfdnqpcpdnu67kmuvu
|
pnpmfileChecksum: y3ex4x7shfdnqpcpdnu67kmuvu
|
||||||
|
|
||||||
|
patchedDependencies:
|
||||||
|
'@wordpress/edit-site@5.15.0':
|
||||||
|
hash: 6y3l6gxu33zybfmvbjd23dtqda
|
||||||
|
path: bin/patches/@wordpress__edit-site@5.15.0.patch
|
||||||
|
|
||||||
importers:
|
importers:
|
||||||
|
|
||||||
.:
|
.:
|
||||||
|
|
Loading…
Reference in New Issue