Skip to content

Commit 1fe53a0

Browse files
authored
Pnpm updates cleanups etc (#7)
1 parent d688b66 commit 1fe53a0

File tree

16 files changed

+979
-892
lines changed

16 files changed

+979
-892
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# Add your env variables here
2-
DEPLOYMENT_ENV="staging"
2+
APP_DEPLOYMENT_ENV="staging"

.env.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# Add your env variables here
2-
DEPLOYMENT_ENV="staging"
2+
APP_DEPLOYMENT_ENV="staging"

.github/workflows/validate.yml

Lines changed: 19 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -17,52 +17,37 @@ jobs:
1717
name: ⬣ Biome lint
1818
runs-on: ubuntu-latest
1919
steps:
20-
- name: ⬇️ Checkout repo
21-
uses: actions/checkout@v4
22-
- name: Setup Biome
23-
uses: biomejs/setup-biome@v2
24-
- name: Run Biome
25-
run: biome ci .
20+
- uses: actions/checkout@v4
21+
- uses: biomejs/setup-biome@v2
22+
- run: biome ci . --reporter=github
2623

2724
typecheck:
25+
needs: lint
2826
name: 🔎 Type check
2927
runs-on: ubuntu-latest
3028
steps:
31-
- name: 🛑 Cancel Previous Runs
32-
uses: styfle/cancel-workflow-action@0.12.1
33-
- name: ⬇️ Checkout repo
34-
uses: actions/checkout@v4
35-
- name: ⎔ Setup node
36-
uses: actions/setup-node@v4
29+
- uses: actions/checkout@v4
30+
- uses: pnpm/action-setup@v4
31+
- uses: actions/setup-node@v4
3732
with:
38-
node-version: 20
39-
- name: 📥 Download deps
40-
uses: bahmutov/npm-install@v1
41-
with:
42-
useLockFile: false
43-
- name: 🔎 Type check
44-
run: npm run typecheck
33+
node-version-file: "package.json"
34+
cache: "pnpm"
35+
- run: pnpm install --prefer-offline --frozen-lockfile
36+
- run: pnpm run typecheck
4537

4638
vitest:
39+
needs: typecheck
4740
name: ⚡ Unit Tests
4841
runs-on: ubuntu-latest
4942
steps:
50-
- name: 🛑 Cancel Previous Runs
51-
uses: styfle/cancel-workflow-action@0.12.1
52-
- name: ⬇️ Checkout repo
53-
uses: actions/checkout@v4
54-
- name: ⎔ Setup node
55-
uses: actions/setup-node@v4
56-
with:
57-
node-version: 20
58-
- name: 📥 Download deps
59-
uses: bahmutov/npm-install@v1
43+
- uses: actions/checkout@v4
44+
- uses: pnpm/action-setup@v4
45+
- uses: actions/setup-node@v4
6046
with:
61-
useLockFile: false
62-
- name: Install dotenv cli
63-
run: npm install -g dotenv-cli
64-
- name: ⚡ Run vitest
65-
run: npm run test:cov
47+
node-version-file: "package.json"
48+
cache: "pnpm"
49+
- run: pnpm install --prefer-offline --frozen-lockfile
50+
- run: pnpm run test:cov
6651
- name: "Report Coverage"
6752
# Only works if you set `reportOnFailure: true` in your vite config as specified above
6853
if: always()

.gitignore

Lines changed: 91 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,94 @@
11
node_modules
2-
/.cache
3-
/build
4-
.env
2+
public/build
3+
build
4+
dist
5+
out
56
coverage
67
.history
7-
.react-router
8+
.react-router
9+
10+
# Other Coverage tools
11+
*.lcov
12+
13+
# macOS
14+
.DS_*
15+
16+
# Cache Directories and files
17+
.cache
18+
.yarn*
19+
.env*
20+
!.env.example
21+
.swp*
22+
.turbo
23+
.npm
24+
.stylelintcache
25+
*.tsbuildinfo
26+
.node_repl_history
27+
28+
# Lock files from other package managers
29+
package-lock.json
30+
yarn.lock
31+
32+
# General tempory files and directories
33+
t?mp
34+
.t?mp
35+
*.t?mp
36+
37+
# Docusaurus cache and generated files
38+
.docusaurus
39+
40+
# Output of 'npm pack'
41+
*.tgz
42+
*.tar
43+
*.tar.gz
44+
*.tar.bz2
45+
*.tbz
46+
*.zip
47+
48+
# Runtime data
49+
pids
50+
*.pid
51+
*.seed
52+
*.pid.lock
53+
54+
# Diagnostic reports (https://nodejs.org/api/report.html)
55+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
56+
57+
# Logs
58+
logs
59+
*.log
60+
npm-debug.log*
61+
yarn-debug.log*
62+
yarn-error.log*
63+
lerna-debug.log*
64+
.pnpm-debug.log*
65+
vite.config.ts.*
66+
67+
# Playwright various test reports
68+
test-results
69+
playwright-report
70+
blob-report
71+
72+
73+
# Editors
74+
.idea/workspace.xml
75+
.idea/usage.statistics.xml
76+
.idea/shelf
77+
78+
79+
# Make it harder to accidentally commit files in the root
80+
/*.json
81+
/*.yaml
82+
/*.yml
83+
/*.toml
84+
/*.ts
85+
/*.tsx
86+
/*.js
87+
/*.jsx
88+
/*.sh
89+
90+
# Dont commit sqlite database files
91+
*.db
92+
*.sqlite
93+
*.sqlite3
94+
*.db-journal

.npmrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
enable-pre-post-scripts=true
2+
side-effects-cache=false
3+
save-exact=true
4+
audit=false
5+
fund=false
6+
progress=false

app/env.server.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { z } from "zod"
22

33
const envSchema = z.object({
44
NODE_ENV: z.enum(["development", "production", "test"]),
5-
DEPLOYMENT_ENV: z.enum(["staging", "production"]),
5+
APP_DEPLOYMENT_ENV: z.enum(["staging", "production"]),
66
})
77

88
type APP_ENV = z.infer<typeof envSchema>
@@ -13,6 +13,7 @@ let env: APP_ENV
1313
* @returns Initialized env vars
1414
*/
1515
export const initEnv = () => {
16+
// biome-ignore lint/nursery/noProcessEnv: This should be the only place to use process.env directly
1617
const envData = envSchema.safeParse(process.env)
1718

1819
if (!envData.success) {

app/library/icon/icons/types.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// This file is generated by icon spritesheet generator
22

3-
export const iconNames = ["ShoppingCart"] as const
3+
export const iconNames = [
4+
"ShoppingCart",
5+
] as const
46

5-
export type IconName = (typeof iconNames)[number]
7+
export type IconName = typeof iconNames[number]

app/routes/resource.locales.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import { z } from "zod"
44
import { resources } from "~/localization/resource"
55
import type { Route } from "./+types/resource.locales"
66

7-
export async function loader({ request }: Route.LoaderArgs) {
7+
export async function loader({ request, context }: Route.LoaderArgs) {
8+
const { env } = context
89
const url = new URL(request.url)
910

1011
const lng = z
@@ -24,7 +25,7 @@ export async function loader({ request }: Route.LoaderArgs) {
2425
const headers = new Headers()
2526

2627
// On production, we want to add cache headers to the response
27-
if (process.env.APP_DEPLOYMENT_ENV === "production") {
28+
if (env.APP_DEPLOYMENT_ENV === "production") {
2829
headers.set(
2930
"Cache-Control",
3031
cacheHeader({

app/routes/robots[.]txt.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ import { generateRobotsTxt } from "@forge42/seo-tools/robots"
33
import { createDomain } from "~/utils/http"
44
import type { Route } from "./+types/robots[.]txt"
55

6-
export async function loader({ request }: Route.LoaderArgs) {
7-
const isProductionDeployment = process.env.DEPLOYMENT_ENV === "production"
6+
export async function loader({ request, context }: Route.LoaderArgs) {
7+
const { env } = context
8+
const isProductionDeployment = env.APP_DEPLOYMENT_ENV === "production"
89
const domain = createDomain(request)
910
const robotsTxt = generateRobotsTxt([
1011
{

biome.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
{
22
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
3+
"files": {
4+
"ignore": ["app/library/icon/**/*"]
5+
},
36
"vcs": {
47
"enabled": true,
58
"clientKind": "git",
@@ -8,9 +11,6 @@
811
},
912
"formatter": {
1013
"enabled": true,
11-
"formatWithErrors": false,
12-
"indentStyle": "tab",
13-
"lineEnding": "lf",
1414
"lineWidth": 120
1515
},
1616
"organizeImports": {
@@ -47,7 +47,8 @@
4747
"recommended": true
4848
},
4949
"nursery": {
50-
"recommended": true
50+
"recommended": true,
51+
"noProcessEnv": "error"
5152
}
5253
}
5354
},

0 commit comments

Comments
 (0)