Skip to content

Commit 0b1f168

Browse files
committed
👷 Add a CI check that all files that use prisma import it
1 parent 866576e commit 0b1f168

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

.gitlab-ci.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
stages:
2+
- test
3+
4+
check_prisma_imports:
5+
image: node:14
6+
stage: test
7+
script:
8+
- npm run check-prisma-imports

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "front",
2+
"name": "loca7",
33
"version": "0.0.1",
44
"private": true,
55
"scripts": {
@@ -18,10 +18,11 @@
1818
"format": "prettier --plugin-search-dir . --write .",
1919
"start": "node -r dotenv/config build",
2020
"start:beta": "STAGE=beta ORIGIN=https://loca7.ewen.works pnpm start",
21-
"check-prisma-imports": "for file in **/*.server.ts; do if ! grep -q 'import { prisma } from' $file; then echo warn: no prisma import in $file; fi; done",
21+
"check-prisma-imports": "shopt -s globstar; found_warning=0; for file in src/**/*server.ts; do if grep -q 'prisma' \"$file\" && ! grep -q 'import { prisma } from' \"$file\"; then echo \"warn: no prisma import in $file\"; found_warning=1; fi; done; if [ $found_warning -eq 0 ]; then echo \"All files have a prisma import\"; fi",
2222
"update-mail-templates": "ts-node mail-templates/updateTypes.ts",
2323
"update-icons": "python src/lib/icons/sveltify.py",
24-
"generate": "concurrently npm:update-mail-templates npm:update-icons && pnpm format"
24+
"generate": "concurrently npm:update-mail-templates npm:update-icons && pnpm format",
25+
"staging:deploy": "ssh [email protected] 'bash --login -c ~/www/loca7.ewen.works/update-staging'"
2526
},
2627
"prisma": {
2728
"seed": "ts-node --transpile-only scripts/importOldData.ts"

0 commit comments

Comments
 (0)