@liguelead/design-system 0.0.5 → 0.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liguelead/design-system",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "type": "module",
5
5
  "main": "components/index.ts",
6
6
  "publishConfig": {
@@ -31,6 +31,7 @@
31
31
  "react": "^18.3.1",
32
32
  "styled-components": "6.1.13",
33
33
  "typescript": "5.6.2",
34
- "typescript-eslint": "^8.11.0"
34
+ "typescript-eslint": "^8.11.0",
35
+ "vite-tsconfig-paths": "^5.1.3"
35
36
  }
36
37
  }
@@ -1,16 +1,43 @@
1
1
  #!/usr/bin/env node
2
- const fs = require('fs')
3
- const path = require('path')
2
+
3
+ import fs from 'fs'
4
+ import path from 'path'
4
5
 
5
6
  // Diretório e arquivos que queremos criar
7
+ const dir = path.resolve(process.cwd(), './')
6
8
  const srcDir = path.resolve(process.cwd(), 'src')
7
9
  const typesDir = path.join(srcDir, 'types')
8
10
  const indexFile = path.join(typesDir, 'index.ts')
9
11
  const typesFile = path.join(typesDir, 'types.ts')
12
+ const tsconfigApp = path.join(dir, 'tsconfig.json')
13
+ const viteConfig = path.join(dir, 'vite.config.ts')
10
14
 
11
15
  // Função para criar pasta e arquivos
12
16
  const createOrUpdateTypes = () => {
13
- // Verifica se a pasta src existe
17
+ const viteConfigContent = `
18
+ // vite.config.ts
19
+ import { defineConfig } from 'vite';
20
+ import react from '@vitejs/plugin-react';
21
+ import tsconfigPaths from 'vite-tsconfig-paths';
22
+
23
+ export default defineConfig({
24
+ plugins: [react(), tsconfigPaths()],
25
+ });
26
+ `
27
+
28
+ const tsconfigAppContent = `{
29
+ "compilerOptions": {
30
+ // Configurações de compilação base
31
+ "baseUrl": "./src"
32
+ }
33
+ }
34
+ `
35
+ fs.writeFileSync(tsconfigApp, tsconfigAppContent, 'utf8')
36
+ console.log(`Arquivo sobrescrito: ${tsconfigApp}`)
37
+
38
+ fs.writeFileSync(viteConfig, viteConfigContent, 'utf8')
39
+ console.log(`Arquivo sobrescrito: ${viteConfig}`)
40
+
14
41
  if (!fs.existsSync(srcDir)) {
15
42
  console.error(
16
43
  'A pasta "src" não foi encontrada. Certifique-se de que ela existe.'
@@ -18,7 +45,6 @@ const createOrUpdateTypes = () => {
18
45
  process.exit(1)
19
46
  }
20
47
 
21
- // Cria a pasta types se não existir
22
48
  if (!fs.existsSync(typesDir)) {
23
49
  fs.mkdirSync(typesDir, { recursive: true })
24
50
  console.log(`Pasta criada: ${typesDir}`)
@@ -26,16 +52,17 @@ const createOrUpdateTypes = () => {
26
52
  console.log(`A pasta já existe: ${typesDir}`)
27
53
  }
28
54
 
29
- // Verifica se o arquivo index.ts existe e cria se necessário
30
55
  if (!fs.existsSync(indexFile)) {
31
- fs.writeFileSync(indexFile, '// Arquivo de exportação\n', 'utf8')
56
+ const indexFileContent = `export type {colorType} from './types'`
57
+ fs.writeFileSync(indexFile, indexFileContent, 'utf8')
32
58
  console.log(`Arquivo criado: ${indexFile}`)
33
59
  } else {
34
60
  console.log(`O arquivo já existe e não será modificado: ${indexFile}`)
35
61
  }
62
+ const typesFileContent = `import {DefaultTheme} from 'styled-components'
63
+ export type colorType = keyof DefaultTheme['colors']`
36
64
 
37
- // Sobrescreve o arquivo types.ts com novo conteúdo
38
- fs.writeFileSync(typesFile, '// Definições de tipos atualizadas\n', 'utf8')
65
+ fs.writeFileSync(typesFile, typesFileContent, 'utf8')
39
66
  console.log(`Arquivo sobrescrito: ${typesFile}`)
40
67
  }
41
68