-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(deps): patch Lerna for Prettier v3 compat
backport of lerna/lerna#3766
- Loading branch information
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |