mirror of
https://github.com/xHyroM/bun-discord-bot.git
synced 2024-12-03 11:21:05 +01:00
feat: show lilybird versions in version cmd, use bun glob
This commit is contained in:
parent
16c842808d
commit
a787a65bd9
4 changed files with 23 additions and 4 deletions
|
@ -1,4 +1,10 @@
|
|||
import { COMMIT_HASH, PRODUCTION } from "../constants.ts";
|
||||
import {
|
||||
COMMIT_HASH,
|
||||
PRODUCTION,
|
||||
LILYBIRD_VERSION,
|
||||
LILYBIRD_HANDLERS_VERSION,
|
||||
LILYBIRD_JSX_VERSION,
|
||||
} from "../constants.ts";
|
||||
import { ApplicationCommand } from "@lilybird/jsx";
|
||||
import { SlashCommand } from "@lilybird/handlers";
|
||||
|
||||
|
@ -11,7 +17,11 @@ export default {
|
|||
`[git-bun-discord-bot-${COMMIT_HASH}](<https://github.com/xHyroM/bun-discord-bot/tree/${COMMIT_HASH}>) ${
|
||||
!PRODUCTION ? "(dev)" : ""
|
||||
}`,
|
||||
`[v${Bun.version} (${Bun.revision})](<https://github.com/oven-sh/bun/releases/tag/bun-v${Bun.version}>)`,
|
||||
`[Bun v${Bun.version} (${Bun.revision})](<https://github.com/oven-sh/bun/releases/tag/bun-v${Bun.version}>)`,
|
||||
"",
|
||||
`[Lilybird v${LILYBIRD_VERSION}](<https://npmjs.org/lilybird>)`,
|
||||
`[Lilybird JSX v${LILYBIRD_JSX_VERSION}](<https://npmjs.org/@lilybird/jsx>)`,
|
||||
`[Lilybird Handlers v${LILYBIRD_HANDLERS_VERSION}](<https://npmjs.org/@lilybird/handlers>)`,
|
||||
].join("\n"),
|
||||
ephemeral: true,
|
||||
});
|
||||
|
|
|
@ -1,7 +1,13 @@
|
|||
import { spawnSync } from "bun";
|
||||
import { dependencies } from "../package.json";
|
||||
|
||||
export const COMMIT_HASH = spawnSync({
|
||||
cmd: ["git", "log", "--pretty=format:%h", "-n", "1"],
|
||||
}).stdout.toString();
|
||||
|
||||
export const LILYBIRD_VERSION = dependencies.lilybird.slice(1);
|
||||
export const LILYBIRD_JSX_VERSION = dependencies["@lilybird/jsx"].slice(1);
|
||||
export const LILYBIRD_HANDLERS_VERSION =
|
||||
dependencies["@lilybird/handlers"].slice(1);
|
||||
|
||||
export const PRODUCTION = process.env.NODE_ENV === "production";
|
||||
|
|
|
@ -3,16 +3,18 @@ import {
|
|||
GuildTextChannel,
|
||||
ApplicationCommandOptionChoiceStructure,
|
||||
} from "lilybird";
|
||||
import { globSync as glob } from "glob";
|
||||
import { Tag } from "../structs/Tag.ts";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { safeSlice } from "../util.ts";
|
||||
import matter from "gray-matter";
|
||||
import { join } from "node:path";
|
||||
import { Glob } from "bun";
|
||||
|
||||
type PartialGuildTextChannel = PartialChannel<GuildTextChannel>;
|
||||
|
||||
const tags = glob(join(import.meta.dir, "..", "..", "data", "tags", "*.md"));
|
||||
const tags = Array.from(
|
||||
new Glob(join(import.meta.dir, "..", "..", "data", "tags", "*.md")).scanSync()
|
||||
);
|
||||
|
||||
export const TAGS: Tag[] = [];
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
"allowSyntheticDefaultImports": true,
|
||||
"noEmit": true,
|
||||
"skipLibCheck": true,
|
||||
"resolveJsonModule": true,
|
||||
"types": ["bun-types", "./globals"]
|
||||
},
|
||||
"include": ["src/**/*"]
|
||||
|
|
Loading…
Reference in a new issue