Skip to content

Commit 67b081c

Browse files
committed
fix: better runtime detection
1 parent 2968dca commit 67b081c

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

src/builder.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
const fs = require("fs");
22
const path = require("path");
33
const shell = require("shelljs");
4-
const { readConfigFile, detectRuntime, RuntimeType } = require("./utils");
4+
const { readConfigFile } = require("./utils");
5+
const { detectRuntime, RuntimeType } = require("./runtimes");
56

67
const exec = (command, options = {}) => shell.exec(command, { async: false, ...options });
78

src/proxy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ const server = http.createServer(function (req, res) {
120120
const cookie = req.headers.cookie;
121121

122122
if (cookie && validateCookie(cookie)) {
123-
const user = currentUser();
123+
const user = currentUser(cookie);
124124
const buff = Buffer.from(JSON.stringify(user), "utf-8");
125125
proxyReq.setHeader("x-ms-client-principal", buff.toString("base64"));
126126
}

src/runtimes.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,15 @@ module.exports.detectRuntime = (app_location) => {
2020
const files = fs.readdirSync(app_location);
2121

2222
if (files.some((file) => path.extname(file) === ".csproj")) {
23+
console.log(">> .NET detected.");
2324
return RuntimeType.dotnet;
2425
}
2526

2627
if (files.includes("package.json")) {
28+
console.log(">> Node.js detected.");
2729
return RuntimeType.node;
2830
}
2931

32+
console.log(">> Unknown runtime detected.");
3033
return RuntimeType.unknown;
3134
};

src/utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@ module.exports.readConfigFile = () => {
121121

122122
const detectedRuntimeType = detectRuntime(app_location);
123123
if (detectedRuntimeType === RuntimeType.node) {
124-
app_artifact_location = path.join(app_location, "bin", "Debug", "netstandard2.1", "publish", app_artifact_location);
125-
} else {
126124
app_artifact_location = path.join(app_location, app_artifact_location);
125+
} else {
126+
app_artifact_location = path.join(app_location, "bin", "Debug", "netstandard2.1", "publish", app_artifact_location);
127127
}
128128

129129
const config = {

0 commit comments

Comments
 (0)