Skip to content

Instantly share code, notes, and snippets.

@johncantrell97
Created March 2, 2022 16:35
Show Gist options
  • Save johncantrell97/f1e3aefc71302baebbd703447cdf71c7 to your computer and use it in GitHub Desktop.
Save johncantrell97/f1e3aefc71302baebbd703447cdf71c7 to your computer and use it in GitHub Desktop.
A esbuild plugin for arc typescript to copy your schema.prisma file into your lambda build directories
let copyPrismaSchema = {
name: "copy-prisma-schema",
setup(build) {
build.onEnd((result) => {
const fs = require("fs");
const source = `${__dirname}/prisma/schema.prisma`;
const destination = build.initialOptions.outfile.replace(
"index.js",
"schema.prisma"
);
fs.copyFileSync(source, destination);
});
},
};
module.exports = {
plugins: [copyPrismaSchema],
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment