1 | const { download } = require('@prisma/fetch-engine')
|
2 | const { getLatestTag } = require('@prisma/fetch-engine')
|
3 | const pkg = require('../package.json')
|
4 | const fs = require('fs')
|
5 | const path = require('path')
|
6 |
|
7 |
|
8 | const runtimePath = eval(`require('path').join(__dirname, '../')`)
|
9 |
|
10 | async 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 |
|
35 | main()
|