forked from HyperPlay-Gaming/hyperplay-desktop-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuildResetExtension.js
32 lines (30 loc) · 918 Bytes
/
buildResetExtension.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const { spawnSync } = require('child_process')
const { existsSync } = require('fs')
const { platform } = require('os')
const process = require('process')
const [nodeExe, scriptPath, ...args] = process.argv
const resetExtensionScript =
'./node_modules/@hyperplay/extension-importer/src/resetExtension.js'
if (existsSync(resetExtensionScript)) {
console.log('spawning pkg', resetExtensionScript, args)
const command = platform() === 'win32' ? 'yarn.cmd' : 'yarn'
const result = spawnSync(
command,
[
'pkg',
resetExtensionScript,
'--out-path',
'./public/extensions/resetExecutables',
...args
],
{ shell: true }
)
if (result.error) {
console.error(result.error)
} else {
console.log('stdout: ', result.stdout.toString())
console.error('stderr: ', result.stderr.toString())
}
} else {
console.warn('Reset extension script could not be found')
}