@batistafull/deploy-server 1.0.0
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/deploy-server.js +39 -0
- package/package.json +13 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { execSync } = require("child_process");
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
const os = require("os");
|
|
7
|
+
|
|
8
|
+
function run() {
|
|
9
|
+
const projectRoot = process.cwd(); // 👈 importante: proyecto donde se instala
|
|
10
|
+
|
|
11
|
+
const documentsPath =
|
|
12
|
+
process.platform === "win32"
|
|
13
|
+
? path.join(process.env.USERPROFILE, "Documents")
|
|
14
|
+
: path.join(os.homedir(), "Documents");
|
|
15
|
+
|
|
16
|
+
const destination = path.join(documentsPath, "app.host");
|
|
17
|
+
|
|
18
|
+
const distPath = path.join(projectRoot, "dist");
|
|
19
|
+
const apiPath = path.join(projectRoot, "server", "api");
|
|
20
|
+
|
|
21
|
+
console.log("📁 Creando carpeta...");
|
|
22
|
+
fs.mkdirSync(destination, { recursive: true });
|
|
23
|
+
|
|
24
|
+
console.log("⚙️ Ejecutando build...");
|
|
25
|
+
execSync("npm run build", {
|
|
26
|
+
cwd: projectRoot,
|
|
27
|
+
stdio: "inherit"
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
console.log("📦 Copiando dist...");
|
|
31
|
+
fs.cpSync(distPath, destination, { recursive: true });
|
|
32
|
+
|
|
33
|
+
console.log("📦 Copiando server/api...");
|
|
34
|
+
fs.cpSync(apiPath, destination, { recursive: true });
|
|
35
|
+
|
|
36
|
+
console.log("✅ Deploy completado en:", destination);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
run();
|
package/package.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@batistafull/deploy-server",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Deploy tool that builds and copies dist + api to Documents/app.host",
|
|
5
|
+
"main": "bin/deploy-server.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"deploy-server": "bin/deploy-server.js"
|
|
8
|
+
},
|
|
9
|
+
"keywords": ["deploy", "cli", "nodejs"],
|
|
10
|
+
"author": "batistafull",
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"type": "commonjs"
|
|
13
|
+
}
|