Skip to content

Commit e7a4f84

Browse files
committed
postinstall checks for DRM first if applicable
1 parent 02d8677 commit e7a4f84

1 file changed

Lines changed: 14 additions & 16 deletions

File tree

tools/postinstall.js

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -43,20 +43,6 @@ async function main () {
4343
await fs.mkdir(path.join(__dirname, '..', 'build', 'Release'))
4444
} catch (e) {}
4545

46-
try {
47-
const data = await fetch(url).then(r => {
48-
if (r.status !== 200) {
49-
throw new Error(`Status: ${r.status}`)
50-
}
51-
return r
52-
}).then(r => r.arrayBuffer())
53-
await fs.writeFile(targetPath, toBuffer(data))
54-
console.log('Found on releases.')
55-
process.exit(0)
56-
} catch (e) {
57-
console.error(e.message)
58-
}
59-
6046
if (process.platform === 'linux' && (process.arch === 'arm' || process.arch === 'arm64')) {
6147
targetPath = path.join(__dirname, '..', 'build', 'Release', 'node-raylib-drm.node')
6248
url = `https://github.com/RobLoach/node-raylib/releases/download/v${process.env.npm_package_version}/node-raylib-${process.platform}-${process.arch}-drm.node`
@@ -69,12 +55,24 @@ async function main () {
6955
}).then(r => r.arrayBuffer())
7056
await fs.writeFile(targetPath, toBuffer(data))
7157
console.log('Found DRM on releases.')
72-
process.exit(0)
7358
} catch (e) {
74-
console.error(e.message)
7559
}
7660
}
7761

62+
try {
63+
const data = await fetch(url).then(r => {
64+
if (r.status !== 200) {
65+
throw new Error(`Status: ${r.status}`)
66+
}
67+
return r
68+
}).then(r => r.arrayBuffer())
69+
await fs.writeFile(targetPath, toBuffer(data))
70+
console.log('Found on releases.')
71+
process.exit(0)
72+
} catch (e) {
73+
console.error(e.message)
74+
}
75+
7876
// couldn't find it, so tell postinstall to compile it
7977
console.log('Not found. Building.')
8078
process.exit(1)

0 commit comments

Comments
 (0)