UNPKG

821 BJavaScriptView Raw
1const { download } = require('@prisma/fetch-engine')
2const { getLatestTag } = require('@prisma/fetch-engine')
3const pkg = require('../package.json')
4const fs = require('fs')
5const path = require('path')
6
7// Until https://github.com/zeit/ncc/issues/390 is resolved we have to do this 🙈
8const runtimePath = eval(`require('path').join(__dirname, '../')`)
9
10async function main() {
11 const tag = await getLatestTag()
12 pkg.prisma = pkg.prisma || {}
13 pkg.prisma.version = tag
14
15 fs.writeFileSync(
16 path.join(__dirname, '../package.json'),
17 JSON.stringify(pkg, null, 2),
18 )
19
20 await download({
21 binaries: {
22 'query-engine': runtimePath,
23 },
24 showProgress: true,
25 printVersion: true,
26 ignoreCache: true,
27 version: tag
28 }).catch((e) => {
29 console.error(e)
30 process.exit(1)
31 })
32
33}
34
35main()