diff --git a/.gitignore b/.gitignore index 9a0ee3f..7dbc8ef 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ coverage.html .DS_Store dist/ +lib/version.ts diff --git a/.husky/pre-commit b/.husky/pre-commit index 863fe55..2312dc5 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,2 +1 @@ -npx ts-node ./check-version.ts npx lint-staged diff --git a/check-version.ts b/check-version.ts deleted file mode 100644 index f993d4c..0000000 --- a/check-version.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { version as hardCodedVersion } from './lib/version'; -import packageJson from './package.json'; - -if (packageJson.version !== hardCodedVersion) { - console.error(`You need to update \`./lib/version.ts\` to match the version in package.json before committing! - -package.json version: \x1B[1;32m${packageJson.version}\x1B[m -hard coded version: \x1B[1;31m${hardCodedVersion}\x1B[m`); - process.exit(1); -} - -process.exit(0); diff --git a/lib/version.ts b/lib/version.ts deleted file mode 100644 index 8719051..0000000 --- a/lib/version.ts +++ /dev/null @@ -1 +0,0 @@ -export const version = '4.5.1'; diff --git a/package.json b/package.json index 7d667c3..b36664a 100644 --- a/package.json +++ b/package.json @@ -82,13 +82,12 @@ "repository": "customerio/customerio-node", "scripts": { "test": "nyc ava", - "build": "tsc -p tsconfig.json", + "build": "node update-version.js && tsc -p tsconfig.json", "lint": "eslint .", "lint:fix": "eslint . --fix", "format": "prettier --write .", "prepublishOnly": "npm run build", - "prepare": "husky", - "version": "node update-version.js" + "prepare": "(husky || true) && node update-version.js" }, "lint-staged": { "*.{js,json,md,ts,yml,yaml}": "prettier --write",