Skip to content

Commit 489fc9f

Browse files
committed
...
1 parent 13394ab commit 489fc9f

File tree

1 file changed

+16
-22
lines changed

1 file changed

+16
-22
lines changed

scripts/localize-deno-dependency.mts

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,30 @@
11
import { copyFile, cp } from 'node:fs/promises'
2-
import { dirname, resolve } from 'node:path'
32
import { fileURLToPath } from 'node:url'
4-
import { consola } from 'consola'
3+
import { dirname, join, resolve } from 'pathe'
54

65
const __filename = fileURLToPath(import.meta.url)
76
const __dirname = dirname(__filename)
87

98
async function main() {
109
const distPath = resolve(__dirname, '../dist')
1110

12-
await copyFile(
13-
resolve(distPath, 'bin.js'),
14-
resolve(
15-
__dirname,
16-
'../examples/deno-package-json/node_modules/.bin/kysely',
17-
),
18-
)
19-
2011
await Promise.allSettled(
2112
['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+
])
3428
}),
3529
)
3630
}

0 commit comments

Comments
 (0)