♻️ Add version reading by package file

This commit is contained in:
Manuel
2023-01-31 21:17:37 +01:00
parent 2b76ae83b1
commit 2b20cecb79
19 changed files with 83 additions and 36 deletions

View File

@@ -0,0 +1,14 @@
const getServerPackageVersion = (): string | undefined => process.env.npm_package_version;
const getServerNodeEnvironment = (): 'development' | 'production' | 'test' =>
process.env.NODE_ENV;
export const getServiceSidePackageAttributes = (): ServerSidePackageAttributesType => ({
packageVersion: getServerPackageVersion(),
environment: getServerNodeEnvironment(),
});
export type ServerSidePackageAttributesType = {
packageVersion: string | undefined;
environment: 'development' | 'production' | 'test';
};