Skip to content

Commit b5755fa

Browse files
authored
ci: fix generate version plugin hiding previous errors (@fehmer) (monkeytypegame#7060)
When build fails for some reason the generate version step also failed because the `/dist` directory is missing. This was hiding other problems like an error in the fontawesome step. Also changes the trigger for the frontend build to include `html` files.
1 parent 78b0eb2 commit b5755fa

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

.github/workflows/monkey-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
- 'backend/**/*.{ts,js,json,lua,css,html}'
5050
- 'backend/package.json'
5151
fe-src:
52-
- 'frontend/**/*.{ts,scss}'
52+
- 'frontend/**/*.{ts,scss,html}'
5353
- 'frontend/package.json'
5454
pkg-src:
5555
- 'packages/**/*'

frontend/scripts/fontawesome.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@ export function getFontawesomeConfig(debug = false): FontawesomeConfig {
9999
(it) => !(solid.includes(it) || regular.includes(it) || brands.includes(it))
100100
);
101101
if (leftOvers.length !== 0) {
102-
throw new Error("unknown icons: " + leftOvers.toString());
102+
throw new Error(
103+
"Fontawesome failed with unknown icons: " + leftOvers.toString()
104+
);
103105
}
104106

105107
if (debug) {

frontend/vite.config.prod.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,13 @@ import { checker } from "vite-plugin-checker";
99
import { writeFileSync } from "fs";
1010
// eslint-disable-next-line import/no-unresolved
1111
import UnpluginInjectPreload from "unplugin-inject-preload/vite";
12-
import { readdirSync, readFileSync, statSync } from "node:fs";
12+
import {
13+
existsSync,
14+
mkdirSync,
15+
readdirSync,
16+
readFileSync,
17+
statSync,
18+
} from "node:fs";
1319
import { ViteMinifyPlugin } from "vite-plugin-minify";
1420
import { sentryVitePlugin } from "@sentry/vite-plugin";
1521
import { getFontsConig } from "./vite.config";
@@ -68,9 +74,14 @@ export default {
6874
apply: "build",
6975

7076
closeBundle() {
77+
const distPath = path.resolve(__dirname, "dist");
78+
if (!existsSync(distPath)) {
79+
mkdirSync(distPath, { recursive: true });
80+
}
81+
7182
const version = CLIENT_VERSION;
7283
const versionJson = JSON.stringify({ version });
73-
const versionPath = path.resolve(__dirname, "dist/version.json");
84+
const versionPath = path.resolve(distPath, "version.json");
7485
writeFileSync(versionPath, versionJson);
7586
},
7687
},

0 commit comments

Comments
 (0)