@igreen/design-system 1.0.5 → 1.0.7
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/package.json +1 -1
- package/postinstall.js +16 -17
package/package.json
CHANGED
package/postinstall.js
CHANGED
|
@@ -17,29 +17,26 @@ const rl = readline.createInterface({
|
|
|
17
17
|
|
|
18
18
|
// Detectar se está sendo instalado em um projeto (não no próprio igreen)
|
|
19
19
|
const isInstallingInProject = () => {
|
|
20
|
-
|
|
20
|
+
// __dirname é o caminho do próprio script
|
|
21
|
+
// Se estiver em node_modules/@igreen/design-system, deve configurar o projeto
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const projectRoot = path.resolve(
|
|
23
|
+
if (__dirname.includes(path.join('node_modules', '@igreen', 'design-system'))) {
|
|
24
|
+
// Projeto raiz está 3 níveis acima
|
|
25
|
+
const projectRoot = path.resolve(__dirname, '..', '..', '..');
|
|
25
26
|
|
|
26
|
-
// Verificar se
|
|
27
|
-
const
|
|
27
|
+
// Verificar se NÃO é o próprio repo igreen
|
|
28
|
+
const isIgreenRepo = fs.existsSync(path.join(projectRoot, 'packages', 'design-system'));
|
|
28
29
|
|
|
29
|
-
//
|
|
30
|
-
return !hasPackagesDir;
|
|
30
|
+
return !isIgreenRepo; // Retorna true se NÃO for o repo igreen
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
return false;
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
const getProjectRoot = () => {
|
|
37
|
-
|
|
38
|
-
//
|
|
39
|
-
|
|
40
|
-
return path.resolve(cwd, '..', '..', '..');
|
|
41
|
-
}
|
|
42
|
-
return cwd;
|
|
37
|
+
// __dirname está em node_modules/@igreen/design-system
|
|
38
|
+
// Projeto raiz está 3 níveis acima
|
|
39
|
+
return path.resolve(__dirname, '..', '..', '..');
|
|
43
40
|
};
|
|
44
41
|
|
|
45
42
|
const question = (query) => new Promise((resolve) => rl.question(query, resolve));
|
|
@@ -49,12 +46,14 @@ async function setupProject() {
|
|
|
49
46
|
|
|
50
47
|
// Verificar se está sendo instalado em um projeto
|
|
51
48
|
if (!isInstallingInProject()) {
|
|
52
|
-
console.log('
|
|
49
|
+
console.log('[DEBUG] __dirname:', __dirname);
|
|
50
|
+
console.log('[DEBUG] Skipping setup (detected as igreen repo or not in node_modules)\n');
|
|
53
51
|
rl.close();
|
|
54
52
|
return;
|
|
55
53
|
}
|
|
56
54
|
|
|
57
55
|
const projectRoot = getProjectRoot();
|
|
56
|
+
console.log('[DEBUG] Project root:', projectRoot);
|
|
58
57
|
|
|
59
58
|
// Verificar se já foi configurado antes
|
|
60
59
|
const igreenConfigPath = path.join(projectRoot, '.igreen-configured');
|
|
@@ -122,7 +121,7 @@ export const metadata: Metadata = {
|
|
|
122
121
|
export default function RootLayout({
|
|
123
122
|
children,
|
|
124
123
|
}: {
|
|
125
|
-
children: React.
|
|
124
|
+
children: React.ReactNode
|
|
126
125
|
}) {
|
|
127
126
|
return (
|
|
128
127
|
<html lang="pt-BR">
|
|
@@ -239,7 +238,7 @@ export default function Home() {
|
|
|
239
238
|
console.log('📚 Documentação: https://github.com/seu-repo/docs');
|
|
240
239
|
console.log('💚 Componentes disponíveis:');
|
|
241
240
|
console.log(' - Button, Input, Label, Checkbox, ExampleCard\n');
|
|
242
|
-
console.log('='.repeat(60) + '
|
|
241
|
+
console.log('='.repeat(60) + '\\n');
|
|
243
242
|
|
|
244
243
|
rl.close();
|
|
245
244
|
}
|