atomsystem 0.1.14 → 0.1.16

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/cli/add.js CHANGED
@@ -55,76 +55,3 @@ if (component == "all") {
55
55
  // 특정 컴포넌트 추가
56
56
  addComponent(component);
57
57
  }
58
-
59
- // "all" 이면 모든 컴포넌트를 추가
60
-
61
- // 사용자에게 추가할 컴포넌트를 선택하도록 묻습니다.
62
- // inquirer
63
- // .prompt([
64
- // {
65
- // type: "list",
66
- // name: "component",
67
- // message: "Which component would you like to add?",
68
- // choices: ["all", ...components], // 'all'을 첫 번째로 추가
69
- // },
70
- // ])
71
- // .then((answers) => {
72
- // const { component } = answers;
73
-
74
- // // 'all'이 선택되면 모든 컴포넌트를 추가합니다.
75
- // if (component === "all") {
76
- // console.log("Adding all components...");
77
-
78
- // components.forEach((comp) => {
79
- // const componentPath = path.join(templateDir, `${comp}/${comp}.tsx`);
80
- // const targetDir = path.join(process.cwd(), "app", "components", comp);
81
- // const targetPath = path.join(targetDir, `${comp}.tsx`);
82
-
83
- // if (fs.existsSync(componentPath)) {
84
- // // 대상 디렉토리가 없으면 생성
85
- // if (!fs.existsSync(targetDir)) {
86
- // fs.mkdirSync(targetDir, { recursive: true });
87
- // console.log(`Created directory: ${targetDir}`);
88
- // }
89
-
90
- // copyFileSync(componentPath, targetPath);
91
- // console.log(`${comp} component has been added to ${targetPath}`);
92
- // } else {
93
- // console.log(
94
- // `Component ${comp} does not exist in the templates directory.`
95
- // );
96
- // }
97
- // });
98
- // } else {
99
- // // 개별 컴포넌트 추가
100
- // const componentPath = path.join(
101
- // templateDir,
102
- // `${component}/${component}.tsx`
103
- // );
104
- // const targetDir = path.join(
105
- // process.cwd(),
106
- // "app",
107
- // "components",
108
- // component
109
- // );
110
- // const targetPath = path.join(targetDir, `${component}.tsx`);
111
-
112
- // if (fs.existsSync(componentPath)) {
113
- // // 대상 디렉토리가 없으면 생성
114
- // if (!fs.existsSync(targetDir)) {
115
- // fs.mkdirSync(targetDir, { recursive: true });
116
- // console.log(`Created directory: ${targetDir}`);
117
- // }
118
-
119
- // copyFileSync(componentPath, targetPath);
120
- // console.log(`${component} component has been added to ${targetPath}`);
121
- // } else {
122
- // console.log(
123
- // `Component ${component} does not exist in the templates directory.`
124
- // );
125
- // }
126
- // }
127
- // })
128
- // .catch((error) => {
129
- // console.error("Error:", error);
130
- // });
package/cli/init.js CHANGED
@@ -1,10 +1,28 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
  import inquirer from "inquirer";
3
3
  import { exec } from "child_process";
4
- import fs from "fs"; // 파일 시스템 작업을 위한 모듈
5
- import path from "path"; // 경로 작업을 위한 모듈
4
+ import fs, { copyFileSync, mkdirSync, readdirSync } from "fs";
5
+ import path from "path";
6
+ import { fileURLToPath } from "url";
7
+ import { promisify } from "util";
6
8
 
7
- // 사용자에게 질문을 던져서 Next.js와 React를 설치할지 물어봅니다.
9
+ const execPromise = promisify(exec);
10
+
11
+ // 현재 실행중인 CLI 파일의 디렉토리 찾기
12
+ const __filename = fileURLToPath(import.meta.url);
13
+ const __dirname = path.dirname(__filename);
14
+
15
+ // 패키지 내부 경로 설정
16
+ const packageRoot = path.join(__dirname, "..");
17
+ const tokenFile = path.join(packageRoot, "token.json");
18
+ const tokenDir = path.join(packageRoot, "tokens");
19
+
20
+ // 프로젝트 루트 경로 (사용자가 실행한 곳)
21
+ const projectRoot = process.cwd();
22
+ const targetTokenFile = path.join(projectRoot, "token.json");
23
+ const targetTokensDir = path.join(projectRoot, "tokens");
24
+
25
+ // 사용자에게 Next.js 설치 여부 질문
8
26
  inquirer
9
27
  .prompt([
10
28
  {
@@ -14,105 +32,94 @@ inquirer
14
32
  default: true,
15
33
  },
16
34
  ])
17
- .then((answers) => {
35
+ .then(async (answers) => {
18
36
  if (answers.installPackages) {
19
37
  console.log("Installing Next.js and React...");
20
38
 
21
- // 두 패키지를 동시에 설치하는 명령어
22
- exec(
23
- "npm install next@latest react@latest react-dom@latest",
24
- (err, stdout, stderr) => {
25
- if (err) {
26
- console.error(`Error: ${stderr}`);
27
- } else {
28
- console.log(stdout);
29
- console.log("Installation complete!");
30
-
31
- // package.json에 scripts 추가
32
- const packageJsonPath = path.join(process.cwd(), "package.json");
33
- fs.readFile(packageJsonPath, "utf8", (err, data) => {
34
- if (err) {
35
- console.error("Error reading package.json:", err);
36
- return;
37
- }
38
-
39
- const packageJson = JSON.parse(data);
40
-
41
- // scripts 항목 추가
42
- packageJson.scripts = packageJson.scripts || {};
43
- packageJson.scripts.dev = "next dev";
44
- packageJson.scripts.build = "next build";
45
- packageJson.scripts.start = "next start";
46
- packageJson.scripts.lint = "next lint";
47
-
48
- // 수정된 package.json을 덮어씁니다.
49
- fs.writeFile(
50
- packageJsonPath,
51
- JSON.stringify(packageJson, null, 2),
52
- (err) => {
53
- if (err) {
54
- console.error("Error updating package.json:", err);
55
- } else {
56
- console.log("Updated package.json with scripts.");
57
- }
58
- }
59
- );
60
- });
61
-
62
- // app 디렉토리 생성 및 layout.tsx, page.tsx 파일 추가
63
- const appDir = path.join(process.cwd(), "app");
64
- const layoutPath = path.join(appDir, "layout.tsx");
65
- const pagePath = path.join(appDir, "page.tsx");
66
-
67
- // app 디렉토리가 없으면 생성
68
- if (!fs.existsSync(appDir)) {
69
- fs.mkdirSync(appDir);
70
- }
71
-
72
- // layout.tsx 파일 내용
73
- const layoutContent = `export default function RootLayout({
74
- children,
75
- }: {
76
- children: React.ReactNode
77
- }) {
39
+ try {
40
+ await execPromise(
41
+ "npm install next@latest react@latest react-dom@latest tailwindcss"
42
+ );
43
+ console.log("✅ Installation complete!");
44
+ } catch (err) {
45
+ console.error("❌ Error during installation:", err);
46
+ return;
47
+ }
48
+
49
+ // package.json 업데이트
50
+ const packageJsonPath = path.join(projectRoot, "package.json");
51
+ try {
52
+ const packageJson = JSON.parse(
53
+ fs.readFileSync(packageJsonPath, "utf8")
54
+ );
55
+
56
+ packageJson.scripts = {
57
+ ...packageJson.scripts,
58
+ dev: "next dev",
59
+ build: "next build",
60
+ build_token:
61
+ "node tokens/buildTokenSplit.js && node tokens/buildMergeCss.js",
62
+ start: "next start",
63
+ lint: "next lint",
64
+ };
65
+
66
+ fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
67
+ console.log("✅ Updated package.json with scripts.");
68
+ } catch (err) {
69
+ console.error("❌ Error updating package.json:", err);
70
+ return;
71
+ }
72
+
73
+ // app 디렉토리 생성 및 파일 추가
74
+ const appDir = path.join(projectRoot, "app");
75
+ if (!fs.existsSync(appDir)) mkdirSync(appDir);
76
+
77
+ const files = [
78
+ {
79
+ path: path.join(appDir, "layout.tsx"),
80
+ content: `export default function RootLayout({ children }: { children: React.ReactNode }) {
78
81
  return (
79
82
  <html lang="en">
80
83
  <body>{children}</body>
81
84
  </html>
82
85
  )
83
- }
84
- `;
85
-
86
- // page.tsx 파일 내용
87
- const pageContent = `export default function Page() {
86
+ }`,
87
+ },
88
+ {
89
+ path: path.join(appDir, "page.tsx"),
90
+ content: `export default function Page() {
88
91
  return <h1>Hello, Next.js!</h1>
89
- }
90
- `;
91
-
92
- // layout.tsx 파일 생성
93
- fs.writeFile(layoutPath, layoutContent, (err) => {
94
- if (err) {
95
- console.error("Error creating layout.tsx:", err);
96
- } else {
97
- console.log("Created layout.tsx.");
98
- }
99
- });
100
-
101
- // page.tsx 파일 생성
102
- fs.writeFile(pagePath, pageContent, (err) => {
103
- if (err) {
104
- console.error("Error creating page.tsx:", err);
105
- } else {
106
- console.log("Created page.tsx.");
107
- }
108
- });
109
- }
110
- }
111
- );
92
+ }`,
93
+ },
94
+ ];
95
+
96
+ files.forEach(({ path, content }) => {
97
+ fs.writeFileSync(path, content);
98
+ console.log(`✅ Created ${path}`);
99
+ });
112
100
  } else {
113
- console.log("Installation skipped.");
101
+ console.log("🚀 Installation skipped.");
114
102
  }
103
+
104
+ // ✅ 토큰 파일 복사 (Next.js 설치 여부와 관계없이 실행)
105
+ copyFileSync(tokenFile, targetTokenFile);
106
+ console.log(`✅ Copied: token.json -> ${targetTokenFile}`);
107
+
108
+ if (!fs.existsSync(targetTokensDir))
109
+ mkdirSync(targetTokensDir, { recursive: true });
110
+
111
+ const tokenFiles = readdirSync(tokenDir).filter((file) =>
112
+ file.endsWith(".js")
113
+ );
114
+ tokenFiles.forEach((file) => {
115
+ const sourcePath = path.join(tokenDir, file);
116
+ const targetPath = path.join(targetTokensDir, file);
117
+ copyFileSync(sourcePath, targetPath);
118
+ console.log(`✅ Copied: ${file} -> ${targetPath}`);
119
+ });
120
+
121
+ console.log("🚀 Token setup complete!");
115
122
  })
116
123
  .catch((error) => {
117
- console.error("Error:", error);
124
+ console.error("❌ Error:", error);
118
125
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "atomsystem",
3
- "version": "0.1.14",
3
+ "version": "0.1.16",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "atomsystem-init": "cli/init.js",
@@ -9,7 +9,6 @@
9
9
  "files": [
10
10
  "token.json",
11
11
  "tokens",
12
- "build",
13
12
  "tailwind.config.ts",
14
13
  "app/templates"
15
14
  ],
@@ -1,275 +0,0 @@
1
- /**
2
- * Do not edit directly, this file was auto-generated.
3
- */
4
-
5
- :root {
6
- --black-50: #5a5a5a;
7
- --black-100: #555555;
8
- --black-200: #4a4a4a;
9
- --black-300: #444444;
10
- --black-400: #3a3a3a;
11
- --black-500: #333333;
12
- --black-600: #2a2a2a;
13
- --black-700: #222222;
14
- --black-800: #1a1a1a;
15
- --black-900: #111111;
16
- --gray-50: #bbbbbb;
17
- --gray-100: #b3b3b3;
18
- --gray-200: #9e9e9e;
19
- --gray-300: #999999;
20
- --gray-400: #8e8e8e;
21
- --gray-500: #888888;
22
- --gray-600: #7e7e7e;
23
- --gray-700: #777777;
24
- --gray-800: #6e6e6e;
25
- --gray-900: #666666;
26
- --white-50: #fafafa;
27
- --white-100: #f5f5f5;
28
- --white-200: #f0f0f0;
29
- --white-300: #ebebeb;
30
- --white-400: #e6e6e6;
31
- --white-500: #e0e0e0;
32
- --white-600: #dbdbdb;
33
- --white-700: #d6d6d6;
34
- --white-800: #d1d1d1;
35
- --white-900: #cccccc;
36
- --blue-50: #f6f8fd;
37
- --blue-100: #ccd7f5;
38
- --blue-200: #a1b6ed;
39
- --blue-300: #7795e4;
40
- --blue-400: #4c73dc;
41
- --blue-500: #2855cc;
42
- --blue-600: #2044a2;
43
- --blue-700: #183277;
44
- --blue-800: #0f204d;
45
- --blue-900: #070e22;
46
- --green-50: #f7fdf7;
47
- --green-100: #cef3ce;
48
- --green-200: #a5e8a5;
49
- --green-300: #7dde7d;
50
- --green-400: #54d454;
51
- --green-500: #31c331;
52
- --green-600: #279b27;
53
- --green-700: #1d721d;
54
- --green-800: #124912;
55
- --green-900: #08210a;
56
- --red-50: #fdf7f7;
57
- --red-100: #f6dada;
58
- --red-200: #edb0b0;
59
- --red-300: #e48787;
60
- --red-400: #da5d5d;
61
- --red-500: #d13434;
62
- --red-600: #af2828;
63
- --red-700: #891f1f;
64
- --red-800: #641717;
65
- --red-900: #3e0e0e;
66
- --brand-primary: #2855cc;
67
- --brand-secondary: #0f204d;
68
- --system-success: #31c331;
69
- --system-danger: #d13434;
70
- --system-info: #333333;
71
- --fill-wrapper: #111111;
72
- --fill-card: #222222;
73
- --fill-info: #333333;
74
- --fill-border: #444444;
75
- --button-text: #fafafa;
76
- --button-primary-standard-background: #2855cc;
77
- --button-secondary-standard-background: #0f204d;
78
- --button-success-standard-background: #31c331;
79
- --button-danger-standard-background: #d13434;
80
- --button-info-standard-background: #333333;
81
- --icon-xs: 16px;
82
- --icon-sm: 24px;
83
- --icon-md: 32px;
84
- --icon-lg: 48px;
85
- --icon-xl: 80px;
86
- --element-xxs: 160px;
87
- --element-xs: 240px;
88
- --element-sm: 320px;
89
- --element-md: 480px;
90
- --element-lg: 640px;
91
- --element-xl: 960px;
92
- --element-2xl: 1280px;
93
- --element-3xl: 1920px;
94
- --element-4xl: 2560px;
95
- --element-5xl: 3840px;
96
- --spacing-nogap: 0;
97
- --spacing-xs: 4px;
98
- --spacing-sm: 8px;
99
- --spacing-md: 16px;
100
- --spacing-lg: 24px;
101
- --spacing-xl: 48px;
102
- --spacing-2xl: 120px;
103
- --spacing-3xl: 240px;
104
- --spacing-4xl: 320px;
105
- --main-title: 'Spoqa Han Sans Neo';
106
- --thin: 100;
107
- --extra-light: 200;
108
- --light: 300;
109
- --normal: 400;
110
- --bold: 700;
111
- --medium: 500;
112
- --semi-bold: 600;
113
- --extra-bold: 800;
114
- --black: 900;
115
- --desktop-h1-font-family: 'Spoqa Han Sans Neo';
116
- --desktop-h1-font-weight: 700;
117
- --desktop-h1-font-size: 48px;
118
- --desktop-h1-line-height: 64;
119
- --desktop-h2-font-family: 'Spoqa Han Sans Neo';
120
- --desktop-h2-font-weight: 700;
121
- --desktop-h2-font-size: 40px;
122
- --desktop-h2-line-height: 50;
123
- --desktop-h3-font-family: 'Spoqa Han Sans Neo';
124
- --desktop-h3-font-weight: 700;
125
- --desktop-h3-font-size: 32px;
126
- --desktop-h3-line-height: 48;
127
- --desktop-h4-font-family: 'Spoqa Han Sans Neo';
128
- --desktop-h4-font-weight: 700;
129
- --desktop-h4-font-size: 24px;
130
- --desktop-h4-line-height: 36;
131
- --desktop-h5-font-family: 'Spoqa Han Sans Neo';
132
- --desktop-h5-font-weight: 700;
133
- --desktop-h5-font-size: 20px;
134
- --desktop-h5-line-height: 30;
135
- --desktop-h6-font-family: 'Spoqa Han Sans Neo';
136
- --desktop-h6-font-weight: 700;
137
- --desktop-h6-font-size: 18px;
138
- --desktop-h6-line-height: 24;
139
- --desktop-body-base-font-family: 'Spoqa Han Sans Neo';
140
- --desktop-body-base-font-weight: 400;
141
- --desktop-body-base-font-size: 16px;
142
- --desktop-body-base-line-height: 24;
143
- --desktop-body-lg-font-family: 'Spoqa Han Sans Neo';
144
- --desktop-body-lg-font-weight: 400;
145
- --desktop-body-lg-font-size: 18px;
146
- --desktop-body-lg-line-height: 24;
147
- --desktop-body-sm-font-family: 'Spoqa Han Sans Neo';
148
- --desktop-body-sm-font-weight: 400;
149
- --desktop-body-sm-font-size: 14px;
150
- --desktop-body-sm-line-height: 20;
151
- --desktop-small-font-family: 'Spoqa Han Sans Neo';
152
- --desktop-small-font-weight: 400;
153
- --desktop-small-font-size: 12px;
154
- --desktop-small-line-height: 18;
155
- --desktop-small-extra-font-family: 'Spoqa Han Sans Neo';
156
- --desktop-small-extra-font-weight: 400;
157
- --desktop-small-extra-font-size: 10px;
158
- --desktop-small-extra-line-height: 16;
159
- --mobile-h1-font-family: 'Spoqa Han Sans Neo';
160
- --mobile-h1-font-weight: 700;
161
- --mobile-h1-font-size: 32px;
162
- --mobile-h1-line-height: 48;
163
- --mobile-h2-font-size: 28px;
164
- --mobile-h2-font-family: 'Spoqa Han Sans Neo';
165
- --mobile-h2-font-weight: 700;
166
- --mobile-h2-line-height: 40;
167
- --mobile-h3-font-family: 'Spoqa Han Sans Neo';
168
- --mobile-h3-font-weight: 700;
169
- --mobile-h3-font-size: 24px;
170
- --mobile-h3-line-height: 32;
171
- --mobile-h4-font-family: 'Spoqa Han Sans Neo';
172
- --mobile-h4-font-weight: 700;
173
- --mobile-h4-font-size: 20px;
174
- --mobile-h4-line-height: 28;
175
- --mobile-h5-font-family: 'Spoqa Han Sans Neo';
176
- --mobile-h5-font-weight: 700;
177
- --mobile-h5-font-size: 18px;
178
- --mobile-h5-line-height: 24;
179
- --mobile-h6-font-family: 'Spoqa Han Sans Neo';
180
- --mobile-h6-font-weight: 700;
181
- --mobile-h6-font-size: 16px;
182
- --mobile-h6-line-height: 24;
183
- --mobile-body-lg-font-family: 'Spoqa Han Sans Neo';
184
- --mobile-body-lg-font-weight: 400;
185
- --mobile-body-lg-font-size: 16px;
186
- --mobile-body-lg-line-height: 24;
187
- --mobile-body-base-font-family: 'Spoqa Han Sans Neo';
188
- --mobile-body-base-font-weight: 400;
189
- --mobile-body-base-font-size: 14px;
190
- --mobile-body-base-line-height: 20;
191
- --mobile-body-sm-font-family: 'Spoqa Han Sans Neo';
192
- --mobile-body-sm-font-weight: 400;
193
- --mobile-body-sm-font-size: 12px;
194
- --mobile-body-sm-line-height: 18;
195
- --mobile-small-font-family: 'Spoqa Han Sans Neo';
196
- --mobile-small-font-weight: 400;
197
- --mobile-small-font-size: 10px;
198
- --mobile-small-line-height: 16;
199
- --mobile-small-extra-font-family: 'Spoqa Han Sans Neo';
200
- --mobile-small-extra-font-weight: 400;
201
- --mobile-small-extra-font-size: 8px;
202
- --mobile-small-extra-line-height: 14;
203
- --rounded-common: 4px;
204
- --rounded-none: 0;
205
- --rounded-xs: 4px;
206
- --rounded-sm: 8px;
207
- --rounded-md: 16px;
208
- --rounded-lg: 24px;
209
- --rounded-full: 1000px;
210
- --shadow-none-blur: 0;
211
- --shadow-none-spread: 0;
212
- --shadow-none-color: #000000;
213
- --shadow-none-type: dropShadow;
214
- --shadow-none-offset-x: 0;
215
- --shadow-none-offset-y: 0;
216
- --shadow-xs-blur: 8px;
217
- --shadow-xs-spread: 0;
218
- --shadow-xs-color: rgba(0, 0, 0, 0.16);
219
- --shadow-xs-type: dropShadow;
220
- --shadow-xs-offset-x: 2px;
221
- --shadow-xs-offset-y: 2px;
222
- --shadow-sm-blur: 16px;
223
- --shadow-sm-spread: 0;
224
- --shadow-sm-color: rgba(0, 0, 0, 0.16);
225
- --shadow-sm-type: dropShadow;
226
- --shadow-sm-offset-x: 4px;
227
- --shadow-sm-offset-y: 4px;
228
- --shadow-md-blur: 32px;
229
- --shadow-md-spread: 0;
230
- --shadow-md-color: rgba(0, 0, 0, 0.16);
231
- --shadow-md-type: dropShadow;
232
- --shadow-md-offset-x: 8px;
233
- --shadow-md-offset-y: 8px;
234
- --shadow-lg-blur: 64px;
235
- --shadow-lg-spread: 0;
236
- --shadow-lg-color: rgba(0, 0, 0, 0.16);
237
- --shadow-lg-type: dropShadow;
238
- --shadow-lg-offset-x: 16px;
239
- --shadow-lg-offset-y: 16px;
240
- --shadow-xl-blur: 120px;
241
- --shadow-xl-spread: 0;
242
- --shadow-xl-color: rgba(0, 0, 0, 0.16);
243
- --shadow-xl-type: dropShadow;
244
- --shadow-xl-offset-x: 24px;
245
- --shadow-xl-offset-y: 24px;
246
- --visible: 1;
247
- --opacity-90: 0.9;
248
- --opacity-80: 0.8;
249
- --opacity-70: 0.7;
250
- --opacity-60: 0.6;
251
- --opacity-50: 0.5;
252
- --opacity-40: 0.4;
253
- --opacity-30: 0.3;
254
- --opacity-20: 0.2;
255
- --opacity-10: 0.1;
256
- --invisible: 0;
257
- --text-standard: #999999;
258
- --text-sub: #666666;
259
- --card-background: #222222;
260
- --card-border: #444444;
261
- --table-header: #2a2a2a;
262
- --input-text-value: #999999;
263
- --input-text-placeholder: #5a5a5a;
264
- --input-text-success: #2855cc;
265
- --input-text-error: #d13434;
266
- --input-background-value: #222222;
267
- --input-background-standard: #2a2a2a;
268
- --input-background-success: #070e22;
269
- --input-background-error: #3e0e0e;
270
- --input-background-disabled: #3a3a3a;
271
- --input-border-standard: #444444;
272
- --input-border-focus: #999999;
273
- --input-border-success: #2855cc;
274
- --input-border-error: #d13434;
275
- }