mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-02-02 03:50:45 +08:00
Add version commit hash (#3286)
* Add version commit hash * Add frontend client hash * Remove export
This commit is contained in:
parent
162beea1b8
commit
616e26b5c5
3 changed files with 6 additions and 3 deletions
|
@ -3,6 +3,7 @@ import { padNumbers } from "./utils/misc";
|
|||
import { readFileSync, writeFileSync, existsSync } from "fs";
|
||||
|
||||
const SERVER_VERSION_FILE_PATH = join(__dirname, "./server.version");
|
||||
const { COMMIT_HASH = "NO_HASH" } = process.env;
|
||||
|
||||
function getDateVersion(): string {
|
||||
const date = new Date();
|
||||
|
@ -28,7 +29,7 @@ function getVersion(): string {
|
|||
return readFileSync(SERVER_VERSION_FILE_PATH, "utf-8");
|
||||
}
|
||||
|
||||
const serverVersion = getDateVersion();
|
||||
const serverVersion = `${getDateVersion()}.${COMMIT_HASH}`;
|
||||
writeFileSync(SERVER_VERSION_FILE_PATH, serverVersion);
|
||||
|
||||
return serverVersion;
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
"audit": "npx webpack --config ./webpack/config.audit.js",
|
||||
"dep-graph": "madge -c -i \"dep-graph.png\" ./src/ts",
|
||||
"build": "npx gulp build",
|
||||
"build-live": "npx gulp build-production",
|
||||
"build-live": "export COMMIT_HASH=`git rev-parse --short HEAD` && npx gulp build-production",
|
||||
"dev": "concurrently \"webpack serve --config=./webpack/config.dev.js\" \"npx gulp watch\"",
|
||||
"deploy-live": "npm run build-live && firebase deploy -P live --only hosting",
|
||||
"tsc": "tsc"
|
||||
|
|
|
@ -13,6 +13,8 @@ function pad(numbers, maxLength, fillString) {
|
|||
);
|
||||
}
|
||||
|
||||
const { COMMIT_HASH = "NO_HASH" } = process.env;
|
||||
|
||||
/** @type { import('webpack').Configuration } */
|
||||
const PRODUCTION_CONFIG = {
|
||||
mode: "production",
|
||||
|
@ -38,7 +40,7 @@ const PRODUCTION_CONFIG = {
|
|||
).join(".");
|
||||
const version = [versionPrefix, versionSuffix].join("_");
|
||||
|
||||
return `export const CLIENT_VERSION = "${version}";`;
|
||||
return `export const CLIENT_VERSION = "${version}.${COMMIT_HASH}";`;
|
||||
},
|
||||
flags: "g",
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue