Skip to content

Commit

Permalink
chore: add back prettier to conventional commit dep
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremybarbet committed Jun 30, 2022
1 parent 7cadb59 commit 3dd7444
Showing 1 changed file with 31 additions and 6 deletions.
37 changes: 31 additions & 6 deletions patches/@lerna+conventional-commits+5.1.6.patch
Expand Up @@ -18,24 +18,49 @@ index 30d177d..1b1e85e 100644
- exports.COMMIT_GUIDELINE,
].join(EOL);
diff --git a/node_modules/@lerna/conventional-commits/lib/update-changelog.js b/node_modules/@lerna/conventional-commits/lib/update-changelog.js
index dfe5030..4f3e794 100644
index dfe5030..5efe38a 100644
--- a/node_modules/@lerna/conventional-commits/lib/update-changelog.js
+++ b/node_modules/@lerna/conventional-commits/lib/update-changelog.js
@@ -4,7 +4,7 @@ const conventionalChangelogCore = require("conventional-changelog-core");
@@ -4,7 +4,8 @@ const conventionalChangelogCore = require("conventional-changelog-core");
const fs = require("fs-extra");
const getStream = require("get-stream");
const log = require("npmlog");
-const { BLANK_LINE, CHANGELOG_HEADER, EOL } = require("./constants");
+const { format, resolveConfig } = require('prettier');
+const { CHANGELOG_HEADER, EOL } = require("./constants");
const { getChangelogConfig } = require("./get-changelog-config");
const { makeBumpOnlyFilter } = require("./make-bump-only-filter");
const { readExistingChangelog } = require("./read-existing-changelog");
@@ -68,7 +68,7 @@ function updateChangelog(pkg, type, { changelogPreset, rootPath, tagPrefix = "v"
@@ -68,16 +69,22 @@ function updateChangelog(pkg, type, { changelogPreset, rootPath, tagPrefix = "v"
]).then(([newEntry, [changelogFileLoc, changelogContents]]) => {
log.silly(type, "writing new entry: %j", newEntry);

- const content = [CHANGELOG_HEADER, newEntry, changelogContents].join(BLANK_LINE);
-
- return fs.writeFile(changelogFileLoc, content.trim() + EOL).then(() => {
- log.verbose(type, "wrote", changelogFileLoc);
-
- return {
- logPath: changelogFileLoc,
- newEntry,
- };
- });
+ const content = [CHANGELOG_HEADER, newEntry, changelogContents].join(EOL);

return fs.writeFile(changelogFileLoc, content.trim() + EOL).then(() => {
log.verbose(type, "wrote", changelogFileLoc);
+
+ return fs.writeFile(changelogFileLoc, content.trim() + EOL).then(() =>
+ resolveConfig(changelogFileLoc).then(prettierOptions =>
+ fs
+ .writeFile(changelogFileLoc, format(content.trim() + EOL, { ...prettierOptions, parser: 'markdown' }))
+ .then(() => {
+ log.verbose(type, 'wrote', changelogFileLoc);
+
+ return {
+ logPath: changelogFileLoc,
+ newEntry,
+ };
+ }),
+ ),
+ );
});
});
}

0 comments on commit 3dd7444

Please sign in to comment.