chore: improve CI/CD, testing infrastructure, and development tooling

- Add GitHub Actions workflows for PHPUnit testing (MySQL and
PostgreSQL)
- Add issue templates (bug reports, feature requests) for better issue
management
- Enhance Makefile with Docker test support and improved build targets
- Update lint-staged configuration with better PHP and JSON handling
- Add comprehensive PHPUnit test infrastructure with Docker support
- Update dependencies and add lock files for composer and vendor-bin
tools
- Improve code scaffolding templates (command, component, view
generators)
- Update build configuration (Vite, package.json, pnpm-lock.yaml)
- Refactor Application.php settings initialization
- Update AdminSettings and UserSettings implementations
- Rename test file for consistency (ApiTest → ApiControllerTest)
- Update .gitignore (track composer.lock, ignore stats.html)
This commit is contained in:
2025-11-23 00:52:22 +02:00
parent ffe902ab37
commit effe1a327d
31 changed files with 8648 additions and 241 deletions

201
.github/workflows/phpunit-mysql.yml vendored Normal file
View File

@@ -0,0 +1,201 @@
# This workflow is provided via the organization template repository
#
# https://github.com/nextcloud/.github
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
#
# SPDX-FileCopyrightText: 2022-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: MIT
name: PHPUnit MySQL
on: pull_request
permissions:
contents: read
concurrency:
group: phpunit-mysql-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout app
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
with:
persist-credentials: false
- name: Get supported server versions
id: versions
uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1
- name: Build test matrix
id: set-matrix
run: |
# Get server branches from version matrix
BRANCHES='${{ steps.versions.outputs.branches }}'
# Build minimal matrix: min Nextcloud with PHP 8.2, max Nextcloud with PHP 8.3
MATRIX=$(jq -nc \
--argjson branches "$BRANCHES" \
'{include: [{"php-versions": "8.2", "mysql-versions": "8.4", "server-versions": $branches[0]}, {"php-versions": "8.3", "mysql-versions": "8.4", "server-versions": $branches[-1]}]}'
)
echo "matrix=$MATRIX" >> $GITHUB_OUTPUT
echo "Generated matrix: $MATRIX"
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/**'
- 'appinfo/**'
- 'lib/**'
- 'templates/**'
- 'tests/**'
- 'vendor/**'
- 'vendor-bin/**'
- '.php-cs-fixer.dist.php'
- 'composer.json'
- 'composer.lock'
phpunit-mysql:
runs-on: ubuntu-latest
needs: [changes, matrix]
if: needs.changes.outputs.src != 'false'
strategy:
matrix: ${{ fromJson(needs.matrix.outputs.matrix) }}
name: MySQL ${{ matrix.mysql-versions }} PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }}
services:
mysql:
image: ghcr.io/nextcloud/continuous-integration-mysql-${{ matrix.mysql-versions }}:latest
ports:
- 4444:3306/tcp
env:
MYSQL_ROOT_PASSWORD: rootpassword
options: --health-cmd="mysqladmin ping" --health-interval 5s --health-timeout 2s --health-retries 10
steps:
- name: Checkout app
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
path: app-checkout
- name: Detect app ID from appinfo/info.xml
run: |
APP_ID=$(grep -oP '(?<=<id>)[^<]+' app-checkout/appinfo/info.xml | head -1)
echo "APP_NAME=$APP_ID" >> $GITHUB_ENV
echo "Detected app ID: $APP_ID"
- name: Checkout server
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
submodules: true
repository: nextcloud/server
ref: ${{ matrix.server-versions }}
- name: Checkout app
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
path: apps/${{ env.APP_NAME }}
- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@0f7f1d08e3e32076e51cae65eb0b0c871405b16e # v2.34.1
with:
php-version: ${{ matrix.php-versions }}
# https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation
extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, mysql, pdo_mysql
coverage: none
ini-file: development
# Temporary workaround for missing pcntl_* in PHP 8.3
ini-values: disable_functions=
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Enable ONLY_FULL_GROUP_BY MySQL option
run: |
echo "SET GLOBAL sql_mode=(SELECT CONCAT(@@sql_mode,',ONLY_FULL_GROUP_BY'));" | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword
echo 'SELECT @@sql_mode;' | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword
- name: Check composer file existence
id: check_composer
uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0
with:
files: apps/${{ env.APP_NAME }}/composer.json
- name: Set up dependencies
# Only run if phpunit config file exists
if: steps.check_composer.outputs.files_exists == 'true'
working-directory: apps/${{ env.APP_NAME }}
run: |
composer remove nextcloud/ocp --dev --no-scripts
composer i
- name: Set up Nextcloud
env:
DB_PORT: 4444
run: |
mkdir data
./occ maintenance:install --verbose --database=mysql --database-name=nextcloud --database-host=127.0.0.1 --database-port=$DB_PORT --database-user=root --database-pass=rootpassword --admin-user admin --admin-pass admin
./occ app:enable --force ${{ env.APP_NAME }}
- name: Check PHPUnit script is defined
id: check_phpunit
continue-on-error: true
working-directory: apps/${{ env.APP_NAME }}
run: |
composer run --list | grep '^ test:unit ' | wc -l | grep 1
- name: PHPUnit
# Only run if phpunit config file exists
if: steps.check_phpunit.outcome == 'success'
working-directory: apps/${{ env.APP_NAME }}
run: composer run test:unit
- name: Print logs
if: always()
run: |
cat data/nextcloud.log
- name: Skipped
# Fail the action when unit tests are not specified
if: steps.check_phpunit.outcome == 'failure'
run: |
echo 'PHPUnit tests are not specified in composer.json scripts'
exit 1
summary:
permissions:
contents: none
runs-on: ubuntu-latest
needs: [changes, phpunit-mysql]
if: always()
name: phpunit-mysql-summary
steps:
- name: Summary status
run: if ${{ needs.changes.outputs.src != 'false' && needs.phpunit-mysql.result != 'success' }}; then exit 1; fi

216
.github/workflows/phpunit-pgsql.yml vendored Normal file
View File

@@ -0,0 +1,216 @@
# This workflow is provided via the organization template repository
#
# https://github.com/nextcloud/.github
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
#
# SPDX-FileCopyrightText: 2022-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: MIT
name: PHPUnit PostgreSQL
on: pull_request
permissions:
contents: read
concurrency:
group: phpunit-pgsql-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout app
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
with:
persist-credentials: false
- name: Get supported server versions
id: versions
uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1
- name: Build test matrix
id: set-matrix
run: |
# Get server branches from version matrix
BRANCHES='${{ steps.versions.outputs.branches }}'
# Build minimal matrix: only latest Nextcloud with PHP 8.3
MATRIX=$(jq -nc \
--argjson branches "$BRANCHES" \
'{include: [{"php-versions": "8.3", "server-versions": $branches[-1]}]}'
)
echo "matrix=$MATRIX" >> $GITHUB_OUTPUT
echo "Generated matrix: $MATRIX"
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/**'
- 'appinfo/**'
- 'lib/**'
- 'templates/**'
- 'tests/**'
- 'vendor/**'
- 'vendor-bin/**'
- '.php-cs-fixer.dist.php'
- 'composer.json'
- 'composer.lock'
phpunit-pgsql:
runs-on: ubuntu-latest
needs: [changes, matrix]
if: needs.changes.outputs.src != 'false'
strategy:
matrix: ${{ fromJson(needs.matrix.outputs.matrix) }}
name: PostgreSQL PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }}
services:
postgres:
image: ghcr.io/nextcloud/continuous-integration-postgres-16:latest # zizmor: ignore[unpinned-images]
ports:
- 4444:5432/tcp
env:
POSTGRES_USER: root
POSTGRES_PASSWORD: rootpassword
POSTGRES_DB: nextcloud
options: --health-cmd pg_isready --health-interval 5s --health-timeout 2s --health-retries 5
steps:
- name: Checkout app
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
with:
persist-credentials: false
path: app-checkout
- name: Detect app ID from appinfo/info.xml
run: |
APP_ID=$(grep -oP '(?<=<id>)[^<]+' app-checkout/appinfo/info.xml | head -1)
echo "APP_NAME=$APP_ID" >> $GITHUB_ENV
echo "Detected app ID: $APP_ID"
- name: Checkout server
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
with:
persist-credentials: false
submodules: true
repository: nextcloud/server
ref: ${{ matrix.server-versions }}
- name: Checkout app
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
with:
persist-credentials: false
path: apps/${{ env.APP_NAME }}
- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@bf6b4fbd49ca58e4608c9c89fba0b8d90bd2a39f # v2.35.5
with:
php-version: ${{ matrix.php-versions }}
# https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation
extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, pgsql, pdo_pgsql
coverage: none
ini-file: development
# Temporary workaround for missing pcntl_* in PHP 8.3
ini-values: disable_functions=
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check composer file existence
id: check_composer
uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0
with:
files: apps/${{ env.APP_NAME }}/composer.json
- name: Set up dependencies
# Only run if phpunit config file exists
if: steps.check_composer.outputs.files_exists == 'true'
working-directory: apps/${{ env.APP_NAME }}
run: |
composer remove nextcloud/ocp --dev --no-scripts
composer i
- name: Set up Nextcloud
env:
DB_PORT: 4444
run: |
mkdir data
./occ maintenance:install --verbose --database=pgsql --database-name=nextcloud --database-host=127.0.0.1 --database-port=$DB_PORT --database-user=root --database-pass=rootpassword --admin-user admin --admin-pass admin
./occ app:enable --force ${{ env.APP_NAME }}
- name: Check PHPUnit script is defined
id: check_phpunit
continue-on-error: true
working-directory: apps/${{ env.APP_NAME }}
run: |
composer run --list | grep '^ test:unit ' | wc -l | grep 1
- name: PHPUnit
# Only run if phpunit config file exists
if: steps.check_phpunit.outcome == 'success'
working-directory: apps/${{ env.APP_NAME }}
run: composer run test:unit
- name: Check PHPUnit integration script is defined
id: check_integration
continue-on-error: true
working-directory: apps/${{ env.APP_NAME }}
run: |
composer run --list | grep '^ test:integration ' | wc -l | grep 1
- name: Run Nextcloud
# Only run if phpunit integration config file exists
if: steps.check_integration.outcome == 'success'
run: php -S localhost:8080 &
- name: PHPUnit integration
# Only run if phpunit integration config file exists
if: steps.check_integration.outcome == 'success'
working-directory: apps/${{ env.APP_NAME }}
run: composer run test:integration
- name: Print logs
if: always()
run: |
cat data/nextcloud.log
- name: Skipped
# Fail the action when neither unit nor integration tests ran
if: steps.check_phpunit.outcome == 'failure' && steps.check_integration.outcome == 'failure'
run: |
echo 'Neither PHPUnit nor PHPUnit integration tests are specified in composer.json scripts'
exit 1
summary:
permissions:
contents: none
runs-on: ubuntu-latest
needs: [changes, phpunit-pgsql]
if: always()
name: phpunit-pgsql-summary
steps:
- name: Summary status
run: if ${{ needs.changes.outputs.src != 'false' && needs.phpunit-pgsql.result != 'success' }}; then exit 1; fi

2
.gitignore vendored
View File

@@ -12,10 +12,10 @@
/js
/css
.DS_Store
composer.lock
build/
tsconfig.app.tsbuildinfo
.env
.env.keys
.envrc
tests/.phpunit.result.cache
stats.html

View File

@@ -1,7 +1,10 @@
module.exports = {
'*.{ts,vue}': ['eslint --fix'],
'src/**/*.{scss,vue,ts,md,json}': ['prettier --write'],
'*.md': ['prettier --write'],
'*.php': [() => 'make php-cs-fixer'],
'*Controller.php': [() => 'make openapi', () => 'git add openapi*.json'],
'*.{scss,vue,ts,md}': ['prettier --write'],
'*.json': (files) => {
const filtered = files.filter(file => !file.includes('openapi.json'));
return filtered.length > 0 ? `prettier --write ${filtered.join(' ')}` : [];
},
'*.php': [() => 'make php-cs-fixer', () => 'make test'],
'*Controller.php': [() => 'make openapi', () => 'git add openapi.json'],
}

View File

@@ -0,0 +1,212 @@
name: Bug Report
description: Report a bug or issue with the AutoCurrency app
labels: ["bug"]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to report a bug! Please fill out the information below to help us investigate.
- type: textarea
id: description
attributes:
label: Bug Description
description: A clear and concise description of what the bug is.
placeholder: Describe the bug...
validations:
required: true
- type: textarea
id: steps
attributes:
label: Steps to Reproduce
description: Steps to reproduce the behavior
placeholder: |
1. Go to '...'
2. Click on '...'
3. Scroll down to '...'
4. See error
validations:
required: true
- type: textarea
id: expected
attributes:
label: Expected Behavior
description: What you expected to happen
placeholder: Describe what should happen...
validations:
required: true
- type: textarea
id: actual
attributes:
label: Actual Behavior
description: What actually happened
placeholder: Describe what actually happens...
validations:
required: true
- type: input
id: nextcloud-version
attributes:
label: Nextcloud Version
description: What version of Nextcloud are you running?
placeholder: e.g., 28.0.1
validations:
required: true
- type: input
id: app-version
attributes:
label: AutoCurrency App Version
description: What version of the AutoCurrency app are you using?
placeholder: e.g., 1.0.0
validations:
required: true
- type: input
id: php-version
attributes:
label: PHP Version
description: What version of PHP is your server running?
placeholder: e.g., 8.2.12
validations:
required: true
- type: dropdown
id: database
attributes:
label: Database
description: Which database are you using?
options:
- SQLite
- MySQL/MariaDB
- PostgreSQL
- Other
validations:
required: true
- type: input
id: browser
attributes:
label: Browser
description: Which browser are you using? (if applicable)
placeholder: e.g., Firefox 120, Chrome 119, Safari 17
- type: markdown
attributes:
value: |
## 📋 Debugging Information
The following information helps us investigate and fix issues quickly. Please provide as much detail as possible.
- type: textarea
id: migration-status
attributes:
label: Migration Status
description: |
**How to check migration status:**
This shows which database migrations have been executed for the AutoCurrency app.
**For Docker installations:**
```bash
docker exec --user www-data -i nextcloud-aio-nextcloud php occ migrations:status autocurrency
```
**For standard installations:**
```bash
php occ migrations:status autocurrency
```
Or from the Nextcloud directory:
```bash
sudo -u www-data php occ migrations:status autocurrency
```
placeholder: Paste the migration status output here...
render: shell
- type: textarea
id: nextcloud-logs
attributes:
label: Nextcloud Server Logs
description: |
**How to get server logs:**
Look for errors related to the AutoCurrency app (last 20-50 lines recommended).
**Via Web UI:**
- Go to Nextcloud Settings → Administration → Logging (or `/settings/admin/logging`)
- Look for entries containing "autocurrency"
**For Docker installations:**
```bash
docker exec --user www-data -i nextcloud-aio-nextcloud tail -100 /var/www/html/data/nextcloud.log | grep -i autocurrency
```
**For standard installations:**
```bash
tail -100 /path/to/nextcloud/data/nextcloud.log | grep -i autocurrency
```
Or from the Nextcloud directory:
```bash
sudo -u www-data tail -100 data/nextcloud.log | grep -i autocurrency
```
placeholder: Paste Nextcloud server logs here...
render: shell
- type: textarea
id: browser-console
attributes:
label: Browser Console Errors
description: |
**How to check browser console:**
1. Open the page where the issue occurs
2. Press **F12** (or right-click → Inspect → Console tab)
3. Look for red error messages
4. Copy any errors related to the AutoCurrency app
**Tip:** You can right-click on an error and select "Copy message" or "Copy stack trace"
placeholder: Paste browser console errors here...
render: javascript
- type: textarea
id: network-errors
attributes:
label: Network Request Errors
description: |
**How to check network requests:**
1. Open the page where the issue occurs
2. Press **F12** → Go to the **Network** tab
3. Reproduce the issue
4. Look for failed requests (shown in red or with 4xx/5xx status codes)
5. Click on the failed request
6. Copy the following information:
- **Request URL** (e.g., `/apps/autocurrency/api/...`)
- **Status Code** (e.g., 500, 404, 403)
- **Response** tab content (the error message/data returned)
**Example format:**
```
Request: POST /apps/autocurrency/api/...
Status: 500 Internal Server Error
Response: {"error": "Database connection failed"}
```
placeholder: Paste network error details here...
render: shell
- type: textarea
id: screenshots
attributes:
label: Screenshots
description: |
If applicable, add screenshots to help explain your problem.
You can drag and drop images directly into this field.
- type: textarea
id: additional
attributes:
label: Additional Context
description: Add any other context about the problem here (e.g., recent changes, specific configuration, workarounds attempted)

View File

@@ -0,0 +1,8 @@
blank_issues_enabled: true
contact_links:
- name: Nextcloud Community Forum
url: https://help.nextcloud.com
about: Ask questions and get help from the Nextcloud community
- name: Security Issue
url: https://github.com/chenasraf/nextcloud-autocurrency/security/advisories/new
about: Report a security vulnerability privately

View File

@@ -0,0 +1,71 @@
name: Feature Request
description: Suggest a new feature or enhancement for the AutoCurrency app
labels: ["enhancement"]
body:
- type: markdown
attributes:
value: |
Thanks for suggesting a feature! Please provide as much detail as possible to help us understand your request.
- type: textarea
id: summary
attributes:
label: Feature Summary
description: A brief summary of the feature you'd like to see
placeholder: Summarize the feature in 1-2 sentences...
validations:
required: true
- type: textarea
id: problem
attributes:
label: Problem or Use Case
description: |
What problem does this feature solve? What's your use case?
Tip: "I'm always frustrated when..."
placeholder: Describe the problem or use case...
validations:
required: true
- type: textarea
id: solution
attributes:
label: Proposed Solution
description: How would you like this feature to work?
placeholder: Describe your proposed solution...
validations:
required: true
- type: textarea
id: alternatives
attributes:
label: Alternatives Considered
description: Have you considered any alternative solutions or workarounds?
placeholder: Describe any alternative solutions or features you've considered...
- type: textarea
id: examples
attributes:
label: Examples
description: |
Are there any similar features in other apps that demonstrate what you're looking for?
placeholder: Provide links or descriptions of similar features elsewhere...
- type: dropdown
id: willing-to-contribute
attributes:
label: Willing to Contribute?
description: Would you be willing to contribute code for this feature?
options:
- "Yes, I can submit a PR"
- "Maybe, with guidance"
- "No, but I can help test"
- "No"
validations:
required: false
- type: textarea
id: additional
attributes:
label: Additional Context
description: Add any other context, mockups, or screenshots about the feature request here

View File

@@ -1,7 +1,7 @@
# SPDX-FileCopyrightText: Bernhard Posselt <dev@bernhard-posselt.com>
# SPDX-License-Identifier: AGPL-3.0-or-later
#
# Nextcloud App Template — Makefile
# AutoCurrency — Makefile
# ---------------------------------
# A friendly, batteries-included Makefile for building and packaging a Nextcloud app
# that uses pnpm (JS) and Composer (PHP).
@@ -30,7 +30,7 @@ app_name=autocurrency
repo_path=chenasraf/nextcloud-$(app_name)
build_tools_directory=$(CURDIR)/build/tools
source_build_directory=$(CURDIR)/build/artifacts/source
source_intermediate_directory=$(CURDIR)/build/artifacts/intermediate-source
source_intermediate_directory=$(CURDIR)/build/artifacts/intermediate-source/$(app_name)
source_package_name=$(source_build_directory)/$(app_name)
app_intermediate_directory=$(CURDIR)/build/artifacts/intermediate/$(app_name)
appstore_build_directory=$(CURDIR)/build/artifacts/appstore
@@ -42,6 +42,10 @@ composer_bin := $(if $(composer),$(composer),php $(composer_phar))
pnpm_wrapper=$(build_tools_directory)/pnpm.sh
pnpm_cmd=$(if $(pnpm),$(pnpm),$(pnpm_wrapper))
# Optional: Set path to Nextcloud installation for local testing
# Can be overridden by environment variable: NEXTCLOUD_ROOT=/path make test
NEXTCLOUD_ROOT ?=
# Default target: install deps & build JS (and PHP if composer.json exists)
all: build
@@ -147,14 +151,15 @@ source:
--exclude="**/.git/**/*" \
--exclude="build" \
--exclude="tests" \
--exclude="src" \
--exclude="/src" \
--exclude="js/node_modules" \
--exclude="node_modules" \
--exclude="*.log" \
--exclude="dist/js/*.log" \
--exclude="rename-template.sh" \
$(CURDIR)/ $(source_intermediate_directory)
cd $(source_intermediate_directory) && \
tar czf $(source_package_name).tar.gz ../$(app_name)
cd $(CURDIR)/build/artifacts/intermediate-source && \
tar czf $(source_package_name).tar.gz $(app_name)
# appstore:
# - Create an App Store tarball (strips tests, dotfiles, dev configs)
@@ -187,19 +192,48 @@ appstore:
--exclude="bower.json" \
--exclude="karma.*" \
--exclude="protractor\.*" \
--exclude=".*" \
--exclude="/gen" \
--exclude="/.*" \
--exclude="dist/js/.*" \
--exclude="src" \
--exclude="/src" \
--exclude="rename-template.sh" \
$(CURDIR)/ $(app_intermediate_directory)
cd $(app_intermediate_directory) && \
tar czf $(appstore_package_name).tar.gz ../$(app_name)
cd $(CURDIR)/build/artifacts/intermediate && \
tar czf $(appstore_package_name).tar.gz $(app_name)
# test:
# - Run PHP unit tests (standard + optional integration config)
# - Run PHP unit tests locally with a configured Nextcloud installation
# - Requires: A fully configured and installed Nextcloud instance with database
# - Auto-detects Nextcloud installation or uses NEXTCLOUD_ROOT (Makefile var or env var)
# - RECOMMENDED: Use 'make test-docker' instead (works in any environment)
.PHONY: test
test: composer
$(CURDIR)/vendor/phpunit/phpunit/phpunit -c tests/phpunit.xml
( test ! -f tests/phpunit.integration.xml ) || $(CURDIR)/vendor/phpunit/phpunit/phpunit -c tests/phpunit.integration.xml
@NC_ROOT="$(NEXTCLOUD_ROOT)"; \
if [ -n "$$NC_ROOT" ]; then \
NC_ROOT=$$(echo "$$NC_ROOT" | sed "s|^\\\~|$$HOME|" | sed "s|^~|$$HOME|"); \
fi; \
if [ -z "$$NC_ROOT" ]; then \
if [ -d "$(CURDIR)/../../../tests/bootstrap.php" ]; then \
NC_ROOT="$(CURDIR)/../../.."; \
fi; \
fi; \
if [ -z "$$NC_ROOT" ]; then \
echo "\x1b[33mCould not find Nextcloud installation.\x1b[0m"; \
echo ""; \
echo "Local testing requires a fully configured Nextcloud instance."; \
echo ""; \
echo "Options:"; \
echo " 1. Use Docker tests (recommended): \x1b[32mmake test-docker\x1b[0m"; \
echo " 2. Set NEXTCLOUD_ROOT in Makefile (line 47) or as env var:"; \
echo " \x1b[32mNEXTCLOUD_ROOT=/path/to/nextcloud make test\x1b[0m"; \
echo ""; \
exit 1; \
fi; \
echo "\x1b[32mUsing Nextcloud root: $$NC_ROOT\x1b[0m"; \
NEXTCLOUD_ROOT="$$NC_ROOT" $(CURDIR)/vendor/phpunit/phpunit/phpunit -c tests/phpunit.xml; \
if [ -f tests/phpunit.integration.xml ]; then \
NEXTCLOUD_ROOT="$$NC_ROOT" $(CURDIR)/vendor/phpunit/phpunit/phpunit -c tests/phpunit.integration.xml; \
fi
# test-docker:
# - Run PHP unit tests inside a Nextcloud Docker container
@@ -231,7 +265,7 @@ test-docker:
exit 1; \
fi; \
echo "\x1b[33mRunning tests in container $$CONTAINER_ID for app $$APP_DIR\x1b[0m"; \
docker exec $$CONTAINER_ID phpunit -c apps-shared/$$APP_DIR/tests/phpunit.xml
docker exec $$CONTAINER_ID phpunit -c apps-shared/$$APP_DIR/tests/phpunit.docker.xml
# lint:
# - Lint JS via pnpm and PHP via composer script "lint"

2995
composer.lock generated Normal file

File diff suppressed because it is too large Load Diff

8
composer/autoload.php Normal file
View File

@@ -0,0 +1,8 @@
<?php
// SPDX-FileCopyrightText: Chen Asraf <contact@casraf.dev>
// SPDX-License-Identifier: AGPL-3.0-or-later
declare(strict_types=1);
require_once __DIR__ . '/../vendor/autoload.php';

View File

@@ -24,7 +24,7 @@ class {{pascalCase name}} extends Command {
*/
protected function configure(): void {
parent::configure();
$this->setName('jukebox:{{kebabCase name}}');
$this->setName('mynextcloudapp:{{kebabCase name}}');
}
/**

View File

@@ -1,22 +1,19 @@
<template>
<div>{{ startCase name }}</div>
</template>
<script>
<script lang="ts">
import { defineComopnent, type PropType } from 'vue'
// import NcComponentExample from '@nextcloud/vue/dist/Components/NcComponentExample.js'
//
// import IconExample from 'vue-material-design-icons/Example.vue'
// import IconExample from '@icons/Example.vue'
export default {
export default defineComponent({
name: '{{pascalCase name}}',
components: {
//
},
}
})
</script>
<style scoped lang="scss"></style>

View File

@@ -0,0 +1,23 @@
<template>
<div class="mynextcloudapp-{{ kebabCase name }}">{{ startCase name }} Page</div>
</template>
<script lang="ts">
import { defineComopnent, type PropType } from 'vue'
// import NcComponentExample from '@nextcloud/vue/dist/Components/NcComponentExample.js'
// import IconExample from '@icons/Example.vue'
export default defineComponent({
name: '{{pascalCase name}}Page',
components: {
//
},
})
</script>
<style scoped lang="scss">
#mynextcloudapp-{{ kebabCase name }} {
/* Your styles here */
}
</style>

View File

@@ -2,6 +2,9 @@
declare(strict_types=1);
// SPDX-FileCopyrightText: Chen Asraf <contact@casraf.dev>
// SPDX-License-Identifier: AGPL-3.0-or-later
namespace OCA\AutoCurrency\AppInfo;
use OCP\AppFramework\App;
@@ -26,7 +29,34 @@ class Application extends App implements IBootstrap {
public function boot(IBootContext $context): void {
}
/**
* Helper to parse Vite Manifest
*/
public static function getViteEntryScript(string $entryName): string {
$jsDir = realpath(__DIR__ . '/../' . Application::JS_DIR);
$manifestPath = dirname($jsDir) . '/.vite/manifest.json';
if (!file_exists($manifestPath)) {
return '';
}
$manifest = json_decode(file_get_contents($manifestPath), true);
if (isset($manifest[$entryName]['file'])) {
$manifestFile = $manifest[$entryName]['file'];
$fullPath = dirname($jsDir) . '/' . $manifestFile;
if (!file_exists($fullPath)) {
return '';
}
return pathinfo($manifestFile, PATHINFO_FILENAME);
}
return '';
}
public static function tableName(string $table): string {
return 'autocurrency_' . $table;
return self::APP_ID . '_' . $table;
}
}

View File

@@ -7,7 +7,6 @@ use OCP\AppFramework\Http\TemplateResponse;
use OCP\IAppConfig;
use OCP\IL10N;
use OCP\Settings\ISettings;
use OCP\Util;
class AdminSettings implements ISettings {
public function __construct(
@@ -20,9 +19,10 @@ class AdminSettings implements ISettings {
* @return TemplateResponse
*/
public function getForm(): TemplateResponse {
Util::addScript(Application::APP_ID, Application::JS_DIR . '/autocurrency-admin');
Util::addStyle(Application::APP_ID, Application::CSS_DIR . '/autocurrency-style');
return new TemplateResponse(Application::APP_ID, 'settings', [], '');
return new TemplateResponse(Application::APP_ID, 'settings', [
'script' => Application::getViteEntryScript('admin.ts'),
'style' => Application::getViteEntryScript('style.css'),
], '');
}
public function getSection(): string {

View File

@@ -7,7 +7,6 @@ use OCP\AppFramework\Http\TemplateResponse;
use OCP\IAppConfig;
use OCP\IL10N;
use OCP\Settings\ISettings;
use OCP\Util;
class UserSettings implements ISettings {
public function __construct(
@@ -20,9 +19,10 @@ class UserSettings implements ISettings {
* @return TemplateResponse
*/
public function getForm(): TemplateResponse {
Util::addScript(Application::APP_ID, Application::JS_DIR . '/autocurrency-user');
Util::addStyle(Application::APP_ID, Application::CSS_DIR . '/autocurrency-style');
return new TemplateResponse(Application::APP_ID, 'settings', [], '');
return new TemplateResponse(Application::APP_ID, 'settings', [
'script' => Application::getViteEntryScript('user.ts'),
'style' => Application::getViteEntryScript('style.css'),
], '');
}
public function getSection(): string {

View File

@@ -9,9 +9,9 @@
},
"scripts": {
"dev": "vite build --watch",
"build": "vue-tsc -b && vite build",
"build": "vite build",
"lint": "eslint src",
"format": "eslint --fix src && prettier --write {src/,README.md}",
"format": "eslint --fix src && prettier --write {vite.config.ts,src/,README.md}",
"prepare": "husky",
"gen": "simple-scaffold -c . -k"
},
@@ -41,11 +41,13 @@
"lint-staged": "^16.2.7",
"prettier": "^2.8.8",
"prettier-plugin-vue": "^1.1.6",
"rollup-plugin-visualizer": "^6.0.5",
"sass": "^1.94.2",
"sass-embedded": "^1.93.3",
"typescript": "^5.9.3",
"typescript": "5.9.2",
"typescript-eslint": "^8.47.0",
"vite": "^6.4.1",
"vite-plugin-checker": "^0.11.0",
"vue-router": "^4.6.3",
"vue-tsc": "^2.2.12"
}

559
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -24,9 +24,9 @@ module.exports = () => {
output: 'src/components',
subDir: false,
},
page: {
templates: ['gen/page'],
output: 'src/pages',
view: {
templates: ['gen/view'],
output: 'src/views',
subDir: false,
},
command: {

6
src/vite-env.d.ts vendored
View File

@@ -1 +1,7 @@
/// <reference types="vite/client" />
declare module '@icons/*.vue' {
import type { DefineComponent } from 'vue'
const component: DefineComponent<object, object, unknown>
export default component
}

View File

@@ -1 +1,12 @@
<?php
use OCA\AutoCurrency\AppInfo\Application;
use OCP\Util;
/* @var array $_ */
$script = $_['script'];
$style = $_['style'];
Util::addScript(Application::APP_ID, Application::JS_DIR . "/$script");
Util::addStyle(Application::APP_ID, Application::CSS_DIR . "/$style");
?>
<div id="autocurrency-settings"></div>

View File

@@ -2,7 +2,37 @@
declare(strict_types=1);
require_once __DIR__ . '/../../../tests/bootstrap.php';
// Detect Nextcloud bootstrap location
// Priority: 1) NEXTCLOUD_ROOT env var, 2) Docker location, 3) Standard location
$nextcloudBootstrap = null;
\OC_App::loadApp(OCA\AutoCurrency\AppInfo\Application::APP_ID);
OC_Hook::clear();
// Check both $_ENV and getenv() as they can differ depending on PHP configuration
$nextcloudRoot = $_ENV['NEXTCLOUD_ROOT'] ?? getenv('NEXTCLOUD_ROOT');
if (!empty($nextcloudRoot)) {
// Use NEXTCLOUD_ROOT environment variable (set by Makefile for local testing)
$nextcloudBootstrap = $nextcloudRoot . '/tests/bootstrap.php';
} elseif (file_exists(__DIR__ . '/../../../tests/bootstrap.php')) {
// Standard location (Docker/installed in Nextcloud apps directory)
$nextcloudBootstrap = __DIR__ . '/../../../tests/bootstrap.php';
}
if ($nextcloudBootstrap && file_exists($nextcloudBootstrap)) {
// Running with full Nextcloud environment
// Define OC_CONSOLE to bypass installation check during tests
if (!defined('OC_CONSOLE')) {
define('OC_CONSOLE', 1);
}
require_once $nextcloudBootstrap;
require_once __DIR__ . '/../vendor/autoload.php';
\OC_App::loadApp(OCA\AutoCurrency\AppInfo\Application::APP_ID);
OC_Hook::clear();
} else {
// Cannot find Nextcloud bootstrap
echo "\n\033[31mError: Nextcloud bootstrap not found.\033[0m\n";
echo "For local testing, set NEXTCLOUD_ROOT environment variable:\n";
echo " NEXTCLOUD_ROOT=~/Dev/nextcloud-docker-dev/workspace/server make test\n";
echo "\nOr run tests in Docker:\n";
echo " make test-docker\n\n";
exit(1);
}

14
tests/phpunit.docker.xml Normal file
View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="bootstrap.php"
timeoutForSmallTests="900"
timeoutForMediumTests="900"
timeoutForLargeTests="900"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
colors="true">
<testsuites>
<testsuite name="AutoCurrency Tests">
<directory suffix="Test.php">.</directory>
</testsuite>
</testsuites>
</phpunit>

View File

@@ -1,12 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="bootstrap.php" timeoutForSmallTests="900" timeoutForMediumTests="900" timeoutForLargeTests="900" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.4/phpunit.xsd" cacheDirectory=".phpunit.cache">
<testsuite name="Auto Currency Tests">
<directory suffix="Test.php">.</directory>
</testsuite>
<source>
<include>
<directory suffix=".php">../appinfo</directory>
<directory suffix=".php">../lib</directory>
</include>
</source>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="bootstrap.php"
timeoutForSmallTests="900"
timeoutForMediumTests="900"
timeoutForLargeTests="900"
cacheDirectory=".phpunit.cache"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
colors="true">
<testsuites>
<testsuite name="AutoCurrency Tests">
<directory suffix="Test.php">.</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory suffix=".php">../appinfo</directory>
<directory suffix=".php">../lib</directory>
</include>
</source>
</phpunit>

View File

@@ -127,7 +127,7 @@ final class ApiControllerTest extends TestCase {
/** Fake a Cospend Project without the class present. */
private function makeProject(string $id, string $name, string $base): object {
$p = $this->getMockBuilder(\stdClass::class)
->addMethods(['getId', 'getName', 'getCurrencyName'])
->onlyMethods(['getId', 'getName', 'getCurrencyName'])
->getMock();
$p->method('getId')->willReturn($id);
@@ -315,7 +315,7 @@ final class ApiControllerTest extends TestCase {
$this->userSession->method('getUser')->willReturn($user);
$p1 = $this->getMockBuilder(\OCA\Cospend\Db\Project::class)
->disableOriginalConstructor()
->addMethods(['getId', 'getName', 'getCurrencyName'])
->onlyMethods(['getId', 'getName', 'getCurrencyName'])
->getMock();
$p1->method('getId')->willReturn('p1');
$p1->method('getName')->willReturn('Trip');
@@ -323,7 +323,7 @@ final class ApiControllerTest extends TestCase {
$p2 = $this->getMockBuilder(\OCA\Cospend\Db\Project::class)
->disableOriginalConstructor()
->addMethods(['getId', 'getName', 'getCurrencyName'])
->onlyMethods(['getId', 'getName', 'getCurrencyName'])
->getMock();
$p2->method('getId')->willReturn('p2');
$p2->method('getName')->willReturn(''); // triggers fallback to id
@@ -404,7 +404,7 @@ final class ApiControllerTest extends TestCase {
$p1 = $this->getMockBuilder(\OCA\Cospend\Db\Project::class)
->disableOriginalConstructor()
->addMethods(['getId', 'getName', 'getCurrencyName'])
->onlyMethods(['getId', 'getName', 'getCurrencyName'])
->getMock();
$p1->method('getId')->willReturn('p1');
$p1->method('getName')->willReturn('Crypto Trip');
@@ -455,7 +455,7 @@ final class ApiControllerTest extends TestCase {
// Project with base 'usd'
$project = $this->getMockBuilder(\OCA\Cospend\Db\Project::class)
->disableOriginalConstructor()
->addMethods(['getCurrencyName'])
->onlyMethods(['getCurrencyName'])
->getMock();
$project->method('getCurrencyName')->willReturn('usd');

View File

@@ -18,7 +18,7 @@ use PHPUnit\Framework\TestCase;
use Psr\Log\LoggerInterface;
use ReflectionClass;
final class CurrencyResolverTest extends TestCase {
final class FetchCurrenciesServiceTest extends TestCase {
private FetchCurrenciesService $resolver;
protected function setUp(): void {

171
vendor-bin/cs-fixer/composer.lock generated Normal file
View File

@@ -0,0 +1,171 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "59bdbac023efd7059e30cfd98dc00b94",
"packages": [],
"packages-dev": [
{
"name": "kubawerlos/php-cs-fixer-custom-fixers",
"version": "v3.35.1",
"source": {
"type": "git",
"url": "https://github.com/kubawerlos/php-cs-fixer-custom-fixers.git",
"reference": "2a35f80ae24ca77443a7af1599c3a3db1b6bd395"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/kubawerlos/php-cs-fixer-custom-fixers/zipball/2a35f80ae24ca77443a7af1599c3a3db1b6bd395",
"reference": "2a35f80ae24ca77443a7af1599c3a3db1b6bd395",
"shasum": ""
},
"require": {
"ext-filter": "*",
"ext-tokenizer": "*",
"friendsofphp/php-cs-fixer": "^3.87",
"php": "^7.4 || ^8.0"
},
"require-dev": {
"phpunit/phpunit": "^9.6.24 || ^10.5.51 || ^11.5.32"
},
"type": "library",
"autoload": {
"psr-4": {
"PhpCsFixerCustomFixers\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Kuba Werłos",
"email": "werlos@gmail.com"
}
],
"description": "A set of custom fixers for PHP CS Fixer",
"support": {
"issues": "https://github.com/kubawerlos/php-cs-fixer-custom-fixers/issues",
"source": "https://github.com/kubawerlos/php-cs-fixer-custom-fixers/tree/v3.35.1"
},
"funding": [
{
"url": "https://github.com/kubawerlos",
"type": "github"
}
],
"time": "2025-09-28T18:43:35+00:00"
},
{
"name": "nextcloud/coding-standard",
"version": "v1.4.0",
"source": {
"type": "git",
"url": "https://github.com/nextcloud/coding-standard.git",
"reference": "8e06808c1423e9208d63d1bd205b9a38bd400011"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nextcloud/coding-standard/zipball/8e06808c1423e9208d63d1bd205b9a38bd400011",
"reference": "8e06808c1423e9208d63d1bd205b9a38bd400011",
"shasum": ""
},
"require": {
"kubawerlos/php-cs-fixer-custom-fixers": "^3.22",
"php": "^8.0",
"php-cs-fixer/shim": "^3.17"
},
"type": "library",
"autoload": {
"psr-4": {
"Nextcloud\\CodingStandard\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Christoph Wurst",
"email": "christoph@winzerhof-wurst.at"
}
],
"description": "Nextcloud coding standards for the php cs fixer",
"keywords": [
"dev"
],
"support": {
"issues": "https://github.com/nextcloud/coding-standard/issues",
"source": "https://github.com/nextcloud/coding-standard/tree/v1.4.0"
},
"time": "2025-06-19T12:27:27+00:00"
},
{
"name": "php-cs-fixer/shim",
"version": "v3.90.0",
"source": {
"type": "git",
"url": "https://github.com/PHP-CS-Fixer/shim.git",
"reference": "db628db551759424b1ba511aef3b0ff0550044f6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHP-CS-Fixer/shim/zipball/db628db551759424b1ba511aef3b0ff0550044f6",
"reference": "db628db551759424b1ba511aef3b0ff0550044f6",
"shasum": ""
},
"require": {
"ext-json": "*",
"ext-tokenizer": "*",
"php": "^7.4 || ^8.0"
},
"replace": {
"friendsofphp/php-cs-fixer": "self.version"
},
"suggest": {
"ext-dom": "For handling output formats in XML",
"ext-mbstring": "For handling non-UTF8 characters."
},
"bin": [
"php-cs-fixer",
"php-cs-fixer.phar"
],
"type": "application",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Dariusz Rumiński",
"email": "dariusz.ruminski@gmail.com"
}
],
"description": "A tool to automatically fix PHP code style",
"support": {
"issues": "https://github.com/PHP-CS-Fixer/shim/issues",
"source": "https://github.com/PHP-CS-Fixer/shim/tree/v3.90.0"
},
"time": "2025-11-20T15:15:37+00:00"
}
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": {},
"prefer-stable": false,
"prefer-lowest": false,
"platform": {},
"platform-dev": {},
"platform-overrides": {
"php": "8.1"
},
"plugin-api-version": "2.6.0"
}

266
vendor-bin/openapi-extractor/composer.lock generated Normal file
View File

@@ -0,0 +1,266 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "cc4604e4c3d0f17f3feec0fe94971ff6",
"packages": [],
"packages-dev": [
{
"name": "adhocore/cli",
"version": "v1.9.4",
"source": {
"type": "git",
"url": "https://github.com/adhocore/php-cli.git",
"reference": "474dc3d7ab139796be98b104d891476e3916b6f4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/adhocore/php-cli/zipball/474dc3d7ab139796be98b104d891476e3916b6f4",
"reference": "474dc3d7ab139796be98b104d891476e3916b6f4",
"shasum": ""
},
"require": {
"php": ">=8.0"
},
"require-dev": {
"phpunit/phpunit": "^9.0"
},
"type": "library",
"autoload": {
"files": [
"src/functions.php"
],
"psr-4": {
"Ahc\\Cli\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jitendra Adhikari",
"email": "jiten.adhikary@gmail.com"
}
],
"description": "Command line interface library for PHP",
"keywords": [
"argument-parser",
"argv-parser",
"cli",
"cli-action",
"cli-app",
"cli-color",
"cli-option",
"cli-writer",
"command",
"console",
"console-app",
"php-cli",
"php8",
"stream-input",
"stream-output"
],
"support": {
"issues": "https://github.com/adhocore/php-cli/issues",
"source": "https://github.com/adhocore/php-cli/tree/v1.9.4"
},
"funding": [
{
"url": "https://paypal.me/ji10",
"type": "custom"
},
{
"url": "https://github.com/adhocore",
"type": "github"
}
],
"time": "2025-05-11T13:23:54+00:00"
},
{
"name": "nextcloud/openapi-extractor",
"version": "dev-main",
"source": {
"type": "git",
"url": "https://github.com/nextcloud/openapi-extractor.git",
"reference": "fc40e144aa0d7bdd388a20ded6dc7681f037a18e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nextcloud/openapi-extractor/zipball/fc40e144aa0d7bdd388a20ded6dc7681f037a18e",
"reference": "fc40e144aa0d7bdd388a20ded6dc7681f037a18e",
"shasum": ""
},
"require": {
"adhocore/cli": "^1.7",
"ext-simplexml": "*",
"nikic/php-parser": "^5.0",
"php": "^8.1",
"phpstan/phpdoc-parser": "^2.1"
},
"require-dev": {
"nextcloud/coding-standard": "^1.2",
"nextcloud/ocp": "dev-master",
"rector/rector": "^2.0"
},
"default-branch": true,
"bin": [
"bin/generate-spec",
"bin/merge-specs"
],
"type": "library",
"autoload": {
"psr-4": {
"OpenAPIExtractor\\": "src"
}
},
"scripts": {
"lint": [
"find . -name \\*.php -not -path './tests/*' -not -path './vendor/*' -not -path './build/*' -print0 | xargs -0 -n1 php -l"
],
"cs:check": [
"php-cs-fixer fix --dry-run --diff"
],
"cs:fix": [
"php-cs-fixer fix"
],
"test:unit": [
"cd tests && ../bin/generate-spec"
],
"rector": [
"rector && composer cs:fix"
]
},
"license": [
"AGPL-3.0-or-later"
],
"description": "A tool for extracting OpenAPI specifications from Nextcloud source code",
"support": {
"source": "https://github.com/nextcloud/openapi-extractor/tree/main",
"issues": "https://github.com/nextcloud/openapi-extractor/issues"
},
"time": "2025-11-17T10:11:48+00:00"
},
{
"name": "nikic/php-parser",
"version": "v5.6.2",
"source": {
"type": "git",
"url": "https://github.com/nikic/PHP-Parser.git",
"reference": "3a454ca033b9e06b63282ce19562e892747449bb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/3a454ca033b9e06b63282ce19562e892747449bb",
"reference": "3a454ca033b9e06b63282ce19562e892747449bb",
"shasum": ""
},
"require": {
"ext-ctype": "*",
"ext-json": "*",
"ext-tokenizer": "*",
"php": ">=7.4"
},
"require-dev": {
"ircmaxell/php-yacc": "^0.0.7",
"phpunit/phpunit": "^9.0"
},
"bin": [
"bin/php-parse"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.x-dev"
}
},
"autoload": {
"psr-4": {
"PhpParser\\": "lib/PhpParser"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Nikita Popov"
}
],
"description": "A PHP parser written in PHP",
"keywords": [
"parser",
"php"
],
"support": {
"issues": "https://github.com/nikic/PHP-Parser/issues",
"source": "https://github.com/nikic/PHP-Parser/tree/v5.6.2"
},
"time": "2025-10-21T19:32:17+00:00"
},
{
"name": "phpstan/phpdoc-parser",
"version": "2.3.0",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpdoc-parser.git",
"reference": "1e0cd5370df5dd2e556a36b9c62f62e555870495"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/1e0cd5370df5dd2e556a36b9c62f62e555870495",
"reference": "1e0cd5370df5dd2e556a36b9c62f62e555870495",
"shasum": ""
},
"require": {
"php": "^7.4 || ^8.0"
},
"require-dev": {
"doctrine/annotations": "^2.0",
"nikic/php-parser": "^5.3.0",
"php-parallel-lint/php-parallel-lint": "^1.2",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "^2.0",
"phpstan/phpstan-phpunit": "^2.0",
"phpstan/phpstan-strict-rules": "^2.0",
"phpunit/phpunit": "^9.6",
"symfony/process": "^5.2"
},
"type": "library",
"autoload": {
"psr-4": {
"PHPStan\\PhpDocParser\\": [
"src/"
]
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "PHPDoc parser with support for nullable, intersection and generic types",
"support": {
"issues": "https://github.com/phpstan/phpdoc-parser/issues",
"source": "https://github.com/phpstan/phpdoc-parser/tree/2.3.0"
},
"time": "2025-08-30T15:50:23+00:00"
}
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": {
"nextcloud/openapi-extractor": 20
},
"prefer-stable": false,
"prefer-lowest": false,
"platform": {},
"platform-dev": {},
"platform-overrides": {
"php": "8.1"
},
"plugin-api-version": "2.6.0"
}

1691
vendor-bin/phpunit/composer.lock generated Normal file

File diff suppressed because it is too large Load Diff

2127
vendor-bin/psalm/composer.lock generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,34 @@
import { createAppConfig } from '@nextcloud/vite-config'
import path from 'path'
import { visualizer } from 'rollup-plugin-visualizer'
import checker from 'vite-plugin-checker'
const manualChunksList = [
'emoji-mart-vue-fast',
'date-fns',
'lodash',
'floating-vue',
'vue-material-design-icons',
]
const manualChunksGroups = {
vue: ['vue-router', 'vue'],
}
const nextcloudSharedList = [
'auth',
'axios',
'browser-storage',
'capabilities',
'event-bus',
'files',
'initial-state',
'l10n',
'logger',
'paths',
'router',
'sharing',
]
// https://vite.dev/config/
export default createAppConfig(
@@ -12,17 +41,65 @@ export default createAppConfig(
root: 'src',
resolve: {
alias: {
'@': path.resolve(__dirname, 'src'),
'@icons': path.resolve(__dirname, 'node_modules/vue-material-design-icons'),
'@': path.resolve(__dirname, 'src'),
},
},
plugins: [
checker({
vueTsc: true,
}),
visualizer({
open: process.env.VITE_BUILD_ANALYZE === 'true',
filename: 'stats.html',
template: 'treemap',
}),
],
build: {
outDir: '../dist',
manifest: true,
cssCodeSplit: false,
rollupOptions: {
output: {
manualChunks: {
vendor: ['vue', 'vue-router'],
entryFileNames: 'js/[name]-[hash].mjs',
chunkFileNames: 'js/[name]-[hash].mjs',
assetFileNames: '[ext]/[name]-[hash].[ext]',
manualChunks(id) {
if (!id.includes('node_modules')) {
return
}
// Parse package path
const parts = id.split('node_modules/')
const pkgPath = parts[parts.length - 1]
// Check for @nextcloud/xxx or nextcloud-xxx
const ncMatch = pkgPath.match(/^@?nextcloud[/-]([^/]+)/)
// Get the package name (e.g., 'auth', 'vue', 'axios')
const ncPkgName = ncMatch?.[1]
if (ncPkgName) {
if (nextcloudSharedList.includes(ncPkgName)) {
return 'nextcloud-common'
}
return `nextcloud-${ncPkgName}`
}
for (const chunk of manualChunksList) {
if (pkgPath.includes(chunk)) {
return chunk
}
}
for (const [groupName, groupPackages] of Object.entries(manualChunksGroups)) {
if (groupPackages.some((pkg) => pkgPath.includes(pkg))) {
return groupName
}
}
// Fallback
return 'vendor'
},
},
},