quapp 1.0.1 → 1.0.3
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/package.json +15 -5
- package/server.js +4 -45
package/package.json
CHANGED
|
@@ -1,20 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "quapp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
7
7
|
},
|
|
8
8
|
"type": "module",
|
|
9
|
-
"author": "",
|
|
9
|
+
"author": "Quapp",
|
|
10
10
|
"bin": {
|
|
11
11
|
"quapp": "./bin/cli.js"
|
|
12
12
|
},
|
|
13
|
-
"license": "
|
|
14
|
-
"description": "",
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"description": "A lightweight CLI tool that starts a Vite/Angular development server with LAN-accessible QR code and prepares your app for production with a simple build command.",
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"archiver": "^7.0.1",
|
|
17
17
|
"open": "^10.1.2",
|
|
18
18
|
"qrcode-terminal": "^0.12.0"
|
|
19
|
-
}
|
|
19
|
+
},
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "https://github.com/Quapp-Store/Quapp/tree/main/packages/quapp"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"README.md",
|
|
26
|
+
"server.js",
|
|
27
|
+
"bin/cli.js",
|
|
28
|
+
"build.js"
|
|
29
|
+
]
|
|
20
30
|
}
|
package/server.js
CHANGED
|
@@ -62,40 +62,6 @@ const getIP = (networkType = "local") => {
|
|
|
62
62
|
return "localhost";
|
|
63
63
|
};
|
|
64
64
|
|
|
65
|
-
// Check if Vite is installed
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
function isViteInstalled() {
|
|
69
|
-
const result = spawnSync(
|
|
70
|
-
process.platform === "win32" ? "npx.cmd" : "npx",
|
|
71
|
-
["vite", "--version"],
|
|
72
|
-
{ stdio: "ignore" }
|
|
73
|
-
);
|
|
74
|
-
return result.status === 0;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
// Install Vite
|
|
80
|
-
const installVite = () => {
|
|
81
|
-
return new Promise((resolve, reject) => {
|
|
82
|
-
console.log("📦 Installing Vite...");
|
|
83
|
-
const install = spawn("npm", ["install", "vite", "-D"], {
|
|
84
|
-
stdio: "inherit",
|
|
85
|
-
shell: true,
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
install.on("exit", (code) => {
|
|
89
|
-
if (code === 0) {
|
|
90
|
-
console.log("✅ Vite installed.");
|
|
91
|
-
resolve();
|
|
92
|
-
} else {
|
|
93
|
-
reject(new Error("Failed to install Vite"));
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
});
|
|
97
|
-
};
|
|
98
|
-
|
|
99
65
|
// Start Vite server
|
|
100
66
|
const startVite = (port, attempt = 0) => {
|
|
101
67
|
const host = config.server.network === "private" ? getIP("private") : "localhost";
|
|
@@ -122,7 +88,10 @@ const startVite = (port, attempt = 0) => {
|
|
|
122
88
|
process.exit(1);
|
|
123
89
|
}
|
|
124
90
|
|
|
125
|
-
const vite = spawn(
|
|
91
|
+
const vite = spawn("npx", ["vite", ...viteArgs], {
|
|
92
|
+
stdio: "pipe",
|
|
93
|
+
shell: true,
|
|
94
|
+
});
|
|
126
95
|
|
|
127
96
|
vite.stdout.on("data", (data) => process.stdout.write(data));
|
|
128
97
|
vite.stderr.on("data", (data) => process.stderr.write(data));
|
|
@@ -156,16 +125,6 @@ const startVite = (port, attempt = 0) => {
|
|
|
156
125
|
// Main
|
|
157
126
|
const main = async () => {
|
|
158
127
|
await loadUserConfig();
|
|
159
|
-
|
|
160
|
-
if (!isViteInstalled()) {
|
|
161
|
-
try {
|
|
162
|
-
await installVite();
|
|
163
|
-
} catch (err) {
|
|
164
|
-
console.error("❌ Failed to install Vite automatically. Please install it manually.");
|
|
165
|
-
process.exit(1);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
128
|
startVite(config.server.port);
|
|
170
129
|
};
|
|
171
130
|
|