jarvis-arch-hexagonal-gen 1.0.0 → 1.0.2
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.
|
@@ -4,11 +4,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.generateCommand = generateCommand;
|
|
7
|
-
// src/cli/commands/generate.ts
|
|
8
7
|
const generator_1 = require("../../core/generator");
|
|
9
8
|
const parser_1 = require("../../core/parser");
|
|
10
9
|
const path_1 = __importDefault(require("path"));
|
|
11
|
-
const config_1 = require("../../utils/config");
|
|
12
10
|
async function generateCommand(plugin, entity, options) {
|
|
13
11
|
let columns = [];
|
|
14
12
|
if (options.fields) {
|
|
@@ -19,9 +17,8 @@ async function generateCommand(plugin, entity, options) {
|
|
|
19
17
|
}
|
|
20
18
|
const metadata = (0, parser_1.parseEntity)(entity, { columns });
|
|
21
19
|
// Lê configuração
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const generator = new generator_1.Generator(path_1.default.join(process.cwd(), pluginsDir));
|
|
20
|
+
const pluginsDir = path_1.default.join(__dirname, '..', 'plugins');
|
|
21
|
+
const generator = new generator_1.Generator(pluginsDir);
|
|
25
22
|
try {
|
|
26
23
|
await generator.generate(plugin, metadata, options);
|
|
27
24
|
console.log('✨ Geração concluída!');
|
package/dist/core/generator.js
CHANGED
|
@@ -12,7 +12,7 @@ const plugin_manager_1 = require("./plugin-manager");
|
|
|
12
12
|
const hook_runner_1 = require("./hook-runner");
|
|
13
13
|
class Generator {
|
|
14
14
|
constructor(pluginsDir) {
|
|
15
|
-
const defaultPluginsDir = path_1.default.join(
|
|
15
|
+
const defaultPluginsDir = path_1.default.join(__dirname, '..', 'plugins');
|
|
16
16
|
this.pluginManager = new plugin_manager_1.PluginManager(pluginsDir || defaultPluginsDir);
|
|
17
17
|
this.hookRunner = new hook_runner_1.HookRunner();
|
|
18
18
|
}
|
|
@@ -36,7 +36,7 @@ class Generator {
|
|
|
36
36
|
continue;
|
|
37
37
|
}
|
|
38
38
|
const outputPath = ejs_1.default.render(file.output, { ...metadata, ...options });
|
|
39
|
-
const fullOutputPath = path_1.default.join(
|
|
39
|
+
const fullOutputPath = path_1.default.join(__dirname, '..', outputPath);
|
|
40
40
|
const templatePath = path_1.default.join(plugin.templatesDir, file.template);
|
|
41
41
|
if (!fs_extra_1.default.existsSync(templatePath)) {
|
|
42
42
|
console.warn(`⚠️ Template não encontrado: ${templatePath}`);
|
|
@@ -7,7 +7,7 @@ exports.registerRoutes = registerRoutes;
|
|
|
7
7
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
async function registerRoutes(metadata, options) {
|
|
10
|
-
const routesFile = path_1.default.join(
|
|
10
|
+
const routesFile = path_1.default.join(__dirname, '..', 'src/routes/index.ts');
|
|
11
11
|
if (await fs_extra_1.default.pathExists(routesFile)) {
|
|
12
12
|
const content = await fs_extra_1.default.readFile(routesFile, 'utf-8');
|
|
13
13
|
const newImport = `import { ${metadata.entity}Controller } from '../modules/${metadata.route}/${metadata.entity}Controller';\n`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jarvis-arch-hexagonal-gen",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Gerador de recursos para projetos Node.js com TypeScript",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Arquitetura Hexagonal",
|
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
"chalk": "^5.6.2",
|
|
24
24
|
"commander": "^15.0.0",
|
|
25
25
|
"ejs": "^6.0.1",
|
|
26
|
-
"text-table": "^0.2.0"
|
|
26
|
+
"text-table": "^0.2.0",
|
|
27
|
+
"fs-extra": "^11.3.5"
|
|
27
28
|
},
|
|
28
29
|
"devDependencies": {
|
|
29
30
|
"@types/chalk": "^0.4.31",
|
|
@@ -35,7 +36,6 @@
|
|
|
35
36
|
"@types/text-table": "^0.2.5",
|
|
36
37
|
"copyfiles": "^2.4.1",
|
|
37
38
|
"cpx": "^1.5.0",
|
|
38
|
-
"fs-extra": "^11.3.5",
|
|
39
39
|
"jest": "^30.4.2",
|
|
40
40
|
"supertest": "^7.2.2",
|
|
41
41
|
"ts-jest": "^29.4.11",
|