viora-ui 1.0.9 → 1.1.1
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.js +15 -6
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -42,20 +42,29 @@ program
|
|
|
42
42
|
process.exit(1);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
// We put components neatly in components/
|
|
46
|
-
const targetDir = path.join(process.cwd(), 'components', '
|
|
45
|
+
// We put components neatly in components/viora-ui instead of relying on generic ui
|
|
46
|
+
const targetDir = path.join(process.cwd(), 'components', 'viora-ui');
|
|
47
47
|
if (!fs.existsSync(targetDir)) {
|
|
48
48
|
fs.mkdirSync(targetDir, { recursive: true });
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
json.files.forEach(file => {
|
|
52
|
-
|
|
53
|
-
const fileName = path.basename(file.name || `${component}.tsx`);
|
|
52
|
+
const fileName = path.basename(file.path || file.name || `${component}.tsx`);
|
|
54
53
|
const fileContent = file.content;
|
|
55
54
|
|
|
56
|
-
|
|
55
|
+
let targetPath;
|
|
56
|
+
if (file.target) {
|
|
57
|
+
targetPath = path.join(process.cwd(), file.target);
|
|
58
|
+
const parentDir = path.dirname(targetPath);
|
|
59
|
+
if (!fs.existsSync(parentDir)) {
|
|
60
|
+
fs.mkdirSync(parentDir, { recursive: true });
|
|
61
|
+
}
|
|
62
|
+
} else {
|
|
63
|
+
targetPath = path.join(targetDir, fileName);
|
|
64
|
+
}
|
|
65
|
+
|
|
57
66
|
fs.writeFileSync(targetPath, fileContent);
|
|
58
|
-
console.log(`\x1b[32m✔ Created ${path.
|
|
67
|
+
console.log(`\x1b[32m✔ Created ${path.relative(process.cwd(), targetPath)}\x1b[0m`);
|
|
59
68
|
});
|
|
60
69
|
|
|
61
70
|
console.log('\x1b[36m\nDone! Component added successfully.\x1b[0m');
|