build: moved firebase config check to gulpfile

This commit is contained in:
Miodec 2023-09-04 13:29:18 +02:00
parent 443a6a59ee
commit 1bd0b4894d
2 changed files with 11 additions and 8 deletions

View file

@ -1,6 +1,8 @@
const { webpack } = require("webpack");
const eslint = require("gulp-eslint-new");
const { task, src, series, watch } = require("gulp");
const { resolve } = require("path");
const fs = require("fs");
const webpackDevConfig = require("./webpack/config.dev.js");
const webpackProdConfig = require("./webpack/config.prod.js");
@ -27,6 +29,15 @@ task("validate-json-schema", function () {
const taskWithWebpackConfig = (webpackConfig) => {
return async () => {
if (
!fs.existsSync(
resolve(__dirname, "../src/ts/constants/firebase-config.ts")
)
) {
const msg = `File firebase-config.ts is missing! Please duplicate firebase-config-example.ts and rename it to firebase-config.ts. If you are using Firebase, fill in the values in the config file. If not, you can leave the fields blank. For more information, check CONTRIBUTING_ADVANCED.md`;
throw new Error(msg);
}
return new Promise((resolve, reject) => {
webpack(webpackConfig, (err, stats) => {
if (err) {

View file

@ -2,7 +2,6 @@ const { resolve } = require("path");
const { merge } = require("webpack-merge");
const BASE_CONFIG = require("./config.base");
const ExtraWatchWebpackPlugin = require("extra-watch-webpack-plugin");
const fs = require("fs");
/** @type { import('webpack').Configuration } */
const DEV_CONFIG = {
@ -25,11 +24,4 @@ const DEV_CONFIG = {
],
};
if (
!fs.existsSync(resolve(__dirname, "../src/ts/constants/firebase-config.ts"))
) {
const msg = `File firebase-config.ts is missing! Please duplicate firebase-config-example.ts and rename it to firebase-config.ts. If you are using Firebase, fill in the values in the config file. If not, you can leave the fields blank. For more information, check CONTRIBUTING_ADVANCED.md`;
throw new Error(msg);
}
module.exports = merge(BASE_CONFIG, DEV_CONFIG);