viora-ui 1.1.0 → 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 +13 -4
  2. package/package.json +1 -1
package/cli.js CHANGED
@@ -49,13 +49,22 @@ program
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', 'viora-ui', 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.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "The official CLI for Viora UI components.",
5
5
  "main": "cli.js",
6
6
  "bin": {