diff --git a/dist_scripts/scripts/buildRadar.js b/dist_scripts/scripts/buildRadar.js index 0868a10..5aa41f6 100755 --- a/dist_scripts/scripts/buildRadar.js +++ b/dist_scripts/scripts/buildRadar.js @@ -36,6 +36,7 @@ var __importStar = (this && this.__importStar) || function (mod) { }; Object.defineProperty(exports, "__esModule", { value: true }); var child_process_1 = require("child_process"); +var crypto_1 = require("crypto"); var fs = __importStar(require("fs-extra")); var paths = __importStar(require("./paths")); // Do this as the first thing so that any code reading it knows the right env. @@ -54,7 +55,7 @@ var runCommand = function (command) { var executedCommand = (0, child_process_1.spawn)(command, { stdio: "inherit", shell: true, - env: __assign({ REACT_APP_RADAR_NAME: "AOE Technology Radar" }, process.env), + env: __assign({ REACT_APP_RADAR_NAME: "AOE Technology Radar", REACT_APP_BUILDHASH: (0, crypto_1.randomBytes)(10).toString("hex") }, process.env), }); executedCommand.on("error", function (error) { reject(error); diff --git a/scripts/buildRadar.ts b/scripts/buildRadar.ts index cf3f921..d6b8109 100644 --- a/scripts/buildRadar.ts +++ b/scripts/buildRadar.ts @@ -1,5 +1,6 @@ #!/usr/bin/env node import { spawn } from "child_process"; +import { randomBytes } from "crypto"; import * as fs from "fs-extra"; import * as paths from "./paths"; @@ -23,7 +24,11 @@ const runCommand = (command: string) => const executedCommand = spawn(command, { stdio: "inherit", shell: true, - env: { REACT_APP_RADAR_NAME: "AOE Technology Radar", ...process.env }, + env: { + REACT_APP_RADAR_NAME: "AOE Technology Radar", + REACT_APP_BUILDHASH: randomBytes(10).toString("hex"), + ...process.env, + }, }); executedCommand.on("error", (error) => { diff --git a/src/components/App.tsx b/src/components/App.tsx index 407db5a..5d4b295 100644 --- a/src/components/App.tsx +++ b/src/components/App.tsx @@ -80,11 +80,15 @@ interface Data { } export default function App() { - const data = useFetch(`${process.env.PUBLIC_URL}/rd.json`); - const messages = useFetch( - `${process.env.PUBLIC_URL}/messages.json` + const data = useFetch( + `${process.env.PUBLIC_URL}/rd.json?${process.env.REACT_APP_BUILDHASH}` + ); + const messages = useFetch( + `${process.env.PUBLIC_URL}/messages.json?${process.env.REACT_APP_BUILDHASH}` + ); + const config = useFetch( + `${process.env.PUBLIC_URL}/config.json?${process.env.REACT_APP_BUILDHASH}` ); - const config = useFetch(`${process.env.PUBLIC_URL}/config.json`); if (data && config) { const { items, releases } = data;