pedrodev.applications
Version:
a package to manage Pedro De's applications, but useful for others.
41 lines (40 loc) • 1.94 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ApplicationsTypes = exports.PedroDevApp = void 0;
const node_path_1 = require("node:path");
var ApplicationsTypes;
(function (ApplicationsTypes) {
ApplicationsTypes[ApplicationsTypes["DiscordBot"] = 1] = "DiscordBot";
ApplicationsTypes[ApplicationsTypes["ExpressSite"] = 2] = "ExpressSite";
ApplicationsTypes[ApplicationsTypes["AnyProject"] = 3] = "AnyProject";
ApplicationsTypes[ApplicationsTypes["PersonalProject"] = 4] = "PersonalProject";
})(ApplicationsTypes || (exports.ApplicationsTypes = ApplicationsTypes = {}));
class PedroDevApp {
constructor(options) {
this.options = options;
}
execute() {
return __awaiter(this, void 0, void 0, function* () {
const { mainFile, dirname } = this.options;
const filePath = (0, node_path_1.resolve)(dirname, mainFile);
try {
if (mainFile.endsWith(".ts") || mainFile.endsWith(".js")) {
require(filePath);
}
}
catch (error) {
console.error(`Erro ao executar o arquivo ${filePath}:`, error);
}
});
}
}
exports.PedroDevApp = PedroDevApp;