template-nestjs-generator
Version:
A custom NestJS CRUD generator
21 lines (18 loc) • 596 B
JavaScript
const fs = require("fs")
const path = require("path")
const filePath = path.join(__dirname, "..", "dist", "index.js")
const shebang = "#!/usr/bin/env node\n"
fs.readFile(filePath, { encoding: "utf8" }, (err, data) => {
if (err) {
console.error("Error reading the file:", err)
return
}
const updatedContent = shebang + data
fs.writeFile(filePath, updatedContent, (err) => {
if (err) {
console.error("Error writing the file:", err)
} else {
console.log("Shebang added successfully.")
}
})
})