Skip to content

Commit 909cda3

Browse files
authored
fix: directory detection for bundle (interactions/events) (#209)
1 parent ea8fd8a commit 909cda3

File tree

2 files changed

+27
-7
lines changed

2 files changed

+27
-7
lines changed

.changeset/eleven-seals-exist.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@djs-core/dev": patch
3+
---
4+
5+
Fix source directory detecton for bundle interactions/events/components

packages/dev/commands/build.ts

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { CAC } from "cac";
33
import fs from "fs/promises";
44
import path from "path";
55
import pc from "picocolors";
6-
import { banner } from "../utils/common";
6+
import { banner, PATH_ALIASES } from "../utils/common";
77

88
declare const Bun: typeof import("bun");
99

@@ -255,11 +255,19 @@ export function registerBuildCommand(cli: CAC) {
255255
const genDir = path.join(botRoot, ".djscore");
256256
const entryPath = path.join(genDir, "index.ts");
257257

258-
const commandsDir = path.join(botRoot, "interactions", "commands");
259-
const buttonsDir = path.join(botRoot, "interactions", "buttons");
260-
const contextsDir = path.join(botRoot, "interactions", "contexts");
261-
const selectsDir = path.join(botRoot, "interactions", "selects");
262-
const eventsDir = path.join(botRoot, "interactions", "events");
258+
const commandsDir = path.join(
259+
botRoot,
260+
PATH_ALIASES.interactions,
261+
"commands",
262+
);
263+
const buttonsDir = path.join(botRoot, PATH_ALIASES.components, "buttons");
264+
const contextsDir = path.join(
265+
botRoot,
266+
PATH_ALIASES.interactions,
267+
"contexts",
268+
);
269+
const selectsDir = path.join(botRoot, PATH_ALIASES.components, "selects");
270+
const eventsDir = path.join(botRoot, PATH_ALIASES.events);
263271

264272
console.log(`${pc.cyan("ℹ")} Project: ${pc.bold(botRoot)}`);
265273
console.log(`${pc.cyan("ℹ")} Generating: ${pc.bold(entryPath)}\n`);
@@ -358,9 +366,16 @@ export function registerBuildCommand(cli: CAC) {
358366
const sizeDisplay =
359367
stats.size > 1024 * 1024 ? `${sizeMB} MB` : `${sizeKB} KB`;
360368

369+
const totalSourceFiles =
370+
commandFiles.length +
371+
buttonFiles.length +
372+
contextFiles.length +
373+
selectFiles.length +
374+
eventFiles.length;
375+
361376
console.log(
362377
pc.green("✓") +
363-
` Build success (${outputs.length} file${outputs.length === 1 ? "" : "s"}, ${sizeDisplay})`,
378+
` Build success (${totalSourceFiles} file${totalSourceFiles === 1 ? "" : "s"}${outputs.length} output${outputs.length === 1 ? "" : "s"}, ${sizeDisplay})`,
364379
);
365380
for (const p of outputs) console.log(pc.dim(` - ${p}`));
366381

0 commit comments

Comments
 (0)