Skip to content

Commit 9a997a2

Browse files
committed
chore: update imports to use node: prefix and replace regex with replaceAll
1 parent 0dc1a47 commit 9a997a2

2 files changed

Lines changed: 11 additions & 15 deletions

File tree

.changeset/changelog-generator.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ const changelogFunctions = {
7272
commitFromSummary = commit;
7373
return "";
7474
})
75-
.replace(/^\s*(?:author|user):\s*@?([^\s]+)/gim, (_, user) => {
75+
.replaceAll(/^\s*(?:author|user):\s*@?([^\s]+)/gim, (_, user) => {
7676
usersFromSummary.push(user);
7777
return "";
7878
})

.changeset/changeset-validate.mjs

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import fs from "fs/promises";
2-
import path from "path";
3-
import { fileURLToPath } from "url";
1+
/* eslint-disable no-console */
2+
import fs from "node:fs/promises";
3+
import path from "node:path";
4+
import { fileURLToPath } from "node:url";
45
import { simpleGit } from "simple-git";
56
import pkgJson from "../package.json" with { type: "json" };
67

@@ -19,7 +20,7 @@ const toLines = (output) =>
1920
.filter(Boolean);
2021

2122
const isChangeset = (filePath) => {
22-
const normalized = filePath.replace(/\\/g, "/");
23+
const normalized = filePath.replaceAll("\\", "/");
2324
return (
2425
normalized.startsWith(".changeset/") &&
2526
normalized.endsWith(".md") &&
@@ -113,14 +114,11 @@ const validate = async (filePath) => {
113114
return errors;
114115
};
115116

116-
const main = async () => {
117-
const changedFiles = await getChangedFiles();
118-
119-
if (changedFiles.length === 0) {
120-
console.log("No changed changeset files found.");
121-
return;
122-
}
117+
const changedFiles = await getChangedFiles();
123118

119+
if (changedFiles.size === 0) {
120+
console.log("No changed changeset files found.");
121+
} else {
124122
const failures = [];
125123
for (const filePath of changedFiles) {
126124
const errors = await validate(filePath);
@@ -136,6 +134,4 @@ const main = async () => {
136134
}
137135
process.exitCode = 1;
138136
}
139-
};
140-
141-
main();
137+
}

0 commit comments

Comments
 (0)