mirror of
https://github.com/chenasraf/nextcloud-app-template.git
synced 2026-05-17 17:28:09 +00:00
build: add refresh-autoload target
This commit is contained in:
6
Makefile
6
Makefile
@@ -112,6 +112,12 @@ endif
|
||||
clean:
|
||||
rm -rf ./build
|
||||
|
||||
# refresh-autoload:
|
||||
# - Regenerate Composer autoload files (if composer.json exists)
|
||||
.PHONY: refresh-autoload
|
||||
refresh-autoload: composer
|
||||
$(if $(composer),$(composer),php $(composer_phar)) dump-autoload -o
|
||||
|
||||
# distclean:
|
||||
# - Run clean and also remove PHP/JS dependencies
|
||||
.PHONY: distclean
|
||||
|
||||
37
README.md
37
README.md
@@ -46,24 +46,25 @@ develop & release your app.
|
||||
|
||||
Below is a rundown of the different targets you can run:
|
||||
|
||||
| Command | What it does | When to use it | Notes |
|
||||
| ------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------- | ---------------------------------------------------------------------- |
|
||||
| `make` | Alias for `make build`. | Anytime; default target. | Same as `make build`. |
|
||||
| `make build` | Installs PHP deps (if `composer.json` exists) and JS deps (if `package.json` or `js/package.json` exists), then runs the JS build. | First run; after pulling changes; CI. | Skips steps that don’t apply (no `composer.json` / no `package.json`). |
|
||||
| `make composer` | Installs Composer deps. If Composer isn’t installed, fetches a local `composer.phar`. | When PHP deps changed. | Skips if `vendor/` already exists. |
|
||||
| `make pnpm` | `pnpm install --frozen-lockfile` then run build. Uses root `package.json` if present, else `js/`. | When JS deps or build changed. | Requires `pnpm`. |
|
||||
| `make clean` | Removes `build/` artifacts. | Before re-packaging; to start fresh. | Keeps dependencies. |
|
||||
| `make distclean` | `clean` + removes `vendor/`, `node_modules/`, `js/vendor/`, `js/node_modules/`. | Nuke-from-orbit cleanup. | You’ll need to re-install deps. |
|
||||
| `make dist` | Runs `make source` and `make appstore`. | Release prep; CI packaging. | Produces both tarballs. |
|
||||
| `make source` | Builds a **source** tarball at `build/artifacts/source/<app>.tar.gz`. | Sharing source-only bundle. | Excludes tests, logs, node_modules, etc. |
|
||||
| `make appstore` | Builds an **App Store–ready** tarball at `build/artifacts/appstore/<app>.tar.gz`. | Upload to Nextcloud App Store. | Aggressively excludes dev/test files & dotfiles. |
|
||||
| `make test` | Runs PHP unit tests (`tests/phpunit.xml` and optional `tests/phpunit.integration.xml`). | CI or local test run. | Ensures Composer deps first. |
|
||||
| `make lint` | Lints JS (`pnpm lint`) and PHP (`composer run lint` via local `composer.phar` if needed). | Pre-commit checks. | Requires corresponding scripts. |
|
||||
| `make php-cs-fixer` | Fixes **staged** PHP files with PHP-CS-Fixer (after `php -l`). | Before committing PHP changes. | Operates on files staged in Git. |
|
||||
| `make format` | Formats JS (`pnpm format`) and PHP (`composer run cs:fix`). | Enforce code style. | Requires those scripts in composer/package.json. |
|
||||
| `make openapi` | Generates OpenAPI JSON via composer script `openapi`. | Refresh API docs. | Output: `build/openapi/openapi.json`. |
|
||||
| `make sign` | Downloads the GitHub release tarball for the version in `version.txt` and prints a base64 SHA-512 signature. | Manual signing for App Store. | Needs private key at `~/.nextcloud/certificates/<app>.key`. |
|
||||
| `make release` | Uploads the signed release to the Nextcloud App Store. | Final publish step. | Needs `NEXTCLOUD_API_TOKEN` env var; prompts if missing. |
|
||||
| Command | What it does | When to use it | Notes |
|
||||
| ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
|
||||
| `make` | Alias for `make build`. | Anytime; default target. | Same as `make build`. |
|
||||
| `make build` | Installs PHP deps (if `composer.json` exists) and JS deps (if `package.json` or `js/package.json` exists), then runs the JS build. | First run; after pulling changes; CI. | Skips steps that don’t apply (no `composer.json` / no `package.json`). |
|
||||
| `make composer` | Installs Composer deps. If Composer isn’t installed, fetches a local `composer.phar`. | When PHP deps changed. | Skips if `vendor/` already exists. |
|
||||
| `make pnpm` | `pnpm install --frozen-lockfile` then run build. Uses root `package.json` if present, else `js/`. | When JS deps or build changed. | Requires `pnpm`. |
|
||||
| `make clean` | Removes `build/` artifacts. | Before re-packaging; to start fresh. | Keeps dependencies. |
|
||||
| `make refresh-autoload` | Regenerate Composer autoload files | After renaming the app namespace or classes | Most useful after using `./rename-template.sh` but also sometimes useful after moving around a lot of PHP files. |
|
||||
| `make distclean` | `clean` + removes `vendor/`, `node_modules/`, `js/vendor/`, `js/node_modules/`. | Nuke-from-orbit cleanup. | You’ll need to re-install deps. |
|
||||
| `make dist` | Runs `make source` and `make appstore`. | Release prep; CI packaging. | Produces both tarballs. |
|
||||
| `make source` | Builds a **source** tarball at `build/artifacts/source/<app>.tar.gz`. | Sharing source-only bundle. | Excludes tests, logs, node_modules, etc. |
|
||||
| `make appstore` | Builds an **App Store–ready** tarball at `build/artifacts/appstore/<app>.tar.gz`. | Upload to Nextcloud App Store. | Aggressively excludes dev/test files & dotfiles. |
|
||||
| `make test` | Runs PHP unit tests (`tests/phpunit.xml` and optional `tests/phpunit.integration.xml`). | CI or local test run. | Ensures Composer deps first. |
|
||||
| `make lint` | Lints JS (`pnpm lint`) and PHP (`composer run lint` via local `composer.phar` if needed). | Pre-commit checks. | Requires corresponding scripts. |
|
||||
| `make php-cs-fixer` | Fixes **staged** PHP files with PHP-CS-Fixer (after `php -l`). | Before committing PHP changes. | Operates on files staged in Git. |
|
||||
| `make format` | Formats JS (`pnpm format`) and PHP (`composer run cs:fix`). | Enforce code style. | Requires those scripts in composer/package.json. |
|
||||
| `make openapi` | Generates OpenAPI JSON via composer script `openapi`. | Refresh API docs. | Output: `build/openapi/openapi.json`. |
|
||||
| `make sign` | Downloads the GitHub release tarball for the version in `version.txt` and prints a base64 SHA-512 signature. | Manual signing for App Store. | Needs private key at `~/.nextcloud/certificates/<app>.key`. |
|
||||
| `make release` | Uploads the signed release to the Nextcloud App Store. | Final publish step. | Needs `NEXTCLOUD_API_TOKEN` env var; prompts if missing. |
|
||||
|
||||
### Quick workflows
|
||||
|
||||
|
||||
Reference in New Issue
Block a user