@liguelead/design-system 0.0.6 → 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 +3 -2
- package/scripts/createTypes.js +32 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@liguelead/design-system",
|
|
3
|
-
"version": "0.0.
|
|
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
|
}
|
package/scripts/createTypes.js
CHANGED
|
@@ -4,13 +4,40 @@ import fs from 'fs'
|
|
|
4
4
|
import path from 'path'
|
|
5
5
|
|
|
6
6
|
// Diretório e arquivos que queremos criar
|
|
7
|
+
const dir = path.resolve(process.cwd(), './')
|
|
7
8
|
const srcDir = path.resolve(process.cwd(), 'src')
|
|
8
9
|
const typesDir = path.join(srcDir, 'types')
|
|
9
10
|
const indexFile = path.join(typesDir, 'index.ts')
|
|
10
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')
|
|
11
14
|
|
|
12
15
|
// Função para criar pasta e arquivos
|
|
13
16
|
const createOrUpdateTypes = () => {
|
|
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.'
|
|
@@ -26,13 +53,16 @@ const createOrUpdateTypes = () => {
|
|
|
26
53
|
}
|
|
27
54
|
|
|
28
55
|
if (!fs.existsSync(indexFile)) {
|
|
29
|
-
|
|
56
|
+
const indexFileContent = `export type {colorType} from './types'`
|
|
57
|
+
fs.writeFileSync(indexFile, indexFileContent, 'utf8')
|
|
30
58
|
console.log(`Arquivo criado: ${indexFile}`)
|
|
31
59
|
} else {
|
|
32
60
|
console.log(`O arquivo já existe e não será modificado: ${indexFile}`)
|
|
33
61
|
}
|
|
62
|
+
const typesFileContent = `import {DefaultTheme} from 'styled-components'
|
|
63
|
+
export type colorType = keyof DefaultTheme['colors']`
|
|
34
64
|
|
|
35
|
-
fs.writeFileSync(typesFile,
|
|
65
|
+
fs.writeFileSync(typesFile, typesFileContent, 'utf8')
|
|
36
66
|
console.log(`Arquivo sobrescrito: ${typesFile}`)
|
|
37
67
|
}
|
|
38
68
|
|