From 5972f8810a291c1dbcd84bcb930a085d77dad7f6 Mon Sep 17 00:00:00 2001 From: Morgan Zolob Date: Wed, 13 Dec 2023 17:30:22 -0800 Subject: [PATCH] Insert shebang in postbuild script 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. --- generator.ts | 1 - package.json | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 generator.ts diff --git a/generator.ts b/generator.ts old mode 100644 new mode 100755 index 02e4505..6167695 --- a/generator.ts +++ b/generator.ts @@ -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"; diff --git a/package.json b/package.json index 3098fbe..794a286 100644 --- a/package.json +++ b/package.json @@ -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",