badmfck-api-server 4.1.40 → 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.
@@ -68,7 +68,17 @@ async function Deploy(opt) {
68
68
  const items = [];
69
69
  const binExists = fs_1.default.existsSync("./bin");
70
70
  if (binExists) {
71
- items.push("./bin", "package.json");
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");
72
82
  }
73
83
  if (Array.isArray(opt.includes)) {
74
84
  for (const inc of opt.includes) {
@@ -611,7 +611,15 @@ class DeployerService extends BaseService_1.BaseService {
611
611
  }
612
612
  if (install) {
613
613
  try {
614
- (0, child_process_1.execFileSync)("npm", ["--prefix", path_1.default.resolve(destination, "__tmp"), "i", "--ignore-scripts"]);
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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "badmfck-api-server",
3
- "version": "4.1.40",
3
+ "version": "4.1.41",
4
4
  "description": "Simple API http server based on express",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",