atomsystem 0.1.45 → 0.1.46

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/dist/index.js +53 -153
  2. package/package.json +11 -13
package/dist/index.js CHANGED
@@ -1,70 +1,18 @@
1
1
  #!/usr/bin/env node
2
-
3
- // node_modules/tsup/assets/esm_shims.js
4
- import path from "path";
5
- import { fileURLToPath } from "url";
6
- var getFilename = () => fileURLToPath(import.meta.url);
7
- var getDirname = () => path.dirname(getFilename());
8
- var __dirname = /* @__PURE__ */ getDirname();
2
+ import {
3
+ addComponent,
4
+ components,
5
+ logger
6
+ } from "./chunk-US4VD4EW.js";
9
7
 
10
8
  // src/index.ts
11
9
  import { Command as Command3 } from "commander";
12
10
 
13
11
  // src/commands/add.ts
14
12
  import { Command } from "commander";
15
- import fs from "fs";
16
- import path2 from "path";
13
+ import path from "path";
17
14
  import prompts from "prompts";
18
15
  import { z } from "zod";
19
-
20
- // src/utils/logger.ts
21
- import chalk from "chalk";
22
- var logger = {
23
- error(...args) {
24
- console.error(chalk.red(...args));
25
- },
26
- warn(...args) {
27
- console.warn(chalk.yellow(...args));
28
- },
29
- info(...args) {
30
- console.info(chalk.cyan(...args));
31
- },
32
- success(...args) {
33
- console.log(chalk.green(...args));
34
- },
35
- log(...args) {
36
- console.log(...args);
37
- },
38
- break() {
39
- console.log("");
40
- }
41
- };
42
-
43
- // src/commands/add.ts
44
- var isBuilt = path2.basename(__dirname) === "dist" || fs.existsSync(path2.join(__dirname, "index.js"));
45
- var baseDir = isBuilt ? path2.join(__dirname, "..") : path2.join(__dirname, "..", "..");
46
- var templateDir = path2.join(baseDir, "app", "templates");
47
- var components = [
48
- "Button",
49
- "Badge",
50
- "Card",
51
- "Collapse",
52
- "CodeBlock",
53
- "Navigation",
54
- "Sidebar",
55
- "Input",
56
- "Theme",
57
- "Tab",
58
- "Toast",
59
- "Pagination",
60
- "Table",
61
- "Modal",
62
- "TOC",
63
- "Dropdown"
64
- ];
65
- var dependenciesMap = {
66
- Theme: ["Button", "Form", "Modal"]
67
- };
68
16
  var addOptionsSchema = z.object({
69
17
  components: z.array(z.string()).optional(),
70
18
  all: z.boolean(),
@@ -75,7 +23,7 @@ var add = new Command().name("add").description("\uD504\uB85C\uC81D\uD2B8\uC5D0
75
23
  const options = addOptionsSchema.parse({
76
24
  components: componentsArg,
77
25
  ...opts,
78
- cwd: path2.resolve(opts.cwd)
26
+ cwd: path.resolve(opts.cwd)
79
27
  });
80
28
  let selectedComponents = options.components || [];
81
29
  if (options.all) {
@@ -103,76 +51,19 @@ var add = new Command().name("add").description("\uD504\uB85C\uC81D\uD2B8\uC5D0
103
51
  logger.error(error);
104
52
  }
105
53
  });
106
- function addComponent(comp, cwd, addedComponents) {
107
- if (addedComponents.has(comp)) return;
108
- addedComponents.add(comp);
109
- const componentSourceDir = path2.join(templateDir, comp);
110
- const componentPath = path2.join(componentSourceDir, `${comp}.tsx`);
111
- const targetDir = path2.join(cwd, "app", "components", comp);
112
- const targetPath = path2.join(targetDir, `${comp}.tsx`);
113
- const cssFileName = `${comp}.css`.toLowerCase();
114
- const sourceCssPath = path2.join(componentSourceDir, cssFileName);
115
- const targetCssPath = path2.join(targetDir, cssFileName);
116
- if (fs.existsSync(componentPath)) {
117
- if (!fs.existsSync(targetDir)) {
118
- fs.mkdirSync(targetDir, { recursive: true });
119
- logger.info(`\uB514\uB809\uD1A0\uB9AC \uC0DD\uC131: ${targetDir}`);
120
- }
121
- fs.copyFileSync(componentPath, targetPath);
122
- logger.success(`\u2705 ${comp} \uCEF4\uD3EC\uB10C\uD2B8(TSX)\uAC00 \uCD94\uAC00\uB418\uC5C8\uC2B5\uB2C8\uB2E4: ${targetPath}`);
123
- if (fs.existsSync(sourceCssPath)) {
124
- fs.copyFileSync(sourceCssPath, targetCssPath);
125
- logger.success(`\u2705 ${comp} \uCEF4\uD3EC\uB10C\uD2B8(CSS)\uAC00 \uCD94\uAC00\uB418\uC5C8\uC2B5\uB2C8\uB2E4: ${targetCssPath}`);
126
- updateGlobalsCss(comp, cssFileName, cwd);
127
- }
128
- if (dependenciesMap[comp]) {
129
- logger.info(`\u23F3 ${comp}\uC758 \uC758\uC874\uC131 \uCEF4\uD3EC\uB10C\uD2B8 \uD655\uC778 \uC911...`);
130
- for (const dep of dependenciesMap[comp]) {
131
- addComponent(dep, cwd, addedComponents);
132
- }
133
- }
134
- } else {
135
- logger.error(`\u274C ${comp} \uCEF4\uD3EC\uB10C\uD2B8\uAC00 atomsystem\uC5D0 \uC874\uC7AC\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.`);
136
- }
137
- }
138
- function updateGlobalsCss(comp, cssFileName, cwd) {
139
- const globalsPath = path2.join(cwd, "app", "globals.css");
140
- const importLine = `@import "./components/${comp}/${cssFileName}";`;
141
- const componentSectionMarker = "/* Component Styles */";
142
- if (fs.existsSync(globalsPath)) {
143
- let content = fs.readFileSync(globalsPath, "utf8");
144
- if (!content.includes(importLine)) {
145
- if (content.includes(componentSectionMarker)) {
146
- const markerIndex = content.indexOf(componentSectionMarker);
147
- const afterMarker = content.slice(markerIndex);
148
- const lastImportIndex = afterMarker.lastIndexOf("@import");
149
- if (lastImportIndex !== -1) {
150
- const endOfLastImport = markerIndex + lastImportIndex + afterMarker.slice(lastImportIndex).indexOf("\n") + 1;
151
- content = content.slice(0, endOfLastImport) + importLine + "\n" + content.slice(endOfLastImport);
152
- } else {
153
- content = content.slice(0, markerIndex + componentSectionMarker.length) + "\n" + importLine + "\n" + content.slice(markerIndex + componentSectionMarker.length);
154
- }
155
- } else {
156
- content = content.trimEnd() + "\n\n" + componentSectionMarker + "\n" + importLine + "\n";
157
- }
158
- fs.writeFileSync(globalsPath, content, "utf8");
159
- logger.success(`\u2705 globals.css\uC5D0 ${comp} @import\uB97C \uCD94\uAC00\uD588\uC2B5\uB2C8\uB2E4.`);
160
- }
161
- } else {
162
- logger.warn(`\u26A0\uFE0F globals.css\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. \uC218\uB3D9\uC73C\uB85C \uCD94\uAC00\uD574 \uC8FC\uC138\uC694:
163
- ${importLine}`);
164
- }
165
- }
166
54
 
167
55
  // src/commands/init.ts
168
56
  import { Command as Command2 } from "commander";
169
- import fs2 from "fs";
170
- import path3 from "path";
57
+ import fs from "fs";
58
+ import path2 from "path";
171
59
  import { exec } from "child_process";
172
60
  import { promisify } from "util";
173
61
  import ora from "ora";
174
62
  import prompts2 from "prompts";
63
+ import { fileURLToPath } from "url";
175
64
  import { z as z2 } from "zod";
65
+ var __filename2 = fileURLToPath(import.meta.url);
66
+ var __dirname2 = path2.dirname(__filename2);
176
67
  var execPromise = promisify(exec);
177
68
  var initOptionsSchema = z2.object({
178
69
  cwd: z2.string(),
@@ -182,11 +73,11 @@ var init = new Command2().name("init").description("\uD504\uB85C\uC81D\uD2B8\uB9
182
73
  try {
183
74
  const options = initOptionsSchema.parse({
184
75
  ...opts,
185
- cwd: path3.resolve(opts.cwd)
76
+ cwd: path2.resolve(opts.cwd)
186
77
  });
187
78
  const projectRoot = options.cwd;
188
- const packageJsonPath = path3.join(projectRoot, "package.json");
189
- if (!fs2.existsSync(packageJsonPath)) {
79
+ const packageJsonPath = path2.join(projectRoot, "package.json");
80
+ if (!fs.existsSync(packageJsonPath)) {
190
81
  logger.error("\u274C \uC624\uB958: \uD604\uC7AC \uB514\uB809\uD1A0\uB9AC\uC5D0\uC11C package.json\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.");
191
82
  logger.info("'npm init'\uC744 \uBA3C\uC800 \uC2E4\uD589\uD55C \uD6C4 \uB2E4\uC2DC \uC2DC\uB3C4\uD574 \uC8FC\uC138\uC694.");
192
83
  process.exit(1);
@@ -201,7 +92,7 @@ var init = new Command2().name("init").description("\uD504\uB85C\uC81D\uD2B8\uB9
201
92
  const pkgSpinner = ora("Next.js\uC640 React \uC124\uCE58 \uC911...").start();
202
93
  try {
203
94
  await execPromise(
204
- "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",
95
+ "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 --legacy-peer-deps",
205
96
  { cwd: projectRoot }
206
97
  );
207
98
  pkgSpinner.succeed("Next.js\uC640 React \uC124\uCE58 \uC644\uB8CC!");
@@ -212,7 +103,7 @@ var init = new Command2().name("init").description("\uD504\uB85C\uC81D\uD2B8\uB9
212
103
  }
213
104
  const sdSpinner = ora("style-dictionary \uC124\uCE58 \uC911...").start();
214
105
  try {
215
- await execPromise("npm install style-dictionary -D", { cwd: projectRoot });
106
+ await execPromise("npm install style-dictionary -D --legacy-peer-deps", { cwd: projectRoot });
216
107
  sdSpinner.succeed("style-dictionary \uC124\uCE58 \uC644\uB8CC!");
217
108
  } catch (err) {
218
109
  sdSpinner.fail("style-dictionary \uC124\uCE58 \uC911 \uC624\uB958 \uBC1C\uC0DD");
@@ -221,7 +112,7 @@ var init = new Command2().name("init").description("\uD504\uB85C\uC81D\uD2B8\uB9
221
112
  }
222
113
  const gsSpinner = ora("gsap Animation \uC124\uCE58 \uC911...").start();
223
114
  try {
224
- await execPromise("npm install gsap", { cwd: projectRoot });
115
+ await execPromise("npm install gsap --legacy-peer-deps", { cwd: projectRoot });
225
116
  gsSpinner.succeed("gsap Animation \uC124\uCE58 \uC644\uB8CC!");
226
117
  } catch (err) {
227
118
  gsSpinner.fail("gsap Animation \uC124\uCE58 \uC911 \uC624\uB958 \uBC1C\uC0DD");
@@ -229,7 +120,7 @@ var init = new Command2().name("init").description("\uD504\uB85C\uC81D\uD2B8\uB9
229
120
  return;
230
121
  }
231
122
  try {
232
- const packageJson = JSON.parse(fs2.readFileSync(packageJsonPath, "utf8"));
123
+ const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
233
124
  packageJson.type = "module";
234
125
  packageJson.scripts = {
235
126
  ...packageJson.scripts,
@@ -239,17 +130,17 @@ var init = new Command2().name("init").description("\uD504\uB85C\uC81D\uD2B8\uB9
239
130
  "lint": "next lint",
240
131
  "token-build": "node build/build-tokens.js"
241
132
  };
242
- fs2.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
133
+ fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
243
134
  logger.success("\u2705 package.json \uC2A4\uD06C\uB9BD\uD2B8 \uC5C5\uB370\uC774\uD2B8 \uC644\uB8CC.");
244
135
  } catch (err) {
245
136
  logger.error("\u274C package.json \uC5C5\uB370\uC774\uD2B8 \uC624\uB958:", err);
246
137
  return;
247
138
  }
248
- const appDir = path3.join(projectRoot, "app");
249
- if (!fs2.existsSync(appDir)) fs2.mkdirSync(appDir, { recursive: true });
139
+ const appDir = path2.join(projectRoot, "app");
140
+ if (!fs.existsSync(appDir)) fs.mkdirSync(appDir, { recursive: true });
250
141
  const files = [
251
142
  {
252
- path: path3.join(appDir, "layout.tsx"),
143
+ path: path2.join(appDir, "layout.tsx"),
253
144
  content: `import { ThemeProvider } from "./components/Theme/Theme";
254
145
  import "./globals.css";
255
146
 
@@ -266,13 +157,13 @@ export default function RootLayout({ children }: { children: React.ReactNode })
266
157
  }`
267
158
  },
268
159
  {
269
- path: path3.join(appDir, "globals.css"),
160
+ path: path2.join(appDir, "globals.css"),
270
161
  content: `@import "tailwindcss";
271
162
  @import "../build/css/_variables.css";
272
163
  @import "../css/text.css";`
273
164
  },
274
165
  {
275
- path: path3.join(appDir, "page.tsx"),
166
+ path: path2.join(appDir, "page.tsx"),
276
167
  content: `import { ThemeSelector } from "./components/Theme/Theme";
277
168
  import { Button } from "./components/Button/Button";
278
169
  import { Card, CardHeader, CardContent, CardFooter } from "./components/Card/Card";
@@ -312,7 +203,7 @@ export default function Page() {
312
203
  }`
313
204
  },
314
205
  {
315
- path: path3.join(projectRoot, "tsconfig.json"),
206
+ path: path2.join(projectRoot, "tsconfig.json"),
316
207
  content: JSON.stringify({
317
208
  compilerOptions: {
318
209
  target: "ES2017",
@@ -338,25 +229,25 @@ export default function Page() {
338
229
  }, null, 2)
339
230
  },
340
231
  {
341
- path: path3.join(projectRoot, "next.config.ts"),
232
+ path: path2.join(projectRoot, "next.config.ts"),
342
233
  content: `import type { NextConfig } from "next";
343
234
 
344
235
  const nextConfig: NextConfig = { reactStrictMode: false };
345
236
  export default nextConfig;`
346
237
  },
347
238
  {
348
- path: path3.join(projectRoot, "postcss.config.mjs"),
239
+ path: path2.join(projectRoot, "postcss.config.mjs"),
349
240
  content: `/** @type {import('postcss-load-config').Config} */
350
241
  const config = { plugins: { "@tailwindcss/postcss": {} } };
351
242
  export default config;`
352
243
  }
353
244
  ];
354
245
  for (const file of files) {
355
- fs2.writeFileSync(file.path, file.content);
246
+ fs.writeFileSync(file.path, file.content);
356
247
  logger.info(`\u2705 \uD30C\uC77C \uC0DD\uC131: ${file.path}`);
357
248
  }
358
- const buildTokensPath = path3.join(projectRoot, "build", "build-tokens.js");
359
- if (fs2.existsSync(buildTokensPath)) {
249
+ const buildTokensPath = path2.join(projectRoot, "build", "build-tokens.js");
250
+ if (fs.existsSync(buildTokensPath)) {
360
251
  const spin = ora("\uB514\uC790\uC778 \uD1A0\uD070 \uBE4C\uB4DC \uC911...").start();
361
252
  try {
362
253
  await execPromise(`node "${buildTokensPath}"`, { cwd: projectRoot });
@@ -367,14 +258,19 @@ export default config;`
367
258
  }
368
259
  }
369
260
  }
370
- const isBuilt2 = path3.basename(__dirname) === "dist" || fs2.existsSync(path3.join(__dirname, "index.js"));
371
- const baseDir2 = isBuilt2 ? path3.join(__dirname, "..") : path3.join(__dirname, "..", "..");
372
- const tokenFile = path3.join(baseDir2, "tokens", "tokens.json");
373
- const buildFile = path3.join(baseDir2, "build", "build-tokens.js");
374
- const textCssFile = path3.join(baseDir2, "css", "text.css");
375
- copyFile(tokenFile, path3.join(projectRoot, "tokens", "tokens.json"));
376
- copyFile(buildFile, path3.join(projectRoot, "build", "build-tokens.js"));
377
- copyFile(textCssFile, path3.join(projectRoot, "css", "text.css"));
261
+ const { baseDir: pkgRoot } = await import("./component-SFV77SNH.js");
262
+ logger.info(`\u{1F50D} Debug: pkgRoot=${pkgRoot}`);
263
+ const tokenFile = path2.join(pkgRoot, "tokens", "tokens.json");
264
+ const buildFile = path2.join(pkgRoot, "build", "build-tokens.js");
265
+ const textCssFile = path2.join(pkgRoot, "css", "text.css");
266
+ copyFile(tokenFile, path2.join(projectRoot, "tokens", "tokens.json"));
267
+ copyFile(buildFile, path2.join(projectRoot, "build", "build-tokens.js"));
268
+ copyFile(textCssFile, path2.join(projectRoot, "css", "text.css"));
269
+ const addedComponents = /* @__PURE__ */ new Set();
270
+ logger.info("\u23F3 \uAE30\uBCF8 \uB370\uBAA8 \uCEF4\uD3EC\uB10C\uD2B8 \uC124\uCE58 \uC911...");
271
+ addComponent("Button", projectRoot, addedComponents);
272
+ addComponent("Theme", projectRoot, addedComponents);
273
+ addComponent("Card", projectRoot, addedComponents);
378
274
  logger.success("\u{1F680} Atomsystem \uCD08\uAE30 \uC124\uC815 \uC644\uB8CC!");
379
275
  } catch (error) {
380
276
  logger.error("\uCD08\uAE30\uD654 \uC911 \uC624\uB958 \uBC1C\uC0DD:");
@@ -382,10 +278,10 @@ export default config;`
382
278
  }
383
279
  });
384
280
  function copyFile(src, dest) {
385
- const dir = path3.dirname(dest);
386
- if (!fs2.existsSync(dir)) fs2.mkdirSync(dir, { recursive: true });
387
- if (fs2.existsSync(src)) {
388
- fs2.copyFileSync(src, dest);
281
+ const dir = path2.dirname(dest);
282
+ if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
283
+ if (fs.existsSync(src)) {
284
+ fs.copyFileSync(src, dest);
389
285
  logger.info(`\u2705 \uBCF5\uC0AC \uC644\uB8CC: ${src} -> ${dest}`);
390
286
  } else {
391
287
  logger.warn(`\u26A0\uFE0F \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC5B4 \uBCF5\uC0AC\uD558\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4: ${src}`);
@@ -395,8 +291,12 @@ function copyFile(src, dest) {
395
291
  // src/index.ts
396
292
  import { readFileSync } from "fs";
397
293
  import { join } from "path";
294
+ import { fileURLToPath as fileURLToPath2 } from "url";
295
+ import { dirname } from "path";
296
+ var __filename3 = fileURLToPath2(import.meta.url);
297
+ var __dirname3 = dirname(__filename3);
398
298
  async function main() {
399
- const packageJsonPath = join(__dirname, "../package.json");
299
+ const packageJsonPath = join(__dirname3, "..", "package.json");
400
300
  const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf8"));
401
301
  const program = new Command3().name("atomsystem").description("Atom Ground Design System CLI").version(packageJson.version);
402
302
  program.addCommand(add);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "atomsystem",
3
- "version": "0.1.45",
3
+ "version": "0.1.46",
4
4
  "type": "module",
5
5
  "homepage": "https://system.atomground.com",
6
6
  "bin": {
@@ -24,8 +24,6 @@
24
24
  "cli:dev": "tsx src/index.ts"
25
25
  },
26
26
  "peerDependencies": {
27
- "react": "^18.0.0",
28
- "react-dom": "^18.0.0",
29
27
  "sd-tailwindcss-transformer": "^2.0.0",
30
28
  "style-dictionary": "^4.2.0"
31
29
  },
@@ -39,7 +37,7 @@
39
37
  "@mui/material": "^7.3.9",
40
38
  "@next/mdx": "^15.4.6",
41
39
  "@next/third-parties": "^15.0.3",
42
- "@tailwindcss/postcss": "^4.0.17",
40
+ "@tailwindcss/postcss": "^4.2.2",
43
41
  "@tokens-studio/sd-transforms": "^1.3.0",
44
42
  "@types/mdx": "^2.0.13",
45
43
  "chalk": "^5.6.2",
@@ -49,11 +47,11 @@
49
47
  "highlight.js": "^11.11.1",
50
48
  "inquirer": "^12.4.2",
51
49
  "lucide-react": "^1.7.0",
52
- "next": "15.2.8",
50
+ "next": "^16.2.4",
53
51
  "ora": "^9.3.0",
54
52
  "prompts": "^2.4.2",
55
- "react": "^18.0.0",
56
- "react-dom": "^18.0.0",
53
+ "react": "^19.2.5",
54
+ "react-dom": "^19.2.5",
57
55
  "react-modal": "^3.16.3",
58
56
  "react-responsive": "^10.0.1",
59
57
  "remark-gfm": "^4.0.1",
@@ -63,21 +61,21 @@
63
61
  "zod": "^4.3.6"
64
62
  },
65
63
  "devDependencies": {
66
- "@types/node": "^20",
64
+ "@types/node": "^20.19.39",
67
65
  "@types/prompts": "^2.4.9",
68
- "@types/react": "^18",
69
- "@types/react-dom": "^18",
66
+ "@types/react": "^18.3.28",
67
+ "@types/react-dom": "^18.3.7",
70
68
  "@types/react-modal": "^3.16.3",
71
69
  "@vitest/browser": "^3.1.1",
72
70
  "@vitest/coverage-v8": "^3.1.1",
73
71
  "eslint": "^8",
74
72
  "eslint-config-next": "15.0.3",
75
73
  "playwright": "^1.51.1",
76
- "postcss": "^8.5.3",
77
- "tailwindcss": "^4.0.17",
74
+ "postcss": "^8.5.10",
75
+ "tailwindcss": "^4.2.2",
78
76
  "tsup": "^8.5.1",
79
77
  "tsx": "^4.21.0",
80
- "typescript": "^5",
78
+ "typescript": "^5.9.3",
81
79
  "vitest": "^3.1.1"
82
80
  }
83
81
  }