commandkit 0.1.11-dev.20250330115847 → 0.1.11-dev.20250330125518
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/index.js +10 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5633,7 +5633,7 @@ var init_version = __esm({
|
|
|
5633
5633
|
"use strict";
|
|
5634
5634
|
init_cjs_shims();
|
|
5635
5635
|
version = /* @__MACRO__ $version */
|
|
5636
|
-
"0.1.11-dev.
|
|
5636
|
+
"0.1.11-dev.20250330125518";
|
|
5637
5637
|
}
|
|
5638
5638
|
});
|
|
5639
5639
|
|
|
@@ -6061,10 +6061,14 @@ __export(generators_exports, {
|
|
|
6061
6061
|
generateEvent: () => generateEvent,
|
|
6062
6062
|
generateLocale: () => generateLocale
|
|
6063
6063
|
});
|
|
6064
|
+
function determineExtension() {
|
|
6065
|
+
return (0, import_fs2.existsSync)((0, import_path4.join)(BASE_PATH, "tsconfig.json")) ? "ts" : "js";
|
|
6066
|
+
}
|
|
6064
6067
|
async function generateCommand(name, customPath) {
|
|
6065
|
-
const cmdPath = (0, import_path4.join)(customPath || COMMANDS_DIR
|
|
6068
|
+
const cmdPath = (0, import_path4.join)(customPath || COMMANDS_DIR);
|
|
6066
6069
|
if (!(0, import_fs2.existsSync)(cmdPath)) await (0, import_promises7.mkdir)(cmdPath, { recursive: true });
|
|
6067
|
-
|
|
6070
|
+
const fileName = `${name}.${determineExtension()}`;
|
|
6071
|
+
if ((0, import_fs2.existsSync)((0, import_path4.join)(cmdPath, fileName))) {
|
|
6068
6072
|
panic(`Command ${name} already exists.`);
|
|
6069
6073
|
}
|
|
6070
6074
|
const commandFile = `
|
|
@@ -6083,10 +6087,10 @@ export const message: MessageCommand = async (ctx) => {
|
|
|
6083
6087
|
await ctx.message.reply('Hello from ${name}!');
|
|
6084
6088
|
};
|
|
6085
6089
|
`.trim();
|
|
6086
|
-
await (0, import_promises7.writeFile)((0, import_path4.join)(cmdPath,
|
|
6090
|
+
await (0, import_promises7.writeFile)((0, import_path4.join)(cmdPath, fileName), commandFile);
|
|
6087
6091
|
console.log(
|
|
6088
6092
|
colors_default.green(
|
|
6089
|
-
`Command ${colors_default.magenta(name)} created at ${colors_default.blue(formatPath(cmdPath))}
|
|
6093
|
+
`Command ${colors_default.magenta(name)} created at ${colors_default.blue(formatPath(`${cmdPath}/${fileName}`))}`
|
|
6090
6094
|
)
|
|
6091
6095
|
);
|
|
6092
6096
|
}
|
|
@@ -6160,6 +6164,7 @@ var init_generators = __esm({
|
|
|
6160
6164
|
EVENTS_DIR = (0, import_path4.join)(BASE_PATH, "src/app/events");
|
|
6161
6165
|
LOCALES_DIR = (0, import_path4.join)(BASE_PATH, "src/app/locales");
|
|
6162
6166
|
formatPath = /* @__PURE__ */ __name((path2) => path2.replace(process.cwd(), ".").replace(/\\/g, "/"), "formatPath");
|
|
6167
|
+
__name(determineExtension, "determineExtension");
|
|
6163
6168
|
__name(generateCommand, "generateCommand");
|
|
6164
6169
|
__name(generateEvent, "generateEvent");
|
|
6165
6170
|
__name(generateLocale, "generateLocale");
|