@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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/postinstall.js +16 -17
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@igreen/design-system",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "iGreen Design System - Complete Package with Auto-Setup",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
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
- const cwd = process.cwd();
20
+ // __dirname é o caminho do próprio script
21
+ // Se estiver em node_modules/@igreen/design-system, deve configurar o projeto
21
22
 
22
- // Se estamos dentro de node_modules/@igreen/design-system
23
- if (cwd.includes(path.join('node_modules', '@igreen', 'design-system'))) {
24
- const projectRoot = path.resolve(cwd, '..', '..', '..');
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 o projeto raiz NÃO é o igreen (verificando se tem packages/)
27
- const hasPackagesDir = fs.existsSync(path.join(projectRoot, 'packages', 'design-system'));
27
+ // Verificar se NÃO é o próprio repo igreen
28
+ const isIgreenRepo = fs.existsSync(path.join(projectRoot, 'packages', 'design-system'));
28
29
 
29
- // Se NÃO tem packages/design-system, é um projeto externo
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
- const cwd = process.cwd();
38
- // Voltar 3 níveis: node_modules/@igreen/design-system -> root
39
- if (cwd.includes(path.join('node_modules', '@igreen', 'design-system'))) {
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('ℹ️ Instalação detectada no próprio repositório iGreen, pulando setup automático.\n');
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.Node
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) + '\n');
241
+ console.log('='.repeat(60) + '\\n');
243
242
 
244
243
  rl.close();
245
244
  }