nexocord 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/cli.js +38 -6
- package/dist/core/client/bootstrap.d.ts.map +1 -1
- package/dist/index.cjs +15 -2
- package/dist/index.js +15 -2
- package/package.json +1 -2
package/dist/bin/cli.js
CHANGED
|
@@ -2143,7 +2143,7 @@ var {
|
|
|
2143
2143
|
} = import__.default;
|
|
2144
2144
|
|
|
2145
2145
|
// src/bin/cli.ts
|
|
2146
|
-
import { spawn } from "child_process";
|
|
2146
|
+
import { spawn, spawnSync } from "child_process";
|
|
2147
2147
|
import path from "path";
|
|
2148
2148
|
import fs from "fs";
|
|
2149
2149
|
|
|
@@ -2638,6 +2638,10 @@ var source_default = chalk;
|
|
|
2638
2638
|
|
|
2639
2639
|
// src/bin/cli.ts
|
|
2640
2640
|
var isBun = typeof globalThis.Bun !== "undefined";
|
|
2641
|
+
function hasRuntime(command) {
|
|
2642
|
+
const result = spawnSync(command, ["--version"], { stdio: "ignore" });
|
|
2643
|
+
return !result.error && result.status === 0;
|
|
2644
|
+
}
|
|
2641
2645
|
function resolveEntry(file) {
|
|
2642
2646
|
if (file)
|
|
2643
2647
|
return file;
|
|
@@ -2689,21 +2693,49 @@ var program2 = new Command;
|
|
|
2689
2693
|
program2.name("nexo").description(source_default.gray("Framework moderno para bots Discord com foco em DX e performance")).version("1.0.0").addHelpText("after", `
|
|
2690
2694
|
${source_default.cyan("Docs:")} ${source_default.gray("https://nexocord.vercel.app/")}
|
|
2691
2695
|
`);
|
|
2692
|
-
program2.command("dev").description("Inicia o bot em modo desenvolvimento").argument("[file]", "Arquivo de entrada").option("-w, --watch", "Reinicia automaticamente ao salvar").action((file, options) => {
|
|
2696
|
+
program2.command("dev").description("Inicia o bot em modo desenvolvimento").argument("[file]", "Arquivo de entrada").option("-w, --watch", "Reinicia automaticamente ao salvar").option("-r, --runtime <runtime>", "Runtime: bun ou node", "auto").action((file, options) => {
|
|
2693
2697
|
const entry = resolveEntry(file);
|
|
2694
2698
|
const env2 = getEnvFile();
|
|
2695
|
-
const watch = options.watch;
|
|
2699
|
+
const watch = Boolean(options.watch);
|
|
2696
2700
|
const ext = entry.split(".").pop();
|
|
2701
|
+
const hasBun = hasRuntime("bun");
|
|
2702
|
+
const hasTsx = hasRuntime("tsx");
|
|
2703
|
+
const runtime = (options.runtime ?? "auto").toLowerCase();
|
|
2697
2704
|
log.start();
|
|
2698
|
-
|
|
2705
|
+
const usingBun = runtime === "bun" || runtime === "auto" && (isBun || ext === "ts" && !hasTsx && hasBun);
|
|
2706
|
+
if (runtime !== "auto" && runtime !== "bun" && runtime !== "node") {
|
|
2707
|
+
log.error("Runtime inválido. Use: auto, bun ou node.");
|
|
2708
|
+
process.exit(1);
|
|
2709
|
+
}
|
|
2710
|
+
console.log(source_default.blue("⚙️ Runtime: ") + source_default.magenta(usingBun ? "Bun" : "Node.js"));
|
|
2699
2711
|
if (env2)
|
|
2700
2712
|
log.env();
|
|
2701
2713
|
if (watch)
|
|
2702
2714
|
log.watch();
|
|
2703
|
-
if (
|
|
2704
|
-
|
|
2715
|
+
if (usingBun) {
|
|
2716
|
+
if (!hasBun) {
|
|
2717
|
+
log.error("Bun não encontrado no PATH.");
|
|
2718
|
+
process.exit(1);
|
|
2719
|
+
}
|
|
2720
|
+
const args2 = [];
|
|
2721
|
+
if (watch)
|
|
2722
|
+
args2.push("--watch");
|
|
2723
|
+
args2.push(entry);
|
|
2724
|
+
return run("bun", args2);
|
|
2705
2725
|
}
|
|
2706
2726
|
if (ext === "ts") {
|
|
2727
|
+
if (!hasTsx) {
|
|
2728
|
+
if (hasBun) {
|
|
2729
|
+
log.warn("tsx não encontrado, iniciando com Bun automaticamente.");
|
|
2730
|
+
const bunArgs = [];
|
|
2731
|
+
if (watch)
|
|
2732
|
+
bunArgs.push("--watch");
|
|
2733
|
+
bunArgs.push(entry);
|
|
2734
|
+
return run("bun", bunArgs);
|
|
2735
|
+
}
|
|
2736
|
+
log.error("Para rodar .ts no Node, instale tsx: npm i -D tsx");
|
|
2737
|
+
process.exit(1);
|
|
2738
|
+
}
|
|
2707
2739
|
const args2 = [];
|
|
2708
2740
|
if (watch)
|
|
2709
2741
|
args2.push("watch");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../../src/core/client/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../../src/core/client/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAQhD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAgB9C,UAAU,KAAK;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,OAAO;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;IACnC,QAAQ,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;IACrC,KAAK,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IACvB,QAAQ,CAAC,EAAE,eAAe,CAAC;CAC5B;AAED,QAAA,MAAM,SAAS;kBACO,OAAO;CAsC5B,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -57470,6 +57470,10 @@ __export(exports_src, {
|
|
|
57470
57470
|
});
|
|
57471
57471
|
module.exports = __toCommonJS(exports_src);
|
|
57472
57472
|
|
|
57473
|
+
// src/core/client/bootstrap.ts
|
|
57474
|
+
var import_node_fs = require("node:fs");
|
|
57475
|
+
var import_node_path2 = __toESM(require("node:path"));
|
|
57476
|
+
|
|
57473
57477
|
// src/core/client/ExtendedClient.ts
|
|
57474
57478
|
var import_discord = __toESM(require_src(), 1);
|
|
57475
57479
|
var intents = [
|
|
@@ -64499,12 +64503,21 @@ async function Router(i) {
|
|
|
64499
64503
|
}
|
|
64500
64504
|
|
|
64501
64505
|
// src/core/client/bootstrap.ts
|
|
64506
|
+
function resolvePath(candidates, fallback) {
|
|
64507
|
+
for (const candidate of candidates) {
|
|
64508
|
+
const absolute = import_node_path2.default.resolve(process.cwd(), candidate);
|
|
64509
|
+
if (import_node_fs.existsSync(absolute)) {
|
|
64510
|
+
return candidate;
|
|
64511
|
+
}
|
|
64512
|
+
}
|
|
64513
|
+
return fallback;
|
|
64514
|
+
}
|
|
64502
64515
|
var Bootstrap = {
|
|
64503
64516
|
async init(options) {
|
|
64504
64517
|
const Token = options.token ?? process.env.TOKEN ?? "";
|
|
64505
64518
|
const paths = {
|
|
64506
|
-
commands: options.paths?.commands ?? "src/commands",
|
|
64507
|
-
events: options.paths?.events ?? "src/events"
|
|
64519
|
+
commands: options.paths?.commands ?? resolvePath(["src/commands", "src/comandos"], "src/commands"),
|
|
64520
|
+
events: options.paths?.events ?? resolvePath(["src/events", "src/eventos"], "src/events")
|
|
64508
64521
|
};
|
|
64509
64522
|
setGlobalSettings({
|
|
64510
64523
|
...options.settings ?? {},
|
package/dist/index.js
CHANGED
|
@@ -57431,6 +57431,10 @@ var require_src = __commonJS((exports) => {
|
|
|
57431
57431
|
__exportStar(require_dist10(), exports);
|
|
57432
57432
|
});
|
|
57433
57433
|
|
|
57434
|
+
// src/core/client/bootstrap.ts
|
|
57435
|
+
import { existsSync as existsSync2 } from "node:fs";
|
|
57436
|
+
import path4 from "node:path";
|
|
57437
|
+
|
|
57434
57438
|
// src/core/client/ExtendedClient.ts
|
|
57435
57439
|
var import_discord = __toESM(require_src(), 1);
|
|
57436
57440
|
var intents = [
|
|
@@ -64460,12 +64464,21 @@ async function Router(i) {
|
|
|
64460
64464
|
}
|
|
64461
64465
|
|
|
64462
64466
|
// src/core/client/bootstrap.ts
|
|
64467
|
+
function resolvePath(candidates, fallback) {
|
|
64468
|
+
for (const candidate of candidates) {
|
|
64469
|
+
const absolute = path4.resolve(process.cwd(), candidate);
|
|
64470
|
+
if (existsSync2(absolute)) {
|
|
64471
|
+
return candidate;
|
|
64472
|
+
}
|
|
64473
|
+
}
|
|
64474
|
+
return fallback;
|
|
64475
|
+
}
|
|
64463
64476
|
var Bootstrap = {
|
|
64464
64477
|
async init(options) {
|
|
64465
64478
|
const Token = options.token ?? process.env.TOKEN ?? "";
|
|
64466
64479
|
const paths = {
|
|
64467
|
-
commands: options.paths?.commands ?? "src/commands",
|
|
64468
|
-
events: options.paths?.events ?? "src/events"
|
|
64480
|
+
commands: options.paths?.commands ?? resolvePath(["src/commands", "src/comandos"], "src/commands"),
|
|
64481
|
+
events: options.paths?.events ?? resolvePath(["src/events", "src/eventos"], "src/events")
|
|
64469
64482
|
};
|
|
64470
64483
|
setGlobalSettings({
|
|
64471
64484
|
...options.settings ?? {},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nexocord",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Framework TypeScript moderno para criar bots escaláveis do Discord com discord.js v14, apresentando arquitetura modular, cli e utilitários amigáveis para desenvolvedores.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -58,7 +58,6 @@
|
|
|
58
58
|
"bin": {
|
|
59
59
|
"nexo": "./dist/bin/cli.js"
|
|
60
60
|
},
|
|
61
|
-
|
|
62
61
|
"engines": {
|
|
63
62
|
"node": ">=20"
|
|
64
63
|
},
|