Files
optolith-client/deploy/remotePath.js
T
2023-11-01 17:17:46 +01:00

32 lines
675 B
JavaScript

// @ts-check
import { join } from "path/posix"
/**
* @param {"prerelease" | "stable"} channel
*/
const remoteChannelPath = channel => {
switch (channel) {
case "prerelease": return "insider"
case "stable": return "."
}
}
/**
* @param {import("./platform.js").System} os
*/
const remoteOsPath = os => {
switch (os) {
case "win": return "win"
case "linux": return "linux"
default: return "mac"
}
}
/**
* @param {string} root
* @param {"prerelease" | "stable"} channel
* @param {import("./platform.js").System} os
*/
export const getRemotePath = (root, channel, os) =>
join(root, remoteChannelPath(channel), remoteOsPath(os))