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

Make patch-package output better errors #683

Closed
Closed
Show file tree
Hide file tree
Changes from 2 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
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
"@babel/eslint-plugin": "^7.12.10",
"@babel/plugin-proposal-class-properties": "^7.12.1",
"@babel/plugin-proposal-export-default-from": "^7.12.1",
"@babel/plugin-proposal-logical-assignment-operators": "^7.20.7",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.12.1",
"@babel/plugin-proposal-numeric-separator": "^7.12.7",
"@babel/plugin-proposal-object-rest-spread": "^7.12.1",
Expand Down Expand Up @@ -182,7 +183,7 @@
"modernizr": "^3.12.0",
"node-fetch": "^2.6.7",
"optimize-css-assets-webpack-plugin": "^6.0.0",
"patch-package": "^6.5.1",
"patch-package": "^8.0.0",
"postcss": "^8.4.16",
"postcss-easings": "^2.0.0",
"postcss-hexrgba": "2.0.1",
Expand Down
30 changes: 30 additions & 0 deletions patches_patch-package/patch-package+8.0.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
diff --git a/node_modules/patch-package/dist/applyPatches.js b/node_modules/patch-package/dist/applyPatches.js
index 2d6344b..71720a6 100644
--- a/node_modules/patch-package/dist/applyPatches.js
+++ b/node_modules/patch-package/dist/applyPatches.js
@@ -213,6 +213,7 @@ function applyPatchesForPackage({ patches, appPath, patchDir, reverse, warnings,
patchFilename,
path,
pathSpecifier,
+ patchDir,
}));
// in case the package has multiple patches, we need to break out of this inner loop
// because we don't want to apply more patches on top of the broken state
@@ -375,7 +376,7 @@ ${chalk_1.default.red.bold("**ERROR**")} ${chalk_1.default.red(`Failed to apply

`;
}
-function createPatchApplicationFailureError({ packageName, actualVersion, originalVersion, patchFilename, path, pathSpecifier, }) {
+function createPatchApplicationFailureError({ packageName, actualVersion, originalVersion, patchFilename, path, pathSpecifier, patchDir, }) {
return `
${chalk_1.default.red.bold("**ERROR**")} ${chalk_1.default.red(`Failed to apply patch for package ${chalk_1.default.bold(packageName)} at path`)}

@@ -399,7 +400,7 @@ ${chalk_1.default.red.bold("**ERROR**")} ${chalk_1.default.red(`Failed to apply
patch-package ${pathSpecifier}

Info:
- Patch file: patches/${patchFilename}
+ Patch file: ${patchDir}${patchFilename}
Patch was made for version: ${chalk_1.default.green.bold(originalVersion)}
Installed version: ${chalk_1.default.red.bold(actualVersion)}
`;
4 changes: 4 additions & 0 deletions scripts/tchap/apply_patches.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
# Script to apply the patches in patches directory, using patch-package.
set -e

echo "Patching patch-package itself... (is https://github.com/ds300/patch-package/issues/488 fixed now?)"
yarn patch-package --patch-dir patches_patch-package --error-on-fail
echo "... done patching patch-package."

node scripts/tchap/checkPatchFile.js

for d in patches/*/ ; do
Expand Down
Loading
Loading