diff --git a/package.json b/package.json index 7a0215c..5bc4c44 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "shrimp-task-manager": "./dist/index.js" }, "scripts": { - "build": "tsc", + "build": "tsc && node scripts/add-shebang.js", "dev": "ts-node src/index.ts", "start": "node dist/index.js", "test": "echo \"Error: no test specified\" && exit 1" diff --git a/scripts/add-shebang.js b/scripts/add-shebang.js new file mode 100644 index 0000000..65c3a7a --- /dev/null +++ b/scripts/add-shebang.js @@ -0,0 +1,12 @@ +import fs from "fs"; +const filePath = "./dist/index.js"; +const shebang = "#!/usr/bin/env node\n"; + +let content = fs.readFileSync(filePath, "utf8"); +if (!content.startsWith(shebang)) { + content = shebang + content; + fs.writeFileSync(filePath, content); + console.log("✅ Shebang added to dist/index.js"); +} else { + console.log("ℹ️ Shebang already present."); +}