fix(build): create random hash for cache invalidation #209
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
@@ -80,11 +80,15 @@ interface Data {
|
||||
}
|
||||
|
||||
export default function App() {
|
||||
const data = useFetch<Data>(`${process.env.PUBLIC_URL}/rd.json`);
|
||||
const messages = useFetch<Messages>(
|
||||
`${process.env.PUBLIC_URL}/messages.json`
|
||||
const data = useFetch<Data>(
|
||||
`${process.env.PUBLIC_URL}/rd.json?${process.env.REACT_APP_BUILDHASH}`
|
||||
);
|
||||
const messages = useFetch<Messages>(
|
||||
`${process.env.PUBLIC_URL}/messages.json?${process.env.REACT_APP_BUILDHASH}`
|
||||
);
|
||||
const config = useFetch<ConfigData>(
|
||||
`${process.env.PUBLIC_URL}/config.json?${process.env.REACT_APP_BUILDHASH}`
|
||||
);
|
||||
const config = useFetch<ConfigData>(`${process.env.PUBLIC_URL}/config.json`);
|
||||
|
||||
if (data && config) {
|
||||
const { items, releases } = data;
|
||||
|
||||
Reference in New Issue
Block a user