|
1 | 1 | import { copyFile, cp } from 'node:fs/promises'
|
2 |
| -import { dirname, resolve } from 'node:path' |
3 | 2 | import { fileURLToPath } from 'node:url'
|
4 |
| -import { consola } from 'consola' |
| 3 | +import { dirname, join, resolve } from 'pathe' |
5 | 4 |
|
6 | 5 | const __filename = fileURLToPath(import.meta.url)
|
7 | 6 | const __dirname = dirname(__filename)
|
8 | 7 |
|
9 | 8 | async function main() {
|
10 | 9 | const distPath = resolve(__dirname, '../dist')
|
11 | 10 |
|
12 |
| - await copyFile( |
13 |
| - resolve(distPath, 'bin.js'), |
14 |
| - resolve( |
15 |
| - __dirname, |
16 |
| - '../examples/deno-package-json/node_modules/.bin/kysely', |
17 |
| - ), |
18 |
| - ) |
19 |
| - |
20 | 11 | await Promise.allSettled(
|
21 | 12 | ['deno-json', 'package-json'].map(async (flavor) => {
|
22 |
| - try { |
23 |
| - return await cp( |
24 |
| - distPath, |
25 |
| - resolve( |
26 |
| - __dirname, |
27 |
| - `../examples/deno-${flavor}/node_modules/kysely-ctl/dist`, |
28 |
| - ), |
29 |
| - { force: true, recursive: true }, |
30 |
| - ) |
31 |
| - } catch (error) { |
32 |
| - consola.error(error) |
33 |
| - } |
| 13 | + const exampleNodeModulesPath = resolve( |
| 14 | + __dirname, |
| 15 | + `../examples/deno-${flavor}/node_modules`, |
| 16 | + ) |
| 17 | + |
| 18 | + await Promise.all([ |
| 19 | + copyFile( |
| 20 | + join(distPath, 'bin.js'), |
| 21 | + join(exampleNodeModulesPath, '.bin/kysely'), |
| 22 | + ), |
| 23 | + cp(distPath, resolve(exampleNodeModulesPath, 'kysely-ctl/dist'), { |
| 24 | + force: true, |
| 25 | + recursive: true, |
| 26 | + }), |
| 27 | + ]) |
34 | 28 | }),
|
35 | 29 | )
|
36 | 30 | }
|
|
0 commit comments