Skip to content

Commit a14b6aa

Browse files
Standardize Sanity template (#32)
* Standardize template * Update Readme * Add Validate Workflow * Add script to generate environment file
1 parent 95d7b7f commit a14b6aa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+23284
-163
lines changed

.github/workflows/prettier.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
name: Prettier
3+
4+
on:
5+
push:
6+
branches: [main]
7+
workflow_dispatch:
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
11+
cancel-in-progress: true
12+
13+
permissions:
14+
contents: read # for checkout
15+
16+
jobs:
17+
run:
18+
name: Can the code be prettier? 🤔
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v4
22+
- uses: pnpm/action-setup@v4
23+
- uses: actions/setup-node@v4
24+
with:
25+
cache: pnpm
26+
node-version: lts/*
27+
- run: pnpm install --dev --ignore-scripts
28+
- uses: actions/cache@v4
29+
with:
30+
path: node_modules/.cache/prettier/.prettier-cache
31+
key: prettier-${{ hashFiles('pnpm-lock.yaml') }}-${{ hashFiles('.prettierignore') }}-${{ hashFiles('package.json') }}
32+
- run: pnpm format
33+
- run: git restore .github/workflows pnpm-lock.yaml
34+
- uses: actions/create-github-app-token@v1
35+
id: generate-token
36+
with:
37+
app-id: ${{ secrets.ECOSPARK_APP_ID }}
38+
private-key: ${{ secrets.ECOSPARK_APP_PRIVATE_KEY }}
39+
- uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7
40+
with:
41+
body: I ran `pnpm format` 🧑‍💻
42+
branch: actions/prettier
43+
commit-message: "chore(prettier): 🤖 ✨"
44+
labels: 🤖 bot
45+
sign-commits: true
46+
title: "chore(prettier): 🤖 ✨"
47+
token: ${{ steps.generate-token.outputs.token }}

.github/workflows/validate.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: Validate Template
2+
on: push
3+
4+
jobs:
5+
validate:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@v4
9+
- name: Validate Sanity Template
10+
uses: sanity-io/template-validator@v1
11+
with:
12+
repository: ${{ github.repository }}

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,8 @@ testem.log
4242
Thumbs.db
4343
.vercel
4444
.angular
45+
46+
# env files
47+
.env
48+
.env.*
49+
!.env.example

README.md

Lines changed: 70 additions & 36 deletions

angular-app/.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
SANITY_PROJECT_ID=""
2+
SANITY_DATASET=""

app/.gitignore renamed to angular-app/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,6 @@ testem.log
4242
Thumbs.db
4343
.vercel
4444
.angular
45+
46+
environment.ts
47+
.env
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
{
2+
"name": "angular-app",
23
"private": true,
34
"scripts": {
45
"ng": "ng",
56
"start": "ng serve",
6-
"dev": "npm start",
7-
"build": "ng build",
7+
"dev": "npm run setEnvVars && npm start",
8+
"build": "npm run setEnvVars && ng build",
89
"watch": "ng build --watch --configuration development",
9-
"test": "ng test"
10+
"test": "ng test",
11+
"setEnvVars": "node src/environments/setEnvVars.ts"
1012
},
1113
"dependencies": {
1214
"@angular/animations": "^16.0.1",
@@ -23,6 +25,7 @@
2325
"@portabletext/types": "^2.0.2",
2426
"@sanity/client": "^6.0.1",
2527
"@sanity/image-url": "^1.0.2",
28+
"dotenv": "^16.4.7",
2629
"express": "^4.15.2",
2730
"rxjs": "~7.8.0",
2831
"tslib": "^2.3.0",

0 commit comments

Comments
 (0)