atomsystem 0.1.35 → 0.1.36
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/build/build-tokens.js +2 -2
- package/cli/init.js +68 -1
- package/package.json +1 -1
package/build/build-tokens.js
CHANGED
|
@@ -181,9 +181,9 @@ myStyleDictionary.registerFormat({
|
|
|
181
181
|
|
|
182
182
|
// global(@theme)인 경우에만 수집해둔 시멘틱 변수(semanticCss)를 추가
|
|
183
183
|
// @theme: Tailwind 유틸리티 클래스 생성에 필요 (bg-primary, text-secondary 등)
|
|
184
|
-
//
|
|
184
|
+
// Tailwind CSS v4의 @theme은 빌드 시 자동으로 :root에도 등록되므로 별도 :root 선언 불필요
|
|
185
185
|
if (selector === "@theme") {
|
|
186
|
-
return `@theme {\n${cssVariables}\n\n${semanticCss}\n}
|
|
186
|
+
return `@theme {\n${cssVariables}\n\n${semanticCss}\n}`;
|
|
187
187
|
}
|
|
188
188
|
return `${selector} {\n${cssVariables}\n} `;
|
|
189
189
|
})
|
package/cli/init.js
CHANGED
|
@@ -49,7 +49,7 @@ inquirer
|
|
|
49
49
|
|
|
50
50
|
try {
|
|
51
51
|
await execPromise(
|
|
52
|
-
"npm install next@latest react@latest react-dom@latest tailwindcss clsx react-modal typescript @types/react @types/node @types/react-dom @types/react-modal"
|
|
52
|
+
"npm install next@latest react@latest react-dom@latest tailwindcss @tailwindcss/postcss postcss clsx react-modal typescript @types/react @types/node @types/react-dom @types/react-modal"
|
|
53
53
|
);
|
|
54
54
|
pkgSpinner.succeed("Next.js and React installation complete!");
|
|
55
55
|
} catch (err) {
|
|
@@ -160,6 +160,56 @@ export default function Page() {
|
|
|
160
160
|
)
|
|
161
161
|
}`,
|
|
162
162
|
},
|
|
163
|
+
// ✅ tsconfig.json: "@/*" 경로 별칭 설정 (예: @/build/typescript/theme)
|
|
164
|
+
{
|
|
165
|
+
path: path.join(projectRoot, "tsconfig.json"),
|
|
166
|
+
content: JSON.stringify({
|
|
167
|
+
compilerOptions: {
|
|
168
|
+
target: "ES2017",
|
|
169
|
+
lib: ["dom", "dom.iterable", "esnext"],
|
|
170
|
+
allowJs: true,
|
|
171
|
+
skipLibCheck: true,
|
|
172
|
+
strict: true,
|
|
173
|
+
noEmit: true,
|
|
174
|
+
esModuleInterop: true,
|
|
175
|
+
module: "esnext",
|
|
176
|
+
moduleResolution: "bundler",
|
|
177
|
+
resolveJsonModule: true,
|
|
178
|
+
isolatedModules: true,
|
|
179
|
+
jsx: "preserve",
|
|
180
|
+
incremental: true,
|
|
181
|
+
plugins: [{ name: "next" }],
|
|
182
|
+
paths: {
|
|
183
|
+
"@/*": ["./*"]
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
include: ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
|
187
|
+
exclude: ["node_modules"]
|
|
188
|
+
}, null, 2),
|
|
189
|
+
},
|
|
190
|
+
// ✅ next.config.ts: Next.js 기본 설정
|
|
191
|
+
{
|
|
192
|
+
path: path.join(projectRoot, "next.config.ts"),
|
|
193
|
+
content: `import type { NextConfig } from "next";
|
|
194
|
+
|
|
195
|
+
const nextConfig: NextConfig = {
|
|
196
|
+
reactStrictMode: false,
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
export default nextConfig;`,
|
|
200
|
+
},
|
|
201
|
+
// ✅ postcss.config.mjs: Tailwind CSS v4 PostCSS 플러그인 등록 (@theme, @import "tailwindcss" 인식)
|
|
202
|
+
{
|
|
203
|
+
path: path.join(projectRoot, "postcss.config.mjs"),
|
|
204
|
+
content: `/** @type {import('postcss-load-config').Config} */
|
|
205
|
+
const config = {
|
|
206
|
+
plugins: {
|
|
207
|
+
"@tailwindcss/postcss": {},
|
|
208
|
+
},
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
export default config;`,
|
|
212
|
+
},
|
|
163
213
|
];
|
|
164
214
|
|
|
165
215
|
files.forEach(({ path, content }) => {
|
|
@@ -167,6 +217,23 @@ export default function Page() {
|
|
|
167
217
|
console.log(`✅ Created ${path}`);
|
|
168
218
|
});
|
|
169
219
|
|
|
220
|
+
// ✅ 토큰 빌드 먼저 실행: Theme.tsx가 @/build/typescript/theme를 import하므로
|
|
221
|
+
// 컴포넌트 복사 전에 build-tokens.js를 실행해 theme.ts를 미리 생성해야 합니다.
|
|
222
|
+
const buildTokensPath = path.join(projectRoot, "build", "build-tokens.js");
|
|
223
|
+
if (fs.existsSync(buildTokensPath)) {
|
|
224
|
+
const tokenBuildSpinner = ora("Building design tokens (generating build/typescript/theme.ts)...").start();
|
|
225
|
+
try {
|
|
226
|
+
await execPromise(`node "${buildTokensPath}"`, { cwd: projectRoot });
|
|
227
|
+
tokenBuildSpinner.succeed("Design tokens built successfully!");
|
|
228
|
+
} catch (err) {
|
|
229
|
+
tokenBuildSpinner.fail("Error during token build");
|
|
230
|
+
console.error(err);
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
} else {
|
|
234
|
+
console.warn("⚠️ build-tokens.js not found, skipping token build.");
|
|
235
|
+
}
|
|
236
|
+
|
|
170
237
|
// add.js를 실행하여 Theme, Card 컴포넌트 및 하위 의존성을 복사합니다.
|
|
171
238
|
const addScriptPath = path.join(__dirname, "add.js");
|
|
172
239
|
if (fs.existsSync(addScriptPath)) {
|