mirror of
https://github.com/supabase/supabase.git
synced 2026-07-02 02:54:18 +08:00
* spec: update v2 reference docs * fix missing spec for Functions * fix dart specs * Add more enrichments * update reference docs * update API Co-authored-by: Copple <10214025+kiwicopple@users.noreply.github.com>
100 lines
5.1 KiB
Makefile
100 lines
5.1 KiB
Makefile
REPO_DIR=$(shell pwd)
|
|
|
|
run: download transform format
|
|
|
|
|
|
###############################################################################
|
|
# Init - prepare the environment
|
|
###############################################################################
|
|
|
|
init:
|
|
cd $(REPO_DIR)/parser && npm install
|
|
|
|
|
|
###############################################################################
|
|
# Download all the specs
|
|
###############################################################################
|
|
download: download.api.v1 download.auth.v1 download.storage.v1 download.tsdoc.v1 download.tsdoc.v2
|
|
|
|
download.api.v1:
|
|
curl -sS https://api.supabase.com/api/v1-json > $(REPO_DIR)/api_v0_openapi.json
|
|
|
|
download.auth.v1:
|
|
curl -sS https://supabase.github.io/gotrue/swagger.json > $(REPO_DIR)/auth_v1_openapi.json
|
|
|
|
download.storage.v1:
|
|
curl -sS https://supabase.github.io/storage-api/api.json > $(REPO_DIR)/storage_v0_openapi.json
|
|
|
|
download.tsdoc.v1:
|
|
curl -sS https://supabase.github.io/supabase-js/v1/spec.json > $(REPO_DIR)/enrichments/tsdoc_v1/supabase.json
|
|
curl -sS https://supabase.github.io/gotrue-js/v1/spec.json > $(REPO_DIR)/enrichments/tsdoc_v1/gotrue.json
|
|
curl -sS https://supabase.github.io/postgrest-js/v1/spec.json > $(REPO_DIR)/enrichments/tsdoc_v1/postgrest.json
|
|
curl -sS https://supabase.github.io/realtime-js/v1/spec.json > $(REPO_DIR)/enrichments/tsdoc_v1/realtime.json
|
|
curl -sS https://supabase.github.io/storage-js/v1/spec.json > $(REPO_DIR)/enrichments/tsdoc_v1/storage.json
|
|
curl -sS https://supabase.github.io/functions-js/v1/spec.json > $(REPO_DIR)/enrichments/tsdoc_v1/functions.json
|
|
|
|
download.tsdoc.v2:
|
|
curl -sS https://supabase.github.io/supabase-js/v2/spec.json > $(REPO_DIR)/enrichments/tsdoc_v2/supabase.json
|
|
curl -sS https://supabase.github.io/gotrue-js/v2/spec.json > $(REPO_DIR)/enrichments/tsdoc_v2/gotrue.json
|
|
curl -sS https://supabase.github.io/postgrest-js/v2/spec.json > $(REPO_DIR)/enrichments/tsdoc_v2/postgrest.json
|
|
curl -sS https://supabase.github.io/realtime-js/v2/spec.json > $(REPO_DIR)/enrichments/tsdoc_v2/realtime.json
|
|
curl -sS https://supabase.github.io/storage-js/v2/spec.json > $(REPO_DIR)/enrichments/tsdoc_v2/storage.json
|
|
curl -sS https://supabase.github.io/functions-js/v2/spec.json > $(REPO_DIR)/enrichments/tsdoc_v2/functions.json
|
|
|
|
###############################################################################
|
|
# Transform docs into working files
|
|
###############################################################################
|
|
transform: dereference.api.v0 dereference.auth.v1 dereference.storage.v0 dereference.tsdoc.v1 dereference.tsdoc.v2 combine.tsdoc.v1 combine.tsdoc.v2
|
|
|
|
dereference.api.v0:
|
|
npx swagger-cli bundle --dereference --outfile $(REPO_DIR)/transforms/api_v0_openapi_deparsed.json $(REPO_DIR)/api_v0_openapi.json
|
|
|
|
dereference.auth.v1:
|
|
npx swagger-cli bundle --dereference --outfile $(REPO_DIR)/transforms/auth_v1_openapi_deparsed.json $(REPO_DIR)/auth_v1_openapi.json
|
|
|
|
dereference.storage.v0:
|
|
npx swagger-cli bundle --dereference --outfile $(REPO_DIR)/transforms/storage_v0_openapi_deparsed.json $(REPO_DIR)/storage_v0_openapi.json
|
|
|
|
dereference.tsdoc.v1:
|
|
cd $(REPO_DIR)/parser && npm run tsdoc:dereference:functions:v1
|
|
cd $(REPO_DIR)/parser && npm run tsdoc:dereference:gotrue:v1
|
|
cd $(REPO_DIR)/parser && npm run tsdoc:dereference:postgrest:v1
|
|
cd $(REPO_DIR)/parser && npm run tsdoc:dereference:realtime:v1
|
|
cd $(REPO_DIR)/parser && npm run tsdoc:dereference:storage:v1
|
|
cd $(REPO_DIR)/parser && npm run tsdoc:dereference:supabase:v1
|
|
|
|
dereference.tsdoc.v2:
|
|
cd $(REPO_DIR)/parser && npm run tsdoc:dereference:functions:v2
|
|
cd $(REPO_DIR)/parser && npm run tsdoc:dereference:gotrue:v2
|
|
cd $(REPO_DIR)/parser && npm run tsdoc:dereference:postgrest:v2
|
|
cd $(REPO_DIR)/parser && npm run tsdoc:dereference:realtime:v2
|
|
cd $(REPO_DIR)/parser && npm run tsdoc:dereference:storage:v2
|
|
cd $(REPO_DIR)/parser && npm run tsdoc:dereference:supabase:v2
|
|
|
|
combine.tsdoc.v1:
|
|
jq -s '{ name: "Combined Specs", children: [.[0], .[1], .[2], .[3], .[4], .[5]] }' \
|
|
$(REPO_DIR)/enrichments/tsdoc_v1/supabase_dereferenced.json \
|
|
$(REPO_DIR)/enrichments/tsdoc_v1/gotrue_dereferenced.json \
|
|
$(REPO_DIR)/enrichments/tsdoc_v1/postgrest_dereferenced.json \
|
|
$(REPO_DIR)/enrichments/tsdoc_v1/realtime_dereferenced.json \
|
|
$(REPO_DIR)/enrichments/tsdoc_v1/storage_dereferenced.json \
|
|
$(REPO_DIR)/enrichments/tsdoc_v1/functions_dereferenced.json \
|
|
> $(REPO_DIR)/enrichments/tsdoc_v1/combined.json
|
|
|
|
combine.tsdoc.v2:
|
|
jq -s '{ name: "Combined Specs", children: [.[0], .[1], .[2], .[3], .[4], .[5]] }' \
|
|
$(REPO_DIR)/enrichments/tsdoc_v2/supabase_dereferenced.json \
|
|
$(REPO_DIR)/enrichments/tsdoc_v2/gotrue_dereferenced.json \
|
|
$(REPO_DIR)/enrichments/tsdoc_v2/postgrest_dereferenced.json \
|
|
$(REPO_DIR)/enrichments/tsdoc_v2/realtime_dereferenced.json \
|
|
$(REPO_DIR)/enrichments/tsdoc_v2/storage_dereferenced.json \
|
|
$(REPO_DIR)/enrichments/tsdoc_v2/functions_dereferenced.json \
|
|
> $(REPO_DIR)/enrichments/tsdoc_v2/combined.json
|
|
|
|
###############################################################################
|
|
# Format everything - easier for git to track changes
|
|
###############################################################################
|
|
format:
|
|
npx prettier --write .
|
|
|