@promptui-lib/codegen 0.1.9 → 0.1.10
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/dist/generators/fonts-generator.d.ts +25 -0
- package/dist/generators/fonts-generator.d.ts.map +1 -0
- package/dist/generators/fonts-generator.js +142 -0
- package/dist/generators/index.d.ts +1 -0
- package/dist/generators/index.d.ts.map +1 -1
- package/dist/generators/index.js +1 -0
- package/dist/generators/variables-generator.d.ts.map +1 -1
- package/dist/generators/variables-generator.js +3 -0
- package/dist/writers/file-writer.d.ts.map +1 -1
- package/dist/writers/file-writer.js +60 -2
- package/package.json +2 -2
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fonts Generator
|
|
3
|
+
* Gera arquivo SCSS com imports de Google Fonts
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Extrai nomes de fontes de um conteúdo SCSS
|
|
7
|
+
*/
|
|
8
|
+
export declare function extractFontsFromSCSS(scssContent: string): string[];
|
|
9
|
+
/**
|
|
10
|
+
* Gera URL do Google Fonts para uma fonte
|
|
11
|
+
*/
|
|
12
|
+
export declare function getGoogleFontUrl(fontName: string): string | null;
|
|
13
|
+
/**
|
|
14
|
+
* Gera conteúdo do arquivo _fonts.scss
|
|
15
|
+
*/
|
|
16
|
+
export declare function generateFontsScss(fonts: string[]): string;
|
|
17
|
+
/**
|
|
18
|
+
* Verifica se uma fonte precisa de import (não é fonte de sistema)
|
|
19
|
+
*/
|
|
20
|
+
export declare function needsFontImport(fontName: string): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Lista de fontes disponíveis no Google Fonts (para referência)
|
|
23
|
+
*/
|
|
24
|
+
export declare function getAvailableFonts(): string[];
|
|
25
|
+
//# sourceMappingURL=fonts-generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fonts-generator.d.ts","sourceRoot":"","sources":["../../src/generators/fonts-generator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAkEH;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,CAsBlE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAiBhE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAwBzD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEzD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,EAAE,CAE5C"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fonts Generator
|
|
3
|
+
* Gera arquivo SCSS com imports de Google Fonts
|
|
4
|
+
*/
|
|
5
|
+
// Mapeamento de fontes conhecidas para URLs do Google Fonts
|
|
6
|
+
const GOOGLE_FONTS_MAP = {
|
|
7
|
+
'Manrope': 'https://fonts.googleapis.com/css2?family=Manrope:wght@200;300;400;500;600;700;800&display=swap',
|
|
8
|
+
'Inter': 'https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap',
|
|
9
|
+
'Roboto': 'https://fonts.googleapis.com/css2?family=Roboto:wght@100;300;400;500;700;900&display=swap',
|
|
10
|
+
'Open Sans': 'https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;500;600;700;800&display=swap',
|
|
11
|
+
'Lato': 'https://fonts.googleapis.com/css2?family=Lato:wght@100;300;400;700;900&display=swap',
|
|
12
|
+
'Poppins': 'https://fonts.googleapis.com/css2?family=Poppins:wght@100;200;300;400;500;600;700;800;900&display=swap',
|
|
13
|
+
'Montserrat': 'https://fonts.googleapis.com/css2?family=Montserrat:wght@100;200;300;400;500;600;700;800;900&display=swap',
|
|
14
|
+
'Source Sans Pro': 'https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@200;300;400;600;700;900&display=swap',
|
|
15
|
+
'Oswald': 'https://fonts.googleapis.com/css2?family=Oswald:wght@200;300;400;500;600;700&display=swap',
|
|
16
|
+
'Raleway': 'https://fonts.googleapis.com/css2?family=Raleway:wght@100;200;300;400;500;600;700;800;900&display=swap',
|
|
17
|
+
'Nunito': 'https://fonts.googleapis.com/css2?family=Nunito:wght@200;300;400;500;600;700;800;900&display=swap',
|
|
18
|
+
'Nunito Sans': 'https://fonts.googleapis.com/css2?family=Nunito+Sans:wght@200;300;400;500;600;700;800;900&display=swap',
|
|
19
|
+
'Work Sans': 'https://fonts.googleapis.com/css2?family=Work+Sans:wght@100;200;300;400;500;600;700;800;900&display=swap',
|
|
20
|
+
'Fira Code': 'https://fonts.googleapis.com/css2?family=Fira+Code:wght@300;400;500;600;700&display=swap',
|
|
21
|
+
'DM Sans': 'https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&display=swap',
|
|
22
|
+
'Playfair Display': 'https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;500;600;700;800;900&display=swap',
|
|
23
|
+
'Ubuntu': 'https://fonts.googleapis.com/css2?family=Ubuntu:wght@300;400;500;700&display=swap',
|
|
24
|
+
'Rubik': 'https://fonts.googleapis.com/css2?family=Rubik:wght@300;400;500;600;700;800;900&display=swap',
|
|
25
|
+
'Quicksand': 'https://fonts.googleapis.com/css2?family=Quicksand:wght@300;400;500;600;700&display=swap',
|
|
26
|
+
'Karla': 'https://fonts.googleapis.com/css2?family=Karla:wght@200;300;400;500;600;700;800&display=swap',
|
|
27
|
+
'Mulish': 'https://fonts.googleapis.com/css2?family=Mulish:wght@200;300;400;500;600;700;800;900&display=swap',
|
|
28
|
+
'Barlow': 'https://fonts.googleapis.com/css2?family=Barlow:wght@100;200;300;400;500;600;700;800;900&display=swap',
|
|
29
|
+
'Josefin Sans': 'https://fonts.googleapis.com/css2?family=Josefin+Sans:wght@100;200;300;400;500;600;700&display=swap',
|
|
30
|
+
'Space Grotesk': 'https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&display=swap',
|
|
31
|
+
'Plus Jakarta Sans': 'https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@200;300;400;500;600;700;800&display=swap',
|
|
32
|
+
'Sora': 'https://fonts.googleapis.com/css2?family=Sora:wght@100;200;300;400;500;600;700;800&display=swap',
|
|
33
|
+
'Lexend': 'https://fonts.googleapis.com/css2?family=Lexend:wght@100;200;300;400;500;600;700;800;900&display=swap',
|
|
34
|
+
'Outfit': 'https://fonts.googleapis.com/css2?family=Outfit:wght@100;200;300;400;500;600;700;800;900&display=swap',
|
|
35
|
+
'Figtree': 'https://fonts.googleapis.com/css2?family=Figtree:wght@300;400;500;600;700;800;900&display=swap',
|
|
36
|
+
'Onest': 'https://fonts.googleapis.com/css2?family=Onest:wght@100;200;300;400;500;600;700;800;900&display=swap',
|
|
37
|
+
'Geist': 'https://fonts.googleapis.com/css2?family=Geist:wght@100;200;300;400;500;600;700;800;900&display=swap',
|
|
38
|
+
};
|
|
39
|
+
// Fontes de sistema (não precisam de import)
|
|
40
|
+
const SYSTEM_FONTS = new Set([
|
|
41
|
+
'Arial',
|
|
42
|
+
'Helvetica',
|
|
43
|
+
'Helvetica Neue',
|
|
44
|
+
'Times New Roman',
|
|
45
|
+
'Times',
|
|
46
|
+
'Georgia',
|
|
47
|
+
'Courier New',
|
|
48
|
+
'Courier',
|
|
49
|
+
'Verdana',
|
|
50
|
+
'Tahoma',
|
|
51
|
+
'Trebuchet MS',
|
|
52
|
+
'Impact',
|
|
53
|
+
'Comic Sans MS',
|
|
54
|
+
'sans-serif',
|
|
55
|
+
'serif',
|
|
56
|
+
'monospace',
|
|
57
|
+
'cursive',
|
|
58
|
+
'fantasy',
|
|
59
|
+
'-apple-system',
|
|
60
|
+
'BlinkMacSystemFont',
|
|
61
|
+
'Segoe UI',
|
|
62
|
+
'system-ui',
|
|
63
|
+
'SF Pro',
|
|
64
|
+
'SF Pro Display',
|
|
65
|
+
'SF Pro Text',
|
|
66
|
+
]);
|
|
67
|
+
/**
|
|
68
|
+
* Extrai nomes de fontes de um conteúdo SCSS
|
|
69
|
+
*/
|
|
70
|
+
export function extractFontsFromSCSS(scssContent) {
|
|
71
|
+
const fonts = new Set();
|
|
72
|
+
// Regex para encontrar font-family: "FontName" ou font-family: FontName
|
|
73
|
+
const fontFamilyRegex = /font-family:\s*["']?([^"';,]+)["']?/gi;
|
|
74
|
+
let match;
|
|
75
|
+
while ((match = fontFamilyRegex.exec(scssContent)) !== null) {
|
|
76
|
+
const fontName = match[1].trim();
|
|
77
|
+
// Ignora variáveis SCSS ($font-family-xxx)
|
|
78
|
+
if (fontName.startsWith('$')) {
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
// Ignora fontes de sistema
|
|
82
|
+
if (!SYSTEM_FONTS.has(fontName)) {
|
|
83
|
+
fonts.add(fontName);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return Array.from(fonts);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Gera URL do Google Fonts para uma fonte
|
|
90
|
+
*/
|
|
91
|
+
export function getGoogleFontUrl(fontName) {
|
|
92
|
+
// Procura match exato
|
|
93
|
+
if (GOOGLE_FONTS_MAP[fontName]) {
|
|
94
|
+
return GOOGLE_FONTS_MAP[fontName];
|
|
95
|
+
}
|
|
96
|
+
// Procura match case-insensitive
|
|
97
|
+
const lowerFontName = fontName.toLowerCase();
|
|
98
|
+
for (const [name, url] of Object.entries(GOOGLE_FONTS_MAP)) {
|
|
99
|
+
if (name.toLowerCase() === lowerFontName) {
|
|
100
|
+
return url;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
// Gera URL dinamicamente (pode não funcionar para todas as fontes)
|
|
104
|
+
const encodedName = fontName.replace(/\s+/g, '+');
|
|
105
|
+
return `https://fonts.googleapis.com/css2?family=${encodedName}:wght@300;400;500;600;700&display=swap`;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Gera conteúdo do arquivo _fonts.scss
|
|
109
|
+
*/
|
|
110
|
+
export function generateFontsScss(fonts) {
|
|
111
|
+
if (fonts.length === 0) {
|
|
112
|
+
return `// PromptUI - Font Imports
|
|
113
|
+
// Auto-generated by PromptUI CLI
|
|
114
|
+
// No custom fonts detected
|
|
115
|
+
`;
|
|
116
|
+
}
|
|
117
|
+
const lines = [
|
|
118
|
+
'// PromptUI - Font Imports',
|
|
119
|
+
'// Auto-generated by PromptUI CLI',
|
|
120
|
+
'',
|
|
121
|
+
];
|
|
122
|
+
for (const font of fonts) {
|
|
123
|
+
const url = getGoogleFontUrl(font);
|
|
124
|
+
if (url) {
|
|
125
|
+
lines.push(`@import url('${url}');`);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
lines.push('');
|
|
129
|
+
return lines.join('\n');
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Verifica se uma fonte precisa de import (não é fonte de sistema)
|
|
133
|
+
*/
|
|
134
|
+
export function needsFontImport(fontName) {
|
|
135
|
+
return !SYSTEM_FONTS.has(fontName);
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Lista de fontes disponíveis no Google Fonts (para referência)
|
|
139
|
+
*/
|
|
140
|
+
export function getAvailableFonts() {
|
|
141
|
+
return Object.keys(GOOGLE_FONTS_MAP);
|
|
142
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { generateTSX, generateIndex } from './tsx-generator.js';
|
|
2
2
|
export { generateSCSS, generateFlatSCSS } from './scss-generator.js';
|
|
3
3
|
export { generateDefaultVariables } from './variables-generator.js';
|
|
4
|
+
export { generateFontsScss, extractFontsFromSCSS, getGoogleFontUrl, needsFontImport, getAvailableFonts, } from './fonts-generator.js';
|
|
4
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/generators/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/generators/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,EACf,iBAAiB,GAClB,MAAM,sBAAsB,CAAC"}
|
package/dist/generators/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { generateTSX, generateIndex } from './tsx-generator.js';
|
|
2
2
|
export { generateSCSS, generateFlatSCSS } from './scss-generator.js';
|
|
3
3
|
export { generateDefaultVariables } from './variables-generator.js';
|
|
4
|
+
export { generateFontsScss, extractFontsFromSCSS, getGoogleFontUrl, needsFontImport, getAvailableFonts, } from './fonts-generator.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"variables-generator.d.ts","sourceRoot":"","sources":["../../src/generators/variables-generator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,wBAAgB,wBAAwB,IAAI,MAAM,
|
|
1
|
+
{"version":3,"file":"variables-generator.d.ts","sourceRoot":"","sources":["../../src/generators/variables-generator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,wBAAgB,wBAAwB,IAAI,MAAM,CA0IjD"}
|
|
@@ -10,6 +10,9 @@ export function generateDefaultVariables() {
|
|
|
10
10
|
// Auto-generated by PromptUI CLI
|
|
11
11
|
// Run 'promptui sync tokens' to update from Figma
|
|
12
12
|
|
|
13
|
+
// Import fonts (if _fonts.scss exists)
|
|
14
|
+
@import 'fonts';
|
|
15
|
+
|
|
13
16
|
// =============================================================================
|
|
14
17
|
// COLORS
|
|
15
18
|
// =============================================================================
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-writer.d.ts","sourceRoot":"","sources":["../../src/writers/file-writer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"file-writer.d.ts","sourceRoot":"","sources":["../../src/writers/file-writer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAMxF,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE;QACL,GAAG,EAAE,MAAM,CAAC;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAqBD;;GAEG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,aAAa,GAAG,cAAc,CAM/D;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,cAAc,EACrB,QAAQ,EAAE,MAAM,GACf,MAAM,CAER;AAyFD;;GAEG;AACH,wBAAsB,cAAc,CAClC,GAAG,EAAE,aAAa,EAClB,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,YAAY,CAAC,CA+DvB;AAED;;GAEG;AACH,wBAAsB,eAAe,CACnC,IAAI,EAAE,aAAa,EAAE,EACrB,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,YAAY,EAAE,CAAC,CASzB"}
|
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
* File Writer
|
|
3
3
|
* Escreve arquivos gerados no sistema de arquivos
|
|
4
4
|
*/
|
|
5
|
-
import { mkdir, writeFile, access } from 'node:fs/promises';
|
|
5
|
+
import { mkdir, writeFile, access, readFile } from 'node:fs/promises';
|
|
6
6
|
import { join, dirname } from 'node:path';
|
|
7
7
|
import { generateTSX, generateIndex } from '../generators/tsx-generator.js';
|
|
8
8
|
import { generateSCSS } from '../generators/scss-generator.js';
|
|
9
9
|
import { generateDefaultVariables } from '../generators/variables-generator.js';
|
|
10
|
+
import { extractFontsFromSCSS, generateFontsScss } from '../generators/fonts-generator.js';
|
|
10
11
|
/**
|
|
11
12
|
* Verifica se um arquivo existe
|
|
12
13
|
*/
|
|
@@ -53,7 +54,22 @@ async function ensureVariablesFile(basePath) {
|
|
|
53
54
|
// Verifica se já existe
|
|
54
55
|
const exists = await fileExists(variablesPath);
|
|
55
56
|
if (exists) {
|
|
56
|
-
|
|
57
|
+
// Verifica se tem o import de fonts
|
|
58
|
+
try {
|
|
59
|
+
const content = await readFile(variablesPath, 'utf-8');
|
|
60
|
+
if (!content.includes("@import 'fonts'") && !content.includes('@import "fonts"')) {
|
|
61
|
+
// Adiciona o import de fonts no início
|
|
62
|
+
const updatedContent = content.replace(/(\/\/ PromptUI - Design Tokens.*?\n)/s, "$1\n// Import fonts\n@import 'fonts';\n");
|
|
63
|
+
if (updatedContent !== content) {
|
|
64
|
+
await writeFile(variablesPath, updatedContent, 'utf-8');
|
|
65
|
+
return variablesPath; // Foi atualizado
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
// Ignora erros de leitura
|
|
71
|
+
}
|
|
72
|
+
return null; // Já existe e está ok
|
|
57
73
|
}
|
|
58
74
|
try {
|
|
59
75
|
await ensureDir(stylesDir);
|
|
@@ -64,6 +80,43 @@ async function ensureVariablesFile(basePath) {
|
|
|
64
80
|
return null;
|
|
65
81
|
}
|
|
66
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* Atualiza ou cria o arquivo de fontes baseado no SCSS gerado
|
|
85
|
+
*/
|
|
86
|
+
async function ensureFontsFile(basePath, scssContent) {
|
|
87
|
+
const parentDir = dirname(basePath);
|
|
88
|
+
const stylesDir = join(parentDir, 'styles');
|
|
89
|
+
const fontsPath = join(stylesDir, '_fonts.scss');
|
|
90
|
+
try {
|
|
91
|
+
// Extrai fontes do SCSS gerado
|
|
92
|
+
const newFonts = extractFontsFromSCSS(scssContent);
|
|
93
|
+
if (newFonts.length === 0) {
|
|
94
|
+
return null; // Sem fontes customizadas
|
|
95
|
+
}
|
|
96
|
+
// Lê fontes existentes (se houver)
|
|
97
|
+
let existingFonts = [];
|
|
98
|
+
const exists = await fileExists(fontsPath);
|
|
99
|
+
if (exists) {
|
|
100
|
+
const existingContent = await readFile(fontsPath, 'utf-8');
|
|
101
|
+
existingFonts = extractFontsFromSCSS(existingContent);
|
|
102
|
+
}
|
|
103
|
+
// Combina fontes existentes com novas (sem duplicatas)
|
|
104
|
+
const allFonts = [...new Set([...existingFonts, ...newFonts])];
|
|
105
|
+
// Gera novo conteúdo
|
|
106
|
+
const fontsContent = generateFontsScss(allFonts);
|
|
107
|
+
await ensureDir(stylesDir);
|
|
108
|
+
await writeFile(fontsPath, fontsContent, 'utf-8');
|
|
109
|
+
// Retorna path apenas se adicionou novas fontes
|
|
110
|
+
const addedFonts = newFonts.filter((f) => !existingFonts.includes(f));
|
|
111
|
+
if (addedFonts.length > 0) {
|
|
112
|
+
return fontsPath;
|
|
113
|
+
}
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
catch {
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
67
120
|
/**
|
|
68
121
|
* Escreve os arquivos do componente
|
|
69
122
|
*/
|
|
@@ -93,6 +146,11 @@ export async function writeComponent(ast, options) {
|
|
|
93
146
|
if (variablesCreated) {
|
|
94
147
|
console.log(` 📁 Created: ${variablesCreated}`);
|
|
95
148
|
}
|
|
149
|
+
// Garante que o arquivo de fontes existe (com as fontes do componente)
|
|
150
|
+
const fontsCreated = await ensureFontsFile(options.basePath, code.scss);
|
|
151
|
+
if (fontsCreated) {
|
|
152
|
+
console.log(` 🔤 Created/Updated: ${fontsCreated}`);
|
|
153
|
+
}
|
|
96
154
|
// Cria diretório
|
|
97
155
|
await ensureDir(componentDir);
|
|
98
156
|
// Escreve arquivos
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptui-lib/codegen",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Code generator for PromptUI - generates React TSX and SCSS",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"dist"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@promptui-lib/core": "0.1.
|
|
33
|
+
"@promptui-lib/core": "0.1.10"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/node": "^20.0.0",
|