@yberagroup/kaizen-ui 0.0.3 → 0.0.4

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/README.md CHANGED
@@ -23,6 +23,7 @@ npx @yberagroup/kaizen-ui init
23
23
  O comando cria/atualiza:
24
24
  - `tailwind.config.cjs` com preset Kaizen
25
25
  - `postcss.config.cjs` com Tailwind + Autoprefixer
26
+ - se existirem `tailwind.config.js`, `tailwind.config.mjs`, `postcss.config.js` ou `postcss.config.mjs` (ex.: template Vite), eles sao **removidos** para nao competir com os `.cjs`
26
27
  - import do tema no arquivo de entrada (`src/main.tsx`, `src/index.tsx`, `app/layout.tsx`, etc.) **ou**, no modo migracao, no seu CSS global
27
28
 
28
29
  Temas suportados no wizard:
@@ -47,12 +48,25 @@ Com **varios** candidatos e **nenhum** importado pelo entry, o wizard lista os a
47
48
 
48
49
  ## Configuracao Tailwind (consumidor)
49
50
 
51
+ O Tailwind so gera classes que aparecem nos arquivos listados em `content`. As classes dos componentes (`text-kz-*`, `font-kz-*`, `rounded-kz-*`, etc.) ficam no **JS compilado** em `node_modules/@yberagroup/kaizen-ui/dist`. Por isso e obrigatorio incluir esse caminho; o `init` ja faz isso com `require.resolve`.
52
+
50
53
  No `tailwind.config.cjs`:
51
54
 
52
55
  ```js
56
+ const path = require("path");
57
+
58
+ const kaizenUiRoot = path.dirname(
59
+ require.resolve("@yberagroup/kaizen-ui/package.json"),
60
+ );
61
+
53
62
  module.exports = {
54
63
  presets: [require("@yberagroup/kaizen-ui/tailwind-preset")],
55
- content: ["./src/**/*.{js,ts,jsx,tsx}", "./index.html"],
64
+ content: [
65
+ "./index.html",
66
+ "./src/**/*.{js,ts,jsx,tsx}",
67
+ "./app/**/*.{js,ts,jsx,tsx}",
68
+ path.join(kaizenUiRoot, "dist", "**", "*.{js,mjs}"),
69
+ ],
56
70
  darkMode: "class",
57
71
  };
58
72
  ```
package/bin/kaizen-ui.mjs CHANGED
@@ -1,5 +1,11 @@
1
1
  #!/usr/bin/env node
2
- import { readFileSync, writeFileSync, existsSync, copyFileSync } from "node:fs";
2
+ import {
3
+ readFileSync,
4
+ writeFileSync,
5
+ existsSync,
6
+ copyFileSync,
7
+ unlinkSync,
8
+ } from "node:fs";
3
9
  import { dirname, join, relative, resolve } from "node:path";
4
10
  import process from "node:process";
5
11
  import { createInterface } from "node:readline/promises";
@@ -123,12 +129,19 @@ function ensureImportInEntry(entryPath, importPath) {
123
129
  function writeTailwindConfig(cwd) {
124
130
  const file = join(cwd, "tailwind.config.cjs");
125
131
  const content = `/** @type {import('tailwindcss').Config} */
132
+ const path = require("path");
133
+
134
+ const kaizenUiRoot = path.dirname(
135
+ require.resolve("@yberagroup/kaizen-ui/package.json"),
136
+ );
137
+
126
138
  module.exports = {
127
139
  presets: [require("@yberagroup/kaizen-ui/tailwind-preset")],
128
140
  content: [
129
141
  "./index.html",
130
142
  "./src/**/*.{js,ts,jsx,tsx}",
131
143
  "./app/**/*.{js,ts,jsx,tsx}",
144
+ path.join(kaizenUiRoot, "dist", "**", "*.{js,mjs}"),
132
145
  ],
133
146
  darkMode: "class",
134
147
  };
@@ -148,6 +161,24 @@ function writePostcssConfig(cwd) {
148
161
  writeFileSync(file, content, "utf-8");
149
162
  }
150
163
 
164
+ /** Remove configs legadas (.js/.mjs) para o Tailwind/PostCSS nao carregarem o arquivo errado ao lado do .cjs. */
165
+ function removeConflictingToolingConfigs(cwd) {
166
+ const names = [
167
+ "tailwind.config.js",
168
+ "tailwind.config.mjs",
169
+ "postcss.config.js",
170
+ "postcss.config.mjs",
171
+ ];
172
+ for (const name of names) {
173
+ const abs = join(cwd, name);
174
+ if (!existsSync(abs)) continue;
175
+ unlinkSync(abs);
176
+ logStep(
177
+ `Removido ${name} (evita conflito com ${name.replace(/\.(js|mjs)$/i, ".cjs")}).`,
178
+ );
179
+ }
180
+ }
181
+
151
182
  async function runInit() {
152
183
  const cwd = process.cwd();
153
184
  const rl = createInterface({ input, output });
@@ -193,6 +224,8 @@ async function runInit() {
193
224
  writePostcssConfig(cwd);
194
225
  logStep("postcss.config.cjs criado/atualizado.");
195
226
 
227
+ removeConflictingToolingConfigs(cwd);
228
+
196
229
  const themeImport = THEME_IMPORT[theme];
197
230
 
198
231
  if (cssStrategy === "migrate") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yberagroup/kaizen-ui",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "scripts": {
@@ -9,7 +9,7 @@
9
9
  "prepublishOnly": "npm run build && npm run lint"
10
10
  },
11
11
  "dependencies": {
12
- "@yberagroup/kaizen-tokens": "^0.0.3",
12
+ "@yberagroup/kaizen-tokens": "^0.0.4",
13
13
  "class-variance-authority": "^0.7.1",
14
14
  "clsx": "^2.1.1",
15
15
  "@fortawesome/fontawesome-svg-core": "^6.7.2",
@@ -1,3 +1,5 @@
1
+ @import url("https://fonts.googleapis.com/css2?family=Nunito+Sans:wght@500;600&family=Syne:wght@500;600&display=swap");
2
+
1
3
  @import "@yberagroup/kaizen-tokens/foundations.css";
2
4
  @tailwind base;
3
5
  @tailwind components;