Skip to content

Commit 3156a48

Browse files
committed
fix(static): 🐛 restore sample loading and harden export deployment
1 parent 9cb57fe commit 3156a48

13 files changed

Lines changed: 666 additions & 121 deletions

.github/workflows/deploy.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,12 @@ jobs:
2626
cache: npm
2727

2828
- run: npm ci
29-
- run: npm run build
29+
- run: npx playwright install --with-deps chromium
30+
- run: npm run lint
31+
- run: npm run typecheck
32+
- run: npm run test:e2e:dev
33+
- run: npm run test:e2e:static
34+
- run: npm run smoke:static
3035

3136
- uses: actions/upload-pages-artifact@v3
3237
with:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ yarn-error.log*
4141

4242
# test results
4343
test-results/
44+
playwright-report/
4445

4546
# review screenshots (artifacts, not source)
4647
review-screenshots/

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,16 +180,26 @@ Open [http://localhost:3000](http://localhost:3000).
180180

181181
```bash
182182
npx playwright install --with-deps chromium
183-
npx playwright test
183+
npm run test:e2e:dev
184+
npm run test:e2e:static
185+
```
186+
187+
### Typecheck & Lint
188+
189+
```bash
190+
npm run typecheck
191+
npm run lint
184192
```
185193

186194
### Build
187195

188196
```bash
189197
npm run build
198+
npm run start
190199
```
191200

192201
Static output is generated in `out/` for deployment.
202+
`npm run start` serves the exported app at `http://localhost:3000/travelback/`.
193203

194204
## Deploy
195205

e2e/travelback.spec.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,16 @@ test.describe('Travelback App', () => {
6464
await expect(page.getByText('Drop your travel file here')).toBeVisible({ timeout: 10_000 })
6565
})
6666

67+
test('loads sample trip from landing CTA', async ({ page }) => {
68+
const sampleBtn = page.getByRole('button', { name: 'Try with a sample trip' })
69+
await expect(sampleBtn).toBeVisible({ timeout: 10_000 })
70+
await sampleBtn.click({ force: true })
71+
72+
await expect(page.getByText('Namsan Tower Walk')).toBeVisible({ timeout: 15_000 })
73+
await expect(page.locator('text=/\\d+ \\/ \\d+ locations/').first()).toBeVisible()
74+
await expect(page.getByRole('button', { name: 'Play' })).toBeVisible({ timeout: 10_000 })
75+
})
76+
6777
test('imports GPX file and displays track', async ({ page }) => {
6878
await uploadGpx(page)
6979

@@ -304,4 +314,3 @@ test.describe('Travelback App', () => {
304314
await expect(page.getByText('Start Export')).toBeVisible()
305315
})
306316
})
307-

eslint.config.mjs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ import nextTs from "eslint-config-next/typescript";
55
const eslintConfig = defineConfig([
66
...nextVitals,
77
...nextTs,
8+
{
9+
rules: {
10+
'react-hooks/preserve-manual-memoization': 'warn',
11+
'react-hooks/set-state-in-effect': 'warn',
12+
},
13+
},
814
// Override default ignores of eslint-config-next.
915
globalIgnores([
1016
// Default ignores of eslint-config-next:

next.config.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1-
import type { NextConfig } from "next"
1+
import type { NextConfig } from 'next'
2+
3+
const basePath = process.env.NODE_ENV === 'production' ? '/travelback' : ''
24

35
const nextConfig: NextConfig = {
46
output: 'export',
5-
basePath: process.env.NODE_ENV === 'production' ? '/travelback' : '',
7+
basePath,
8+
env: {
9+
NEXT_PUBLIC_BASE_PATH: basePath,
10+
},
611
images: {
712
unoptimized: true,
813
},

0 commit comments

Comments
 (0)