atomsystem 0.1.5 → 0.1.6
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/bin/app-component.js +34 -0
- package/package.json +3 -2
- package/test/files.js +1 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
|
|
6
|
+
// 사용자 입력 (예: "button")
|
|
7
|
+
const componentName = process.argv[2];
|
|
8
|
+
|
|
9
|
+
if (!componentName) {
|
|
10
|
+
console.error(
|
|
11
|
+
"❌ Component name is required! Example: npx atomsystem add button"
|
|
12
|
+
);
|
|
13
|
+
process.exit(1);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// 패키지 내부의 템플릿 폴더
|
|
17
|
+
const srcDir = path.join(__dirname, "..", "app", "Component");
|
|
18
|
+
const srcPath = path.join(srcDir, `${componentName}.tsx`);
|
|
19
|
+
|
|
20
|
+
// 사용자 프로젝트의 대상 폴더
|
|
21
|
+
const destDir = path.join(process.cwd(), "app", "component");
|
|
22
|
+
const destPath = path.join(destDir, `${componentName}.tsx`);
|
|
23
|
+
|
|
24
|
+
if (!fs.existsSync(srcPath)) {
|
|
25
|
+
console.error(`❌ Component "${componentName}" not found in templates!`);
|
|
26
|
+
process.exit(1);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// 대상 폴더가 없으면 생성
|
|
30
|
+
fs.mkdirSync(destDir, { recursive: true });
|
|
31
|
+
|
|
32
|
+
// 파일 복사
|
|
33
|
+
fs.copyFileSync(srcPath, destPath);
|
|
34
|
+
console.log(`✅ ${componentName}.tsx added to app/component`);
|
package/package.json
CHANGED
package/test/files.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
console.log("file!");
|