Skip to content

Commit

Permalink
refactor: bump node and modernize
Browse files Browse the repository at this point in the history
  • Loading branch information
codebytere committed Oct 22, 2024
1 parent b1b021a commit 84f485b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 20 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"devDependencies": {
"@types/debug": "^4.1.12",
"@types/node": "^16.11.7",
"@types/node": "^20.9.0",
"husky": "^8.0.0",
"lint-staged": "^13.0.4",
"nock": "^13.5.5",
Expand Down
17 changes: 6 additions & 11 deletions src/note-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,24 @@ export const findNoteInPRBody = (body: string): string | null => {
const multilineMatch = /(?:(?:\r?\n)Notes:(?:\r?\n+)((?:\*.+(?:(?:\r?\n)|$))+))/gi.exec(body);

let notes: string | null = null;
if (onelineMatch && onelineMatch[1]) {
if (onelineMatch?.[1]) {
notes = onelineMatch[1];
} else if (multilineMatch && multilineMatch[1]) {
} else if (multilineMatch?.[1]) {
notes = multilineMatch[1];
}

// Remove the default PR template if it exists.
notes = notes ? notes.replace(/<!--.*?-->/g, '') : null;

if (notes) {
debug(`Found Notes: ${JSON.stringify(notes.trim())}`);

// Remove the default PR template.
notes = notes.replace(/<!--.*?-->/g, '');
}

if (notes) {
const sanitizeMap = new Map([
['<', '&lt;'],
['>', '&gt;'],
]);
for (const [oldVal, newVal] of sanitizeMap.entries()) {
// TODO: use replaceAll when @node/types catches up to 15
while (notes.includes(oldVal)) {
notes = notes.replace(oldVal, newVal);
}
notes = notes.replaceAll(oldVal, newVal);
}
}

Expand Down
5 changes: 1 addition & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es2018",
"target": "es2021",
"outDir": "lib",
"lib": [
"es6"
],
"sourceMap": true,
"rootDir": "src",
"experimentalDecorators": true,
Expand Down
15 changes: 11 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -709,10 +709,12 @@
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.0.4.tgz#43a63fc5edce226bed106b31b875165256271107"
integrity sha512-k3NqigXWRzQZVBDS5D1U70A5E8Qk4Kh+Ha/x4M8Bt9pF0X05eggfnC9+63Usc9Q928hRUIpIhTQaXsZwZBl4Ew==

"@types/node@^16.11.7":
version "16.11.59"
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.11.59.tgz#823f238b9063ccc3b3b7f13186f143a57926c4f6"
integrity sha512-6u+36Dj3aDzhfBVUf/mfmc92OEdzQ2kx2jcXGdigfl70E/neV21ZHE6UCz4MDzTRcVqGAM27fk+DLXvyDsn3Jw==
"@types/node@^20.9.0":
version "20.16.13"
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.16.13.tgz#148c152d757dc73f8d65f0f6f078f39050b85b0c"
integrity sha512-GjQ7im10B0labo8ZGXDGROUl9k0BNyDgzfGpb4g/cl+4yYDWVKcozANF4FGr4/p0O/rAkQClM6Wiwkije++1Tg==
dependencies:
undici-types "~6.19.2"

"@types/pino-http@^5.0.6":
version "5.8.1"
Expand Down Expand Up @@ -2868,6 +2870,11 @@ uglify-js@^3.1.4:
dependencies:
commander "~2.20.3"

undici-types@~6.19.2:
version "6.19.8"
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.19.8.tgz#35111c9d1437ab83a7cdc0abae2f26d88eda0a02"
integrity sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==

universal-github-app-jwt@^1.0.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/universal-github-app-jwt/-/universal-github-app-jwt-1.1.1.tgz#d57cee49020662a95ca750a057e758a1a7190e6e"
Expand Down

0 comments on commit 84f485b

Please sign in to comment.