diff --git a/.github/workflows.template/vitest.yml b/.github/workflows.template/vitest.yml new file mode 100644 index 0000000..683fb08 --- /dev/null +++ b/.github/workflows.template/vitest.yml @@ -0,0 +1,96 @@ +# SPDX-FileCopyrightText: Your Name +# SPDX-License-Identifier: AGPL-3.0-or-later + +name: Vitest + +on: pull_request + +permissions: + contents: read + +concurrency: + group: vitest-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + changes: + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: read + + outputs: + src: ${{ steps.changes.outputs.src }} + + steps: + - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 + id: changes + continue-on-error: true + with: + filters: | + src: + - '.github/workflows/**' + - 'src/**' + - 'package.json' + - 'pnpm-lock.yaml' + - 'tsconfig.json' + - 'tsconfig.*.json' + - 'vite.config.ts' + - 'vitest.config.ts' + + vitest: + runs-on: ubuntu-latest + + needs: changes + if: needs.changes.outputs.src != 'false' + + name: Vitest + + steps: + - name: Checkout + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false + + - name: Set up Node + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 + with: + node-version: 22 + + - name: Install pnpm + uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0 + with: + run_install: false + + - name: Get pnpm store directory + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + + - name: Setup pnpm cache + uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 + with: + path: ${{ env.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Run tests + run: pnpm test:run + + summary: + permissions: + contents: none + runs-on: ubuntu-latest + needs: [changes, vitest] + + if: always() + + name: vitest-summary + + steps: + - name: Summary status + run: if ${{ needs.changes.outputs.src != 'false' && needs.vitest.result != 'success' }}; then exit 1; fi diff --git a/.prettierrc b/.prettierrc index 6ccb8cd..548c817 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,7 +1,4 @@ { - "plugins": [ - "prettier-plugin-vue" - ], "printWidth": 100, "semi": false, "singleQuote": true, diff --git a/gen/component/index.ts b/gen/component/index.ts new file mode 100644 index 0000000..7b5ece2 --- /dev/null +++ b/gen/component/index.ts @@ -0,0 +1,2 @@ +import {{ pascalCase name }} from './{{ pascalCase name }}.vue' +export default {{ pascalCase name }} diff --git a/gen/component/{{pascalCase name}}.vue b/gen/component/{{pascalCase name}}.vue index c5c4b51..efb76a4 100644 --- a/gen/component/{{pascalCase name}}.vue +++ b/gen/component/{{pascalCase name}}.vue @@ -2,6 +2,7 @@ SPDX-FileCopyrightText: Your Name SPDX-License-Identifier: AGPL-3.0-or-later --> + diff --git a/gen/view/{{pascalCase name}}Page.vue b/gen/view/{{pascalCase name}}Page.vue index c1fea30..f6af1fe 100644 --- a/gen/view/{{pascalCase name}}Page.vue +++ b/gen/view/{{pascalCase name}}Page.vue @@ -1,3 +1,8 @@ + + diff --git a/promo.png b/promo.png deleted file mode 100644 index 2b98c2a..0000000 Binary files a/promo.png and /dev/null differ diff --git a/src/components/index.ts b/src/components/index.ts new file mode 100644 index 0000000..e064070 --- /dev/null +++ b/src/components/index.ts @@ -0,0 +1,2 @@ +import StatusBadge from './StatusBadge.vue' +export default StatusBadge diff --git a/vite.config.ts b/vite.config.ts index a971a56..9e82ec6 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,4 +1,5 @@ import { createAppConfig } from '@nextcloud/vite-config' +import { existsSync, rmSync } from 'node:fs' import path from 'path' import { visualizer } from 'rollup-plugin-visualizer' import checker from 'vite-plugin-checker' @@ -37,6 +38,7 @@ export default createAppConfig( settings: path.resolve(path.join('src', 'settings.ts')), }, { + emptyOutputDirectory: false, config: { root: 'src', resolve: { @@ -46,6 +48,17 @@ export default createAppConfig( }, }, plugins: [ + { + name: 'clean-dist-js', + generateBundle() { + for (const dir of ['dist/js', 'dist/css']) { + const p = path.resolve(__dirname, dir) + if (existsSync(p)) { + rmSync(p, { recursive: true }) + } + } + }, + }, checker({ vueTsc: true, }),