Skip to content

Commit 1297a93

Browse files
committed
Update build script.
1 parent 906cca3 commit 1297a93

File tree

3 files changed

+37
-12
lines changed

3 files changed

+37
-12
lines changed

Makefile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,8 @@
1-
all:
2-
node build.mjs
1+
watch: install
2+
NODE_ENV=development node build.mjs
3+
4+
install:
5+
npm install
6+
7+
build: install
8+
NODE_ENV=production node build.mjs

README.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
Makerspace Task List
2-
====================
1+
# Makerspace Task List
32

43
Takes a public Trello board and shows it as a nice list, suitable for printing on A4 paper.
54

@@ -9,4 +8,18 @@ The page header, date and extra text to the right, is editable directly in the b
98

109
At the top one can select both which board to use, and which lists from that board to include. These settings are hidden when printing.
1110

12-
![Screenshot](./docs/screenshot.png)
11+
![Screenshot](./docs/screenshot.png)
12+
13+
## Usage
14+
15+
Development mode:
16+
17+
```bash
18+
make watch
19+
```
20+
21+
Production build:
22+
23+
```bash
24+
make build
25+
```

build.mjs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,17 @@ const ctx = await esbuild.context({
1111
outdir: 'dist',
1212
});
1313

14-
let { host, port } = await ctx.serve({
15-
servedir: 'dist',
16-
onRequest: () => {
17-
}
18-
});
14+
if (process.env.NODE_ENV === 'production') {
15+
await ctx.rebuild();
16+
console.log('Build succeeded.');
17+
process.exit(0);
18+
} else {
19+
let { host, port } = await ctx.serve({
20+
servedir: 'dist',
21+
onRequest: () => {
22+
}
23+
});
1924

20-
console.log('Build succeeded. Serving on http://' + host + ':' + port);
21-
console.log("Watching for changes...");
25+
console.log('Build succeeded. Serving on http://' + host + ':' + port);
26+
console.log("Watching for changes...");
27+
}

0 commit comments

Comments
 (0)