web: Use monorepo package utilities to build packages (#14159)
* web: Format live reload package. * web: Format package.json. * web: Revise globals. * web: Build entrypoints with a single ESBuild context. Clean up entrypoints. * web: WIP Prepare monorepo package for use. * web: Update build paths. Fix types. * web: WIP Add monorepo dependency. * web: Use monorepo utilities when building. * web: Fix issue where linters collide. Update ignore file. - Remove unused sort override for polyfills. * core: Prepare repo for NPM workspaces.
This commit is contained in:
		
							
								
								
									
										45
									
								
								web/packages/monorepo/version.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								web/packages/monorepo/version.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,45 @@ | ||||
| import { execSync } from "node:child_process"; | ||||
|  | ||||
| import PackageJSON from "../../../package.json" with { type: "json" }; | ||||
| import { MonoRepoRoot } from "./paths.js"; | ||||
|  | ||||
| /** | ||||
|  * The current version of authentik in SemVer format. | ||||
|  * | ||||
|  */ | ||||
| export const AuthentikVersion = /**@type {`${number}.${number}.${number}`} */ (PackageJSON.version); | ||||
|  | ||||
| /** | ||||
|  * Reads the last commit hash from the current git repository. | ||||
|  */ | ||||
| export function readGitBuildHash() { | ||||
|     try { | ||||
|         const commit = execSync("git rev-parse HEAD", { | ||||
|             encoding: "utf8", | ||||
|             cwd: MonoRepoRoot, | ||||
|         }) | ||||
|             .toString() | ||||
|             .trim(); | ||||
|  | ||||
|         return commit; | ||||
|     } catch (_error) { | ||||
|         console.debug("Git commit could not be read."); | ||||
|     } | ||||
|  | ||||
|     return process.env.GIT_BUILD_HASH || ""; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Reads the build identifier for the current environment. | ||||
|  * | ||||
|  * This must match the behavior defined in authentik's server-side `get_full_version` function. | ||||
|  * | ||||
|  * @see {@link "authentik\_\_init\_\_.py"} | ||||
|  */ | ||||
| export function readBuildIdentifier() { | ||||
|     const { GIT_BUILD_HASH } = process.env; | ||||
|  | ||||
|     if (!GIT_BUILD_HASH) return AuthentikVersion; | ||||
|  | ||||
|     return [AuthentikVersion, GIT_BUILD_HASH].join("+"); | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 Teffen Ellis
					Teffen Ellis