Skip to content

Commit dd8c192

Browse files
committed
simplify
1 parent 0e8a7d7 commit dd8c192

2 files changed

Lines changed: 6 additions & 15 deletions

File tree

src/identifier.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ import { versions } from 'node:process';
44
import * as libc from 'detect-libc';
55
import { getAbi } from 'node-abi';
66

7-
const stdlib = libc.familySync();
8-
const platform = process.env['BUILD_PLATFORM'] || os.platform();
9-
const arch = process.env['BUILD_ARCH'] || os.arch();
10-
const abi = getAbi(versions.node, 'node');
11-
7+
export const stdlib = libc.familySync();
8+
export const platform = process.env['BUILD_PLATFORM'] || os.platform();
9+
export const arch = process.env['BUILD_ARCH'] || os.arch();
10+
export const abi = getAbi(versions.node, 'node');
1211
export const identifier = [platform, arch, stdlib, abi].filter(c => c !== undefined && c !== null).join('-');

src/index.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,11 @@
11
/* eslint-disable no-console */
22
import type { AsyncLocalStorage } from 'node:async_hooks';
33
import { spawnSync } from 'node:child_process';
4-
import * as os from 'node:os';
54
import * as path from 'node:path';
6-
import { env, versions } from 'node:process';
5+
import { env } from 'node:process';
76
import { threadId } from 'node:worker_threads';
8-
import * as libc from 'detect-libc';
9-
import { getAbi } from 'node-abi';
107
import { copyBinary } from './copy-binary';
11-
12-
const stdlib = libc.familySync();
13-
const platform = process.env['BUILD_PLATFORM'] || os.platform();
14-
const arch = process.env['BUILD_ARCH'] || os.arch();
15-
const abi = getAbi(versions.node, 'node');
16-
const identifier = [platform, arch, stdlib, abi].filter(c => c !== undefined && c !== null).join('-');
8+
import { abi, arch, identifier, platform, stdlib } from './identifier';
179

1810
type AsyncStorageArgs = {
1911
/** The AsyncLocalStorage instance used to fetch the store */

0 commit comments

Comments
 (0)