Skip to content

Commit

Permalink
#357 deps: upgrade dependencies and Typescript versions
Browse files Browse the repository at this point in the history
  • Loading branch information
kristersd committed Jun 8, 2024
1 parent 32203ac commit 16c17e7
Show file tree
Hide file tree
Showing 9 changed files with 4,532 additions and 6,382 deletions.
10,811 changes: 4,485 additions & 6,326 deletions package-lock.json

Large diffs are not rendered by default.

52 changes: 27 additions & 25 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
"private": true,
"scripts": {
"start": "node dist/index.js",
"dev": "npm-run-all --parallel 'dev:*'",
"dev": "npm-run-all --parallel dev:*",
"dev:bot": "nodemon -r dotenv/config ./src/index.ts",
"dev:test": "vitest",
"build": "tsc",
"test": "npm-run-all -c --parallel 'test:*'",
"test": "npm-run-all -c --parallel test:*",
"test:vitest": "vitest --run",
"test:lint": "eslint --ext js,ts . && prettier --check .",
"prettier": "prettier --write ."
Expand All @@ -20,37 +20,39 @@
},
"license": "MIT",
"dependencies": {
"date-fns": "2.27.0",
"discord.js": "14.11.0",
"dotenv": "10.0.0",
"date-fns": "3.6.0",
"discord.js": "14.15.3",
"dotenv": "16.4.5",
"gists": "2.0.0",
"lru-cache": "10.0.0",
"node-cron": "3.0.0",
"node-fetch": "2.6.7",
"open-graph-scraper": "4.11.0",
"openai": "4.17.3",
"lru-cache": "10.2.2",
"node-cron": "3.0.3",
"node-fetch": "2.6.12",
"open-graph-scraper": "6.5.2",
"openai": "4.49.1",
"pdf2pic": "3.1.1",
"pretty-bytes": "5.6.0",
"query-string": "7.1.3",
"uuid": "8.3.2"
"uuid": "9.0.1"
},
"devDependencies": {
"@types/node": "20.6.0",
"@types/node-cron": "3.0.1",
"@types/node-fetch": "2.5.4",
"@types/open-graph-scraper": "4.8.1",
"@typescript-eslint/eslint-plugin": "5.9.0",
"@typescript-eslint/parser": "5.9.0",
"eslint": "8.6.0",
"eslint-config-prettier": "8.3.0",
"nodemon": "2.0.20",
"@types/node": "20.14.2",
"@types/node-cron": "3.0.11",
"@types/node-fetch": "2.6.11",
"@types/open-graph-scraper": "4.8.5",
"@typescript-eslint/eslint-plugin": "7.12.0",
"@typescript-eslint/parser": "7.12.0",
"eslint": "8.57.0",
"eslint-config-prettier": "8.8.0",
"nodemon": "3.1.3",
"npm-run-all": "4.1.5",
"prettier": "2.3.2",
"ts-node": "10.8.1",
"typescript": "4.5.4",
"vitest": "0.29.2"
"prettier": "3.3.1",
"ts-node": "10.9.2",
"typescript": "5.4.5",
"vitest": "1.6.0"
},
"prettier": {
"trailingComma": "all"
},
"engines": {
"node": ">=20.0.0"
}
}
7 changes: 6 additions & 1 deletion src/features/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,12 @@ Here's an article explaining the difference between the two: https://goshakkk.na
),
]);

const { documents } = await res.json();
const { documents } = (await res.json()) as {
documents: (
| { title: string; excerpt: string; mdn_url: string }
| undefined
)[];
};
const [topResult] = documents;

if (!topResult) {
Expand Down
11 changes: 7 additions & 4 deletions src/features/jobs-moderation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,11 @@ export const resetJobCacheCommand = {
.setDescription("User to clear post history for")
.setRequired(true),
)
.setDefaultMemberPermissions(PermissionFlagsBits.ManageMessages),

.setDefaultMemberPermissions(
PermissionFlagsBits.ManageMessages,
// NOTE: 'addUserOption' forces the type to be SlashCommandOptionsOnlyBuilder
// which would require to have 'addSubcommand' and 'addSubcommandGroup' methods when registering the command
) as SlashCommandBuilder,
handler: async (interaction: CommandInteraction) => {
const { options } = interaction;

Expand Down Expand Up @@ -317,8 +320,8 @@ More details & apply: https://example.com/apply
? `If you're hiring: ${freeflowHiring}
If you're seeking work: ${freeflowForHire}`
: hiring
? `Join FreeFlow's server to start hiring for web3: ${freeflowHiring}`
: `Apply to join FreeFlow's talent pool for web3: ${freeflowForHire}`,
? `Join FreeFlow's server to start hiring for web3: ${freeflowHiring}`
: `Apply to join FreeFlow's talent pool for web3: ${freeflowForHire}`,
);
}
await thread.send("Your post:");
Expand Down
6 changes: 4 additions & 2 deletions src/features/promotion-threads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ const promotionThread: ChannelHandlers = {
const res = await fetch(
`https://publish.twitter.com/oembed?url=${firstLink}`,
);
const { author_name } = await res.json();
const { author_name } = (await res.json()) as {
author_name: string;
};
maybeTitle = `${author_name} on Twitter `;
} catch (e) {
// do nothing
Expand All @@ -56,7 +58,7 @@ const promotionThread: ChannelHandlers = {
maybeTitle = `${msg.author.username} tweet`;
} else if (result.ogSiteName === "GitHub") {
maybeTitle =
result.ogDescription || result.title || result.ogSiteName;
result.ogDescription || result.ogTitle || result.ogSiteName;
} else {
maybeTitle = `${result.twitterTitle || result.ogTitle}`;
}
Expand Down
2 changes: 1 addition & 1 deletion src/features/resume.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export const resumeResources = async (bot: Client) => {
{
role: "user",
content: firstMessage.content,
file_ids: [file.id],
attachments: [{ file_id: file.id }],
},
],
}),
Expand Down
21 changes: 0 additions & 21 deletions src/helpers/discord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
ChannelType,
GuildTextThreadCreateOptions,
} from "discord.js";
import prettyBytes from "pretty-bytes";

export const difference = <T>(a: Set<T>, b: Set<T>) =>
new Set(Array.from(a).filter((x) => !b.has(x)));
Expand Down Expand Up @@ -97,26 +96,6 @@ export const quoteMessageContent = (content: string) => {
return quoted;
};

/*
* Create a message embed that
*/
export const describeAttachments = (attachments: Message["attachments"]) => {
return attachments.size === 0
? ""
: "Attachments:\n" +
attachments
.map(
({ size, name, contentType, url }) =>
// Include size of the file and the filename
`${prettyBytes(size)}: ${
// If it's a video or image, include a link.
// Renders as `1.12mb: [some-image.jpg](<original image url>)`
contentType?.match(/(image|video)/) ? `[${name}](${url})` : name
}`,
)
.join("\n");
};

/*
* Escape content that Discord would otherwise do undesireable things with.
* Sepecifically, suppresses @-mentions and link previews.
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/react-docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const getReactDocsContent = async (searchPath: string) => {
"X-GitHub-Api-Version": "2022-11-28",
},
});
const json = await response.json();
const json = (await response.json()) as { content: string };
const contentBase64 = json.content;
const decodedContent = Buffer.from(contentBase64, "base64").toString(
"utf8",
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
"forceConsistentCasingInFileNames": true
},
"include": ["src/**/*.ts"],
"exclude": ["node_modules"]
"exclude": ["node_modules", "src/**/*.test.ts"]
}

0 comments on commit 16c17e7

Please sign in to comment.