Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
jairhenrique committed Jul 20, 2023
1 parent 0a8d001 commit 31fcf70
Show file tree
Hide file tree
Showing 17 changed files with 379 additions and 348 deletions.
1 change: 1 addition & 0 deletions fragments/1689884768036.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update dependencies.
2 changes: 1 addition & 1 deletion myself-release.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { readFileSync } from "fs";
import NewsFragments from "./src/index.js";

const pjson = JSON.parse(
readFileSync(new URL("./package.json", import.meta.url))
readFileSync(new URL("./package.json", import.meta.url)),
);

const newsFragments = new NewsFragments();
Expand Down
672 changes: 351 additions & 321 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@
"@vitest/ui": "^0.33.0",
"eslint": "^8.26.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^4.1.0",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-simple-import-sort": "^10.0.0",
"mock-fs": "^5.1.0",
"mockdate": "^3.0.5",
"prettier": "^2.8.0",
"prettier": "^3.0.0",
"pretty-quick": "^3.1.1",
"semver": "^7.3.5",
"vitest": "^0.33.0"
Expand Down
2 changes: 1 addition & 1 deletion src/build-template.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const saveChangelogToFile = function (filePath, renderedTemplate) {
export const generateTemplateData = function (
newVersion,
dateFormat,
fragments
fragments,
) {
return {
newVersion,
Expand Down
4 changes: 2 additions & 2 deletions src/cli/burn.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ Remember to create with {green news-fragments create <fragment-type> <fragment-t
const templateData = generateTemplateData(
version,
newsFragmentsUserConfig.changelogDateFormat,
newsFragments.fragmentsToBurn
newsFragments.fragmentsToBurn,
);

const renderedTemplate = renderTemplate(
newsFragmentsUserConfig.changelogTemplate,
templateData,
version
version,
);

saveChangelogToFile(newsFragmentsUserConfig.changelogFile, renderedTemplate);
Expand Down
2 changes: 1 addition & 1 deletion src/cli/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { checkFragmentsFolder } from "../helpers.js";
const availableFragmentTypes = newsFragmentsUserConfig.fragmentsTypes.map(
function (el) {
return el.extension;
}
},
);

export const create = function (inputs, flags) {
Expand Down
2 changes: 1 addition & 1 deletion src/cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import('meow').then(meow => { // eslint-disable-line
shortFlag: "p",
},
},
}
},
);

const commands = {
Expand Down
8 changes: 4 additions & 4 deletions src/cli/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ marked.setOptions({
export const preview = function (inputs, flags) {
if (!!flags && flags.previousVersion) {
const previousVersionRegex = new RegExp(
`(\\[\\/\\/\\]: # \\(s-${flags.previousVersion}\\))[\\s\\S]*(\\[\\/\\/\\]: # \\(e-${flags.previousVersion}\\))`
`(\\[\\/\\/\\]: # \\(s-${flags.previousVersion}\\))[\\s\\S]*(\\[\\/\\/\\]: # \\(e-${flags.previousVersion}\\))`,
);

const changelogContent = getChangelogContent(newsFragmentsUserConfig);
const previousOutput = marked(
(changelogContent.match(previousVersionRegex) || [""])[0]
(changelogContent.match(previousVersionRegex) || [""])[0],
);

process.stdout.write(previousOutput);
Expand All @@ -33,13 +33,13 @@ export const preview = function (inputs, flags) {
const templateData = generateTemplateData(
version,
newsFragmentsUserConfig.changelogDateFormat,
newsFragments.fragmentsToBurn
newsFragments.fragmentsToBurn,
);

const renderedTemplate = renderTemplate(
newsFragmentsUserConfig.changelogTemplate,
templateData,
version
version,
);

const output = marked(renderedTemplate);
Expand Down
2 changes: 1 addition & 1 deletion src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,5 @@ export const retrieveUserConfig = function (config, name) {
};

export const newsFragmentsUserConfig = buildConfig(
retrieveUserConfig(globalConfig, "news-fragments")
retrieveUserConfig(globalConfig, "news-fragments"),
);
6 changes: 3 additions & 3 deletions src/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import { checkChangelogFile } from "./helpers.js";

export const getFragmentsFilesByFragmentType = function (
fragmentsFolder,
fragmentType
fragmentType,
) {
const dir = fs.readdirSync(fragmentsFolder);

const files = dir.filter((elm) =>
elm.match(new RegExp(`.*\.(${fragmentType})`, "ig"))
elm.match(new RegExp(`.*\.(${fragmentType})`, "ig")),
);

return files.map((file) => {
Expand Down Expand Up @@ -42,7 +42,7 @@ export const getFragments = function (newsFragmentsConfig) {
fragmentsTypes.forEach((fragmentType) => {
const files = getFragmentsFilesByFragmentType(
fragmentsFolder,
fragmentType.extension
fragmentType.extension,
);

if (files.length > 0) {
Expand Down
6 changes: 3 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ export default class NewsFragments extends Plugin {
const templateData = generateTemplateData(
version,
newsFragmentsUserConfig.changelogDateFormat,
this.fragmentsToBurn
this.fragmentsToBurn,
);
const renderedTemplate = renderTemplate(
newsFragmentsUserConfig.changelogTemplate,
templateData,
version
version,
);
saveChangelogToFile(
newsFragmentsUserConfig.changelogFile,
renderedTemplate
renderedTemplate,
);
deleteFragmentsFiles(this.fragmentsToDelete);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/build-template.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,6 @@ test("should generate the data to use in template", () => {
},
];
expect(
generateTemplateData("0.0.2", "YYYY-MM-DD", fakeFragments)
generateTemplateData("0.0.2", "YYYY-MM-DD", fakeFragments),
).toStrictEqual(mockData);
});
4 changes: 2 additions & 2 deletions tests/cli/create.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ test("should return success message when create a fragment", async () => {
const result = create(["create", "feature", "show"]);

expect(result).toStrictEqual(
"Fragment fragments/1557831718135.feature created with success!"
"Fragment fragments/1557831718135.feature created with success!",
);
});

Expand Down Expand Up @@ -51,5 +51,5 @@ test.each(["", "message."])(

expect(contents).toStrictEqual(message);
fs.unlinkSync("fragments/1557831718135.feature");
}
},
);
2 changes: 1 addition & 1 deletion tests/cli/preview.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ test("should return a previous version", async () => {
expect(result).toContain("# [1.0.1] - (2020-03-11)");
expect(result).toContain("## Bugfixes");
expect(result).toContain(
"Remove method &#x60;getName&#x60; from NewsFragments plugin."
"Remove method &#x60;getName&#x60; from NewsFragments plugin.",
);
});

Expand Down
2 changes: 1 addition & 1 deletion tests/file.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,6 @@ test("should return the changelog content", async () => {
};

expect(getChangelogContent(fakeNewsFragmentsConfig)).toEqual(
"My content bruh"
"My content bruh",
);
});
6 changes: 3 additions & 3 deletions tests/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { newsFragmentsUserConfig } from "../src/config";
import Plugin from "../src/index";

const pjson = JSON.parse(
readFileSync(new URL("../package.json", import.meta.url))
readFileSync(new URL("../package.json", import.meta.url)),
);

let newsFragments;
Expand Down Expand Up @@ -55,9 +55,9 @@ test("should delete fragments when generated changelog", () => {
newsFragments.bump(version);

expect(fs.readdirSync(newsFragmentsUserConfig.fragmentsFolder)).toStrictEqual(
[".gitkeep"]
[".gitkeep"],
);
expect(
fs.readFileSync(newsFragmentsUserConfig.changelogFile, "utf8")
fs.readFileSync(newsFragmentsUserConfig.changelogFile, "utf8"),
).toStrictEqual(expectedOutput);
});

0 comments on commit 31fcf70

Please sign in to comment.