Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@prisma/get-platform

Package Overview
Dependencies
Maintainers
4
Versions
7833
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@prisma/get-platform - npm Package Compare versions

Comparing version 0.0.3 to 0.1.0

10

dist/getPlatform.d.ts

@@ -6,5 +6,15 @@ /// <reference types="node" />

libssl?: string;
distro?: {
dist: string;
codename: string;
release: string;
};
};
export declare function getos(): Promise<GetOSResult>;
export declare function resolveUbuntu(): Promise<null | {
dist: string;
release: string;
codename: string;
}>;
export declare function getLibSslVersion(): Promise<string | undefined>;
export declare function getPlatform(): Promise<Platform>;

29

dist/getPlatform.js

@@ -7,5 +7,9 @@ "use strict";

const os_1 = __importDefault(require("os"));
const fs_1 = __importDefault(require("fs"));
const util_1 = require("util");
const child_process_1 = require("child_process");
const debug_1 = __importDefault(require("debug"));
const debug = debug_1.default('getos');
const readFile = util_1.promisify(fs_1.default.readFile);
const exists = util_1.promisify(fs_1.default.exists);
async function getos() {

@@ -21,5 +25,25 @@ const platform = os_1.default.platform();

libssl: await getLibSslVersion(),
distro: await resolveUbuntu(),
};
}
exports.getos = getos;
async function resolveUbuntu() {
if (await exists('/etc/lsb-release')) {
const idRegex = /distrib_id=(.*)/i;
const releaseRegex = /distrib_release=(.*)/i;
const codenameRegex = /distrib_codename=(.*)/i;
const file = await readFile('/etc/lsb-release', 'utf-8');
const idMatch = file.match(idRegex);
const id = (idMatch && idMatch[1]) || null;
const codenameMatch = file.match(codenameRegex);
const codename = (codenameMatch && codenameMatch[1]) || null;
const releaseMatch = file.match(releaseRegex);
const release = (releaseMatch && releaseMatch[1]) || null;
if (id && codename && release && id.toLowerCase() === 'ubuntu') {
return { dist: id, release, codename };
}
}
return null;
}
exports.resolveUbuntu = resolveUbuntu;
async function getLibSslVersion() {

@@ -62,3 +86,3 @@ const [version, ls] = await Promise.all([

async function getPlatform() {
const { platform, libssl } = await getos();
const { platform, libssl, distro } = await getos();
if (platform === 'darwin') {

@@ -70,2 +94,5 @@ return 'darwin';

if (libssl === '1.0.2') {
if (distro && distro.codename === 'xenial') {
return 'linux-glibc-libssl1.0.2-ubuntu1604';
}
return 'linux-glibc-libssl1.0.2';

@@ -72,0 +99,0 @@ }

2

dist/platforms.d.ts

@@ -1,1 +0,1 @@

export declare type Platform = 'native' | 'darwin' | 'linux-glibc-libssl1.0.1' | 'linux-glibc-libssl1.0.2' | 'linux-glibc-libssl1.1.0';
export declare type Platform = 'native' | 'darwin' | 'linux-glibc-libssl1.0.1' | 'linux-glibc-libssl1.0.2' | 'linux-glibc-libssl1.0.2-ubuntu1604' | 'linux-glibc-libssl1.1.0';
{
"name": "@prisma/get-platform",
"version": "0.0.3",
"version": "0.1.0",
"main": "dist/index.js",

@@ -5,0 +5,0 @@ "types": "dist/index.d.ts",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc