Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
igalklebanov committed Feb 2, 2025
1 parent 13394ab commit 489fc9f
Showing 1 changed file with 16 additions and 22 deletions.
38 changes: 16 additions & 22 deletions scripts/localize-deno-dependency.mts
Original file line number Diff line number Diff line change
@@ -1,36 +1,30 @@
import { copyFile, cp } from 'node:fs/promises'
import { dirname, resolve } from 'node:path'
import { fileURLToPath } from 'node:url'
import { consola } from 'consola'
import { dirname, join, resolve } from 'pathe'

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

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

await copyFile(
resolve(distPath, 'bin.js'),
resolve(
__dirname,
'../examples/deno-package-json/node_modules/.bin/kysely',
),
)

await Promise.allSettled(
['deno-json', 'package-json'].map(async (flavor) => {
try {
return await cp(
distPath,
resolve(
__dirname,
`../examples/deno-${flavor}/node_modules/kysely-ctl/dist`,
),
{ force: true, recursive: true },
)
} catch (error) {
consola.error(error)
}
const exampleNodeModulesPath = resolve(
__dirname,
`../examples/deno-${flavor}/node_modules`,
)

await Promise.all([
copyFile(
join(distPath, 'bin.js'),
join(exampleNodeModulesPath, '.bin/kysely'),
),
cp(distPath, resolve(exampleNodeModulesPath, 'kysely-ctl/dist'), {
force: true,
recursive: true,
}),
])
}),
)
}
Expand Down

0 comments on commit 489fc9f

Please sign in to comment.