badmfck-api-server 4.1.39 → 4.1.41
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.
|
@@ -65,7 +65,21 @@ async function Deploy(opt) {
|
|
|
65
65
|
console.log("Build");
|
|
66
66
|
var execResult = run("npm run build");
|
|
67
67
|
console.log(execResult);
|
|
68
|
-
const items = [
|
|
68
|
+
const items = [];
|
|
69
|
+
const binExists = fs_1.default.existsSync("./bin");
|
|
70
|
+
if (binExists) {
|
|
71
|
+
items.push("./bin");
|
|
72
|
+
if (fs_1.default.existsSync("package.json")) {
|
|
73
|
+
items.push("package.json");
|
|
74
|
+
}
|
|
75
|
+
if (fs_1.default.existsSync("package-lock.json")) {
|
|
76
|
+
items.push("package-lock.json");
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
else if (fs_1.default.existsSync("./dist") && fs_1.default.existsSync(path_1.default.resolve("dist", "index.html"))) {
|
|
80
|
+
console.log("No ./bin found — detected ./dist with index.html, using it as distribution");
|
|
81
|
+
items.push("./dist");
|
|
82
|
+
}
|
|
69
83
|
if (Array.isArray(opt.includes)) {
|
|
70
84
|
for (const inc of opt.includes) {
|
|
71
85
|
if (typeof inc !== "string" || inc.length === 0)
|
|
@@ -80,6 +94,9 @@ async function Deploy(opt) {
|
|
|
80
94
|
items.push(inc);
|
|
81
95
|
}
|
|
82
96
|
}
|
|
97
|
+
if (items.length === 0) {
|
|
98
|
+
throw new Error("Nothing to archive (no ./bin and no includes specified)");
|
|
99
|
+
}
|
|
83
100
|
const excludes = new Set();
|
|
84
101
|
const addExclude = (raw, source) => {
|
|
85
102
|
if (typeof raw !== "string")
|
|
@@ -611,7 +611,15 @@ class DeployerService extends BaseService_1.BaseService {
|
|
|
611
611
|
}
|
|
612
612
|
if (install) {
|
|
613
613
|
try {
|
|
614
|
-
|
|
614
|
+
const tmpDir = path_1.default.resolve(destination, "__tmp");
|
|
615
|
+
const useCi = fs_1.default.existsSync(path_1.default.resolve(tmpDir, "package-lock.json"));
|
|
616
|
+
if (!useCi) {
|
|
617
|
+
(0, LogService_1.logWarn)("No package-lock.json in uploaded tarball — falling back to `npm i`. " +
|
|
618
|
+
"This is non-deterministic and vulnerable to supply-chain attacks. " +
|
|
619
|
+
"Commit and include package-lock.json for `npm ci` (deterministic + faster).");
|
|
620
|
+
}
|
|
621
|
+
const npmCmd = useCi ? "ci" : "i";
|
|
622
|
+
(0, child_process_1.execFileSync)("npm", ["--prefix", tmpDir, npmCmd, "--ignore-scripts"]);
|
|
615
623
|
}
|
|
616
624
|
catch (e) {
|
|
617
625
|
console.error(e);
|