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.
Files changed (2) hide show
  1. package/cli.js +15 -6
  2. 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/kokonutui instead of relying on generic ui
46
- const targetDir = path.join(process.cwd(), 'components', 'kokonutui');
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
- // Some registries use object {name, content}, some string. We handle object.
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
- const targetPath = path.join(targetDir, fileName);
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.join('components', 'kokonutui', fileName)}\x1b[0m`);
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');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "viora-ui",
3
- "version": "1.0.9",
3
+ "version": "1.1.1",
4
4
  "description": "The official CLI for Viora UI components.",
5
5
  "main": "cli.js",
6
6
  "bin": {