-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from khaykingleb/supabase-integration
Supabase integration
- Loading branch information
Showing
25 changed files
with
862 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
SUPABASE_URL=http://127.0.0.1:54321 | ||
SUPABASE_ANON_KEY= | ||
SUPABASE_SERVICE_ROLE_KEY= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# This file is used by direnv to automatically load environment variables | ||
# from the .env file whenever you enter this directory. | ||
|
||
# To ensure security, direnv requires you to explicitly allow the execution | ||
# of this file by running 'direnv allow' after any changes. | ||
# This prevents unauthorized scripts from being executed automatically. | ||
|
||
dotenv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,3 +34,22 @@ jobs: | |
run: npx semantic-release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.PAT_GITHUB }} | ||
|
||
deploy: | ||
needs: release | ||
runs-on: ubuntu-latest | ||
env: | ||
SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }} | ||
PROJECT_ID: ${{ secrets.PROJECT_ID }} | ||
steps: | ||
- name: Checkout code so that it is available to use in the executing runner | ||
uses: actions/[email protected] | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: supabase/setup-cli@v1 | ||
with: | ||
version: latest | ||
|
||
- name: Deploy | ||
run: supabase functions deploy --project-ref ${{ env.PROJECT_ID }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,17 @@ | ||
# Node | ||
node_modules | ||
/.cache | ||
/build | ||
.env | ||
|
||
# Terraform | ||
terraform.tfstate | ||
terraform.tfstate.backup | ||
terraform.tfvars | ||
.terraform | ||
|
||
# Supabase | ||
supabase/volumes/db/data | ||
|
||
# Misc | ||
.env | ||
.DS_Store | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
direnv 2.35.0 | ||
pre-commit 3.7.0 | ||
nodejs 21.7.3 | ||
pnpm 9.9.0 | ||
yarn 1.22.22 | ||
supabase-cli 2.1.1 | ||
terraform 1.5.4 | ||
pre-commit 3.7.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,121 +1,192 @@ | ||
SHELL := /bin/bash | ||
.DEFAULT_GOAL = help | ||
SHELL := /bin/bash | ||
VENDOR_DIR := vendor/react-notion-x | ||
|
||
##@ Repo Initialization | ||
# Load environment variables from .env | ||
ifneq (,$(wildcard ./.env)) | ||
include .env | ||
export | ||
endif | ||
|
||
prerequisite: ## Install prerequisite tools | ||
##============================================================================= | ||
##@ Repo Initialization | ||
##============================================================================= | ||
|
||
PLUGINS := \ | ||
direnv https://github.com/asdf-community/asdf-direnv.git \ | ||
pre-commit https://github.com/jonathanmorley/asdf-pre-commit.git \ | ||
nodejs https://github.com/asdf-vm/asdf-nodejs.git \ | ||
pnpm https://github.com/jonathanmorley/asdf-pnpm.git \ | ||
yarn https://github.com/twuni/asdf-yarn.git \ | ||
supabase-cli https://github.com/gavinying/asdf-supabase-cli.git \ | ||
terraform https://github.com/asdf-community/asdf-hashicorp.git | ||
|
||
prerequisites: ## Install prerequisite tools | ||
@echo "Checking and installing required plugins." | ||
@plugins=( \ | ||
"terraform https://github.com/asdf-community/asdf-hashicorp.git" \ | ||
"pnpm https://github.com/jonathanmorley/asdf-pnpm.git" \ | ||
"yarn https://github.com/twuni/asdf-yarn.git" \ | ||
"nodejs https://github.com/asdf-vm/asdf-nodejs.git" \ | ||
"pre-commit https://github.com/jonathanmorley/asdf-pre-commit.git" \ | ||
); \ | ||
for info in "$${plugins[@]}"; do \ | ||
read plugin url <<< "$$info"; \ | ||
@echo "${PLUGINS}" | tr ' ' '\n' | paste - - | while read -r plugin url; do \ | ||
if asdf plugin-list | grep -q $$plugin; then \ | ||
echo "Plugin '$$plugin' is already installed."; \ | ||
else \ | ||
echo "Adding plugin '$$plugin'."; \ | ||
asdf plugin-add $$plugin $$url; \ | ||
fi; \ | ||
done; | ||
done | ||
@echo "Installing specified versions." | ||
asdf install | ||
@echo "Currently installed versions:" | ||
asdf current | ||
.PHONY: prerequisite | ||
.PHONY: prerequisites | ||
|
||
env: ## Create .env file if it doesn't exist | ||
@if ! [ -e .env ]; then \ | ||
cp .env.example .env; \ | ||
echo "Created .env file. Please edit it according to your setup."; \ | ||
fi | ||
.PHONY: env | ||
|
||
deps-notion: ## Install dependencies for react-notion-x | ||
@echo "Installing dependencies for react-notion-x." | ||
git submodule update --init --recursive | ||
cd vendor/react-notion-x && yarn install --frozen-lockfile | ||
.PHONY: notion-deps | ||
@git submodule update --init --recursive | ||
@cd ${VENDOR_DIR} && yarn install --frozen-lockfile | ||
.PHONY: deps-notion | ||
|
||
deps: deps-notion ## Install repo dependencies | ||
@echo "Installing dependencies." | ||
pnpm install | ||
@pnpm install | ||
.PHONY: deps | ||
|
||
deps-prod: deps-notion ## Install production dependencies | ||
@echo "Installing production dependencies." | ||
pnpm install --frozen-lockfile | ||
@pnpm install --frozen-lockfile | ||
.PHONY: deps-prod | ||
|
||
pre-commit: ## Install pre-commit hooks | ||
@echo "Installing pre-commit hooks." | ||
pre-commit install -t pre-commit -t commit-msg | ||
@pre-commit install -t pre-commit -t commit-msg | ||
.PHONY: pre-commit | ||
|
||
init: prerequisite deps pre-commit ## Initialize local environment for development | ||
init: prerequisites env deps pre-commit ## Initialize local environment for development | ||
.PHONY: init | ||
|
||
##============================================================================= | ||
##@ Scripts | ||
##============================================================================= | ||
|
||
build-notion: ## Build react-notion-x | ||
@echo "Building react-notion-x." | ||
cd vendor/react-notion-x && yarn build | ||
@cd ${VENDOR_DIR} && yarn build | ||
.PHONY: build-notion | ||
|
||
build: build-notion ## Build project | ||
@echo "Building project." | ||
pnpm run build | ||
@pnpm run build | ||
.PHONY: build | ||
|
||
run-dev: ## Run development server | ||
@echo "Running development server." | ||
pnpm run dev | ||
@pnpm run dev | ||
.PHONY: run-dev | ||
|
||
run-prod: build ## Run production server | ||
@echo "Starting server." | ||
pnpm run start | ||
@pnpm run start | ||
.PHONY: run-prod | ||
|
||
lint: ## Lint project | ||
@echo "Linting project." | ||
pnpm run lint && pnpm run stylelint && pnpm run typecheck | ||
@pnpm run lint && pnpm run stylelint && pnpm run typecheck | ||
.PHONY: lint | ||
|
||
format: ## Format project | ||
@echo "Formatting project." | ||
pnpm run format | ||
@pnpm run format | ||
.PHONY: format | ||
|
||
##============================================================================= | ||
##@ Supabase | ||
##============================================================================= | ||
|
||
supabase-start: ## Start supabase containers | ||
@echo "Starting supabase." | ||
@supabase start | ||
.PHONY: supabase-start | ||
|
||
supabase-status: ## Check supabase status | ||
@echo "Checking supabase status." | ||
@supabase status | ||
.PHONY: supabase-status | ||
|
||
supabase-reset: ## Reset supabase database (runs migrations and seeds) | ||
@echo "Resetting supabase database." | ||
@supabase db reset | ||
.PHONY: supabase-reset | ||
|
||
supabase-migration-%: ## Create supabase migration | ||
@echo "Creating custom migration: supabase/migrations/some_timestamp_$*.sql" | ||
@supabase db diff --use-migra -f $* | ||
.PHONY: supabase-migration-% | ||
|
||
supabase-generate-types: ## Generate supabase types | ||
@echo "Generating supabase types." | ||
@supabase gen types typescript --local > app/integrations/supabase/database.types.ts | ||
.PHONY: supabase-generate-types | ||
|
||
supabase-stop: ## Stop supabase containers | ||
@echo "Stopping supabase." | ||
@supabase stop | ||
.PHONY: supabase-stop | ||
|
||
#============================================================================== | ||
##@ Ngrok | ||
##============================================================================== | ||
|
||
ngrok-dev: ## Run ngrok for development server | ||
@echo "Running ngrok." | ||
ngrok http 5173 | ||
@ngrok http 5173 | ||
.PHONY: ngrok-dev | ||
|
||
ngrok-prod: ## Run ngrok for production server | ||
@echo "Running ngrok." | ||
ngrok http 3000 | ||
@ngrok http 55203 | ||
.PHONY: ngrok-prod | ||
|
||
##@ Miscullaneous | ||
#============================================================================== | ||
##@ Security | ||
##============================================================================== | ||
|
||
create-secrets-baseline: ## Create secrets baseline file | ||
detect-secrets scan > .secrets.baseline | ||
create-secrets-baseline: ## Create secrets baseline file | ||
@detect-secrets scan > .secrets.baseline | ||
.PHONY: create-secrets-baseline | ||
|
||
audit-secrets-baseline: ## Check updated .secrets.baseline file | ||
detect-secrets audit .secrets.baseline | ||
git commit .secrets.baseline --no-verify -m "build(security): update secrets.baseline" | ||
audit-secrets-baseline: ## Check updated .secrets.baseline file | ||
@detect-secrets audit .secrets.baseline | ||
.PHONY: audit-secrets-baseline | ||
|
||
update-pre-commit-hooks: ## Update pre-commit hooks | ||
pre-commit autoupdate | ||
detect-secrets: ## Scan for secrets | ||
@detect-secrets scan --baseline .secrets.baseline | ||
.PHONY: detect-secrets | ||
|
||
##============================================================================= | ||
##@ Miscellaneous | ||
##============================================================================= | ||
|
||
update-pre-commit-hooks: ## Update pre-commit hooks | ||
@pre-commit autoupdate | ||
.PHONY: update-pre-commit-hooks | ||
|
||
clean: ## Clean project | ||
@echo "Cleaning project." | ||
rm -rf node_modules build | ||
find vendor/react-notion-x -type d -name 'build' -exec rm -rf {} + | ||
find vendor/react-notion-x -type d -name 'node_modules' -exec rm -rf {} + | ||
@rm -rf node_modules build | ||
@find ${VENDOR_DIR} -type d -name 'build' -exec rm -rf {} + | ||
@find ${VENDOR_DIR} -type d -name 'node_modules' -exec rm -rf {} + | ||
.PHONY: clean | ||
|
||
##============================================================================= | ||
##@ Helper | ||
##============================================================================= | ||
|
||
help: ## Display help | ||
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage: \033[36m\033[0m\n"} /^[a-zA-Z\.\%-]+:.*?##/ { printf " \033[36m%-24s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) | ||
help: ## Display help | ||
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} \ | ||
/^[a-zA-Z_-]+%?:.*?##/ { printf " \033[36m%-24s\033[0m %s\n", $$1, $$2 } \ | ||
/^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) | ||
.PHONY: help |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.