-
Notifications
You must be signed in to change notification settings - Fork 545
Expand file tree
/
Copy pathTaskfile.yaml
More file actions
222 lines (197 loc) · 11.3 KB
/
Taskfile.yaml
File metadata and controls
222 lines (197 loc) · 11.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
version: "3"
dotenv: [".env"]
includes:
web:
taskfile: ./apps/web
tasks:
py:init: POETRY_VIRTUALENVS_IN_PROJECT=true poetry install --no-cache --no-interaction --all-extras
py:run: poetry run python3 {{.CLI_ARGS}}
stripe:
cmds:
- stripe listen --print-secret | tr -d '\r\n' | (echo -n 'STRIPE_WEBHOOK_SECRET="'; cat; echo '"') > .env.stripe
- stripe listen --skip-verify --forward-to http://localhost:8788/webhook/stripe
bacon: bacon {{.CLI_ARGS}}
stat: btop -f hyprnote -u 500 --preset 1
clean-plugins:
cmds:
- find plugins -mindepth 1 -maxdepth 1 -type d ! -exec test -f {}/Cargo.toml \; -exec rm -rf {} \;
diff:
vars:
DIFF_FROM: "desktop_v0.0.79"
DIFF_TO: "desktop_v0.0.80"
PATHS: "apps/desktop/src-tauri plugins crates"
cmds:
- git diff {{.DIFF_FROM}} {{.DIFF_TO}} -- {{.PATHS}} | diff2html -i stdin
jsonschema:
cmds:
- |
jsonschema validate ./plugins/db/seed/schema.json ./plugins/db/seed/onboarding.json
jsonschema validate ./plugins/db/seed/schema.json ./plugins/db/seed/dev.json
i18n:
cmds:
- |
pnpm -F desktop lingui:extract |
awk -F '│' '($2 ~ /[^ ]/ && $3 ~ /[0-9-]/) {
gsub(/^ *| *$/, "", $2);
gsub(/[^0-9-]/, "", $3);
gsub(/^ *| *$/, "", $4);
printf "{\"language\":\"%s\",\"total\":%d,\"missing\":%d}\n",
$2,
($3 == "-" ? 0: $3),
($4 == "-" ? 0: $4)
}'
stt:
cmds:
- chmod +x ./apps/desktop/src-tauri/resources/stt-aarch64-apple-darwin
- chmod +x ./apps/desktop/src-tauri/resources/passthrough-aarch64-apple-darwin
db:
env:
DB: /Users/yujonglee/Library/Application Support/hyprnote/db.sqlite
cmds:
- |
sqlite3 -json "$DB" 'SELECT store FROM main LIMIT 1;' |
jq -r '.[0].store' |
jless
env-sample:
vars:
INPUT_ENV: '{{.INPUT_ENV | default ".env"}}'
OUTPUT_ENV: '{{.OUTPUT_ENV | default ".env.sample"}}'
cmds:
- sed -E '/^[A-Z_][A-Z0-9_]*=/s/=.*/=""/' {{.INPUT_ENV}} > {{.OUTPUT_ENV}}
supabase:
cmds:
- pnpm exec supabase {{.CLI_ARGS}}
supabase-stop:
cmds:
- pnpm exec supabase stop
- task: supabase-tunnel-stop
supabase-tunnel-start:
platforms: [darwin]
cmds:
- bash scripts/supabase-tunnel-start.sh
supabase-expose:
platforms: [darwin]
cmds:
- task: supabase-tunnel-stop
- task: supabase-env
- task: supabase-tunnel-start
supabase-no-expose:
platforms: [darwin]
cmds:
- task: supabase-tunnel-stop
- task: supabase-env
supabase-tunnel-stop:
platforms: [darwin]
cmds:
- bash scripts/supabase-tunnel-stop.sh
supabase-env:
internal: true
cmds:
- |
pnpm exec supabase status --output=env | awk -F= '
/^ANON_KEY=/ { print "SUPABASE_ANON_KEY=" $2; print "VITE_SUPABASE_ANON_KEY=" $2 }
/^API_URL=/ { print "SUPABASE_URL=" $2; print "VITE_SUPABASE_URL=" $2 }
/^DB_URL=/ { print "DATABASE_URL=" $2 }
/^FUNCTIONS_URL=/ { print "SUPABASE_FUNCTIONS_URL=" $2; print "VITE_SUPABASE_FUNCTIONS_URL=" $2 }
/^GRAPHQL_URL=/ { print "SUPABASE_GRAPHQL_URL=" $2; print "VITE_SUPABASE_GRAPHQL_URL=" $2 }
/^INBUCKET_URL=/ { print "SUPABASE_INBUCKET_URL=" $2 }
/^JWT_SECRET=/ { print "SUPABASE_JWT_SECRET=" $2 }
/^MAILPIT_URL=/ { print "SUPABASE_MAILPIT_URL=" $2 }
/^MCP_URL=/ { print "SUPABASE_MCP_URL=" $2 }
/^PUBLISHABLE_KEY=/ { print "SUPABASE_PUBLISHABLE_KEY=" $2; print "VITE_SUPABASE_PUBLISHABLE_KEY=" $2 }
/^REST_URL=/ { print "SUPABASE_REST_URL=" $2; print "VITE_SUPABASE_REST_URL=" $2 }
/^SECRET_KEY=/ { print "SUPABASE_SECRET_KEY=" $2 }
/^SERVICE_ROLE_KEY=/ { print "SUPABASE_SERVICE_ROLE_KEY=" $2 }
/^STUDIO_URL=/ { print "SUPABASE_STUDIO_URL=" $2 }
' > .env.supabase
supabase-storage-seed-config:
internal: true
vars:
SUPABASE_STORAGE_ASSETS_DIR: '{{.SUPABASE_STORAGE_ASSETS_DIR | default "./.seed/storage/assets"}}'
SUPABASE_STORAGE_ASSETS_BUCKET: '{{.SUPABASE_STORAGE_ASSETS_BUCKET | default "assets"}}'
SUPABASE_STORAGE_MODELS_DIR: '{{.SUPABASE_STORAGE_MODELS_DIR | default "./.seed/storage/models"}}'
SUPABASE_STORAGE_MODELS_BUCKET: '{{.SUPABASE_STORAGE_MODELS_BUCKET | default "models"}}'
SUPABASE_STORAGE_AUDIO_FILES_DIR: '{{.SUPABASE_STORAGE_AUDIO_FILES_DIR | default "./.seed/storage/audio-files"}}'
SUPABASE_STORAGE_AUDIO_FILES_BUCKET: '{{.SUPABASE_STORAGE_AUDIO_FILES_BUCKET | default "audio-files"}}'
cmds:
- mkdir -p supabase/{{.SUPABASE_STORAGE_ASSETS_DIR}} supabase/{{.SUPABASE_STORAGE_MODELS_DIR}} supabase/{{.SUPABASE_STORAGE_AUDIO_FILES_DIR}}
- dasel put -f supabase/config.toml -t bool -v true 'storage.buckets.{{.SUPABASE_STORAGE_ASSETS_BUCKET}}.public'
- dasel put -f supabase/config.toml -t string -v '5GiB' 'storage.buckets.{{.SUPABASE_STORAGE_ASSETS_BUCKET}}.file_size_limit'
- dasel put -f supabase/config.toml -t json -v '[]' 'storage.buckets.{{.SUPABASE_STORAGE_ASSETS_BUCKET}}.allowed_mime_types'
- dasel put -f supabase/config.toml -t string -v '{{.SUPABASE_STORAGE_ASSETS_DIR}}' 'storage.buckets.{{.SUPABASE_STORAGE_ASSETS_BUCKET}}.objects_path'
- dasel put -f supabase/config.toml -t bool -v true 'storage.buckets.{{.SUPABASE_STORAGE_MODELS_BUCKET}}.public'
- dasel put -f supabase/config.toml -t string -v '5GiB' 'storage.buckets.{{.SUPABASE_STORAGE_MODELS_BUCKET}}.file_size_limit'
- dasel put -f supabase/config.toml -t json -v '[]' 'storage.buckets.{{.SUPABASE_STORAGE_MODELS_BUCKET}}.allowed_mime_types'
- dasel put -f supabase/config.toml -t string -v '{{.SUPABASE_STORAGE_MODELS_DIR}}' 'storage.buckets.{{.SUPABASE_STORAGE_MODELS_BUCKET}}.objects_path'
- dasel put -f supabase/config.toml -t bool -v true 'storage.buckets.{{.SUPABASE_STORAGE_AUDIO_FILES_BUCKET}}.public'
- dasel put -f supabase/config.toml -t string -v '5GiB' 'storage.buckets.{{.SUPABASE_STORAGE_AUDIO_FILES_BUCKET}}.file_size_limit'
- dasel put -f supabase/config.toml -t json -v '[]' 'storage.buckets.{{.SUPABASE_STORAGE_AUDIO_FILES_BUCKET}}.allowed_mime_types'
- dasel put -f supabase/config.toml -t string -v '{{.SUPABASE_STORAGE_AUDIO_FILES_DIR}}' 'storage.buckets.{{.SUPABASE_STORAGE_AUDIO_FILES_BUCKET}}.objects_path'
# infisical run --env=dev --projectId=87dad7b5-72a6-4791-9228-b3b86b169db1 --path="/supabase" -- task supabase-start
supabase-start:
cmds:
- curl -o supabase/config.toml https://gist.githubusercontent.com/yujonglee/c0704ebe0818621a64753d663c4fcaff/raw/b82572dfcb6ffa4d20c332a8dd7650e5b82b99c3/supabase-default.toml
- dasel put -f supabase/config.toml -t int -v 17 'db.major_version'
- dasel put -f supabase/config.toml -t string -v 'http://localhost:3000' 'auth.site_url'
- dasel put -f supabase/config.toml -t json -v '["http://localhost:3000/callback/auth"]' 'auth.additional_redirect_urls'
- '[ -n "$GITHUB_CLIENT_ID" ] && [ -n "$GITHUB_CLIENT_SECRET" ] && dasel put -f supabase/config.toml -t bool -v true ''auth.external.github.enabled'' || true'
- '[ -n "$GITHUB_CLIENT_ID" ] && [ -n "$GITHUB_CLIENT_SECRET" ] && dasel put -f supabase/config.toml -t string -v ''{{.GITHUB_CLIENT_ID}}'' ''auth.external.github.client_id'' || true'
- '[ -n "$GITHUB_CLIENT_ID" ] && [ -n "$GITHUB_CLIENT_SECRET" ] && dasel put -f supabase/config.toml -t string -v ''{{.GITHUB_CLIENT_SECRET}}'' ''auth.external.github.secret'' || true'
- '[ -n "$GITHUB_CLIENT_ID" ] && [ -n "$GITHUB_CLIENT_SECRET" ] && dasel put -f supabase/config.toml -t string -v '''' ''auth.external.github.redirect_uri'' || true'
- '[ -n "$GOOGLE_CLIENT_ID" ] && [ -n "$GOOGLE_CLIENT_SECRET" ] && dasel put -f supabase/config.toml -t bool -v true ''auth.external.google.enabled'' || true'
- '[ -n "$GOOGLE_CLIENT_ID" ] && [ -n "$GOOGLE_CLIENT_SECRET" ] && dasel put -f supabase/config.toml -t string -v ''{{.GOOGLE_CLIENT_ID}}'' ''auth.external.google.client_id'' || true'
- '[ -n "$GOOGLE_CLIENT_ID" ] && [ -n "$GOOGLE_CLIENT_SECRET" ] && dasel put -f supabase/config.toml -t string -v ''{{.GOOGLE_CLIENT_SECRET}}'' ''auth.external.google.secret'' || true'
- '[ -n "$GOOGLE_CLIENT_ID" ] && [ -n "$GOOGLE_CLIENT_SECRET" ] && dasel put -f supabase/config.toml -t bool -v false ''auth.external.google.skip_nonce_check'' || true'
- dasel put -f supabase/config.toml -t bool -v true 'auth.hook.custom_access_token.enabled'
- dasel put -f supabase/config.toml -t string -v 'pg-functions://postgres/public/custom_access_token_hook' 'auth.hook.custom_access_token.uri'
# - task: supabase-storage-seed-config
# - '[ ! -f supabase/signing_keys.json ] && pnpm exec supabase gen signing-key --algorithm ES256 | jq -s ''.'' > supabase/signing_keys.json || true'
# - dasel put -f supabase/config.toml -t string -v './signing_keys.json' 'auth.signing_keys_path'
- pnpm exec dprint fmt supabase/config.toml
- pnpm exec supabase start -x realtime,logflare
- task: supabase-env
- pnpm exec supabase migration up --local
nango-dev-connection:
silent: true
requires:
vars: [DEV_NANGO_CONNECTION_ID]
vars:
USER_ID: '{{.USER_ID | default ""}}'
INTEGRATION_ID: '{{.INTEGRATION_ID | default "google-calendar"}}'
PROVIDER: '{{.PROVIDER | default "google-calendar"}}'
cmds:
- |
DB_URL=$(pnpm exec supabase status --output=env 2>/dev/null | awk -F= '/^DB_URL=/{gsub(/^"|"$/, "", $2); print $2}')
if [ -z "$DB_URL" ]; then
echo "DB_URL not found. Start local Supabase first (e.g. task supabase-start)." >&2
exit 1
fi
USER_ID="{{.USER_ID}}"
if [ -z "$USER_ID" ]; then
USER_ID=$(psql "$DB_URL" -tAc "SELECT id::text FROM auth.users ORDER BY created_at DESC LIMIT 1")
fi
if [ -z "$USER_ID" ]; then
echo "No user found in auth.users. Sign in once, or pass USER_ID explicitly." >&2
exit 1
fi
psql "$DB_URL" \
-v ON_ERROR_STOP=1 \
-c "INSERT INTO nango_connections (user_id, integration_id, connection_id, provider) VALUES ('$USER_ID'::uuid, '{{.INTEGRATION_ID}}', '{{.DEV_NANGO_CONNECTION_ID}}', '{{.PROVIDER}}') ON CONFLICT (user_id, integration_id) DO UPDATE SET connection_id = EXCLUDED.connection_id, provider = EXCLUDED.provider, updated_at = now(), status = 'connected', last_error_type = NULL, last_error_description = NULL, last_error_at = NULL;" \
>/dev/null
printf 'ok user_id=%s integration_id=%s connection_id=%s\n' "$USER_ID" "{{.INTEGRATION_ID}}" "{{.DEV_NANGO_CONNECTION_ID}}"
nango-dev-user-id:
silent: true
internal: true
cmds:
- |
DB_URL=$(pnpm exec supabase status --output=env 2>/dev/null | awk -F= '/^DB_URL=/{gsub(/^"|"$/, "", $2); print $2}')
if [ -z "$DB_URL" ]; then
echo "DB_URL not found. Start local Supabase first (e.g. task supabase-start)." >&2
exit 1
fi
USER_ID=$(psql "$DB_URL" -tAc "SELECT id::text FROM auth.users ORDER BY created_at DESC LIMIT 1")
if [ -z "$USER_ID" ]; then
echo "No user found in auth.users. Sign in once first." >&2
exit 1
fi
printf 'user_id=%s\n' "$USER_ID"