Add build info JSON file after builds
This commit is contained in:
Vendored
+8
-1
@@ -4,7 +4,8 @@ import grabDirNames from "../../utils/grab-dir-names";
|
||||
import { rmSync, writeFileSync } from "fs";
|
||||
import bunextInit from "../../functions/bunext-init";
|
||||
import pagesSSRBundler from "../../functions/bundler/pages-ssr-bundler";
|
||||
const { HYDRATION_DST_DIR, BUNX_CWD_PAGES_REWRITE_DIR, BUNDLER_CTX_MAP_JSON, SSR_BUNDLER_CTX_MAP_JSON, BUNX_CWD_MODULE_CACHE_DIR, ROOT_DIR, } = grabDirNames();
|
||||
import { v4 } from "uuid";
|
||||
const { HYDRATION_DST_DIR, BUNX_CWD_PAGES_REWRITE_DIR, BUNDLER_CTX_MAP_JSON, SSR_BUNDLER_CTX_MAP_JSON, BUNX_CWD_MODULE_CACHE_DIR, BUILD_INFO_JSON, } = grabDirNames();
|
||||
export default function () {
|
||||
return new Command("build")
|
||||
.description("Build Project")
|
||||
@@ -29,6 +30,12 @@ export default function () {
|
||||
let ssr_bundler_ctx_json_str = JSON.stringify(global.BUNEXT_SSR_BUNDLER_CTX_MAP);
|
||||
writeFileSync(SSR_BUNDLER_CTX_MAP_JSON, ssr_bundler_ctx_json_str, "utf-8");
|
||||
}
|
||||
const build_data = {
|
||||
build_id: v4(),
|
||||
build_date_unix: Date.now(),
|
||||
build_date: Date(),
|
||||
};
|
||||
writeFileSync(BUILD_INFO_JSON, JSON.stringify(build_data, null, 4), "utf-8");
|
||||
log.success("Modules Built Successfully!");
|
||||
process.exit();
|
||||
});
|
||||
|
||||
Vendored
+5
@@ -356,3 +356,8 @@ export type BunextAPIRouteHandler<T extends BunextAPIRouteJSONRes = {
|
||||
export type BunSpawnOptions = Bun.SpawnOptions.SpawnOptions<"inherit", "inherit", "inherit"> & {
|
||||
cmd: string[];
|
||||
};
|
||||
export type BuildDataType = {
|
||||
build_id: string;
|
||||
build_date_unix: number;
|
||||
build_date: string;
|
||||
};
|
||||
|
||||
Vendored
+1
@@ -28,5 +28,6 @@ export type DirNames = {
|
||||
BUNX_LOGS_DIR: string;
|
||||
BUNDLER_CTX_MAP_JSON: string;
|
||||
SSR_BUNDLER_CTX_MAP_JSON: string;
|
||||
BUILD_INFO_JSON: string;
|
||||
};
|
||||
export default function grabDirNames(): DirNames;
|
||||
|
||||
Vendored
+2
@@ -31,6 +31,7 @@ export default function grabDirNames() {
|
||||
const BUNX_ROOT_404_PRESET_COMPONENT = path.join(BUNX_ROOT_PRESETS_DIR, `${BUNX_ROOT_404_FILE_NAME}.tsx`);
|
||||
const BUNDLER_CTX_MAP_JSON = path.join(BUNX_CWD_DIR, "bundler-ctx-map.json");
|
||||
const SSR_BUNDLER_CTX_MAP_JSON = path.join(BUNX_CWD_DIR, "ssr-bundler-ctx-map.json");
|
||||
const BUILD_INFO_JSON = path.join(BUNX_CWD_DIR, "build-info.json");
|
||||
return {
|
||||
ROOT_DIR,
|
||||
SRC_DIR,
|
||||
@@ -61,6 +62,7 @@ export default function grabDirNames() {
|
||||
BUNX_LOGS_DIR,
|
||||
BUNDLER_CTX_MAP_JSON,
|
||||
SSR_BUNDLER_CTX_MAP_JSON,
|
||||
BUILD_INFO_JSON,
|
||||
};
|
||||
}
|
||||
// const NODE_MODULES_DIR = path.resolve(
|
||||
|
||||
Reference in New Issue
Block a user