diff --git a/.github/workflows/checks.yaml b/.github/workflows/checks.yaml index c9eefa8..aa5ad11 100644 --- a/.github/workflows/checks.yaml +++ b/.github/workflows/checks.yaml @@ -13,7 +13,7 @@ jobs: - uses: actions/checkout@v4 - uses: oven-sh/setup-bun@v1 - name: Install Dependencies - run: bun install + run: bun install --frozen-lockfile - name: Runs Prettier Formatter run: bun run lint:prettier @@ -24,7 +24,7 @@ jobs: - uses: actions/checkout@v4 - uses: oven-sh/setup-bun@v1 - name: Install Dependencies - run: bun install + run: bun install --frozen-lockfile - name: Runs cSpell Spell Checker run: bun run lint:spelling @@ -35,7 +35,7 @@ jobs: - uses: actions/checkout@v4 - uses: oven-sh/setup-bun@v1 - name: Install Dependencies - run: bun install + run: bun install --frozen-lockfile - name: Runs Markdown Linter run: bun run lint:markdown @@ -46,7 +46,7 @@ jobs: - uses: actions/checkout@v4 - uses: oven-sh/setup-bun@v1 - name: Install Dependencies - run: bun install + run: bun install --frozen-lockfile - name: Runs ESLint run: bun run lint:eslint @@ -61,7 +61,7 @@ jobs: - uses: oven-sh/setup-bun@v1 - name: "Install dependencies" - run: bun install + run: bun install --production --frozen-lockfile - name: "Build site" run: bun run build diff --git a/.github/workflows/deploy-preview.yml b/.github/workflows/deploy-preview.yml index fd8f175..f081804 100644 --- a/.github/workflows/deploy-preview.yml +++ b/.github/workflows/deploy-preview.yml @@ -25,7 +25,7 @@ jobs: - uses: oven-sh/setup-bun@v1 - name: "Install dependencies" - run: bun install + run: bun install --production --frozen-lockfile - name: "Deploy target: preview" run: bun run build diff --git a/.github/workflows/deploy-prod.yml b/.github/workflows/deploy-prod.yml index bccf7a5..5bf0b5e 100644 --- a/.github/workflows/deploy-prod.yml +++ b/.github/workflows/deploy-prod.yml @@ -13,15 +13,12 @@ jobs: steps: - uses: actions/checkout@v4 # v4 with: - fetch-depth: 0 - # Whether to configure the token or SSH key with the local git config - # Default: true persist-credentials: false # <--- checking this in commit context - uses: oven-sh/setup-bun@v1 - name: "Install dependencies" - run: bun install + run: bun install --production --frozen-lockfile - name: "Deploy target: production 🚀" run: bun run build diff --git a/.github/workflows/deploy-staging.yml b/.github/workflows/deploy-staging.yml index bc28585..8a5dd19 100644 --- a/.github/workflows/deploy-staging.yml +++ b/.github/workflows/deploy-staging.yml @@ -20,7 +20,7 @@ jobs: - uses: oven-sh/setup-bun@v1 - name: "Install dependencies" - run: bun install + run: bun install --production --frozen-lockfile - name: "Deploy target: staging" run: bun run build diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..1b2974c --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,32 @@ +name: release 🚀 + +on: + push: + branches: [ main ] + +env: + HUSKY: 0 + CI: true + +jobs: + release: + if: ${{ github.event.repository.full_name == github.repository }} && {{ !contains(github.event.head_commit.message, "skip ci") }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 # v4 + with: + fetch-depth: 0 + persist-credentials: false + + - uses: actions/setup-node@v4 + with: + node-version: 'latest' + - uses: oven-sh/setup-bun@v1 + + - name: "Install dependencies" + run: bun install --frozen-lockfile + + - name: "Release" + run: bunx semantic-release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.husky/commit-msg b/.husky/commit-msg new file mode 100755 index 0000000..9e35954 --- /dev/null +++ b/.husky/commit-msg @@ -0,0 +1,3 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" +bunx --no-install commitlint --edit "$1" diff --git a/.husky/install.mjs b/.husky/install.mjs new file mode 100644 index 0000000..5a33bee --- /dev/null +++ b/.husky/install.mjs @@ -0,0 +1,6 @@ +// Skip Husky install in production and CI +if (process.env.NODE_ENV === 'production' || process.env.CI === 'true') { + process.exit(0); +} +const husky = (await import('husky')).default; +console.log(husky()); diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 0000000..93f8566 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,3 @@ +#!/usr/bin/env sh +. "$(dirname "$0")/_/husky.sh" +bun lint-staged diff --git a/.lintstagedrc.yml b/.lintstagedrc.yml new file mode 100644 index 0000000..09edcda --- /dev/null +++ b/.lintstagedrc.yml @@ -0,0 +1,8 @@ +'*.{js,ts,vue}': + - prettier --list-different + - eslint +'*.md': + - cspell + - markdownlint-cli2 +'*.{json,yml}': + - prettier --list-different diff --git a/.releaserc b/.releaserc new file mode 100644 index 0000000..6da26ff --- /dev/null +++ b/.releaserc @@ -0,0 +1,33 @@ +{ + "branches": "main", + "debug": true, + "tagFormat": "${version}", + "addReleases": "top", + "npmPublish": false, + "plugins": [ + "@semantic-release/commit-analyzer", + "@semantic-release/release-notes-generator", + [ + "@semantic-release/npm", + { + "npmPublish": false + } + ], + [ + "@semantic-release/changelog", + { + "changelogFile": "CHANGELOG.md" + } + ], + "@semantic-release/github", + [ + "@semantic-release/git", + { + "assets": [ + "CHANGELOG.md", + "package.json" + ] + } + ] + ] +} diff --git a/bun.lockb b/bun.lockb index 0a01a6e..a6f1e39 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/commitlint.config.ts b/commitlint.config.ts new file mode 100644 index 0000000..3f5e287 --- /dev/null +++ b/commitlint.config.ts @@ -0,0 +1 @@ +export default { extends: ['@commitlint/config-conventional'] }; diff --git a/cspell.json b/cspell.json index f60f83c..562ec02 100644 --- a/cspell.json +++ b/cspell.json @@ -12,7 +12,9 @@ ".vscode/**", "cspell-config/**", "package.json", - ".**.**" + ".output/**", + ".husky/**", + ".nuxt/**" ], "caseSensitive": true, "dictionaries": [ diff --git a/package.json b/package.json index 5b580cd..4ff01d8 100644 --- a/package.json +++ b/package.json @@ -12,9 +12,10 @@ "lint:eslint": "eslint .", "lint:prettier": "prettier --check .", "fix:prettier": "prettier --write .", - "prepare": "husky", + "prepare": "node .husky/install.mjs", "postinstall": "nuxt prepare", - "ci:check": "bun run lint:eslint && bun run lint:prettier && bun run lint:spelling && bun run lint:markdown" + "ci:check": "bun run lint:eslint && bun run lint:prettier && bun run lint:spelling && bun run lint:markdown", + "release": "semantic-release" }, "dependencies": { "@nuxt/content": "^2.12.1", @@ -24,6 +25,7 @@ "@nuxt/ui": "^2.16.0", "@nuxt/ui-pro": "^1.1.0", "@nuxtjs/seo": "^2.0.0-rc.10", + "nuxt-headlessui": "^1.2.0", "dayjs": "^1.11.10", "nuxt": "^3.11.2", "nuxt-gtag": "^2.0.6", @@ -33,15 +35,23 @@ "vue-tsc": "^2.0.16" }, "devDependencies": { + "@commitlint/cli": "^19.3.0", + "@commitlint/config-conventional": "^19.2.2", + "@semantic-release/changelog": "^6.0.3", + "@semantic-release/commit-analyzer": "^12.0.0", + "@semantic-release/git": "^10.0.1", + "@semantic-release/github": "^10.0.5", + "@semantic-release/release-notes-generator": "^13.0.0", "@vue/test-utils": "^2.4.5", "cspell": "^8.7.0", "eslint": "^8.57.0", "husky": "^9.0.11", + "lint-staged": "^15.2.4", "markdownlint": "^0.34.0", "markdownlint-cli2": "^0.13.0", - "nuxt-headlessui": "^1.2.0", "prettier": "^3.2.5", "prettier-eslint": "^16.3.0", - "prettier-plugin-tailwindcss": "^0.5.14" + "prettier-plugin-tailwindcss": "^0.5.14", + "semantic-release": "^23.1.1" } }