Skip to content

Commit

Permalink
chore(deps): patch Lerna for Prettier v3 compat
Browse files Browse the repository at this point in the history
backport of lerna/lerna#3766
  • Loading branch information
turadg authored and kriskowal committed Jul 18, 2023
1 parent 93afa1f commit 82f4881
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions patches/@lerna+version+5.6.2.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
diff --git a/node_modules/@lerna/version/lib/git-add.js b/node_modules/@lerna/version/lib/git-add.js
index d24f8ca..9b9b38d 100644
--- a/node_modules/@lerna/version/lib/git-add.js
+++ b/node_modules/@lerna/version/lib/git-add.js
@@ -24,12 +24,12 @@ function resolvePrettier() {
return resolvedPrettier;
}

-function maybeFormatFile(filePath) {
+async function maybeFormatFile(filePath) {
const prettier = resolvePrettier();
if (!prettier) {
return;
}
- const config = resolvedPrettier.resolveConfig.sync(filePath);
+ const config = await resolvedPrettier.resolveConfig(filePath);
try {
const input = fs.readFileSync(filePath, "utf8");
fs.writeFileSync(filePath, resolvedPrettier.format(input, { ...config, filepath: filePath }), "utf8");
@@ -44,11 +44,11 @@ function maybeFormatFile(filePath) {
* @param {{ granularPathspec: boolean; }} gitOpts
* @param {import("@lerna/child-process").ExecOpts} execOpts
*/
-function gitAdd(changedFiles, gitOpts, execOpts) {
+async function gitAdd(changedFiles, gitOpts, execOpts) {
let files = [];
for (const file of changedFiles) {
const filePath = slash(path.relative(execOpts.cwd, path.resolve(execOpts.cwd, file)));
- maybeFormatFile(filePath);
+ await maybeFormatFile(filePath);
if (gitOpts.granularPathspec) {
files.push(filePath);
}

0 comments on commit 82f4881

Please sign in to comment.