nestai-framework
Version:
Unlocking Next-Gen AI Agents with N.E.S.T.
28 lines (22 loc) • 715 B
text/typescript
/**
* Postinstall script to ensure
* that package.json has a \n as EOL.
*/
import fs from "fs-extra";
import path from "path";
import { rootDir } from "./_lib";
// const files = ["bun.lockb", "package.json"];
const files = ["package.json"];
try {
files.forEach(file => {
const filePath = path.join(rootDir, file);
const content = fs.readFileSync(filePath, "utf-8");
if (!content.endsWith("\n")) {
const fixedContent = content.replace(/\r\n/g, "\n");
fs.writeFileSync(filePath, fixedContent + "\n");
}
});
} catch (error) {
console.error("Error while ensuring EOL in package.json", error);
process.exit(1);
}