Skip to content

Commit

Permalink
Insert shebang in postbuild script
Browse files Browse the repository at this point in the history
The shebang on the top of the TS file causes GitHub to identify it as
javascript, which kind of annoyed me. So this removes it from the TS
file, and adds it to the built JS file using a node command. Using node
here instead of something like perl since node should always be
installed if you're able to run build.
  • Loading branch information
mogzol committed Dec 14, 2023
1 parent 7c7e216 commit 5972f88
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 1 deletion.
1 change: 0 additions & 1 deletion generator.ts
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env node
import type { DMMF } from "@prisma/generator-helper";
import generatorHelper from "@prisma/generator-helper";
import { mkdir, writeFile } from "node:fs/promises";
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
},
"scripts": {
"build": "tsc -p tsconfig.build.json",
"postbuild": "node -e \"g='generator.js';f=require('fs');f.writeFileSync(g,'#!/usr/bin/env node\\n'+f.readFileSync(g))\"",
"clean": "rimraf --glob *.js **/__TEST_TMP__",
"generate": "prisma generate --schema=prisma/example.prisma",
"lint": "prettier --check . && eslint . --ext .ts",
Expand Down

0 comments on commit 5972f88

Please sign in to comment.