diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..44cea15c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,98 @@ +name: CI + +on: + push: + branches: [develop, main] + pull_request: + branches: [develop, main] + +jobs: + lint-test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + + - name: Enable Corepack + run: corepack enable + + - name: Install dependencies + run: yarn install --immutable + + - name: Lint + run: yarn lint + + - name: Type check + run: npx vue-tsc --noEmit + + - name: Test + run: yarn test + + build-electron: + runs-on: ubuntu-latest + needs: lint-test + + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + + - name: Enable Corepack + run: corepack enable + + - name: Install dependencies + run: yarn install --immutable + + - name: Build Electron (linux-unpacked) + run: npx quasar build -m electron + + - name: Verify build output + run: test -d dist/electron/Packaged/linux-unpacked + + - name: Upload linux-unpacked artifact + uses: actions/upload-artifact@v4 + with: + name: linux-unpacked + path: dist/electron/Packaged/linux-unpacked/ + retention-days: 3 + + build-flatpak: + runs-on: ubuntu-latest + needs: build-electron + if: startsWith(github.ref, 'refs/heads/release/') || github.ref == 'refs/heads/main' + + steps: + - uses: actions/checkout@v4 + + - name: Download linux-unpacked artifact + uses: actions/download-artifact@v4 + with: + name: linux-unpacked + path: flatpak/linux-unpacked/ + + - name: Setup Flatpak + run: | + sudo apt-get update + sudo apt-get install -y flatpak flatpak-builder + flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo + flatpak install -y --user flathub org.freedesktop.Platform//24.08 + flatpak install -y --user flathub org.freedesktop.Sdk//24.08 + flatpak install -y --user flathub org.electronjs.Electron2.BaseApp//24.08 + + - name: Copy icon + run: | + mkdir -p flatpak/icons + cp src-electron/icons/icon.png flatpak/icons/com.atit.qcalc.png + + - name: Build Flatpak + run: | + cd flatpak + flatpak-builder --force-clean --user --disable-updates --repo=repo .flatpak-builder/build com.atit.qcalc.yml diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 00000000..2312dc58 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1 @@ +npx lint-staged diff --git a/CHANGELOG.md b/CHANGELOG.md index 48d16738..dcb089b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,28 @@ All notable changes to this project are recorded in this file. The format is based on [Keep a Changelog] and this project follows [Semantic Versioning]. +## [0.11.7] 2026-03-07 + +### Added + +- **Vitest Test Infrastructure**: Added unit test framework with 30 tests for CalculatorMath class (`vitest.config.ts`, `src/classes/__tests__/CalculatorMath.test.ts`). +- **GitHub Actions CI/CD Pipeline**: Added automated CI workflow for linting and testing (`.github/workflows/ci.yml`). +- **Pre-commit Hooks**: Added husky + lint-staged for automated code quality checks before commits. + +### Changed + +- **Electron 35 → 40 Upgrade**: Upgraded Electron to version 40 with ESM compatibility fixes for the main process. +- **Vue 3.5+ useTemplateRef Migration**: Replaced legacy `ref(null)` template ref pattern with `useTemplateRef()` across 5 components (`ResultField.vue`, `SettingCard.vue`, `ToolTip.vue`, `QuasarColorPicker.vue`, `useRecordManager.ts`). +- **Any Type Removal**: Reduced `any` type usage from 16 to 1 by using Vue 3.3+ `toValue()` for `ComputedRef` unwrapping in `NarrowLayout.vue` and `WideLayout.vue`. +- **CSS v-bind → CSS Custom Properties**: Migrated Vue CSS `v-bind()` to `:style` injection with `var()` CSS custom properties in `CalcButton.vue` and `RecordCard.vue` for better performance and standards compliance. +- **CSP Security Hardening**: Split Content Security Policy configuration for development and production environments with stricter production rules. +- **Dependencies Updated**: Upgraded all dependencies to latest minor versions and applied Snyk security fixes for Capacitor packages. + +### Fixed + +- **Electron Main Process ESM Compatibility**: Fixed build errors caused by CJS/ESM format conflicts by using static `import fs from 'fs'` and removing top-level `await`. +- **vue-tsc Type Errors**: Fixed type checking errors in `ShowTips.vue`, `ErrorUtils.ts`, `electron-env.d.ts`, `electron-main.ts`, and `electron-preload.ts`. + ## [0.11.6] 2025-12-27 ### Added diff --git a/flatpak/com.atit.qcalc.metainfo.xml b/flatpak/com.atit.qcalc.metainfo.xml index dd1687d5..be262fcd 100644 --- a/flatpak/com.atit.qcalc.metainfo.xml +++ b/flatpak/com.atit.qcalc.metainfo.xml @@ -48,9 +48,14 @@ - + -

Latest release with bug fixes and improvements.

+

Electron 40 upgrade, Vue 3.5+ modernization, Vitest test infrastructure, CI/CD pipeline, and CSP security hardening.

+
+
+ + +

Number format per calculator feature and various bug fixes.

diff --git a/index.html b/index.html index 7c2ccfc6..fa42f99b 100644 --- a/index.html +++ b/index.html @@ -11,10 +11,17 @@ name="viewport" content="initial-scale=1, width=device-width, viewport-fit=cover<% if (ctx.mode.cordova || ctx.mode.capacitor) { %>, viewport-fit=cover<% } %>" /> + <% if (ctx.dev) { %> + <% } else { %> + + <% } %> @@ -564,7 +571,11 @@ :color="primaryAccentColor" class="col-5 q-pr-sm" dense - @update:model-value="(value: any) => currentDecimalPlaces = Number(value)" + @update:model-value=" + (value: number | null) => { + if (value != null) currentDecimalPlaces = Number(value); + } + " >