High performance self-hosted photo and video management solution.
TypeScript backup-toolfluttergoogle-photosgoogle-photos-alternativejavascriptmobile-appnestjsnodejsphoto-galleryphotosphotos-managementself-hostedsveltesveltekittypescriptvideos
chore: mise scripts (#28367)
Jason Rasmussen15f3947ae6cb
diff --git a/.github/workflows/test.yml b/.github/workflows/test.ymlindex 078722cb7c..18a88bd617 100644--- a/.github/workflows/test.yml+++ b/.github/workflows/test.yml@@ -674,11 +674,8 @@ jobs:- name: Install server dependenciesrun: SHARP_IGNORE_GLOBAL_LIBVIPS=true pnpm --filter immich install --frozen-lockfile- - name: Build the app- run: pnpm --filter immich build-- name: Run API generation- run: ./bin/generate-open-api.sh+ run: mise //:open-apiworking-directory: open-api- name: Find file changes@@ -770,7 +767,7 @@ jobs:exit 1- name: Run SQL generation- run: pnpm sync:sql+ run: mise //:sqlenv:DB_URL: postgres://postgres:postgres@localhost:5432/immichdiff --git a/Makefile b/Makefileindex 0b77da3a7f..648aed5120 100644--- a/Makefile+++ b/Makefile@@ -37,16 +37,11 @@ prod-scale:.PHONY: open-apiopen-api:- cd ./open-api && bash ./bin/generate-open-api.sh--open-api-dart:- cd ./open-api && bash ./bin/generate-open-api.sh dart--open-api-typescript:- cd ./open-api && bash ./bin/generate-open-api.sh typescript+ @printf "This command has been removed. Please use:\n\n mise open-api # or mise //:open-api from another directory\n\n"\n\n >&2 && exit 1sql:- pnpm --filter immich run sync:sql+ @printf "This command has been removed. Please use:\n\n mise sql # or mise //:sql from another directory\n\n"\n\n >&2 && exit 1+renovate:LOG_LEVEL=debug pnpm exec renovate --platform=local --repository-cache=resetdiff --git a/docs/docs/developer/devcontainers.md b/docs/docs/developer/devcontainers.mdindex f912c78490..99f340c557 100644--- a/docs/docs/developer/devcontainers.md+++ b/docs/docs/developer/devcontainers.md@@ -243,8 +243,8 @@ To connect the mobile app to your Dev Container:- **Server code** (`/server`): Changes trigger automatic restart- **Web code** (`/web`): Changes trigger hot module replacement-- **Database migrations**: Run `pnpm run sync:sql` in the server directory-- **API changes**: Regenerate TypeScript SDK with `make open-api`+- **Database migrations**: Run `mise //:sql`+- **API changes**: Regenerate TypeScript SDK with `mise //:open-api`## Testing@@ -289,7 +289,7 @@ make open-api-typescript # Generate TypeScript SDKmake open-api-dart # Generate Dart SDK# Database-make sql # Sync database schema+mise sql # Sync database schema```### Debuggingdiff --git a/misc/release/pump-version.sh b/misc/release/pump-version.shindex 8b06c3a23b..39a3364723 100755--- a/misc/release/pump-version.sh+++ b/misc/release/pump-version.sh@@ -70,9 +70,7 @@ if [ "$CURRENT_SERVER" != "$NEXT_SERVER" ]; thenpnpm version "$NEXT_SERVER" --no-git-tag-version --prefix packages/sdk# copy version to open-api spec- pnpm install --frozen-lockfile --prefix server- pnpm --prefix server run build- ( cd ./open-api && bash ./bin/generate-open-api.sh )+ mise run //:open-apiuv version --directory machine-learning "$NEXT_SERVER"diff --git a/mise.toml b/mise.tomlindex 38123a062d..21022238cd 100644--- a/mise.toml+++ b/mise.toml@@ -40,6 +40,31 @@ macos-arm64 = { asset_pattern = "jellyfin-ffmpeg_*_portable_macarm64-gpl.tar.xz"experimental = truepin = true+[tasks.open-api-typescript]+run = [+ "pnpm dlx oazapfts --optimistic --argumentStyle=object --useEnumType --allSchemas open-api/immich-openapi-specs.json packages/sdk/src/fetch-client.ts",+ { task = "//:sdk:install" },+ { task = "//:sdk:build" },+]++[tasks.open-api-dart]+dir = "open-api"+run = "bash ./bin/generate-dart-sdk.sh"++[tasks.open-api]+env = { SHARP_IGNORE_GLOBAL_LIBVIPS = true }+run = [+ { task = "//server:install" },+ { task = "//server:build" },+ { task = "//server:sync-open-api" },+ { task = ":open-api-typescript"},+ { task = ":open-api-dart"},+]++[tasks.sql]+dir = "server"+run = "node ./dist/bin/sync-sql.js"+# SDK tasks[tasks."sdk:install"]dir = "packages/sdk"diff --git a/open-api/bin/generate-dart-sdk.sh b/open-api/bin/generate-dart-sdk.shnew file mode 100755index 0000000000..e81d28096f--- /dev/null+++ b/open-api/bin/generate-dart-sdk.sh@@ -0,0 +1,28 @@+#!/usr/bin/env bash+OPENAPI_GENERATOR_VERSION=v7.12.0++set -euo pipefail++# usage: ./bin/generate-dart-sdk.sh++rm -rf ../mobile/openapi+cd ./templates/mobile/serialization/native+wget -O native_class.mustache https://raw.githubusercontent.com/OpenAPITools/openapi-generator/$OPENAPI_GENERATOR_VERSION/modules/openapi-generator/src/main/resources/dart2/serialization/native/native_class.mustache+patch --no-backup-if-mismatch -u native_class.mustache <native_class.mustache.patch+patch --no-backup-if-mismatch -u native_class.mustache <native_class_nullable_items_in_arrays.patch++cd ../../+wget -O api.mustache https://raw.githubusercontent.com/OpenAPITools/openapi-generator/$OPENAPI_GENERATOR_VERSION/modules/openapi-generator/src/main/resources/dart2/api.mustache+patch --no-backup-if-mismatch -u api.mustache <api.mustache.patch++cd ../../+pnpm dlx --allow-build="" @openapitools/openapi-generator-cli generate -g dart -i ./immich-openapi-specs.json -o ../mobile/openapi -t ./templates/mobile++# Post generate patches+patch --no-backup-if-mismatch -u ../mobile/openapi/lib/api_client.dart <./patch/api_client.dart.patch+patch --no-backup-if-mismatch -u ../mobile/openapi/lib/api.dart <./patch/api.dart.patch+patch --no-backup-if-mismatch -u ../mobile/openapi/pubspec.yaml <./patch/pubspec_immich_mobile.yaml.patch+patch --no-backup-if-mismatch -u ../mobile/openapi/lib/model/asset_edit_action_item_dto.dart <./patch/asset_edit_action_item_dto.dart.patch+# Don't include analysis_options.yaml for the generated openapi files+# so that language servers can properly exclude the mobile/openapi directory+rm ../mobile/openapi/analysis_options.yamldiff --git a/open-api/bin/generate-open-api.sh b/open-api/bin/generate-open-api.shdeleted file mode 100755index d03ff7a063..0000000000--- a/open-api/bin/generate-open-api.sh+++ /dev/null@@ -1,52 +0,0 @@-#!/usr/bin/env bash-OPENAPI_GENERATOR_VERSION=v7.12.0--set -euo pipefail--# usage: ./bin/generate-open-api.sh--function dart {- rm -rf ../mobile/openapi- cd ./templates/mobile/serialization/native- wget -O native_class.mustache https://raw.githubusercontent.com/OpenAPITools/openapi-generator/$OPENAPI_GENERATOR_VERSION/modules/openapi-generator/src/main/resources/dart2/serialization/native/native_class.mustache- patch --no-backup-if-mismatch -u native_class.mustache <native_class.mustache.patch- patch --no-backup-if-mismatch -u native_class.mustache <native_class_nullable_items_in_arrays.patch-- cd ../../- wget -O api.mustache https://raw.githubusercontent.com/OpenAPITools/openapi-generator/$OPENAPI_GENERATOR_VERSION/modules/openapi-generator/src/main/resources/dart2/api.mustache- patch --no-backup-if-mismatch -u api.mustache <api.mustache.patch-- cd ../../- pnpm dlx --allow-build="" @openapitools/openapi-generator-cli generate -g dart -i ./immich-openapi-specs.json -o ../mobile/openapi -t ./templates/mobile-- # Post generate patches- patch --no-backup-if-mismatch -u ../mobile/openapi/lib/api_client.dart <./patch/api_client.dart.patch- patch --no-backup-if-mismatch -u ../mobile/openapi/lib/api.dart <./patch/api.dart.patch- patch --no-backup-if-mismatch -u ../mobile/openapi/pubspec.yaml <./patch/pubspec_immich_mobile.yaml.patch- patch --no-backup-if-mismatch -u ../mobile/openapi/lib/model/asset_edit_action_item_dto.dart <./patch/asset_edit_action_item_dto.dart.patch- # Don't include analysis_options.yaml for the generated openapi files- # so that language servers can properly exclude the mobile/openapi directory- rm ../mobile/openapi/analysis_options.yaml-}--function typescript {- pnpm dlx oazapfts --optimistic --argumentStyle=object --useEnumType --allSchemas immich-openapi-specs.json ../packages/sdk/src/fetch-client.ts- pnpm --filter @immich/sdk install --frozen-lockfile- pnpm --filter @immich/sdk build-}--# requires server to be built-(- cd ..- SHARP_IGNORE_GLOBAL_LIBVIPS=true pnpm --filter immich build- pnpm --filter immich sync:open-api-)--if [[ $# -ge 1 ]] && [[ $1 == 'dart' ]]; then- dart-elif [[ $# -ge 1 ]] && [[ $1 == 'typescript' ]]; then- typescript-else- dart- typescript-fidiff --git a/packages/cli/README.md b/packages/cli/README.mdindex b9d61fce09..92582fccc4 100644--- a/packages/cli/README.md+++ b/packages/cli/README.md@@ -4,14 +4,9 @@ Please see the [Immich CLI documentation](https://docs.immich.app/features/comma# For developers-Before building the CLI, you must build the immich server and the open-api client. To build the server run the following in the server folder:+Before building the CLI, you must build the immich server and the open-api client. You can use the following command:- $ pnpm install- $ pnpm run build--Then, to build the open-api client run the following in the open-api folder:-- $ ./bin/generate-open-api.sh+ $ mise //:open-api## Run from builddiff --git a/server/mise.toml b/server/mise.tomlindex 95230b6d04..b8236c60c6 100644--- a/server/mise.toml+++ b/server/mise.toml@@ -33,9 +33,9 @@ env._.path = "./node_modules/.bin"run = "tsc --noEmit"[tasks.sql]-run = "node ./dist/bin/sync-open-api.js"+run = "node ./dist/bin/sync-sql.js"-[tasks."open-api"]+[tasks."sync-open-api"]run = "node ./dist/bin/sync-open-api.js"[tasks.migrations]diff --git a/server/package.json b/server/package.jsonindex 365befe408..904cb3c6c8 100644--- a/server/package.json+++ b/server/package.json@@ -33,8 +33,6 @@"migrations:revert": "sql-tools -u ${DB_URL:-postgres://postgres:postgres@localhost:5432/immich} migrations revert","schema:drop": "sql-tools -u ${DB_URL:-postgres://postgres:postgres@localhost:5432/immich} query 'DROP schema public cascade; CREATE schema public;'","schema:reset": "pnpm run schema:drop && pnpm run migrations:run",- "sync:open-api": "node ./dist/bin/sync-open-api.js",- "sync:sql": "node ./dist/bin/sync-sql.js","email:dev": "email dev -p 3050 --dir src/emails"},"dependencies": {