@knapsack/app
Version:
Build Design Systems with Knapsack
44 lines • 1.99 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.mkcertProcessOptions = exports.settingsPath = exports.binaryName = exports.version = void 0;
const os_1 = __importDefault(require("os"));
const path_1 = __importDefault(require("path"));
const utils_1 = require("@knapsack/utils");
const log_1 = require("./log");
/** the mkcert binary version */
// @todo: is it worth having some logic here to help keep this version # up to date?
exports.version = '1.4.4';
const platformMap = {
linux: 'linux',
darwin: 'darwin',
win32: 'windows',
};
const architectureMap = {
arm: 'arm',
arm64: 'arm64',
x64: 'amd64',
};
const plat = os_1.default.platform();
const platform = (0, utils_1.isObjKey)(plat, platformMap) ? platformMap[plat] : undefined;
const arch = os_1.default.arch();
const architecture = (0, utils_1.isObjKey)(arch, architectureMap)
? architectureMap[arch]
: undefined;
if (platform === undefined) {
log_1.log.warn(`Automatic HTTPS support for the ${plat} platform is unsupported...`);
}
if (architecture === undefined) {
log_1.log.warn(`Automatic HTTPS support for the ${arch} architecture is unsupported...`);
}
/** the mkcert binary name. Falls back to using linux + x64 if we somehow run across an unknown / unsupported system. */
exports.binaryName = `mkcert-v${exports.version}-${platform || platformMap.linux}-${architecture || architectureMap.x64}${platform === 'windows' ? '.exe' : ''}`;
/** the path to the folder containing any SSL certs + binary downloaded */
exports.settingsPath = path_1.default.join(os_1.default.homedir(), '.knapsack.cloud', 'auto-encrypt-localhost');
exports.mkcertProcessOptions = {
name: 'Knapsack dev server is configuring local HTTPS',
env: { ...process.env, CAROOT: exports.settingsPath },
};
//# sourceMappingURL=constants.js.map