Use TS with gulp

This commit is contained in:
Wendelin
2025-05-09 08:23:53 +02:00
parent e1b099e88b
commit ff3b65605e
33 changed files with 325 additions and 200 deletions

34
build-scripts/env.ts Normal file
View File

@@ -0,0 +1,34 @@
import fs from "fs";
import path from "path";
import paths from "./paths";
const isTrue = (value) => value === "1" || value?.toLowerCase() === "true";
export default {
isProdBuild() {
return (
process.env.NODE_ENV === "production" || module.exports.isStatsBuild()
);
},
isStatsBuild() {
return isTrue(process.env.STATS);
},
isTestBuild() {
return isTrue(process.env.IS_TEST);
},
isNetlify() {
return isTrue(process.env.NETLIFY);
},
version() {
const version = fs
.readFileSync(path.resolve(paths.root_dir, "pyproject.toml"), "utf8")
.match(/version\W+=\W"(\d{8}\.\d(?:\.dev)?)"/);
if (!version) {
throw Error("Version not found");
}
return version[1];
},
isDevContainer() {
return isTrue(process.env.DEV_CONTAINER);
},
};