quilon
Version:
Generate ERDs from your entity files automagically
32 lines (31 loc) • 1.35 kB
JavaScript
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.InitCommand = void 0;
const fs_1 = __importDefault(require("fs"));
const types_1 = require("../../global/types");
const config_1 = require("../../global/config");
const AbstractCommand_1 = require("../AbstractCommand");
class InitCommand extends AbstractCommand_1.AbstractCommand {
constructor() {
super(...arguments);
this.DEFAULT_CONFIG = {
$schema: "https://raw.githubusercontent.com/quilon-tool/quilon/main/src/config/config-schema.json",
entities: [],
orm: types_1.ORMs.TypeORM,
diagramLanguage: types_1.DiagramLanguages.Mermaid,
outputDir: config_1.GlobalConfig.OUTPUT_DIR,
};
}
execute() {
if (fs_1.default.existsSync(config_1.GlobalConfig.CONFIG_PATH)) {
console.error(`${config_1.GlobalConfig.CONFIG_FILE} already exists.`);
return;
}
fs_1.default.writeFileSync(config_1.GlobalConfig.CONFIG_PATH, JSON.stringify(this.DEFAULT_CONFIG, null, 2));
console.log(`${config_1.GlobalConfig.CONFIG_FILE} successfully created.`);
}
}
exports.InitCommand = InitCommand;
;