Skip to content

Commit 0d9ba26

Browse files
committed
handle hot reload for gitpod and local envs
1 parent 039db87 commit 0d9ba26

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

watch.mjs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,19 @@ import fs from 'node:fs/promises'
44
import path from 'node:path'
55
import os from 'node:os'
66

7-
const cmd = './watch.sh'
7+
const cmd = buildCommand()
88
const dir = './src'
99
const delay = 500
1010

11+
function buildCommand () {
12+
const tasks = process.env.GIPOD_TASKS
13+
const port = tasks ? tasks[0]?.env?.PORT || 8080 : 80
14+
return `./watch ${port}`
15+
}
16+
1117
/**
1218
* Get all files in `dir` and in all of its subdirectories and in all of their
13-
* subdirectories, and so on...
19+
* subdirectories, an d so on...
1420
* @param {string} dir directory to read
1521
* @returns
1622
*/

watch.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
cd ../aegis
22
yarn build
3-
curl -s http://localhost/reload
3+
curl -s http://localhost:$1/reload

0 commit comments

Comments
 (0)