chore: make buildConfig.json optional (#822)
This commit is contained in:
parent
ae832d0125
commit
15f36263cd
1
.github/workflows/build.yml
vendored
1
.github/workflows/build.yml
vendored
@ -17,6 +17,5 @@ jobs:
|
||||
node-version: ${{ matrix.version }}
|
||||
- run: npm ci
|
||||
- run: cp config.json.example config.json
|
||||
- run: echo '{"version":"","buildLabel":"","matchmakingBuildId":""}' > static/data/buildConfig.json
|
||||
- run: npm run build
|
||||
- run: npm run lint
|
||||
|
@ -19,11 +19,5 @@ do
|
||||
mv config.tmp config.json
|
||||
done
|
||||
|
||||
if [ ! -f "/app/static/data/buildConfig.json" ]
|
||||
then
|
||||
echo "buildConfig not found, refusing to start."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
npm install
|
||||
exec npm run dev
|
||||
|
@ -1,13 +1,21 @@
|
||||
import path from "path";
|
||||
import fs from "fs";
|
||||
|
||||
const rootDir = path.join(__dirname, "../..");
|
||||
const repoDir = path.basename(rootDir) == "build" ? path.join(rootDir, "..") : rootDir;
|
||||
const buildConfigPath = path.join(repoDir, "static/data/buildConfig.json");
|
||||
export const buildConfig = JSON.parse(fs.readFileSync(buildConfigPath, "utf-8")) as IBuildConfig;
|
||||
|
||||
interface IBuildConfig {
|
||||
version: string;
|
||||
buildLabel: string;
|
||||
matchmakingBuildId: string;
|
||||
}
|
||||
|
||||
export const buildConfig: IBuildConfig = {
|
||||
version: "",
|
||||
buildLabel: "",
|
||||
matchmakingBuildId: ""
|
||||
};
|
||||
|
||||
const rootDir = path.join(__dirname, "../..");
|
||||
const repoDir = path.basename(rootDir) == "build" ? path.join(rootDir, "..") : rootDir;
|
||||
const buildConfigPath = path.join(repoDir, "static/data/buildConfig.json");
|
||||
if (fs.existsSync(buildConfigPath)) {
|
||||
Object.assign(buildConfig, JSON.parse(fs.readFileSync(buildConfigPath, "utf-8")) as IBuildConfig);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user