Skip to content

Commit

Permalink
fix generetor for 3278942842034232 time
Browse files Browse the repository at this point in the history
  • Loading branch information
TheArmagan committed Mar 23, 2022
1 parent a65d86f commit 6a265ed
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions other/pluginTypesGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ globalThis.Underline = {
console.info(`[BİLGİ] "${rltPath}" konumundaki plugin yükleniyor..`)
/** @type {import("../types/Plugin")} */
let plugin = require(pluginFile);
console.info("Plugin:", plugin._type, plugin.namespace,plugin);
console.info("Plugin:", plugin._type, plugin.namespace, plugin);
// console.log(plugin)

if (plugin._type != "plugin")
Expand All @@ -32,10 +32,10 @@ globalThis.Underline = {
return console.warn(`[UYARI] ${plugin.name} plugini zaten yüklenmiş. Atlanıyor..`);

loadedNamespaces.push(plugin.namespace);

let parsedPluginPath = path.parse(pluginFile);
// console.log(parsedPluginPath)

let dtsPath = "";

switch (parsedPluginPath.dir.split(path.sep).pop()) {
Expand All @@ -50,7 +50,7 @@ globalThis.Underline = {
}
console.log(dtsPath);
let isDTS = fs.existsSync(dtsPath);

if (isDTS) {
pluginTypes.push(`["${plugin.namespace}"]: import("${path.relative(process.cwd(), dtsPath).replace(".d.ts", "").replaceAll(path.sep, "/")}").Plugin`);
} else {
Expand All @@ -75,12 +75,12 @@ globalThis.Underline = {

}
}

console.info(`[BİLGİ] "${plugin.name}" plugini tipi çıkartıldı.`);
});

await makeSureFolderExists(path.resolve(__dirname, "../generated"));
let result = `export class Types {\n${pluginTypes.map(i => ` ${i};`).join("\n")}\n};\n${`export type TEventNames = ${TEventNames.join(" | ").trim() || "any"};`}\n${`export type TEvents = ${TEvents.join(" | ").trim() || "any"};`}\n${TInterfaces.join("\n")}\n`.trim();
let result = `export class Types {\n${pluginTypes.map(i => ` ${i};`).join("\n")}\n};\n${`export type TEventNames = ${TEventNames.join(" | ").trim() || '""'};`}\n${`export type TEvents = ${TEvents.join(" | ").trim() || "[]"};`}\n${TInterfaces.join("\n")}\n`.trim();
console.info(result);
await fs.promises.writeFile(path.resolve(__dirname, "../generated/pluginTypes.d.ts"), result);

Expand Down Expand Up @@ -126,7 +126,7 @@ async function getPluginFilePaths() {
let folderPath = path.resolve(pluginsPath, folderOrZip.name.replace(".up.zip", ".up"));
let zipPath = path.resolve(pluginsPath, folderOrZip.name);

await fs.promises.rm(folderPath, {recursive: true}).catch(() => {});
await fs.promises.rm(folderPath, { recursive: true }).catch(() => { });
await makeSureFolderExists(folderPath);
await extractZip(zipPath, { dir: folderPath });
fs.promises.unlink(zipPath).catch(() => null);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"@types/recursive-readdir": "^2.2.0"
},
"name": "armagan-basit-altyapi",
"version": "2.0.2",
"version": "2.0.3",
"description": "Kullanımı basit ancak bir yandanda içinde birçek özellik barındıran discord bot altyapısı.",
"main": "index.js",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Basit Altyapı (Versiyon 2.0.2) (v13.x)
# Basit Altyapı (Versiyon 2.0.3) (v13.x)

Kullanımı basit ancak bir yandanda içinde birçek özellik barındıran discord bot altyapısı. Sık sık güncelleme alıyor. (Slash Commands)

Expand Down

0 comments on commit 6a265ed

Please sign in to comment.