cloud-ide-cide 2.0.34

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.
@@ -0,0 +1,57 @@
1
+ const { execSync } = require('child_process');
2
+ const { readFileSync } = require('fs');
3
+
4
+
5
+ async function startProject() {
6
+ const cide = JSON.parse(readFileSync('./cide.json', { encoding: 'utf8' }));
7
+ if (cide) {
8
+ let start_command = "";
9
+ if (cide.templete === 'node') {
10
+ if (!cide?.main) {
11
+ console?.log("main path for project start missing!..");
12
+ console?.log("");
13
+ console?.log("update cide.json, add main='path_to_main_file'");
14
+ } else {
15
+ start_command = "npx ts-node-dev " + cide?.main;
16
+ }
17
+ }
18
+ if (cide.templete === 'react') {
19
+ start_command = "vite";
20
+ }
21
+ if (start_command != "") {
22
+ console.log('==============================Cloud Ide CLI Welcomes you==============================');
23
+ console.log(`You are using ` + cide.templete + ` Templete!!!`)
24
+ console.log('');
25
+ console.log(cide.description);
26
+ console.log('');
27
+ console.log(start_command);
28
+ if (execSync(start_command, { stdio: 'inherit' },
29
+ (error, stdout, stderr) => {
30
+ if (error) {
31
+ console.error('Error starting project:', error);
32
+ }
33
+
34
+ if (stdout) {
35
+ console.log(stdout)
36
+ }
37
+
38
+ if (stderr) {
39
+ console.log(stderr)
40
+ }
41
+ }
42
+ )) {
43
+ if (cide.name) {
44
+ console.log(`${cide.name} Started Succesfully!`);
45
+ } else {
46
+ console.log("Project Started Succesfully!")
47
+ }
48
+ }
49
+ } else {
50
+ console.log("You have entered invalid templete");
51
+ }
52
+ } else {
53
+ console.log("Please Create the cide.json file to run project properly");
54
+ }
55
+ }
56
+
57
+ module.exports = startProject;