Skip to content

Commit 2cb528a

Browse files
committed
chore: convert system util to TS
1 parent a1a8f27 commit 2cb528a

File tree

6 files changed

+33
-40
lines changed

6 files changed

+33
-40
lines changed

packages/server/lib/cloud/exception.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Bluebird from 'bluebird'
33
import pkg from '@packages/root'
44
import api from './api'
55
import user from './user'
6-
import system from '../util/system'
6+
import * as system from '../util/system'
77
import { stripPath } from './strip_path'
88

99
const { serializeError } = require('serialize-error')

packages/server/lib/modes/run.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import runEvents from '../plugins/run_events'
1818
import * as env from '../util/env'
1919
import trash from '../util/trash'
2020
import { id as randomId } from '../util/random'
21-
import system from '../util/system'
21+
import * as system from '../util/system'
2222
import chromePolicyCheck from '../util/chrome_policy_check'
2323
import type { SpecWithRelativeRoot, SpecFile, TestingType, OpenProjectLaunchOpts, FoundBrowser, BrowserVideoController, VideoRecording, ProcessOptions, ProtocolManagerShape, AutomationCommands } from '@packages/types'
2424
import type { Cfg, ProjectBase } from '../project-base'

packages/server/lib/project-base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import * as savedState from './saved_state'
1515
import { SocketCt } from './socket-ct'
1616
import { SocketE2E } from './socket-e2e'
1717
import { ensureProp } from './util/class-helpers'
18-
import system from './util/system'
18+
import * as system from './util/system'
1919
import type {
2020
BannersState,
2121
FoundBrowser,

packages/server/lib/util/system.js

Lines changed: 0 additions & 35 deletions
This file was deleted.

packages/server/lib/util/system.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import os from 'os'
2+
import si from 'systeminformation'
3+
4+
const getOsVersion = async () => {
5+
try {
6+
const osInfo = await si.osInfo()
7+
8+
if (osInfo.distro && osInfo.release) {
9+
return `${osInfo.distro} - ${osInfo.release}`
10+
}
11+
12+
return os.release()
13+
} catch (error) {
14+
return os.release()
15+
}
16+
}
17+
18+
export const info = async () => {
19+
const osVersion = await getOsVersion()
20+
21+
return {
22+
osName: os.platform(),
23+
osVersion,
24+
osCpus: os.cpus(),
25+
osMemory: {
26+
free: os.freemem(),
27+
total: os.totalmem(),
28+
},
29+
}
30+
}

packages/server/test/unit/cloud/exceptions_spec.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
require('../../spec_helper')
2-
31
delete global.fs
42

53
const api = require('../../../lib/cloud/api').default

0 commit comments

Comments
 (0)