neura-packages 1.0.4 → 1.0.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.
Files changed (2) hide show
  1. package/cli.js +41 -7
  2. package/package.json +1 -1
package/cli.js CHANGED
@@ -3,17 +3,51 @@
3
3
  const fs = require("fs");
4
4
  const path = require("path");
5
5
 
6
+ // Recursive copy function
7
+ function copyFolderSync(source, target) {
8
+ if (!fs.existsSync(source)) {
9
+ console.log("❌ UI folder not found inside package.");
10
+ process.exit(1);
11
+ }
12
+
13
+ if (!fs.existsSync(target)) {
14
+ fs.mkdirSync(target, { recursive: true });
15
+ }
16
+
17
+ const files = fs.readdirSync(source);
18
+
19
+ files.forEach((file) => {
20
+ const srcFile = path.join(source, file);
21
+ const destFile = path.join(target, file);
22
+
23
+ if (fs.lstatSync(srcFile).isDirectory()) {
24
+ copyFolderSync(srcFile, destFile);
25
+ } else {
26
+ if (!fs.existsSync(destFile)) {
27
+ fs.copyFileSync(srcFile, destFile);
28
+ }
29
+ }
30
+ });
31
+ }
32
+
6
33
  const command = process.argv[2];
7
34
 
8
35
  if (command === "init") {
9
- const targetDir = path.join(process.cwd(), "UI");
36
+ const projectRoot = process.cwd();
37
+ const srcPath = path.join(projectRoot, "src");
10
38
 
11
- if (!fs.existsSync(targetDir)) {
12
- fs.mkdirSync(targetDir);
13
- console.log("✅ UI folder created successfully!");
14
- } else {
15
- console.log("⚠ UI folder already exists.");
39
+ if (!fs.existsSync(srcPath)) {
40
+ console.log("❌ No src folder found. Run inside a Vite/React project.");
41
+ process.exit(1);
16
42
  }
43
+
44
+ const templatePath = path.join(__dirname, "UI");
45
+ const targetPath = path.join(srcPath, "UI");
46
+
47
+ copyFolderSync(templatePath, targetPath);
48
+
49
+ console.log("✅ UI folder copied successfully into src/UI");
17
50
  } else {
18
- console.log("Usage: npx neura init");
51
+ console.log("Usage:");
52
+ console.log(" npx neura init");
19
53
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neura-packages",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "",
5
5
  "main": "UI/index.js",
6
6
  "files": [