feat: template updates

This commit is contained in:
2026-02-24 00:34:05 +02:00
parent 23b9a8ec5e
commit 6b0654bbda
8 changed files with 119 additions and 3 deletions

96
.github/workflows.template/vitest.yml vendored Normal file
View File

@@ -0,0 +1,96 @@
# SPDX-FileCopyrightText: Your Name <your@email.com>
# 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

View File

@@ -1,7 +1,4 @@
{
"plugins": [
"prettier-plugin-vue"
],
"printWidth": 100,
"semi": false,
"singleQuote": true,

2
gen/component/index.ts Normal file
View File

@@ -0,0 +1,2 @@
import {{ pascalCase name }} from './{{ pascalCase name }}.vue'
export default {{ pascalCase name }}

View File

@@ -2,6 +2,7 @@
SPDX-FileCopyrightText: Your Name <your@email.com>
SPDX-License-Identifier: AGPL-3.0-or-later
-->
<template>
<div>{{ startCase name }}</div>
</template>

View File

@@ -1,3 +1,8 @@
<!--
SPDX-FileCopyrightText: Your Name <your@email.com>
SPDX-License-Identifier: AGPL-3.0-or-later
-->
<template>
<div class="mynextcloudapp-{{ kebabCase name }}">{{ startCase name }} Page</div>
</template>

BIN
promo.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 338 KiB

2
src/components/index.ts Normal file
View File

@@ -0,0 +1,2 @@
import StatusBadge from './StatusBadge.vue'
export default StatusBadge

View File

@@ -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,
}),