Skip to content

Commit db39eac

Browse files
authored
Set NODE_ENV and VERSION when building (#700)
* Set NODE_ENV and VERSION when building Should fix the version flag not reporting correctly as well as enable the service worker and prevent the 404 hmr requests again. * Log env vars To help make sure it's built correctly when looking at the Travis logs.
1 parent c020cd2 commit db39eac

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

build/tasks.ts

+6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { register, run } from "@coder/runner";
2+
import { logger, field } from "@coder/logger";
23
import * as fs from "fs";
34
import * as fse from "fs-extra";
45
import * as os from "os";
@@ -17,6 +18,11 @@ const vscodeVersion = process.env.VSCODE_VERSION || "1.33.1";
1718
const vsSourceUrl = `https://codesrv-ci.cdr.sh/vstar-${vscodeVersion}.tar.gz`;
1819

1920
const buildServerBinary = register("build:server:binary", async (runner) => {
21+
logger.info("Building with environment", field("env", {
22+
NODE_ENV: process.env.NODE_ENV,
23+
VERSION: process.env.VERSION,
24+
}));
25+
2026
await ensureInstalled();
2127
await Promise.all([
2228
buildBootstrapFork(),

scripts/build.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ function docker_build() {
1515
docker cp ./. $containerID:/src
1616
exec "cd /src && yarn"
1717
exec "cd /src && npm rebuild"
18-
exec "cd /src && yarn task build:server:binary"
18+
exec "cd /src && NODE_ENV=production VERSION=$VERSION yarn task build:server:binary"
1919
exec "cd /src && yarn task package $VERSION"
2020
docker cp $containerID:/src/release/. ./release/
2121
}
2222

2323
if [[ "$OSTYPE" == "darwin"* ]]; then
24-
yarn task build:server:binary
24+
NODE_ENV=production yarn task build:server:binary
2525
else
2626
if [[ "$TARGET" == "alpine" ]]; then
2727
IMAGE="codercom/nbin-alpine"

0 commit comments

Comments
 (0)