From 220058108955529a9e8453d726e9b8927a00685d Mon Sep 17 00:00:00 2001 From: Keshav Mohta Date: Fri, 10 Jan 2025 23:51:08 +0530 Subject: [PATCH] [main]: added githooks and workflow --- .githooks/pre-commit | 46 ++++++ .githooks/prepare-commit-msg | 17 +++ .github/ISSUE_TEMPLATE/BUG_REPORT.yml | 4 +- .github/actions/md-lint/.markdownlint.json | 17 --- .github/workflows/lint-n-build.yml | 38 +++++ .github/workflows/markdown-lint.yml | 12 +- CHANGELOG.md | 31 +--- abcd.code-workspace | 3 +- package-lock.json | 162 ++++++++++++++------- package.json | 16 +- setup-hooks.sh | 24 +++ 11 files changed, 260 insertions(+), 110 deletions(-) create mode 100755 .githooks/pre-commit create mode 100755 .githooks/prepare-commit-msg delete mode 100755 .github/actions/md-lint/.markdownlint.json create mode 100644 .github/workflows/lint-n-build.yml create mode 100755 setup-hooks.sh diff --git a/.githooks/pre-commit b/.githooks/pre-commit new file mode 100755 index 0000000..32a8b82 --- /dev/null +++ b/.githooks/pre-commit @@ -0,0 +1,46 @@ +#!/bin/bash + +# Step 1: Validate branch naming convention +BRANCH_NAME=$(git symbolic-ref --short HEAD) +echo "Current branch: $BRANCH_NAME" + +# Define the branches to exclude +EXCLUDED_BRANCHES="develop main release refactor" + +# Check if the current branch is in the excluded list +for EXCLUDED_BRANCH in $EXCLUDED_BRANCHES; do + if [ "$BRANCH_NAME" = "$EXCLUDED_BRANCH" ]; then + echo "Skipping pre-commit checks for branch: $BRANCH_NAME" + exit 0 + fi +done + +# Pre-commit checks (e.g., linting, testing, etc.) +echo "Running pre-commit checks for branch: $BRANCH_NAME" + +echo "$BRANCH_NAME" | grep -Eq '^(feature|bugfix|hotfix|task)/[A-Za-z]+-[0-9]+' +if [ $? -ne 0 ]; then + echo "Error: Branch name '$BRANCH_NAME' is invalid." + echo "Use a valid branch naming convention, e.g., feature/XYZ-123-description." + exit 1 +fi + +# Step 2: Run poetry linting tools +echo "Running poetry linting tools..." +if ! poetry run flake8 .; then + echo "flake8 failed. Aborting commit." + exit 1 +fi + +if ! poetry run black --check .; then + echo "black failed. Aborting commit." + exit 1 +fi + +if ! poetry run mypy .; then + echo "mypy failed. Aborting commit." + exit 1 +fi + +echo "Pre-commit checks passed!" +exit 0 diff --git a/.githooks/prepare-commit-msg b/.githooks/prepare-commit-msg new file mode 100755 index 0000000..a348d83 --- /dev/null +++ b/.githooks/prepare-commit-msg @@ -0,0 +1,17 @@ +#!/bin/bash + +# This script prepends the branch name to the commit message +# Skip certain branches (configurable) +if [ -z "$BRANCHES_TO_SKIP" ]; then + BRANCHES_TO_SKIP="master develop release refactor" +fi + +BRANCH_NAME=$(git symbolic-ref --short HEAD) +BRANCH_NAME="${BRANCH_NAME##*/}" + +BRANCH_EXCLUDED=$(printf "%s\n" $BRANCHES_TO_SKIP | grep -c "^$BRANCH_NAME$") +BRANCH_IN_COMMIT=$(grep -c "\[$BRANCH_NAME\]" "$1") + +if [ -n "$BRANCH_NAME" ] && ! [ $BRANCH_EXCLUDED -eq 1 ] && ! [ $BRANCH_IN_COMMIT -ge 1 ]; then + sed -i.bak -e "1s/^/[$BRANCH_NAME]: /" "$1" +fi diff --git a/.github/ISSUE_TEMPLATE/BUG_REPORT.yml b/.github/ISSUE_TEMPLATE/BUG_REPORT.yml index 0c27c3e..7884338 100644 --- a/.github/ISSUE_TEMPLATE/BUG_REPORT.yml +++ b/.github/ISSUE_TEMPLATE/BUG_REPORT.yml @@ -1,8 +1,8 @@ name: Bug Report description: File a bug report to help us improve. title: "🐛 RZB-25000X:" -labels: ["bug", "invalid"] -assignees: ["xkeshav"] +labels: ["bug"] +assignees: ["recursivezero"] body: - type: markdown diff --git a/.github/actions/md-lint/.markdownlint.json b/.github/actions/md-lint/.markdownlint.json deleted file mode 100755 index 6af7807..0000000 --- a/.github/actions/md-lint/.markdownlint.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "default": true, - "MD003": { - "style": "consistent" - }, - "MD029": false, - "MD033": false, - "MD007": { - "indent": 2 - }, - "MD013": { - "line_length": 200, - "tables": false - }, - "no-hard-tabs": false, - "whitespace": false -} diff --git a/.github/workflows/lint-n-build.yml b/.github/workflows/lint-n-build.yml new file mode 100644 index 0000000..c34b0bf --- /dev/null +++ b/.github/workflows/lint-n-build.yml @@ -0,0 +1,38 @@ +name: Lint and Build +run-name: Lint and Build when push or raise PR + +on: + push: + branches: ["main", "develop", "feature/*", "!task/*"] + + pull_request_target: + branches: + - main + - develop + +jobs: + lint-and-build: + runs-on: ubuntu-latest + steps: + # Step 1: Checkout the repository + - name: Checkout code + uses: actions/checkout@v4 + + # Step 2: Set up Node.js + - name: Set up Node.js environment + uses: actions/setup-node@v4 + with: + node-version: 20 # Replace with your desired Node.js version + cache: "npm" # Cache npm dependencies for faster builds + + # Step 3: Install dependencies + - name: Install dependencies + run: npm install + + # Step 4: Run linting + - name: Run lint + run: npm run lint + + # Step 5: Run build + - name: Run build + run: npm run build diff --git a/.github/workflows/markdown-lint.yml b/.github/workflows/markdown-lint.yml index 3033730..1123215 100644 --- a/.github/workflows/markdown-lint.yml +++ b/.github/workflows/markdown-lint.yml @@ -1,10 +1,20 @@ name: markdown-lint -run-name: learning github action from workflow +run-name: Linting markdown files on: push: branches: - main - develop + paths: + - "**.md" # Match any .md file in any directory + - "**.mdx" + pull_request: + branches: + - main + - develop + paths: + - "**.md" + - "**.mdx" jobs: markdown-lint: runs-on: ubuntu-latest diff --git a/CHANGELOG.md b/CHANGELOG.md index 79fb3ee..724f274 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,37 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on Keep a Changelog and this project adheres to Semantic Versioning. -## [0.0.1] - 2024-01-01 +## [1.0.0] - 2025-10-01 -Added +Created Repo from template -Basic Astro setup -React and Tailwind -Lint and workspace file - -Changed - -## [1.0.0] - 2024-10-07 - -- Added New Repo - -## [1.1.1] - 2024-10-21 - -- launched with server nd db connection - -## [1.2.0] - 2024-10-22 - -Changed - -- build on client side - -## [1.3.0] - 2024-12-22 - -Added - -- Product Detail page -- Zipped page -- Share button on product detail page ### [Unreleased] diff --git a/abcd.code-workspace b/abcd.code-workspace index 4805789..3dfe3d4 100644 --- a/abcd.code-workspace +++ b/abcd.code-workspace @@ -1,6 +1,7 @@ { "folders": [ { + "name": "abcd", "path": "." } ], @@ -114,7 +115,7 @@ "files.autoSave": "onFocusChange", "files.eol": "\r\n", "files.exclude": { - ".git/**": true + "**/.git": false }, "files.readonlyExclude": { "dist/**": true diff --git a/package-lock.json b/package-lock.json index 1e56457..4983ff4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,13 @@ { - "name": "astro-template", - "version": "1.3.0", + "name": "abcd", + "version": "1.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "astro-template", - "version": "1.3.0", + "name": "abcd", + "version": "1.0.0", + "hasInstallScript": true, "license": "MIT", "dependencies": { "@astrojs/check": "0.9.4", @@ -46,7 +47,8 @@ "postcss-import": "16.1.0", "prettier": "3.1.0", "prettier-plugin-astro": "0.14.1", - "prettier-plugin-tailwindcss": "0.6.8" + "prettier-plugin-tailwindcss": "0.6.8", + "shx": "0.3.4" }, "funding": { "type": "individual", @@ -353,9 +355,9 @@ } }, "node_modules/@babel/compat-data": { - "version": "7.26.3", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.26.3.tgz", - "integrity": "sha512-nHIxvKPniQXpmQLb0vhY3VaFb3S0YrTAwpOWJZh1wn3oJPjJk9Asva204PsBdmAE8vpzfHudT8DB0scYvy9q0g==", + "version": "7.26.5", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.26.5.tgz", + "integrity": "sha512-XvcZi1KWf88RVbF9wn8MN6tYFloU5qX8KjuF3E1PVBmJ9eypXfs4GRiJwLuTZL0iSnJUKn1BFPa5BPZZJyFzPg==", "engines": { "node": ">=6.9.0" } @@ -398,12 +400,12 @@ } }, "node_modules/@babel/generator": { - "version": "7.26.3", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.26.3.tgz", - "integrity": "sha512-6FF/urZvD0sTeO7k6/B15pMLC4CHUv1426lzr3N01aHJTl046uCAh9LXW/fzeXXjPNCJ6iABW5XaWOsIZB93aQ==", + "version": "7.26.5", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.26.5.tgz", + "integrity": "sha512-2caSP6fN9I7HOe6nqhtft7V4g7/V/gfDsC3Ag4W7kEzzvRGKqiv0pu0HogPiZ3KaVSoNDhUws6IJjDjpfmYIXw==", "dependencies": { - "@babel/parser": "^7.26.3", - "@babel/types": "^7.26.3", + "@babel/parser": "^7.26.5", + "@babel/types": "^7.26.5", "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.25", "jsesc": "^3.0.2" @@ -413,11 +415,11 @@ } }, "node_modules/@babel/helper-compilation-targets": { - "version": "7.25.9", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.25.9.tgz", - "integrity": "sha512-j9Db8Suy6yV/VHa4qzrj9yZfZxhLWQdVnRlXxmKLYlhWUVB1sB2G5sxuWYXk/whHD9iW76PmNzxZ4UCnTQTVEQ==", + "version": "7.26.5", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.26.5.tgz", + "integrity": "sha512-IXuyn5EkouFJscIDuFF5EsiSolseme1s0CZB+QxVugqJLYmKdxI1VfIBOst0SUu4rnk2Z7kqTwmoO1lp3HIfnA==", "dependencies": { - "@babel/compat-data": "^7.25.9", + "@babel/compat-data": "^7.26.5", "@babel/helper-validator-option": "^7.25.9", "browserslist": "^4.24.0", "lru-cache": "^5.1.1", @@ -464,9 +466,9 @@ } }, "node_modules/@babel/helper-plugin-utils": { - "version": "7.25.9", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.25.9.tgz", - "integrity": "sha512-kSMlyUVdWe25rEsRGviIgOWnoT/nfABVWlqt9N19/dIPWViAOW2s9wznP5tURbs/IDuNk4gPy3YdYRgH3uxhBw==", + "version": "7.26.5", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.26.5.tgz", + "integrity": "sha512-RS+jZcRdZdRFzMyr+wcsaqOmld1/EqTghfaBGQQd/WnRdzdlvSZ//kF7U8VQTxf1ynZ4cjUcYgjVGx13ewNPMg==", "engines": { "node": ">=6.9.0" } @@ -508,11 +510,11 @@ } }, "node_modules/@babel/parser": { - "version": "7.26.3", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.26.3.tgz", - "integrity": "sha512-WJ/CvmY8Mea8iDXo6a7RK2wbmJITT5fN3BEkRuFlxVyNx8jOKIIhmC4fSkTcPcf8JyavbBwIe6OpiCOBXt/IcA==", + "version": "7.26.5", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.26.5.tgz", + "integrity": "sha512-SRJ4jYmXRqV1/Xc+TIVG84WjHBXKlxO9sHQnA2Pf12QQEAp1LOh6kDzNHXcUnbH1QI0FDoPPVOt+vyUDucxpaw==", "dependencies": { - "@babel/types": "^7.26.3" + "@babel/types": "^7.26.5" }, "bin": { "parser": "bin/babel-parser.js" @@ -574,15 +576,15 @@ } }, "node_modules/@babel/traverse": { - "version": "7.26.4", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.26.4.tgz", - "integrity": "sha512-fH+b7Y4p3yqvApJALCPJcwb0/XaOSgtK4pzV6WVjPR5GLFQBRI7pfoX2V2iM48NXvX07NUxxm1Vw98YjqTcU5w==", + "version": "7.26.5", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.26.5.tgz", + "integrity": "sha512-rkOSPOw+AXbgtwUga3U4u8RpoK9FEFWBNAlTpcnkLFjL5CT+oyHNuUUC/xx6XefEJ16r38r8Bc/lfp6rYuHeJQ==", "dependencies": { "@babel/code-frame": "^7.26.2", - "@babel/generator": "^7.26.3", - "@babel/parser": "^7.26.3", + "@babel/generator": "^7.26.5", + "@babel/parser": "^7.26.5", "@babel/template": "^7.25.9", - "@babel/types": "^7.26.3", + "@babel/types": "^7.26.5", "debug": "^4.3.1", "globals": "^11.1.0" }, @@ -591,9 +593,9 @@ } }, "node_modules/@babel/types": { - "version": "7.26.3", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.26.3.tgz", - "integrity": "sha512-vN5p+1kl59GVKMvTHt55NzzmYVxprfJD+ql7U9NFIfKCBkYE55LYtS+WtPlaYOyzydrKI8Nezd+aZextrd+FMA==", + "version": "7.26.5", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.26.5.tgz", + "integrity": "sha512-L6mZmwFDK6Cjh1nRCLXpa6no13ZIioJDz7mdkzHv399pThrTa/k0nUlNaenOeh2kWu/iaOQYElEpKPUswUa9Vg==", "dependencies": { "@babel/helper-string-parser": "^7.25.9", "@babel/helper-validator-identifier": "^7.25.9" @@ -3368,9 +3370,9 @@ } }, "node_modules/browserslist": { - "version": "4.24.3", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.24.3.tgz", - "integrity": "sha512-1CPmv8iobE2fyRMV97dAcMVegvvWKxmq94hkLiAkUGwKVTyDLw33K+ZxiFrREKmmps4rIw6grcCFCnTMSZ/YiA==", + "version": "4.24.4", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.24.4.tgz", + "integrity": "sha512-KDi1Ny1gSePi1vm0q4oxSF8b4DR44GF4BbmS2YdhPLOEqd8pDviZOGH/GsmRwoWJ2+5Lr085X7naowMwKHDG1A==", "funding": [ { "type": "opencollective", @@ -3489,9 +3491,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001690", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001690.tgz", - "integrity": "sha512-5ExiE3qQN6oF8Clf8ifIDcMRCRE/dMGcETG/XGMD8/XiXm6HXQgQTh1yZYLXXpSOsEUlJm1Xr7kGULZTuGtP/w==", + "version": "1.0.30001692", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001692.tgz", + "integrity": "sha512-A95VKan0kdtrsnMubMKxEKUKImOPSuCpYgxSQBo036P5YYgVIcOYJEgt/txJWqObiRQeISNCfef9nvlQ0vbV7A==", "funding": [ { "type": "opencollective", @@ -4290,9 +4292,9 @@ "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" }, "node_modules/electron-to-chromium": { - "version": "1.5.79", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.79.tgz", - "integrity": "sha512-nYOxJNxQ9Om4EC88BE4pPoNI8xwSFf8pU/BAeOl4Hh/b/i6V4biTAzwV7pXi3ARKeoYO5JZKMIXTryXSVer5RA==" + "version": "1.5.80", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.80.tgz", + "integrity": "sha512-LTrKpW0AqIuHwmlVNV+cjFYTnXtM9K37OGhpe0ZI10ScPSxqVSryZHIY3WnCS5NSYbBODRTZyhRMS2h5FAEqAw==" }, "node_modules/emmet": { "version": "2.4.11", @@ -5833,12 +5835,12 @@ "dev": true }, "node_modules/h3": { - "version": "1.13.0", - "resolved": "https://registry.npmjs.org/h3/-/h3-1.13.0.tgz", - "integrity": "sha512-vFEAu/yf8UMUcB4s43OaDaigcqpQd14yanmOsn+NcRX3/guSKncyE2rOYhq8RIchgJrPSs/QiIddnTTR1ddiAg==", + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/h3/-/h3-1.13.1.tgz", + "integrity": "sha512-u/z6Z4YY+ANZ05cRRfsFJadTBrNA6e3jxdU+AN5UCbZSZEUwgHiwjvUEe0k1NoQmAvQmETwr+xB5jd7mhCJuIQ==", "dependencies": { "cookie-es": "^1.2.2", - "crossws": ">=0.2.0 <0.4.0", + "crossws": "^0.3.1", "defu": "^6.1.4", "destr": "^2.0.3", "iron-webcrypto": "^1.2.1", @@ -6295,6 +6297,15 @@ "node": ">= 0.4" } }, + "node_modules/interpret": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz", + "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==", + "dev": true, + "engines": { + "node": ">= 0.10" + } + }, "node_modules/ipaddr.js": { "version": "1.9.1", "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", @@ -9603,6 +9614,18 @@ "url": "https://paulmillr.com/funding/" } }, + "node_modules/rechoir": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", + "integrity": "sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw==", + "dev": true, + "dependencies": { + "resolve": "^1.1.6" + }, + "engines": { + "node": ">= 0.10" + } + }, "node_modules/recma-build-jsx": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/recma-build-jsx/-/recma-build-jsx-1.0.0.tgz", @@ -10446,6 +10469,23 @@ "node": ">=8" } }, + "node_modules/shelljs": { + "version": "0.8.5", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.5.tgz", + "integrity": "sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==", + "dev": true, + "dependencies": { + "glob": "^7.0.0", + "interpret": "^1.0.0", + "rechoir": "^0.6.2" + }, + "bin": { + "shjs": "bin/shjs" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/shiki": { "version": "1.26.1", "resolved": "https://registry.npmjs.org/shiki/-/shiki-1.26.1.tgz", @@ -10461,6 +10501,22 @@ "@types/hast": "^3.0.4" } }, + "node_modules/shx": { + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/shx/-/shx-0.3.4.tgz", + "integrity": "sha512-N6A9MLVqjxZYcVn8hLmtneQWIJtp8IKzMP4eMnx+nqkvXoqinUPCbUFLp2UcWTEIUONhlk0ewxr/jaVGlc+J+g==", + "dev": true, + "dependencies": { + "minimist": "^1.2.3", + "shelljs": "^0.8.5" + }, + "bin": { + "shx": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/side-channel": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", @@ -11343,9 +11399,9 @@ } }, "node_modules/type-fest": { - "version": "4.31.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.31.0.tgz", - "integrity": "sha512-yCxltHW07Nkhv/1F6wWBr8kz+5BGMfP+RbRSYFnegVb0qV/UMT0G0ElBloPVerqn4M2ZV80Ir1FtCcYv1cT6vQ==", + "version": "4.32.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.32.0.tgz", + "integrity": "sha512-rfgpoi08xagF3JSdtJlCwMq9DGNDE0IMh3Mkpc1wUypg9vPi786AiqeBBKcqvIkq42azsBM85N490fyZjeUftw==", "engines": { "node": ">=16" }, @@ -11671,9 +11727,9 @@ } }, "node_modules/update-browserslist-db": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.1.tgz", - "integrity": "sha512-R8UzCaa9Az+38REPiJ1tXlImTJXlVfgHZsglwBD/k6nj76ctsH1E3q4doGrukiLQd3sGQYu56r5+lo5r94l29A==", + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.2.tgz", + "integrity": "sha512-PPypAm5qvlD7XMZC3BujecnaOxwhrtoFR+Dqkk5Aa/6DssiH0ibKoketaj9w8LP7Bont1rYeoV5plxD7RTEPRg==", "funding": [ { "type": "opencollective", @@ -11690,7 +11746,7 @@ ], "dependencies": { "escalade": "^3.2.0", - "picocolors": "^1.1.0" + "picocolors": "^1.1.1" }, "bin": { "update-browserslist-db": "cli.js" diff --git a/package.json b/package.json index 83a5ff8..ac7cdce 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,9 @@ { - "name": "astro-template", - "version": "1.3.0", + "name": "abcd", + "version": "1.0.0", "description": "front end starter in Astro with React codebase", "homepage": "https://parixan.xyz", - "displayName": "template", + "displayName": "abcd", "license": "MIT", "publisher": "recursivezero", "private": true, @@ -14,10 +14,10 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/recursivezero/template.git" + "url": "git+https://github.com/recursivezero/abcd.git" }, "bugs": { - "url": "https://github.com/recursivezero/template/issues", + "url": "https://github.com/recursivezero/abcd/issues", "email": "recursivezero@outlook.com" }, "funding": { @@ -43,7 +43,8 @@ "check": "astro check", "lint": "prettier -w --cache . && prettier -w --cache **/*.astro", "clean": "rm -rf dist rm -rf build", - "nuke": "rm -rf node_modules && rm package-lock.json && npm run clean" + "nuke": "shx rm -rf node_modules && rm package-lock.json && npm run clean", + "postinstall": "sh ./setup-hooks.sh" }, "dependencies": { "@astrojs/check": "0.9.4", @@ -83,6 +84,7 @@ "postcss-import": "16.1.0", "prettier": "3.1.0", "prettier-plugin-astro": "0.14.1", - "prettier-plugin-tailwindcss": "0.6.8" + "prettier-plugin-tailwindcss": "0.6.8", + "shx": "0.3.4" } } diff --git a/setup-hooks.sh b/setup-hooks.sh new file mode 100755 index 0000000..10817af --- /dev/null +++ b/setup-hooks.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +# Define the hooks directory +HOOKS_DIR=".githooks" +GIT_HOOKS_DIR=".git/hooks" + +# Check if .git/hooks exists +if [ ! -d "$GIT_HOOKS_DIR" ]; then + echo "Error: This script must be run from the root of a Git repository." + exit 1 +fi + +# Copy hooks to .git/hooks and make them executable +for HOOK in pre-commit prepare-commit-msg; do + if [ -f "$HOOKS_DIR/$HOOK" ]; then + cp "$HOOKS_DIR/$HOOK" "$GIT_HOOKS_DIR/$HOOK" + chmod +x "$GIT_HOOKS_DIR/$HOOK" + echo "$HOOK installed." + else + echo "Warning: $HOOK not found in $HOOKS_DIR." + fi +done + +echo "All hooks have been set up."