ds300 / patch-package

Fix broken node modules instantly 🏃🏽‍♀️💨
MIT License
10.26k stars 287 forks source link

Failed to apply patch #461

Open kosiew opened 1 year ago

kosiew commented 1 year ago

We found this in our Render deploy log:

Apr 13 04:29:54 PM  $ patch-package
Apr 13 04:29:55 PM  patch-package 6.5.1
Apr 13 04:29:55 PM  Applying patches...
Apr 13 04:29:55 PM  
Apr 13 04:29:55 PM  **ERROR** Failed to apply patch for package @wordpress/block-library at path
Apr 13 04:29:55 PM  
Apr 13 04:29:55 PM      node_modules/@wordpress/block-library
Apr 13 04:29:55 PM  
Apr 13 04:29:55 PM    This error was caused because patch-package cannot apply the following patch file:
Apr 13 04:29:55 PM  
Apr 13 04:29:55 PM      patches/@wordpress+block-library+8.5.0.patch

Here is the contents of the patches/@wordpress+block-library+8.5.0.patch

diff --git a/node_modules/@wordpress/block-library/build-module/heading/edit.js b/node_modules/@wordpress/block-library/build-module/heading/edit.js
index b748690..2370a7a 100644
--- a/node_modules/@wordpress/block-library/build-module/heading/edit.js
+++ b/node_modules/@wordpress/block-library/build-module/heading/edit.js
@@ -115,14 +115,12 @@ function HeadingEdit(_ref) {
     onSplit: (value, isOriginal) => {
       let block;

-      if (isOriginal || value) {
+      if (isOriginal) {
         block = createBlock('core/heading', { ...attributes,
           content: value
         });
       } else {
-        var _getDefaultBlockName;
-
-        block = createBlock((_getDefaultBlockName = getDefaultBlockName()) !== null && _getDefaultBlockName !== void 0 ? _getDefaultBlockName : 'core/heading');
+        block = createBlock('core/paragraph', {...attributes, content:value});
       }

       if (isOriginal) {
diff --git a/node_modules/@wordpress/block-library/build-module/quote/edit.js b/node_modules/@wordpress/block-library/build-module/quote/edit.js
index f108e09..0d4f038 100644
--- a/node_modules/@wordpress/block-library/build-module/quote/edit.js
+++ b/node_modules/@wordpress/block-library/build-module/quote/edit.js
@@ -89,6 +89,8 @@ export default function QuoteEdit(_ref) {
   });
   const innerBlocksProps = useInnerBlocksProps(blockProps, {
     template: TEMPLATE,
+    allowedBlocks: 
+      ['core/paragraph'],
     templateInsertUpdatesSelection: true
   });
   return createElement(Fragment, null, createElement(BlockControls, {

Strangely, it worked when we tested it locally after removing node_modules.

Vitomir2 commented 2 months ago

I am experiencing the same problem.