Initial curated projectbrain source from 8a7b1e0651dbdab97d744cbd2e653ab3970ac6c5
This commit is contained in:
commit
5aa3e8d685
700 files changed
+132801
No files matched your search
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env node
|
||||
import { spawn } from "node:child_process";
|
||||
import { createRequire } from "node:module";
|
||||
|
||||
const require = createRequire(import.meta.url);
|
||||
const prismaCli = require.resolve("prisma/build/index.js");
|
||||
|
||||
const child = spawn(process.execPath, [prismaCli, "generate", "--schema", "prisma/schema.prisma"], {
|
||||
stdio: ["ignore", "pipe", "pipe"],
|
||||
env: {
|
||||
...process.env,
|
||||
PRISMA_HIDE_UPDATE_MESSAGE: "true",
|
||||
},
|
||||
});
|
||||
|
||||
const writeFiltered = (stream, chunk) => {
|
||||
const lines = chunk
|
||||
.toString()
|
||||
.split(/\r?\n/)
|
||||
.filter((line) => {
|
||||
const trimmed = line.trim();
|
||||
return (
|
||||
trimmed &&
|
||||
!trimmed.startsWith("Tip:") &&
|
||||
!trimmed.startsWith("Help us improve the Prisma ORM") &&
|
||||
!trimmed.includes("https://pris.ly/orm/survey/")
|
||||
);
|
||||
});
|
||||
|
||||
if (lines.length) stream.write(`${lines.join("\n")}\n`);
|
||||
};
|
||||
|
||||
child.stdout?.on("data", (chunk) => writeFiltered(process.stdout, chunk));
|
||||
child.stderr?.on("data", (chunk) => writeFiltered(process.stderr, chunk));
|
||||
|
||||
child.on("error", (error) => {
|
||||
console.error(`Failed to start Prisma: ${error.message}`);
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
child.on("close", (code) => {
|
||||
process.exit(code ?? 1);
|
||||
});
|
||||
Reference in new issue
Block a user