Add build info JSON file after builds

This commit is contained in:
2026-09-23 05:18:53 +01:00
parent 2335c60cc3
commit 39a5e91eeb
9 changed files with 52 additions and 4 deletions
+6
View File
@@ -24,12 +24,14 @@
"react-dom": "^19.2.4", "react-dom": "^19.2.4",
"tailwindcss": "^4.2.2", "tailwindcss": "^4.2.2",
"typescript": "^5.0.0", "typescript": "^5.0.0",
"uuid": "^14.0.2",
}, },
"devDependencies": { "devDependencies": {
"@testing-library/dom": "^10.4.1", "@testing-library/dom": "^10.4.1",
"@types/chokidar": "^2.1.7", "@types/chokidar": "^2.1.7",
"@types/lodash": "^4.17.24", "@types/lodash": "^4.17.24",
"@types/micromatch": "^4.0.10", "@types/micromatch": "^4.0.10",
"@types/uuid": "^11.0.0",
"happy-dom": "^20.8.4", "happy-dom": "^20.8.4",
}, },
}, },
@@ -179,6 +181,8 @@
"@types/react-dom": ["@types/[email protected]", "", { "peerDependencies": { "@types/react": "^19.2.0" } }, "sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ=="], "@types/react-dom": ["@types/[email protected]", "", { "peerDependencies": { "@types/react": "^19.2.0" } }, "sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ=="],
"@types/uuid": ["@types/[email protected]", "", { "dependencies": { "uuid": "*" } }, "sha512-HVyk8nj2m+jcFRNazzqyVKiZezyhDKrGUA3jlEcg/nZ6Ms+qHwocba1Y/AaVaznJTAM9xpdFSh+ptbNrhOGvZA=="],
"@types/whatwg-mimetype": ["@types/[email protected]", "", {}, "sha512-c2AKvDT8ToxLIOUlN51gTiHXflsfIFisS4pO7pDPoKouJCESkhZnEy623gwP9laCy5lnLDAw1vAzu2vM2YLOrA=="], "@types/whatwg-mimetype": ["@types/[email protected]", "", {}, "sha512-c2AKvDT8ToxLIOUlN51gTiHXflsfIFisS4pO7pDPoKouJCESkhZnEy623gwP9laCy5lnLDAw1vAzu2vM2YLOrA=="],
"@types/ws": ["@types/[email protected]", "", { "dependencies": { "@types/node": "*" } }, "sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg=="], "@types/ws": ["@types/[email protected]", "", { "dependencies": { "@types/node": "*" } }, "sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg=="],
@@ -323,6 +327,8 @@
"undici-types": ["[email protected]", "", {}, "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw=="], "undici-types": ["[email protected]", "", {}, "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw=="],
"uuid": ["[email protected]", "", { "bin": { "uuid": "dist-node/bin/uuid" } }, "sha512-xZe/16rV4aa+HGSOCiY2YeLT1OybRLrrkL/Rqaq7p7GMVXjFh+6wN4oMYgjFmnSnhY8t6Xpdl2l9qmnHYuMHwQ=="],
"whatwg-mimetype": ["[email protected]", "", {}, "sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q=="], "whatwg-mimetype": ["[email protected]", "", {}, "sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q=="],
"ws": ["[email protected]", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-blAT2mjOEIi0ZzruJfIhb3nps74PRWTCz1IjglWEEpQl5XS/UNama6u2/rjFkDDouqr4L67ry+1aGIALViWjDg=="], "ws": ["[email protected]", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-blAT2mjOEIi0ZzruJfIhb3nps74PRWTCz1IjglWEEpQl5XS/UNama6u2/rjFkDDouqr4L67ry+1aGIALViWjDg=="],
+8 -1
View File
@@ -4,7 +4,8 @@ import grabDirNames from "../../utils/grab-dir-names";
import { rmSync, writeFileSync } from "fs"; import { rmSync, writeFileSync } from "fs";
import bunextInit from "../../functions/bunext-init"; import bunextInit from "../../functions/bunext-init";
import pagesSSRBundler from "../../functions/bundler/pages-ssr-bundler"; 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 () { export default function () {
return new Command("build") return new Command("build")
.description("Build Project") .description("Build Project")
@@ -29,6 +30,12 @@ export default function () {
let ssr_bundler_ctx_json_str = JSON.stringify(global.BUNEXT_SSR_BUNDLER_CTX_MAP); 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"); 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!"); log.success("Modules Built Successfully!");
process.exit(); process.exit();
}); });
+5
View File
@@ -356,3 +356,8 @@ export type BunextAPIRouteHandler<T extends BunextAPIRouteJSONRes = {
export type BunSpawnOptions = Bun.SpawnOptions.SpawnOptions<"inherit", "inherit", "inherit"> & { export type BunSpawnOptions = Bun.SpawnOptions.SpawnOptions<"inherit", "inherit", "inherit"> & {
cmd: string[]; cmd: string[];
}; };
export type BuildDataType = {
build_id: string;
build_date_unix: number;
build_date: string;
};
+1
View File
@@ -28,5 +28,6 @@ export type DirNames = {
BUNX_LOGS_DIR: string; BUNX_LOGS_DIR: string;
BUNDLER_CTX_MAP_JSON: string; BUNDLER_CTX_MAP_JSON: string;
SSR_BUNDLER_CTX_MAP_JSON: string; SSR_BUNDLER_CTX_MAP_JSON: string;
BUILD_INFO_JSON: string;
}; };
export default function grabDirNames(): DirNames; export default function grabDirNames(): DirNames;
+2
View File
@@ -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 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 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 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 { return {
ROOT_DIR, ROOT_DIR,
SRC_DIR, SRC_DIR,
@@ -61,6 +62,7 @@ export default function grabDirNames() {
BUNX_LOGS_DIR, BUNX_LOGS_DIR,
BUNDLER_CTX_MAP_JSON, BUNDLER_CTX_MAP_JSON,
SSR_BUNDLER_CTX_MAP_JSON, SSR_BUNDLER_CTX_MAP_JSON,
BUILD_INFO_JSON,
}; };
} }
// const NODE_MODULES_DIR = path.resolve( // const NODE_MODULES_DIR = path.resolve(
+4 -2
View File
@@ -1,6 +1,6 @@
{ {
"name": "@moduletrace/bunext", "name": "@moduletrace/bunext",
"version": "1.1.12", "version": "1.1.13",
"main": "dist/index.js", "main": "dist/index.js",
"module": "index.ts", "module": "index.ts",
"dependencies": { "dependencies": {
@@ -22,13 +22,15 @@
"react": "^19.2.4", "react": "^19.2.4",
"react-dom": "^19.2.4", "react-dom": "^19.2.4",
"tailwindcss": "^4.2.2", "tailwindcss": "^4.2.2",
"typescript": "^5.0.0" "typescript": "^5.0.0",
"uuid": "^14.0.2"
}, },
"devDependencies": { "devDependencies": {
"@testing-library/dom": "^10.4.1", "@testing-library/dom": "^10.4.1",
"@types/chokidar": "^2.1.7", "@types/chokidar": "^2.1.7",
"@types/lodash": "^4.17.24", "@types/lodash": "^4.17.24",
"@types/micromatch": "^4.0.10", "@types/micromatch": "^4.0.10",
"@types/uuid": "^11.0.0",
"happy-dom": "^20.8.4" "happy-dom": "^20.8.4"
}, },
"exports": { "exports": {
+15 -1
View File
@@ -4,6 +4,8 @@ import grabDirNames from "../../utils/grab-dir-names";
import { rmSync, writeFileSync } from "fs"; import { rmSync, writeFileSync } from "fs";
import bunextInit from "../../functions/bunext-init"; import bunextInit from "../../functions/bunext-init";
import pagesSSRBundler from "../../functions/bundler/pages-ssr-bundler"; import pagesSSRBundler from "../../functions/bundler/pages-ssr-bundler";
import type { BuildDataType } from "../../types";
import { v4 } from "uuid";
const { const {
HYDRATION_DST_DIR, HYDRATION_DST_DIR,
@@ -11,7 +13,7 @@ const {
BUNDLER_CTX_MAP_JSON, BUNDLER_CTX_MAP_JSON,
SSR_BUNDLER_CTX_MAP_JSON, SSR_BUNDLER_CTX_MAP_JSON,
BUNX_CWD_MODULE_CACHE_DIR, BUNX_CWD_MODULE_CACHE_DIR,
ROOT_DIR, BUILD_INFO_JSON,
} = grabDirNames(); } = grabDirNames();
export default function () { export default function () {
@@ -56,6 +58,18 @@ export default function () {
); );
} }
const build_data: BuildDataType = {
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!"); log.success("Modules Built Successfully!");
process.exit(); process.exit();
+6
View File
@@ -424,3 +424,9 @@ export type BunSpawnOptions = Bun.SpawnOptions.SpawnOptions<
> & { > & {
cmd: string[]; cmd: string[];
}; };
export type BuildDataType = {
build_id: string;
build_date_unix: number;
build_date: string;
};
+5
View File
@@ -30,6 +30,7 @@ export type DirNames = {
BUNX_LOGS_DIR: string; BUNX_LOGS_DIR: string;
BUNDLER_CTX_MAP_JSON: string; BUNDLER_CTX_MAP_JSON: string;
SSR_BUNDLER_CTX_MAP_JSON: string; SSR_BUNDLER_CTX_MAP_JSON: string;
BUILD_INFO_JSON: string;
}; };
export default function grabDirNames(): DirNames { export default function grabDirNames(): DirNames {
@@ -90,11 +91,14 @@ export default function grabDirNames(): DirNames {
BUNX_CWD_DIR, BUNX_CWD_DIR,
"bundler-ctx-map.json", "bundler-ctx-map.json",
); );
const SSR_BUNDLER_CTX_MAP_JSON = path.join( const SSR_BUNDLER_CTX_MAP_JSON = path.join(
BUNX_CWD_DIR, BUNX_CWD_DIR,
"ssr-bundler-ctx-map.json", "ssr-bundler-ctx-map.json",
); );
const BUILD_INFO_JSON = path.join(BUNX_CWD_DIR, "build-info.json");
return { return {
ROOT_DIR, ROOT_DIR,
SRC_DIR, SRC_DIR,
@@ -125,6 +129,7 @@ export default function grabDirNames(): DirNames {
BUNX_LOGS_DIR, BUNX_LOGS_DIR,
BUNDLER_CTX_MAP_JSON, BUNDLER_CTX_MAP_JSON,
SSR_BUNDLER_CTX_MAP_JSON, SSR_BUNDLER_CTX_MAP_JSON,
BUILD_INFO_JSON,
}; };
} }