mirror of
https://github.com/SrIzan10/next-auth.git
synced 2026-05-01 10:55:20 +00:00
* fix: discord types were inaccurate * fix: build on windows computers * Apply review suggestions * Update discord.ts --------- Co-authored-by: Balázs Orbán <info@balazsorban.com>
22 lines
699 B
JavaScript
22 lines
699 B
JavaScript
// After build, copy the files in ./package to the root directory, excluding the package.json file.
|
|
|
|
import fs from "fs/promises"
|
|
import path from "path"
|
|
|
|
let __dirname = path.dirname(new URL(import.meta.url).pathname)
|
|
|
|
// The above hack to polyfill "__dirname" for ESM does not work on Windows computers,
|
|
// so we might have to manually perform more steps.
|
|
__dirname = __dirname.split(path.sep).join(path.posix.sep)
|
|
if (__dirname.match(/^\/\w:\//)) {
|
|
__dirname = __dirname.slice(3) // Remove the drive prefix.
|
|
}
|
|
|
|
const root = path.join(__dirname, "..")
|
|
const pkgDir = path.join(root, "package")
|
|
|
|
await fs.cp(pkgDir, root, {
|
|
recursive: true,
|
|
filter: (src) => !src.includes("package.json"),
|
|
})
|