Updates
This commit is contained in:
+12
-15
@@ -1,5 +1,6 @@
|
||||
// @ts-check
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
const isLocal = process.env.NEXT_PUBLIC_DSQL_LOCAL || null;
|
||||
const production = process.env.NODE_ENV == "production";
|
||||
@@ -15,25 +16,18 @@ function grabDist() {
|
||||
return ".local_dist";
|
||||
}
|
||||
|
||||
const DIST_DIR = path.resolve(process.cwd(), "./.dist");
|
||||
|
||||
if (isBuilding) {
|
||||
if (!fs.existsSync("./.dist")) fs.mkdirSync("./.dist");
|
||||
|
||||
if (!fs.existsSync("./.dist/BUILD")) {
|
||||
fs.writeFileSync("./.dist/BUILD", "0", "utf-8");
|
||||
}
|
||||
|
||||
const distDir = (() => {
|
||||
if (isLocal) return ".local_dist";
|
||||
|
||||
try {
|
||||
const buildNumber = fs.readFileSync("./.dist/BUILD", "utf-8");
|
||||
const newBuildNumber = Number(buildNumber) + 1;
|
||||
|
||||
if (newBuildNumber < 0) {
|
||||
throw new Error("Invalid Build Number");
|
||||
}
|
||||
fs.writeFileSync("./.dist/BUILD", String(newBuildNumber));
|
||||
return `.dist/build-${newBuildNumber}`;
|
||||
const buildNumber = fs.readFileSync(
|
||||
`${DIST_DIR}/BUILD`,
|
||||
"utf-8"
|
||||
);
|
||||
return `.dist/build-${buildNumber}`;
|
||||
} catch (/** @type {*} */ error) {
|
||||
console.log("Build Number Generation Error =>", error.message);
|
||||
process.exit();
|
||||
@@ -48,7 +42,10 @@ function grabDist() {
|
||||
if (isLocal) return ".local_dist";
|
||||
|
||||
try {
|
||||
const buildNumber = fs.readFileSync("./.dist/BUILD", "utf-8");
|
||||
const buildNumber = fs.readFileSync(
|
||||
`${DIST_DIR}/BUILD`,
|
||||
"utf-8"
|
||||
);
|
||||
return `.dist/build-${buildNumber}`;
|
||||
} catch (/** @type {*} */ error) {
|
||||
console.log("Build Number Parse Error =>", error.message);
|
||||
|
||||
@@ -5,9 +5,9 @@ const path = require("path");
|
||||
const fs = require("fs");
|
||||
const { Server } = require("socket.io");
|
||||
const { parse } = require("url");
|
||||
const userAuth = require("datasquirel/users/user-auth");
|
||||
const decrypt = require("datasquirel/functions/decrypt");
|
||||
const parseCookies = require("datasquirel/utils/functions/parseCookies");
|
||||
const userAuth = require("@moduletrace/datasquirel/users/user-auth");
|
||||
const decrypt = require("@moduletrace/datasquirel/functions/decrypt");
|
||||
const parseCookies = require("@moduletrace/datasquirel/utils/functions/parseCookies");
|
||||
const suSocketAuth = require("../package-shared/functions/backend/suSocketAuth");
|
||||
const { WriteStream, ReadStream, write } = require("fs");
|
||||
const { Readable } = require("node:stream");
|
||||
|
||||
Reference in New Issue
Block a user