Files
archived-next-auth/packages/frameworks-sveltekit/scripts/postbuild.js
James dfe6509472 fix: comment Discord profile, fix @auth/sveltekit build on Windows (#6550)
* 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>
2023-01-29 12:05:14 +00:00

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"),
})