Skip to content

Commit 3828c77

Browse files
committed
update all the things
1 parent 419ace7 commit 3828c77

File tree

12 files changed

+3202
-3296
lines changed

12 files changed

+3202
-3296
lines changed

epicshop/Dockerfile

Lines changed: 9 additions & 4 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_GITHUB_REPO=https://github.com/epicweb-dev/build-react-hooks
56
ENV EPICSHOP_CONTEXT_CWD="/myapp/workshop-content"
67
ENV EPICSHOP_DEPLOYED="true"
78
ENV EPICSHOP_DISABLE_WATCHER="true"
@@ -11,11 +12,15 @@ 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_GITHUB_REPO} ${EPICSHOP_CONTEXT_CWD}
17+
1418
ADD . .
1519

1620
RUN npm install --omit=dev
1721

18-
CMD rm -rf ${EPICSHOP_CONTEXT_CWD} && \
19-
git clone https://github.com/epicweb-dev/build-react-hooks ${EPICSHOP_CONTEXT_CWD} && \
20-
cd ${EPICSHOP_CONTEXT_CWD} && \
22+
RUN cd ${EPICSHOP_CONTEXT_CWD} && \
23+
npx epicshop warm
24+
25+
CMD cd ${EPICSHOP_CONTEXT_CWD} && \
2126
npx epicshop start

epicshop/fix-watch.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ const debouncedRun = debounce(run, 200)
2020

2121
// Add event listeners.
2222
watcher
23-
.on('addDir', path => {
23+
.on('addDir', (path) => {
2424
debouncedRun()
2525
})
26-
.on('unlinkDir', path => {
26+
.on('unlinkDir', (path) => {
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: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,29 @@ const VERBOSE = false
1212
const logVerbose = (...args) => (VERBOSE ? console.log(...args) : undefined)
1313

1414
const workshopRoot = here('..')
15-
const examples = (await readDir(here('../examples'))).map(dir =>
15+
const examples = (await readDir(here('../examples'))).map((dir) =>
1616
here(`../examples/${dir}`),
1717
)
1818
const exercises = (await readDir(here('../exercises')))
19-
.map(name => here(`../exercises/${name}`))
20-
.filter(filepath => fs.statSync(filepath).isDirectory())
19+
.map((name) => here(`../exercises/${name}`))
20+
.filter((filepath) => fs.statSync(filepath).isDirectory())
2121
const exerciseApps = (
2222
await Promise.all(
23-
exercises.flatMap(async exercise => {
23+
exercises.flatMap(async (exercise) => {
2424
return (await readDir(exercise))
25-
.filter(dir => {
25+
.filter((dir) => {
2626
return /(problem|solution)/.test(dir)
2727
})
28-
.map(dir => path.join(exercise, dir))
28+
.map((dir) => path.join(exercise, dir))
2929
}),
3030
)
3131
).flat()
32-
const exampleApps = (await readDir(here('../examples'))).map(dir =>
32+
const exampleApps = (await readDir(here('../examples'))).map((dir) =>
3333
here(`../examples/${dir}`),
3434
)
3535
const apps = [...exampleApps, ...exerciseApps]
3636

37-
const appsWithPkgJson = [...examples, ...apps].filter(app => {
37+
const appsWithPkgJson = [...examples, ...apps].filter((app) => {
3838
const pkgjsonPath = path.join(app, 'package.json')
3939
return exists(pkgjsonPath)
4040
})
@@ -70,7 +70,7 @@ async function updateTsconfig() {
7070
const tsconfig = {
7171
files: [],
7272
exclude: ['node_modules'],
73-
references: appsWithPkgJson.map(a => ({
73+
references: appsWithPkgJson.map((a) => ({
7474
path: relativeToWorkshopRoot(a).replace(/\\/g, '/'),
7575
})),
7676
}

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-build-react-hooks'
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

0 commit comments

Comments
 (0)