Skip to content

Commit 3981773

Browse files
committed
update setup
1 parent 5cb5c51 commit 3981773

File tree

12 files changed

+102
-121
lines changed

12 files changed

+102
-121
lines changed

.prettierrc

Lines changed: 0 additions & 35 deletions
This file was deleted.

.vscode/extensions.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
2-
"recommendations": [
3-
"dbaeumer.vscode-eslint",
4-
"esbenp.prettier-vscode",
5-
"bradlc.vscode-tailwindcss",
6-
"neotan.vscode-auto-restart-typescript-eslint-servers",
7-
"prisma.prisma",
8-
"qwtel.sqlite-viewer"
9-
]
2+
"recommendations": [
3+
"dbaeumer.vscode-eslint",
4+
"esbenp.prettier-vscode",
5+
"bradlc.vscode-tailwindcss",
6+
"neotan.vscode-auto-restart-typescript-eslint-servers",
7+
"prisma.prisma",
8+
"qwtel.sqlite-viewer"
9+
]
1010
}

.vscode/settings.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"typescript.preferences.autoImportFileExcludePatterns": [
3-
"@remix-run/server-runtime",
4-
"@remix-run/router",
5-
"react-router-dom",
6-
"react-router"
7-
],
8-
"workbench.editorAssociations": {
9-
"*.db": "sqlite-viewer.view"
10-
}
2+
"typescript.preferences.autoImportFileExcludePatterns": [
3+
"@remix-run/server-runtime",
4+
"@remix-run/router",
5+
"react-router-dom",
6+
"react-router"
7+
],
8+
"workbench.editorAssociations": {
9+
"*.db": "sqlite-viewer.view"
10+
}
1111
}

epicshop/Dockerfile

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
FROM node:20-bookworm-slim as base
1+
FROM node:24-bookworm-slim as base
22

33
RUN apt-get update && apt-get install -y git
44

5+
ENV EPICSHOP_REPO=https://github.com/epicweb-dev/testing-fundamentals
56
ENV EPICSHOP_CONTEXT_CWD="/myapp/workshop-content"
67
ENV EPICSHOP_DEPLOYED="true"
78
ENV EPICSHOP_DISABLE_WATCHER="true"
@@ -11,11 +12,18 @@ ENV NODE_ENV="production"
1112

1213
WORKDIR /myapp
1314

15+
# Clone the workshop repo during build time, excluding database files
16+
RUN git clone --depth 1 ${EPICSHOP_REPO} ${EPICSHOP_CONTEXT_CWD} && \
17+
find ${EPICSHOP_CONTEXT_CWD} -name "data.db" -delete
18+
1419
ADD . .
1520

1621
RUN npm install --omit=dev
1722

18-
CMD rm -rf ${EPICSHOP_CONTEXT_CWD} && \
19-
git clone https://github.com/epicweb-dev/testing-fundamentals ${EPICSHOP_CONTEXT_CWD} && \
23+
RUN echo "🔥 Warming up cache..." && \
24+
cd ${EPICSHOP_CONTEXT_CWD} && \
25+
npx epicshop warm
26+
27+
CMD echo "⚡ Starting up..." && \
2028
cd ${EPICSHOP_CONTEXT_CWD} && \
2129
npx epicshop start

epicshop/fix-watch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ watcher
2727
// Only act if path contains two slashes (excluding the leading `./`)
2828
debouncedRun()
2929
})
30-
.on('error', error => console.log(`Watcher error: ${error}`))
30+
.on('error', (error) => console.log(`Watcher error: ${error}`))
3131

3232
/**
3333
* Simple debounce implementation

epicshop/fix.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,29 @@ const here = (...p) => path.join(__dirname, ...p)
1111
// const logVerbose = (...args) => (VERBOSE ? console.log(...args) : undefined)
1212

1313
const workshopRoot = here('..')
14-
const examples = (await readDir(here('../examples'))).map(dir =>
14+
const examples = (await readDir(here('../examples'))).map((dir) =>
1515
here(`../examples/${dir}`),
1616
)
1717
const exercises = (await readDir(here('../exercises')))
18-
.map(name => here(`../exercises/${name}`))
19-
.filter(filepath => fs.statSync(filepath).isDirectory())
18+
.map((name) => here(`../exercises/${name}`))
19+
.filter((filepath) => fs.statSync(filepath).isDirectory())
2020
const exerciseApps = (
2121
await Promise.all(
22-
exercises.flatMap(async exercise => {
22+
exercises.flatMap(async (exercise) => {
2323
return (await readDir(exercise))
24-
.filter(dir => {
24+
.filter((dir) => {
2525
return /(problem|solution)/.test(dir)
2626
})
27-
.map(dir => path.join(exercise, dir))
27+
.map((dir) => path.join(exercise, dir))
2828
}),
2929
)
3030
).flat()
31-
const exampleApps = (await readDir(here('../examples'))).map(dir =>
31+
const exampleApps = (await readDir(here('../examples'))).map((dir) =>
3232
here(`../examples/${dir}`),
3333
)
3434
const apps = [...exampleApps, ...exerciseApps]
3535

36-
const appsWithPkgJson = [...examples, ...apps].filter(app => {
36+
const appsWithPkgJson = [...examples, ...apps].filter((app) => {
3737
const pkgjsonPath = path.join(app, 'package.json')
3838
return exists(pkgjsonPath)
3939
})
@@ -71,7 +71,7 @@ async function updateRootTsConfig() {
7171
const tsconfig = {
7272
files: [],
7373
exclude: ['node_modules'],
74-
references: appsWithPkgJson.map(a => ({
74+
references: appsWithPkgJson.map((a) => ({
7575
path: relativeToWorkshopRoot(a).replace(/\\/g, '/'),
7676
})),
7777
}
@@ -92,7 +92,7 @@ async function updateRootTsConfig() {
9292
}
9393

9494
async function copyExerciseTsConfigs() {
95-
const exercisesWithoutTsCongif = exerciseApps.filter(exercisePath => {
95+
const exercisesWithoutTsCongif = exerciseApps.filter((exercisePath) => {
9696
return !fs.existsSync(path.join(exercisePath, 'tsconfig.json'))
9797
})
9898

@@ -106,7 +106,7 @@ async function copyExerciseTsConfigs() {
106106
)
107107

108108
await Promise.all(
109-
exercisesWithoutTsCongif.map(exercisePath => {
109+
exercisesWithoutTsCongif.map((exercisePath) => {
110110
const tsConfigPath = path.resolve(exercisePath, 'tsconfig.json')
111111
return fs.promises.writeFile(tsConfigPath, tsConfigTemplate)
112112
}),
@@ -119,7 +119,7 @@ async function copyExercisePrettierConfigs() {
119119
'utf8',
120120
)
121121
await Promise.all(
122-
exerciseApps.map(exercise => {
122+
exerciseApps.map((exercise) => {
123123
const prettierConfigPath = path.join(exercise, '.prettierrc')
124124
return fs.promises.writeFile(prettierConfigPath, prettierConfig)
125125
}),

epicshop/fly.toml

Lines changed: 0 additions & 46 deletions
This file was deleted.

epicshop/fly.yaml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
2+
#
3+
4+
app: 'epicweb-dev-testing-fundamentals'
5+
primary_region: sjc
6+
kill_signal: SIGINT
7+
kill_timeout: 5s
8+
swap_size_mb: 512
9+
10+
experimental:
11+
auto_rollback: true
12+
13+
attached:
14+
secrets: {}
15+
16+
services:
17+
- processes:
18+
- app
19+
protocol: tcp
20+
internal_port: 8080
21+
22+
ports:
23+
- port: 80
24+
25+
handlers:
26+
- http
27+
force_https: true
28+
- port: 443
29+
30+
handlers:
31+
- tls
32+
- http
33+
34+
concurrency:
35+
type: connections
36+
hard_limit: 100
37+
soft_limit: 80
38+
39+
tcp_checks:
40+
- interval: 15s
41+
timeout: 2s
42+
grace_period: 1s
43+
44+
http_checks:
45+
- interval: 10s
46+
timeout: 2s
47+
grace_period: 5s
48+
method: get
49+
path: /resources/healthcheck
50+
protocol: http
51+
tls_skip_verify: false

epicshop/setup-custom.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@ import {
44
isProblemApp,
55
setPlayground,
66
} from '@epic-web/workshop-utils/apps.server'
7+
import { warm } from '@epic-web/workshop-cli/warm'
78
import fsExtra from 'fs-extra'
89

10+
await warm()
11+
912
const allApps = await getApps()
1013
const problemApps = allApps.filter(isProblemApp)
1114

@@ -22,7 +25,7 @@ if (!process.env.SKIP_PLAYGROUND) {
2225
() => {
2326
console.log('✅ first problem app set up')
2427
},
25-
error => {
28+
(error) => {
2629
console.error(error)
2730
throw new Error('❌ first problem app setup failed')
2831
},

exercises/04.vitest/README.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# Moving to Vitest
22

3-
43
<EpicVideo url="https://www.epicweb.dev/workshops/testing-fundamentals/moving-to-vitest/overview-of-vitest" />
54

65
Up to this point, we've been building what essentially is a primitive testing framework. Functions like `test()`, and `expect()`, and even `waitFor()` are the building blocks that help us structure and execute our automated tests.

0 commit comments

Comments
 (0)