@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.
- package/bin/index.js +16 -5
- 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
|
|
7
|
-
const
|
|
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.
|
|
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 });
|