@liorandb/studio 0.0.1 → 0.0.2

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/bin/index.js +16 -5
  2. package/package.json +1 -1
package/bin/index.js CHANGED
@@ -1,19 +1,30 @@
1
1
  #!/usr/bin/env node
2
2
  import fs from "fs";
3
3
  import path from "path";
4
+ import { fileURLToPath } from "url";
4
5
  import { execSync } from "child_process";
5
6
 
6
- const target = process.cwd();
7
- const templateDir = new URL("../template", import.meta.url).pathname;
7
+ const __filename = fileURLToPath(import.meta.url);
8
+ const __dirname = path.dirname(__filename);
9
+
10
+ const templateDir = path.resolve(__dirname, "../template");
11
+ const targetDir = process.argv[2]
12
+ ? path.resolve(process.argv[2])
13
+ : process.cwd();
8
14
 
9
15
  console.log("šŸš€ Creating LioranDB Studio...\n");
10
16
 
11
- fs.cpSync(templateDir, target, { recursive: true });
17
+ if (!fs.existsSync(templateDir)) {
18
+ console.error("āŒ Template directory not found:", templateDir);
19
+ process.exit(1);
20
+ }
21
+
22
+ fs.cpSync(templateDir, targetDir, { recursive: true });
12
23
 
13
24
  console.log("šŸ“¦ Installing dependencies...\n");
14
25
 
15
- execSync("npm install", { stdio: "inherit" });
26
+ execSync("npm install", { stdio: "inherit", cwd: targetDir });
16
27
 
17
28
  console.log("\nšŸ”„ Starting dev server...\n");
18
29
 
19
- execSync("npm run dev", { stdio: "inherit" });
30
+ execSync("npm run dev", { stdio: "inherit", cwd: targetDir });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liorandb/studio",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "bin": {
5
5
  "liorandb-studio": "./bin/index.js"
6
6
  },