husky install for version increment
This commit is contained in:
4
.husky/pre-commit
Normal file
4
.husky/pre-commit
Normal file
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
. "$(dirname "$0")/_/husky.sh"
|
||||
|
||||
node scripts/incrementVersion.ts
|
||||
24
incrementVersion.ts
Normal file
24
incrementVersion.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
// /incrementVersion.ts
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
|
||||
const filePath = path.join(__dirname, "../config/webVersion.ts");
|
||||
const fileContent = fs.readFileSync(filePath, "utf8");
|
||||
|
||||
const versionRegex = /const webVersion = "(\d+)\.(\d+)\.(\d+)\.(\d+)";/;
|
||||
const match = fileContent.match(versionRegex);
|
||||
|
||||
if (!match) {
|
||||
console.error("Version format not found!");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const [_, major, minor, build, patch] = match;
|
||||
const newVersion = `${major}.${minor}.${build}.${parseInt(patch, 10) + 1}`;
|
||||
const updatedContent = fileContent.replace(
|
||||
versionRegex,
|
||||
`const webVersion = "${newVersion}";`
|
||||
);
|
||||
|
||||
fs.writeFileSync(filePath, updatedContent, "utf8");
|
||||
console.log(`Version updated to ${newVersion}`);
|
||||
12
package-lock.json
generated
12
package-lock.json
generated
@@ -46,7 +46,7 @@
|
||||
"@types/redux-mock-store": "^1.5.0",
|
||||
"@types/testing-library__react": "^10.2.0",
|
||||
"cypress": "^14.0.0",
|
||||
"husky": "^9.1.7",
|
||||
"husky": "^8.0.0",
|
||||
"identity-obj-proxy": "^3.0.0",
|
||||
"jest": "^29.7.0",
|
||||
"jest-environment-jsdom": "^29.7.0",
|
||||
@@ -4201,15 +4201,15 @@
|
||||
}
|
||||
},
|
||||
"node_modules/husky": {
|
||||
"version": "9.1.7",
|
||||
"resolved": "https://registry.npmjs.org/husky/-/husky-9.1.7.tgz",
|
||||
"integrity": "sha512-5gs5ytaNjBrh5Ow3zrvdUUY+0VxIuWVL4i9irt6friV+BqdCfmV11CQTWMiBYWHbXhco+J1kHfTOUkePhCDvMA==",
|
||||
"version": "8.0.3",
|
||||
"resolved": "https://registry.npmjs.org/husky/-/husky-8.0.3.tgz",
|
||||
"integrity": "sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"husky": "bin.js"
|
||||
"husky": "lib/bin.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
"node": ">=14"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/typicode"
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
"postbuild": "copy LICENSE_ICONIFY.txt out\\LICENSE_ICONIFY.txt",
|
||||
"start": "next start",
|
||||
"lint": "next lint",
|
||||
"test": "jest"
|
||||
"test": "jest",
|
||||
"prepare": "husky install"
|
||||
},
|
||||
"dependencies": {
|
||||
"@fontsource/roboto": "^5.1.0",
|
||||
@@ -50,7 +51,7 @@
|
||||
"@types/redux-mock-store": "^1.5.0",
|
||||
"@types/testing-library__react": "^10.2.0",
|
||||
"cypress": "^14.0.0",
|
||||
"husky": "^9.1.7",
|
||||
"husky": "^8.0.0",
|
||||
"identity-obj-proxy": "^3.0.0",
|
||||
"jest": "^29.7.0",
|
||||
"jest-environment-jsdom": "^29.7.0",
|
||||
|
||||
Reference in New Issue
Block a user