This commit is contained in:
Benjamin Toby
2025-02-03 13:41:13 +01:00
parent cee4bc0478
commit 619afc8303
29 changed files with 722 additions and 169 deletions
+6
View File
@@ -0,0 +1,6 @@
/**
* # Grab the current distribution directory
* @description This returns the relative path from the CWD. Eg `./.dist/build-1`
* @returns {string | undefined}
*/
export default function grabDist(): string | undefined;
+45
View File
@@ -0,0 +1,45 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = grabDist;
const fs_1 = __importDefault(require("fs"));
const path_1 = __importDefault(require("path"));
const production = process.env.NODE_ENV == "production";
const isBuilding = process.env.BUILDING_APP;
/**
* # Grab the current distribution directory
* @description This returns the relative path from the CWD. Eg `./.dist/build-1`
* @returns {string | undefined}
*/
function grabDist() {
const DIST_DIR = path_1.default.resolve(process.cwd(), "./.dist");
if (isBuilding) {
const distDir = (() => {
try {
const buildNumber = fs_1.default.readFileSync(`${DIST_DIR}/BUILD`, "utf-8");
return `.dist/build-${buildNumber}`;
}
catch ( /** @type {*} */error) {
console.log("Build Number Generation Error =>", error.message);
process.exit();
}
})();
return distDir;
}
if (production) {
const distDir = (() => {
try {
const buildNumber = fs_1.default.readFileSync(`${DIST_DIR}/BUILD`, "utf-8");
return `.dist/build-${buildNumber}`;
}
catch ( /** @type {*} */error) {
console.log("Build Number Parse Error =>", error.message);
process.exit();
}
})();
return distDir;
}
return undefined;
}
+3
View File
@@ -0,0 +1,3 @@
import type { NextConfig } from "next";
declare const nextConfig: NextConfig;
export default nextConfig;
+13
View File
@@ -0,0 +1,13 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const grabDist_1 = __importDefault(require("./functions/grabDist"));
const distDir = (0, grabDist_1.default)();
const nextConfig = {
/* config options here */
reactStrictMode: true,
distDir,
};
exports.default = nextConfig;
+6
View File
@@ -0,0 +1,6 @@
import type { NextApiRequest, NextApiResponse } from "next";
type Data = {
name: string;
};
export default function handler(req: NextApiRequest, res: NextApiResponse<Data>): void;
export {};
+6
View File
@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = handler;
function handler(req, res) {
res.status(200).json({ name: "John Doe" });
}
+13
View File
@@ -0,0 +1,13 @@
declare const _default: {
content: string[];
theme: {
extend: {
colors: {
background: string;
foreground: string;
};
};
};
plugins: never[];
};
export default _default;
+18
View File
@@ -0,0 +1,18 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = {
content: [
"./pages/**/*.{js,ts,jsx,tsx,mdx}",
"./components/**/*.{js,ts,jsx,tsx,mdx}",
"./app/**/*.{js,ts,jsx,tsx,mdx}",
],
theme: {
extend: {
colors: {
background: "var(--background)",
foreground: "var(--foreground)",
},
},
},
plugins: [],
};