Clone
2
Development
Chen Asraf edited this page 2026-03-18 11:25:59 +02:00

Automation

Most development processes are automated:

  • GitHub Actions run tests, builds, and validations on each push or pull request.
  • Pre-commit formatting is handled by lint-staged, which automatically formats code before committing.

🛠️ The NPM package husky takes care of installing the pre-commit hook automatically after pnpm install.


Manual Commands

While automation handles most workflows, the following commands are available for local development and debugging:

Command Description Notes
make Installs dependencies and compiles frontend/backend assets
make test Runs PHP unit tests
make test-frontend Runs frontend (Vitest) tests
make format Auto-fix code style
make lint Check code quality
make openapi Generate OpenAPI documentation Output saved to openapi.json
make appstore Production build for Nextcloud app store
make source Create full source package
make distclean Clean build artifacts and dependencies
make sign Sign release archive with SHA-512 signature Run after uploading .tar.gz to GitHub. Uses ~/.nextcloud/certificates/forum.key

Scaffolding

Generate boilerplate for common app pieces with:

pnpm gen <type> [name]

name is required for every type except migration.

Available generators

Type Purpose Output directory Name required? Template folder Notes
component Vue single-file component for reusable UI src/components gen/component For user-facing building blocks.
view Vue view / route view src/views gen/view Pair with your router.
api PHP controller (API endpoint) lib/Controller gen/api PSR-4 namespace: OCA\<App>\Controller.
service PHP service class lib/Service gen/service Business logic; DI-friendly.
util PHP utility/helper lib/Util gen/util Pure helpers / small utilities.
model PHP DB model / entity lib/Db gen/model Pair with migrations.
command Nextcloud OCC console command lib/Command gen/command Shows up in occ.
task-queued Queued background job lib/Cron gen/task-queued Extend queued job base.
task-timed Timed background job (cron) lib/Cron gen/task-timed Scheduled execution.
migration Database migration lib/Migration gen/migration Auto-numbers version; injects version and dt.
How migrations are numbered

The scaffolder looks at lib/Migration, finds the latest VersionNNNN... file, and increments it for you. It also injects:

  • version — the next numeric version
  • dt — a timestamp like YYYYMMDDHHmmss (via date-fns)

You don't pass a name for migrations.

Resources

Nextcloud Development

Technologies Used