From 7531e94ade8361c125149234d0ced48403aa1ebf Mon Sep 17 00:00:00 2001 From: biancalui-emarsys Date: Fri, 17 Jan 2025 11:40:17 +0800 Subject: [PATCH] chore: update postinstall script MV-885 --- package.json | 2 +- scripts/postinstall.js | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 scripts/postinstall.js diff --git a/package.json b/package.json index 3c81701..c7a0c85 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "types": "typescript/index.d.ts", "type": "module", "scripts": { - "postinstall": "tsc", + "postinstall": "node scripts/postinstall.js", "test": "echo \"Error: no test specified\" && exit 1" }, "keywords": [ diff --git a/scripts/postinstall.js b/scripts/postinstall.js new file mode 100644 index 0000000..6799d0b --- /dev/null +++ b/scripts/postinstall.js @@ -0,0 +1,10 @@ +import { execSync } from 'child_process'; + +try { + // Check if TypeScript is installed + execSync('tsc --version', { stdio: 'ignore' }); + console.log('TypeScript detected, running tsc...'); + execSync('tsc', { stdio: 'inherit' }); +} catch (error) { + console.warn('TypeScript is not installed. Skipping compilation.'); +}