@igniter-js/cli 0.1.11 → 0.2.0
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.
- package/bin/igniter +2 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.js +14390 -523
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14427 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +37 -51
- package/dist/templates/components.json.hbs +0 -21
- package/dist/templates/copilot.feature.instructions.hbs +0 -145
- package/dist/templates/copilot.form.instructions.hbs +0 -1021
- package/dist/templates/copilot.igniter.instructions.hbs +0 -753
- package/dist/templates/copilot.instructions.hbs +0 -117
- package/dist/templates/copilot.next.instructions.hbs +0 -67
- package/dist/templates/copilot.review.instructions.hbs +0 -42
- package/dist/templates/copilot.test.instructions.hbs +0 -55
- package/dist/templates/docker-compose.hbs +0 -15
- package/dist/templates/env.hbs +0 -33
- package/dist/templates/eslintrc.hbs +0 -6
- package/dist/templates/express.server.hbs +0 -33
- package/dist/templates/feature.controller.hbs +0 -95
- package/dist/templates/feature.index.hbs +0 -5
- package/dist/templates/feature.interface.hbs +0 -101
- package/dist/templates/feature.procedure.hbs +0 -88
- package/dist/templates/globals.hbs +0 -123
- package/dist/templates/igniter.client.hbs +0 -21
- package/dist/templates/igniter.context.hbs +0 -23
- package/dist/templates/igniter.hbs +0 -8
- package/dist/templates/igniter.router.hbs +0 -29
- package/dist/templates/layout.hbs +0 -39
- package/dist/templates/page.hbs +0 -117
- package/dist/templates/prisma.hbs +0 -9
- package/dist/templates/readme.hbs +0 -119
- package/dist/templates/route.hbs +0 -4
- package/dist/templates/use-form-with-zod.hbs +0 -39
- package/dist/templates/vitest.config.hbs +0 -11
- package/dist/templates/vscode.settings.hbs +0 -53
- package/dist/utils/analyze.d.ts +0 -17
- package/dist/utils/analyze.js +0 -185
- package/dist/utils/analyze.js.map +0 -1
- package/dist/utils/cli-style.d.ts +0 -55
- package/dist/utils/cli-style.js +0 -171
- package/dist/utils/cli-style.js.map +0 -1
- package/dist/utils/consts.d.ts +0 -19
- package/dist/utils/consts.js +0 -30
- package/dist/utils/consts.js.map +0 -1
- package/dist/utils/handlebars-helpers.d.ts +0 -1
- package/dist/utils/handlebars-helpers.js +0 -88
- package/dist/utils/handlebars-helpers.js.map +0 -1
- package/dist/utils/helpers.d.ts +0 -13
- package/dist/utils/helpers.js +0 -112
- package/dist/utils/helpers.js.map +0 -1
- package/dist/utils/platform-utils.d.ts +0 -46
- package/dist/utils/platform-utils.js +0 -95
- package/dist/utils/platform-utils.js.map +0 -1
- package/dist/utils/prisma-schema-parser.d.ts +0 -60
- package/dist/utils/prisma-schema-parser.js +0 -255
- package/dist/utils/prisma-schema-parser.js.map +0 -1
- package/dist/utils/project-utils.d.ts +0 -32
- package/dist/utils/project-utils.js +0 -123
- package/dist/utils/project-utils.js.map +0 -1
- package/dist/utils/template-handler.d.ts +0 -6
- package/dist/utils/template-handler.js +0 -32
- package/dist/utils/template-handler.js.map +0 -1
- package/readme.md +0 -165
package/dist/utils/helpers.js
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CLIHelper = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const child_process_1 = require("child_process");
|
|
6
|
-
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
7
|
-
const path_1 = tslib_1.__importDefault(require("path"));
|
|
8
|
-
const consts_1 = require("./consts");
|
|
9
|
-
const platform_utils_1 = require("./platform-utils");
|
|
10
|
-
class CLIHelper {
|
|
11
|
-
execCommand(command) {
|
|
12
|
-
try {
|
|
13
|
-
// Ajustar comando para Windows se necessário
|
|
14
|
-
const adjustedCommand = this.adjustCommandForWindows(command);
|
|
15
|
-
const needsInteraction = consts_1.INTERACTIVE_COMMANDS.some((cmd) => adjustedCommand.includes(cmd));
|
|
16
|
-
if (needsInteraction) {
|
|
17
|
-
console.log(`\n📦 Executing: ${adjustedCommand}\n`);
|
|
18
|
-
(0, child_process_1.execSync)(adjustedCommand, { stdio: 'inherit' });
|
|
19
|
-
console.log('\n✅ Command completed successfully\n');
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
(0, child_process_1.execSync)(adjustedCommand, {
|
|
23
|
-
stdio: ['pipe', 'pipe', 'pipe'],
|
|
24
|
-
encoding: 'utf-8'
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
catch (error) {
|
|
29
|
-
console.error(`Failed to execute command: ${command} \n${error}`);
|
|
30
|
-
process.exit(1);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
// Método para ajustar comandos para Windows
|
|
34
|
-
adjustCommandForWindows(command) {
|
|
35
|
-
if (!(0, platform_utils_1.isWindows)())
|
|
36
|
-
return command;
|
|
37
|
-
return command;
|
|
38
|
-
}
|
|
39
|
-
createDir(dir) {
|
|
40
|
-
const normalizedDir = (0, platform_utils_1.normalizePath)(dir);
|
|
41
|
-
if (!fs_1.default.existsSync(normalizedDir)) {
|
|
42
|
-
fs_1.default.mkdirSync(normalizedDir, { recursive: true });
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
createFile(filePath, content = '') {
|
|
46
|
-
const normalizedPath = (0, platform_utils_1.normalizePath)(filePath);
|
|
47
|
-
const dir = path_1.default.dirname(normalizedPath);
|
|
48
|
-
if (!fs_1.default.existsSync(dir)) {
|
|
49
|
-
fs_1.default.mkdirSync(dir, { recursive: true });
|
|
50
|
-
}
|
|
51
|
-
fs_1.default.writeFileSync(normalizedPath, content);
|
|
52
|
-
}
|
|
53
|
-
updateFile(filePath, content) {
|
|
54
|
-
fs_1.default.writeFileSync((0, platform_utils_1.normalizePath)(filePath), content);
|
|
55
|
-
}
|
|
56
|
-
checkDependencies(dependencies) {
|
|
57
|
-
for (const dep of dependencies) {
|
|
58
|
-
try {
|
|
59
|
-
(0, child_process_1.execSync)(`${dep} --version`, { stdio: 'pipe' });
|
|
60
|
-
}
|
|
61
|
-
catch (error) {
|
|
62
|
-
console.error(`Required dependency not found: ${dep}. Please install it before proceeding. \n${error}`);
|
|
63
|
-
process.exit(1);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
async delay(ms) {
|
|
68
|
-
return new Promise(resolve => setTimeout(resolve, ms));
|
|
69
|
-
}
|
|
70
|
-
loadJSON(filePath) {
|
|
71
|
-
try {
|
|
72
|
-
return JSON.parse(fs_1.default.readFileSync((0, platform_utils_1.normalizePath)(filePath), 'utf8'));
|
|
73
|
-
}
|
|
74
|
-
catch (error) {
|
|
75
|
-
console.error(`Failed to load JSON file: ${filePath} \n${error}`);
|
|
76
|
-
process.exit(1);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
saveJSON(filePath, data) {
|
|
80
|
-
try {
|
|
81
|
-
fs_1.default.writeFileSync((0, platform_utils_1.normalizePath)(filePath), JSON.stringify(data, null, 2));
|
|
82
|
-
}
|
|
83
|
-
catch (error) {
|
|
84
|
-
console.error(`Failed to save JSON file: ${filePath} \n${error}`);
|
|
85
|
-
process.exit(1);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
createDirectoryStructure(structure, basePath = '') {
|
|
89
|
-
Object.entries(structure).forEach(([dir, content]) => {
|
|
90
|
-
const fullPath = (0, platform_utils_1.normalizePath)(path_1.default.join(basePath, dir));
|
|
91
|
-
this.createDir(fullPath);
|
|
92
|
-
if (Array.isArray(content)) {
|
|
93
|
-
content.forEach(file => {
|
|
94
|
-
if (typeof file === 'string') {
|
|
95
|
-
this.createFile(path_1.default.join(fullPath, file));
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
else if (content && typeof content === 'object') {
|
|
100
|
-
this.createDirectoryStructure(content, fullPath);
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
installDependencies(dependencies, dev = false) {
|
|
105
|
-
const deps = Object.entries(dependencies)
|
|
106
|
-
.map(([name, version]) => `${name}@${version}`)
|
|
107
|
-
.join(' ');
|
|
108
|
-
this.execCommand(`npm install ${dev ? '-D ' : ''}${deps}`);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
exports.CLIHelper = CLIHelper;
|
|
112
|
-
//# sourceMappingURL=helpers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/utils/helpers.ts"],"names":[],"mappings":";;;;AAAA,iDAAwC;AACxC,oDAAmB;AACnB,wDAAuB;AACvB,qCAA+C;AAC/C,qDAA2D;AAE3D,MAAa,SAAS;IACV,WAAW,CAAC,OAAe;QACnC,IAAI,CAAC;YACH,6CAA6C;YAC7C,MAAM,eAAe,GAAG,IAAI,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAA;YAE7D,MAAM,gBAAgB,GAAG,6BAAoB,CAAC,IAAI,CAAC,CAAC,GAAW,EAAE,EAAE,CAAC,eAAe,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAA;YAElG,IAAI,gBAAgB,EAAE,CAAC;gBACrB,OAAO,CAAC,GAAG,CAAC,mBAAmB,eAAe,IAAI,CAAC,CAAA;gBACnD,IAAA,wBAAQ,EAAC,eAAe,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAA;gBAC/C,OAAO,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAA;YACrD,CAAC;iBAAM,CAAC;gBACN,IAAA,wBAAQ,EAAC,eAAe,EAAE;oBACxB,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;oBAC/B,QAAQ,EAAE,OAAO;iBAClB,CAAC,CAAA;YACJ,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,8BAA8B,OAAO,MAAM,KAAK,EAAE,CAAC,CAAA;YAC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AA,8BAAa,EAAC,cAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAA;YACxD,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAA;YAExB,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;gBAC3B,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;oBACrB,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;wBAC7B,IAAI,CAAC,UAAU,CAAC,cAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAA;oBAC5C,CAAC;gBACH,CAAC,CAAC,CAAA;YACJ,CAAC;iBAAM,IAAI,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;gBAClD,IAAI,CAAC,wBAAwB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAA;YAClD,CAAC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IAES,mBAAmB,CAAC,YAAoC,EAAE,MAAe,KAAK;QACtF,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC;aACtC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,GAAG,IAAI,IAAI,OAAO,EAAE,CAAC;aAC9C,IAAI,CAAC,GAAG,CAAC,CAAA;QAEZ,IAAI,CAAC,WAAW,CAAC,eAAe,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC,CAAA;IAC5D,CAAC;CACF;AA7GD,8BA6GC"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Funções básicas de utilidade para detecção de plataforma
|
|
3
|
-
* Arquivo separado para evitar referências circulares
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Verifica se está rodando no Windows
|
|
7
|
-
* @returns {boolean} True se estiver rodando no Windows
|
|
8
|
-
*/
|
|
9
|
-
export declare function isWindows(): boolean;
|
|
10
|
-
/**
|
|
11
|
-
* Normaliza separadores de caminho para a plataforma atual
|
|
12
|
-
* @param {string} filePath - O caminho a ser normalizado
|
|
13
|
-
* @returns {string} O caminho normalizado
|
|
14
|
-
*/
|
|
15
|
-
export declare function normalizePath(filePath: string): string;
|
|
16
|
-
/**
|
|
17
|
-
* Verifica se o terminal suporta caracteres Unicode
|
|
18
|
-
* @returns {boolean} True se o terminal suportar caracteres Unicode
|
|
19
|
-
*/
|
|
20
|
-
export declare function supportsUnicode(): boolean;
|
|
21
|
-
/**
|
|
22
|
-
* Obtém elementos visuais apropriados para a plataforma atual
|
|
23
|
-
* @returns {object} Objeto contendo elementos visuais adequados para a plataforma atual
|
|
24
|
-
*/
|
|
25
|
-
export declare function getVisualElements(): {
|
|
26
|
-
verticalLine: string;
|
|
27
|
-
horizontalLine: string;
|
|
28
|
-
topRight: string;
|
|
29
|
-
topLeft: string;
|
|
30
|
-
bottomRight: string;
|
|
31
|
-
bottomLeft: string;
|
|
32
|
-
cross: string;
|
|
33
|
-
bullet: string;
|
|
34
|
-
checkmark: string;
|
|
35
|
-
cross_mark: string;
|
|
36
|
-
warning: string;
|
|
37
|
-
info: string;
|
|
38
|
-
arrow: string;
|
|
39
|
-
};
|
|
40
|
-
declare const _default: {
|
|
41
|
-
isWindows: typeof isWindows;
|
|
42
|
-
normalizePath: typeof normalizePath;
|
|
43
|
-
supportsUnicode: typeof supportsUnicode;
|
|
44
|
-
getVisualElements: typeof getVisualElements;
|
|
45
|
-
};
|
|
46
|
-
export default _default;
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isWindows = isWindows;
|
|
4
|
-
exports.normalizePath = normalizePath;
|
|
5
|
-
exports.supportsUnicode = supportsUnicode;
|
|
6
|
-
exports.getVisualElements = getVisualElements;
|
|
7
|
-
const tslib_1 = require("tslib");
|
|
8
|
-
const path_1 = tslib_1.__importDefault(require("path"));
|
|
9
|
-
const is_windows_1 = tslib_1.__importDefault(require("is-windows"));
|
|
10
|
-
/**
|
|
11
|
-
* Funções básicas de utilidade para detecção de plataforma
|
|
12
|
-
* Arquivo separado para evitar referências circulares
|
|
13
|
-
*/
|
|
14
|
-
/**
|
|
15
|
-
* Verifica se está rodando no Windows
|
|
16
|
-
* @returns {boolean} True se estiver rodando no Windows
|
|
17
|
-
*/
|
|
18
|
-
function isWindows() {
|
|
19
|
-
return (0, is_windows_1.default)() || process.platform === 'win32';
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Normaliza separadores de caminho para a plataforma atual
|
|
23
|
-
* @param {string} filePath - O caminho a ser normalizado
|
|
24
|
-
* @returns {string} O caminho normalizado
|
|
25
|
-
*/
|
|
26
|
-
function normalizePath(filePath) {
|
|
27
|
-
return path_1.default.normalize(filePath);
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Verifica se o terminal suporta caracteres Unicode
|
|
31
|
-
* @returns {boolean} True se o terminal suportar caracteres Unicode
|
|
32
|
-
*/
|
|
33
|
-
function supportsUnicode() {
|
|
34
|
-
// Verificação mais robusta de suporte a Unicode no Windows
|
|
35
|
-
const isWinOS = isWindows();
|
|
36
|
-
// No Windows, verificar também a variável de ambiente TERM
|
|
37
|
-
const termVar = process.env.TERM || '';
|
|
38
|
-
const isPowerShell = process.env.SHELL?.includes('powershell') || false;
|
|
39
|
-
const isWindowsTerminal = process.env.WT_SESSION !== undefined;
|
|
40
|
-
// Windows Terminal e PowerShell Core suportam Unicode bem
|
|
41
|
-
if (isWinOS && (isWindowsTerminal || isPowerShell || termVar.includes('xterm'))) {
|
|
42
|
-
return true;
|
|
43
|
-
}
|
|
44
|
-
// Para outros sistemas, verificar se é um TTY
|
|
45
|
-
return process.stdout.isTTY && !isWinOS;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Obtém elementos visuais apropriados para a plataforma atual
|
|
49
|
-
* @returns {object} Objeto contendo elementos visuais adequados para a plataforma atual
|
|
50
|
-
*/
|
|
51
|
-
function getVisualElements() {
|
|
52
|
-
const hasUnicodeSupport = supportsUnicode();
|
|
53
|
-
// Elementos ASCII simples para baixa compatibilidade
|
|
54
|
-
let elements = {
|
|
55
|
-
verticalLine: '|',
|
|
56
|
-
horizontalLine: '-',
|
|
57
|
-
topRight: '+',
|
|
58
|
-
topLeft: '+',
|
|
59
|
-
bottomRight: '+',
|
|
60
|
-
bottomLeft: '+',
|
|
61
|
-
cross: '+',
|
|
62
|
-
bullet: '*',
|
|
63
|
-
checkmark: '√',
|
|
64
|
-
cross_mark: 'x',
|
|
65
|
-
warning: '!',
|
|
66
|
-
info: 'i',
|
|
67
|
-
arrow: '->'
|
|
68
|
-
};
|
|
69
|
-
// Elementos aprimorados para terminais com melhor suporte a símbolos
|
|
70
|
-
if (hasUnicodeSupport) {
|
|
71
|
-
elements = {
|
|
72
|
-
verticalLine: '│',
|
|
73
|
-
horizontalLine: '─',
|
|
74
|
-
topRight: '┐',
|
|
75
|
-
topLeft: '┌',
|
|
76
|
-
bottomRight: '┘',
|
|
77
|
-
bottomLeft: '└',
|
|
78
|
-
cross: '┼',
|
|
79
|
-
bullet: '•',
|
|
80
|
-
checkmark: '✓',
|
|
81
|
-
cross_mark: '✗',
|
|
82
|
-
warning: '⚠',
|
|
83
|
-
info: 'ℹ',
|
|
84
|
-
arrow: '→'
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
return elements;
|
|
88
|
-
}
|
|
89
|
-
exports.default = {
|
|
90
|
-
isWindows,
|
|
91
|
-
normalizePath,
|
|
92
|
-
supportsUnicode,
|
|
93
|
-
getVisualElements
|
|
94
|
-
};
|
|
95
|
-
//# sourceMappingURL=platform-utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"platform-utils.js","sourceRoot":"","sources":["../../src/utils/platform-utils.ts"],"names":[],"mappings":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GAAG;QACV,MAAM,EAAE,GAAG;QACX,SAAS,EAAE,GAAG;QACd,UAAU,EAAE,GAAG;QACf,OAAO,EAAE,GAAG;QACZ,IAAI,EAAE,GAAG;QACT,KAAK,EAAE,IAAI;KACZ,CAAA;IAED,qEAAqE;IACrE,IAAI,iBAAiB,EAAE,CAAC;QACtB,QAAQ,GAAG;YACT,YAAY,EAAE,GAAG;YACjB,cAAc,EAAE,GAAG;YACnB,QAAQ,EAAE,GAAG;YACb,OAAO,EAAE,GAAG;YACZ,WAAW,EAAE,GAAG;YAChB,UAAU,EAAE,GAAG;YACf,KAAK,EAAE,GAAG;YACV,MAAM,EAAE,GAAG;YACX,SAAS,EAAE,GAAG;YACd,UAAU,EAAE,GAAG;YACf,OAAO,EAAE,GAAG;YACZ,IAAI,EAAE,GAAG;YACT,KAAK,EAAE,GAAG;SACX,CAAA;IACH,CAAC;IAED,OAAO,QAAQ,CAAA;AACjB,CAAC;AAED,kBAAe;IACb,SAAS;IACT,aAAa;IACb,eAAe;IACf,iBAAiB;CAClB,CAAA"}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
interface ParsedField {
|
|
2
|
-
name: string;
|
|
3
|
-
type: string;
|
|
4
|
-
zodType: string;
|
|
5
|
-
description: string;
|
|
6
|
-
isRelation: boolean;
|
|
7
|
-
isOptional: boolean;
|
|
8
|
-
isList: boolean;
|
|
9
|
-
hasDefault: boolean;
|
|
10
|
-
isEnum?: boolean;
|
|
11
|
-
enumValues?: string[];
|
|
12
|
-
relations?: {
|
|
13
|
-
type: 'one-to-one' | 'one-to-many' | 'many-to-many';
|
|
14
|
-
model: string;
|
|
15
|
-
fields: string[];
|
|
16
|
-
references: string[];
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
export declare class PrismaSchemaParser {
|
|
20
|
-
private readonly schemaPath;
|
|
21
|
-
private schemaContent;
|
|
22
|
-
constructor(basePath?: string);
|
|
23
|
-
/**
|
|
24
|
-
* Loads the Prisma schema file content
|
|
25
|
-
*/
|
|
26
|
-
private loadSchema;
|
|
27
|
-
/**
|
|
28
|
-
* Gets the raw schema content
|
|
29
|
-
*/
|
|
30
|
-
getSchemaContent(): string;
|
|
31
|
-
/**
|
|
32
|
-
* Checks if a model exists in the Prisma schema
|
|
33
|
-
*/
|
|
34
|
-
hasModel(modelName: string): boolean;
|
|
35
|
-
/**
|
|
36
|
-
* Gets fields from a specific model
|
|
37
|
-
*/
|
|
38
|
-
getModelFields(modelName: string): ParsedField[];
|
|
39
|
-
/**
|
|
40
|
-
* Parses field strings into structured field objects
|
|
41
|
-
*/
|
|
42
|
-
private parseFields;
|
|
43
|
-
/**
|
|
44
|
-
* Parses a single field line into a structured field object
|
|
45
|
-
*/
|
|
46
|
-
private parseFieldLine;
|
|
47
|
-
/**
|
|
48
|
-
* Parses a relation decorator into a structured object
|
|
49
|
-
*/
|
|
50
|
-
private parseRelation;
|
|
51
|
-
/**
|
|
52
|
-
* Decodes HTML entities in a string
|
|
53
|
-
*/
|
|
54
|
-
private decodeHtmlEntities;
|
|
55
|
-
/**
|
|
56
|
-
* Converts Prisma types to Zod types
|
|
57
|
-
*/
|
|
58
|
-
private getZodType;
|
|
59
|
-
}
|
|
60
|
-
export {};
|
|
@@ -1,255 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PrismaSchemaParser = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
6
|
-
const path_1 = tslib_1.__importDefault(require("path"));
|
|
7
|
-
class PrismaSchemaParser {
|
|
8
|
-
constructor(basePath = process.cwd()) {
|
|
9
|
-
this.schemaContent = '';
|
|
10
|
-
this.schemaPath = path_1.default.join(basePath, 'prisma/schema.prisma');
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Loads the Prisma schema file content
|
|
14
|
-
*/
|
|
15
|
-
loadSchema() {
|
|
16
|
-
if (!fs_1.default.existsSync(this.schemaPath)) {
|
|
17
|
-
throw new Error('Prisma schema file not found');
|
|
18
|
-
}
|
|
19
|
-
this.schemaContent = fs_1.default.readFileSync(this.schemaPath, 'utf-8');
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Gets the raw schema content
|
|
23
|
-
*/
|
|
24
|
-
getSchemaContent() {
|
|
25
|
-
this.loadSchema();
|
|
26
|
-
return this.schemaContent;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Checks if a model exists in the Prisma schema
|
|
30
|
-
*/
|
|
31
|
-
hasModel(modelName) {
|
|
32
|
-
this.loadSchema();
|
|
33
|
-
const modelRegex = new RegExp(`model\\s+${modelName}\\s*{`, 'i');
|
|
34
|
-
return modelRegex.test(this.schemaContent);
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Gets fields from a specific model
|
|
38
|
-
*/
|
|
39
|
-
getModelFields(modelName) {
|
|
40
|
-
this.loadSchema();
|
|
41
|
-
if (!this.hasModel(modelName)) {
|
|
42
|
-
return [];
|
|
43
|
-
}
|
|
44
|
-
const modelRegex = new RegExp(`model\\s+${modelName}\\s*{([^}]*)}`, 'i');
|
|
45
|
-
const modelMatch = this.schemaContent.match(modelRegex);
|
|
46
|
-
if (!modelMatch || !modelMatch[1]) {
|
|
47
|
-
return [];
|
|
48
|
-
}
|
|
49
|
-
const fieldsContent = modelMatch[1].trim();
|
|
50
|
-
const fields = this.parseFields(fieldsContent);
|
|
51
|
-
// Transform parsed fields to include relationship info
|
|
52
|
-
return fields.map(field => ({
|
|
53
|
-
...field,
|
|
54
|
-
isRelation: !!field.relations || this.schemaContent.includes(`model ${field.type} {`),
|
|
55
|
-
isList: field.isList || (field.relations?.type === 'one-to-many' || field.relations?.type === 'many-to-many'),
|
|
56
|
-
isOptional: field.hasDefault || field.isOptional
|
|
57
|
-
}));
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Parses field strings into structured field objects
|
|
61
|
-
*/
|
|
62
|
-
parseFields(fieldsContent) {
|
|
63
|
-
this.loadSchema();
|
|
64
|
-
const fieldLines = fieldsContent.split('\n');
|
|
65
|
-
const fields = [];
|
|
66
|
-
for (const line of fieldLines) {
|
|
67
|
-
const trimmedLine = line.trim();
|
|
68
|
-
if (!trimmedLine || trimmedLine.startsWith('@@'))
|
|
69
|
-
continue;
|
|
70
|
-
const field = this.parseFieldLine(trimmedLine);
|
|
71
|
-
if (field) {
|
|
72
|
-
console.log(field);
|
|
73
|
-
fields.push(field);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
return fields;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Parses a single field line into a structured field object
|
|
80
|
-
*/
|
|
81
|
-
parseFieldLine(line) {
|
|
82
|
-
this.loadSchema();
|
|
83
|
-
// Basic field pattern: name type modifiers
|
|
84
|
-
const fieldPattern = /^(\w+)\s+(\w+)(?:\?|\[\])?\s*(@[^\n]+)?$/;
|
|
85
|
-
const match = line.match(fieldPattern);
|
|
86
|
-
if (!match)
|
|
87
|
-
return null;
|
|
88
|
-
const [, name, type] = match;
|
|
89
|
-
const modifiers = line.slice(match[0].length).trim();
|
|
90
|
-
const isOptional = line.includes('?');
|
|
91
|
-
const isList = line.includes('[]');
|
|
92
|
-
const hasDefault = line.includes('@default');
|
|
93
|
-
// Check if type is a model (potential relation)
|
|
94
|
-
const isModelType = this.schemaContent.includes(`model ${type} {`);
|
|
95
|
-
// Parse relations
|
|
96
|
-
let relations = undefined;
|
|
97
|
-
let isRelation = false;
|
|
98
|
-
if (line.includes('@relation') || isModelType) {
|
|
99
|
-
const relationMatch = line.match(/@relation\([^)]*\)/);
|
|
100
|
-
if (relationMatch) {
|
|
101
|
-
relations = this.parseRelation(relationMatch[0], isList);
|
|
102
|
-
isRelation = true;
|
|
103
|
-
}
|
|
104
|
-
else if (isModelType) {
|
|
105
|
-
// If it's a model type but doesn't have @relation, create a default relation
|
|
106
|
-
relations = {
|
|
107
|
-
type: isList ? 'one-to-many' : 'one-to-one',
|
|
108
|
-
model: type,
|
|
109
|
-
fields: [name + 'Id'],
|
|
110
|
-
references: ['id']
|
|
111
|
-
};
|
|
112
|
-
isRelation = true;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
// Verifica se é um enum
|
|
116
|
-
const isEnum = this.schemaContent.includes(`enum ${type} {`);
|
|
117
|
-
return {
|
|
118
|
-
name,
|
|
119
|
-
type,
|
|
120
|
-
zodType: this.getZodType(type, isOptional || hasDefault, isList),
|
|
121
|
-
description: `${name} field`,
|
|
122
|
-
isOptional: isOptional || hasDefault,
|
|
123
|
-
isList,
|
|
124
|
-
hasDefault,
|
|
125
|
-
isEnum,
|
|
126
|
-
relations,
|
|
127
|
-
isRelation
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Parses a relation decorator into a structured object
|
|
132
|
-
*/
|
|
133
|
-
parseRelation(relationString, isList) {
|
|
134
|
-
try {
|
|
135
|
-
// Extract details from @relation(...) string
|
|
136
|
-
const relationDetails = relationString.match(/@relation\(([^)]+)\)/)?.[1].trim();
|
|
137
|
-
if (!relationDetails)
|
|
138
|
-
return undefined;
|
|
139
|
-
// Extract fields and references from the relation
|
|
140
|
-
const fieldsMatch = relationDetails.match(/fields:\s*\[\s*([^\]]+)\s*\]/);
|
|
141
|
-
const referencesMatch = relationDetails.match(/references:\s*\[\s*([^\]]+)\s*\]/);
|
|
142
|
-
if (fieldsMatch && referencesMatch) {
|
|
143
|
-
// Get fields and references
|
|
144
|
-
const fields = fieldsMatch[1].split(',').map(f => f.trim().replace(/['"]/g, ''));
|
|
145
|
-
const references = referencesMatch[1].split(',').map(r => r.trim().replace(/['"]/g, ''));
|
|
146
|
-
// Try to find referenced model from the context
|
|
147
|
-
let model = '';
|
|
148
|
-
// Check if there's an explicit model name attribute
|
|
149
|
-
const modelMatch = relationDetails.match(/name:\s*['"]?(\w+)['"]?/);
|
|
150
|
-
if (modelMatch) {
|
|
151
|
-
model = modelMatch[1];
|
|
152
|
-
}
|
|
153
|
-
else {
|
|
154
|
-
// Infer model from schema by looking at field references
|
|
155
|
-
// This is a simplification - in a real implementation you might need to look at
|
|
156
|
-
// the other side of the relation in the schema
|
|
157
|
-
const referenceField = references[0].replace(/['"]/g, '');
|
|
158
|
-
if (referenceField === 'id') {
|
|
159
|
-
// Try to find "@relation(fields: [categoryId], references: [id])"
|
|
160
|
-
// Where categoryId indicates a Category model
|
|
161
|
-
const possibleModelField = fields[0];
|
|
162
|
-
if (possibleModelField && possibleModelField.toLowerCase().endsWith('id')) {
|
|
163
|
-
// Extract model name by removing the 'Id' suffix
|
|
164
|
-
model = possibleModelField.substring(0, possibleModelField.length - 2);
|
|
165
|
-
// Convert first letter to uppercase for proper model name format
|
|
166
|
-
model = model.charAt(0).toUpperCase() + model.slice(1);
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
// Determine relation type based on list status and fields/references count
|
|
171
|
-
let relationType;
|
|
172
|
-
if (fields.length > 1 || references.length > 1) {
|
|
173
|
-
relationType = 'many-to-many';
|
|
174
|
-
}
|
|
175
|
-
else if (isList) {
|
|
176
|
-
relationType = 'one-to-many';
|
|
177
|
-
}
|
|
178
|
-
else {
|
|
179
|
-
relationType = 'one-to-one';
|
|
180
|
-
}
|
|
181
|
-
return {
|
|
182
|
-
type: relationType,
|
|
183
|
-
model,
|
|
184
|
-
fields,
|
|
185
|
-
references
|
|
186
|
-
};
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
catch (error) {
|
|
190
|
-
console.log(`Error parsing relation: ${error}`);
|
|
191
|
-
}
|
|
192
|
-
return undefined;
|
|
193
|
-
}
|
|
194
|
-
/**
|
|
195
|
-
* Decodes HTML entities in a string
|
|
196
|
-
*/
|
|
197
|
-
decodeHtmlEntities(text) {
|
|
198
|
-
return text
|
|
199
|
-
.replace(/&/g, '&')
|
|
200
|
-
.replace(/</g, '<')
|
|
201
|
-
.replace(/>/g, '>')
|
|
202
|
-
.replace(/"/g, '"')
|
|
203
|
-
.replace(/'/g, "'")
|
|
204
|
-
.replace(/`/g, '`');
|
|
205
|
-
}
|
|
206
|
-
/**
|
|
207
|
-
* Converts Prisma types to Zod types
|
|
208
|
-
*/
|
|
209
|
-
getZodType(type, isOptional = false, isList = false) {
|
|
210
|
-
this.loadSchema();
|
|
211
|
-
// Verifica se é um enum primeiro
|
|
212
|
-
const enumMatch = this.schemaContent.match(new RegExp(`enum\\s+${type}\\s*{([^}]*)}`, 'i'));
|
|
213
|
-
if (enumMatch) {
|
|
214
|
-
const enumValues = enumMatch[1]
|
|
215
|
-
.trim()
|
|
216
|
-
.split('\n')
|
|
217
|
-
.map(v => v.trim())
|
|
218
|
-
.filter(Boolean)
|
|
219
|
-
.map(v => this.decodeHtmlEntities(v)) // Decodifica HTML entities
|
|
220
|
-
.map(v => v.replace(/['"]/g, '').trim());
|
|
221
|
-
return `z.enum([${enumValues.map(v => `'${v}'`).join(', ')}])`;
|
|
222
|
-
}
|
|
223
|
-
const uuidMatch = this.schemaContent.match(/@default\(uuid\((\d+)?\)\)/);
|
|
224
|
-
const uuidVersion = uuidMatch ? (uuidMatch[1] || '4') : null;
|
|
225
|
-
const typeMap = {
|
|
226
|
-
'String': 'z.string()',
|
|
227
|
-
'Int': 'z.number().int()',
|
|
228
|
-
'Float': 'z.number()',
|
|
229
|
-
'Boolean': 'z.boolean()',
|
|
230
|
-
'DateTime': 'z.date()',
|
|
231
|
-
'Json': 'z.any()',
|
|
232
|
-
'BigInt': 'z.bigint()',
|
|
233
|
-
'Decimal': 'z.number()',
|
|
234
|
-
'Bytes': 'z.instanceof(Buffer)',
|
|
235
|
-
'UUID': `z.string().uuid(${uuidVersion ? `{ version: ${uuidVersion} }` : ''})`,
|
|
236
|
-
};
|
|
237
|
-
// Handle relationships
|
|
238
|
-
if (!typeMap[type]) {
|
|
239
|
-
if (isList) {
|
|
240
|
-
return 'z.array(z.string().min(1))';
|
|
241
|
-
}
|
|
242
|
-
return 'z.string().min(1)';
|
|
243
|
-
}
|
|
244
|
-
let zodType = typeMap[type] || 'z.any()';
|
|
245
|
-
if (isList) {
|
|
246
|
-
zodType = `z.array(${zodType})`;
|
|
247
|
-
}
|
|
248
|
-
if (isOptional) {
|
|
249
|
-
zodType = `${zodType}.optional().nullable()`;
|
|
250
|
-
}
|
|
251
|
-
return zodType;
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
exports.PrismaSchemaParser = PrismaSchemaParser;
|
|
255
|
-
//# sourceMappingURL=prisma-schema-parser.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prisma-schema-parser.js","sourceRoot":"","sources":["../../src/utils/prisma-schema-parser.ts"],"names":[],"mappings":";;;;AAAA,oDAAmB;AACnB,wDAAuB;AAqBvB,MAAa,kBAAkB;IAI7B,YAAY,WAAmB,OAAO,CAAC,GAAG,EAAE;QAFpC,kBAAa,GAAW,EAAE,CAAA;QAGhC,IAAI,CAAC,UAAU,GAAG,cAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,sBAAsB,CAAC,CAAA;IAC/D,CAAC;IAED;;OAEG;IACK,UAAU;QAChB,IAAI,CAAC,YAAE,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;YACpC,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAA;QACjD,CAAC;QACD,IAAI,CAAC,aAAa,GAAG,YAAE,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;IAChE,CAAC;IAED;;OAEG;IACI,gBAAgB;QACrB,IAAI,CAAC,UAAU,EAAE,CAAA;QACjB,OAAO,IAAI,CAAC,aAAa,CAAA;IAC3B,CAAC;IAED;;OAEG;IACI,QAAQ,CAAC,SAAiB;QAC/B,IAAI,CAAC,UAAU,EAAE,CAAA;QACjB,MAAM,UAAU,GAAG,IAAI,MAAM,CAAC,YAAY,SAA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EAAE,kBAAkB;YACzB,OAAO,EAAE,YAAY;YACrB,SAAS,EAAE,aAAa;YACxB,UAAU,EAAE,UAAU;YACtB,MAAM,EAAE,SAAS;YACjB,QAAQ,EAAE,YAAY;YACtB,SAAS,EAAE,YAAY;YACvB,OAAO,EAAE,sBAAsB;YAC/B,MAAM,EAAE,mBAAmB,WAAW,CAAC,CAAC,CAAC,cAAc,WAAW,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG;SAC/E,CAAA;QAED,uBAAuB;QACvB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;YACnB,IAAI,MAAM,EAAE,CAAC;gBACX,OAAO,4BAA4B,CAAA;YACrC,CAAC;YAED,OAAO,mBAAmB,CAAA;QAC5B,CAAC;QAED,IAAI,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,SAAS,CAAA;QAExC,IAAI,MAAM,EAAE,CAAC;YACX,OAAO,GAAG,WAAW,OAAO,GAAG,CAAA;QACjC,CAAC;QAED,IAAI,UAAU,EAAE,CAAC;YACf,OAAO,GAAG,GAAG,OAAO,wBAAwB,CAAA;QAC9C,CAAC;QAED,OAAO,OAAO,CAAA;IAChB,CAAC;CACF;AAzRD,gDAyRC"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Verifica se o projeto atual é um projeto Next.js
|
|
3
|
-
* @returns {boolean} true se for um projeto Next.js, false caso contrário
|
|
4
|
-
*/
|
|
5
|
-
export declare function isNextJSProject(projectPath?: string): boolean;
|
|
6
|
-
/**
|
|
7
|
-
* Verifica se o projeto possui uma pasta src
|
|
8
|
-
* @returns {boolean} true se a pasta src existir, false caso contrário
|
|
9
|
-
*/
|
|
10
|
-
export declare function hasSrcFolder(projectPath?: string): boolean;
|
|
11
|
-
/**
|
|
12
|
-
* Retorna o caminho base para o código da aplicação (src/ ou raiz)
|
|
13
|
-
* @returns {string} O caminho base do código
|
|
14
|
-
*/
|
|
15
|
-
export declare function getProjectBasePath(projectPath?: string): string;
|
|
16
|
-
/**
|
|
17
|
-
* Retorna o caminho correto para a API do Next.js (com ou sem pasta src)
|
|
18
|
-
* @returns {string} O caminho para a pasta de API
|
|
19
|
-
*/
|
|
20
|
-
export declare function getNextApiPath(projectPath?: string): string;
|
|
21
|
-
/**
|
|
22
|
-
* Supported package managers
|
|
23
|
-
*/
|
|
24
|
-
export type PackageManager = 'npm' | 'yarn' | 'pnpm' | 'bun' | 'deno';
|
|
25
|
-
/**
|
|
26
|
-
* Detects the package manager used in the project
|
|
27
|
-
* Priority: packageManager field in package.json > lock files presence
|
|
28
|
-
* @param projectPath Path to the project root
|
|
29
|
-
* @returns The detected package manager or 'npm' as fallback
|
|
30
|
-
*/
|
|
31
|
-
export declare function getPackageManager(projectPath?: string): PackageManager;
|
|
32
|
-
export declare function getPackageManagerRunner(packageManager: 'bun' | 'npm' | 'yarn' | 'pnpm'): string;
|