diff --git a/src/v8/update-class-validator.ts b/src/v8/update-class-validator.ts new file mode 100644 index 0000000..7587936 --- /dev/null +++ b/src/v8/update-class-validator.ts @@ -0,0 +1,18 @@ +import { existsSync } from "fs"; +import { readFile, writeFile } from "fs/promises"; + +export const stage = "before-install"; + +export default async function updateClassValidator() { + if (!existsSync("api/package.json")) { + return; + } + + const packageJson = JSON.parse(await readFile("api/package.json", "utf-8")); + + if (packageJson.dependencies) { + packageJson.dependencies["class-validator"] = "^0.14.0"; + } + + await writeFile("api/package.json", JSON.stringify(packageJson, null, 4)); +}