jarvis-arch-hexagonal-gen 1.0.7 → 1.0.9

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.
@@ -18,7 +18,8 @@ async function generateCommand(plugin, entity, options) {
18
18
  const metadata = (0, parser_1.parseEntity)(entity, { columns });
19
19
  // Lê configuração
20
20
  const pluginsDir = path_1.default.join(__dirname, '..', '..', 'plugins');
21
- const generator = new generator_1.Generator(pluginsDir);
21
+ const outputDir = process.cwd();
22
+ const generator = new generator_1.Generator(pluginsDir, outputDir);
22
23
  try {
23
24
  await generator.generate(plugin, metadata, options);
24
25
  console.log('✨ Geração concluída!');
@@ -11,10 +11,15 @@ const path_1 = __importDefault(require("path"));
11
11
  const plugin_manager_1 = require("./plugin-manager");
12
12
  const hook_runner_1 = require("./hook-runner");
13
13
  class Generator {
14
- constructor(pluginsDir) {
14
+ /**
15
+ * @param pluginsDir Caminho absoluto para a pasta onde estão os plugins (ex: dentro do pacote)
16
+ * @param outputDir Caminho absoluto onde os arquivos gerados serão escritos (padrão: process.cwd())
17
+ */
18
+ constructor(pluginsDir, outputDir = process.cwd()) {
15
19
  const defaultPluginsDir = path_1.default.join(__dirname, '..', 'plugins');
16
20
  this.pluginManager = new plugin_manager_1.PluginManager(pluginsDir || defaultPluginsDir);
17
21
  this.hookRunner = new hook_runner_1.HookRunner();
22
+ this.outputDir = outputDir;
18
23
  }
19
24
  async generate(pluginName, metadata, options = {}) {
20
25
  const plugin = this.pluginManager.load(pluginName);
@@ -35,8 +40,10 @@ class Generator {
35
40
  if (file.condition && !this.evaluateCondition(file.condition, options)) {
36
41
  continue;
37
42
  }
43
+ // Renderiza o caminho de saída (relativo ao projeto)
38
44
  const outputPath = ejs_1.default.render(file.output, { ...metadata, ...options });
39
- const fullOutputPath = path_1.default.join(__dirname, '..', outputPath);
45
+ // 👇 CAMINHO CORRIGIDO: usa this.outputDir (process.cwd()) como base
46
+ const fullOutputPath = path_1.default.join(this.outputDir, outputPath);
40
47
  const templatePath = path_1.default.join(plugin.templatesDir, file.template);
41
48
  if (!fs_extra_1.default.existsSync(templatePath)) {
42
49
  console.warn(`⚠️ Template não encontrado: ${templatePath}`);
@@ -16,7 +16,6 @@ class PluginManager {
16
16
  if (this.cache.has(pluginName))
17
17
  return this.cache.get(pluginName);
18
18
  const foundPath = this.findPluginPath(pluginName);
19
- console.log(foundPath);
20
19
  if (!foundPath) {
21
20
  throw new Error(`Manifest não encontrado para o plugin "${pluginName}"`);
22
21
  }
@@ -45,12 +44,9 @@ class PluginManager {
45
44
  findPluginPath(pluginName) {
46
45
  const search = (dir) => {
47
46
  const items = fs_extra_1.default.readdirSync(dir);
48
- console.log("item", JSON.stringify(items, null, 2));
49
47
  for (const item of items) {
50
48
  const fullPath = path_1.default.join(dir, item);
51
49
  const stat = fs_extra_1.default.statSync(fullPath);
52
- console.log("fullPath: ", fullPath);
53
- console.log("stat: ", stat);
54
50
  if (stat.isDirectory()) {
55
51
  if (item === pluginName && fs_extra_1.default.existsSync(path_1.default.join(fullPath, 'manifest.json'))) {
56
52
  return fullPath;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jarvis-arch-hexagonal-gen",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "Gerador de recursos para projetos Node.js com TypeScript",
5
5
  "keywords": [
6
6
  "Arquitetura Hexagonal",