@veecode-platform/safira-cli
Version:
Generate a microservice project from your spec.
45 lines (44 loc) • 1.5 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.PlatformUtil = exports.Architecture = exports.Platform = void 0;
const support_exception_1 = require("../exception/support-exception");
var Platform;
(function (Platform) {
Platform["darwin"] = "darwin";
Platform["linux"] = "linux";
Platform["win32"] = "win32";
})(Platform = exports.Platform || (exports.Platform = {}));
var Architecture;
(function (Architecture) {
Architecture["x64"] = "x64";
Architecture["x86"] = "x86";
Architecture["arm64"] = "arm64";
})(Architecture = exports.Architecture || (exports.Architecture = {}));
class PlatformUtil {
static isLinux() {
return this.platformName() === Platform.linux;
}
static isMacOS() {
return this.platformName() === Platform.darwin;
}
static isWindows() {
return this.platformName() === Platform.win32;
}
static platformName() {
return process.platform;
}
static architecture() {
switch (process.arch) {
case Architecture.x64:
return Architecture.x64;
case PlatformUtil.x32:
return Architecture.x86;
case Architecture.arm64:
return Architecture.arm64;
default:
throw new support_exception_1.ArchitectureNotSupportedException(`Unsupported architecture: ${process.arch}`);
}
}
}
exports.PlatformUtil = PlatformUtil;
PlatformUtil.x32 = "x32";