@travetto/base
Advanced tools
Comparing version 3.4.0-rc.0 to 3.4.0-rc.1
export * from './src/console'; | ||
export * from './src/compiler'; | ||
export * from './src/data'; | ||
@@ -8,3 +9,2 @@ export * from './src/error'; | ||
export * from './src/global-env'; | ||
export * from './src/proxy'; | ||
export * from './src/resource'; | ||
@@ -17,2 +17,3 @@ export * from './src/resource-query'; | ||
export * from './src/object'; | ||
export * from './src/proxy'; | ||
export * from './src/util'; |
{ | ||
"name": "@travetto/base", | ||
"version": "3.4.0-rc.0", | ||
"version": "3.4.0-rc.1", | ||
"description": "Environment config and common utilities for travetto applications.", | ||
@@ -29,4 +29,4 @@ "keywords": [ | ||
"dependencies": { | ||
"@travetto/manifest": "^3.4.0-rc.0", | ||
"@types/node": "^20.8.9", | ||
"@travetto/manifest": "^3.4.0-rc.1", | ||
"@types/node": "^20.8.10", | ||
"@types/source-map-support": "^0.5.9", | ||
@@ -36,3 +36,3 @@ "source-map-support": "^0.5.21" | ||
"peerDependencies": { | ||
"@travetto/transformer": "^3.4.0-rc.0" | ||
"@travetto/transformer": "^3.4.0-rc.1" | ||
}, | ||
@@ -39,0 +39,0 @@ "peerDependenciesMeta": { |
@@ -39,2 +39,3 @@ <!-- This file was generated by @travetto/doc and should not be modified directly --> | ||
* `getList(key: string): string[];` - Retrieve an environmental value as a list | ||
* `addToList(key: string, value: string): string[];` - Add an item to an environment value, ensuring uniqueness | ||
@@ -55,4 +56,2 @@ ## Shared Global Environment State | ||
get dynamic(): boolean; | ||
/** The list of the profiles */ | ||
get profiles(): string[]; | ||
/** Get list of resource paths */ | ||
@@ -63,3 +62,3 @@ get resourcePaths(): string[]; | ||
/** Get node major version */ | ||
get nodeVersion(): string; | ||
get nodeVersion(): number; | ||
/** Export as plain object */ | ||
@@ -74,5 +73,4 @@ toJSON(): Record<string, unknown>; | ||
* `dynamic` - This is derived from `process.env.TRV_DYNAMIC`. This field reflects certain feature sets used throughout the framework. | ||
* `profiles` - This is a list derived from `process.env.TRV_PROFILES`. This can be checked at runtime to see if specific profiles are met. This primarily used in the framework to determine if the test profile is activated. | ||
* `resourcePaths` - This is a list derived from `process.env.TRV_RESOURCES`. This points to a list of folders that the [FileResourceProvider](https://github.com/travetto/travetto/tree/main/module/base/src/resource.ts#L46) will search against, by default. | ||
* `test` - This is true if `profiles` includes a value of `test` | ||
* `test` - This is true if `envName` is `test` | ||
* `nodeVersion` - This is derived from `process.version`, and is used primarily for logging purposes | ||
@@ -86,9 +84,5 @@ In addition to reading these values, there is a defined method for setting/updating these values: | ||
const resources = [...cfg.resourcePaths ?? [], ...GlobalEnv.resourcePaths]; | ||
const profiles = new Set([...GlobalEnv.profiles, ...(cfg.profiles ?? [])]); | ||
const envName = (cfg.envName ?? GlobalEnv.envName) || readNodeEnv(); | ||
profiles.delete(GlobalEnv.envName); | ||
profiles.add(envName); | ||
Object.assign(set, { | ||
@@ -99,3 +93,2 @@ NODE_ENV: detectNodeEnv(envName), | ||
TRV_DYNAMIC: cfg.dynamic ?? GlobalEnv.dynamic, | ||
TRV_PROFILES: [...profiles].sort().join(','), | ||
TRV_RESOURCES: resources.join(',') | ||
@@ -102,0 +95,0 @@ }); |
@@ -22,2 +22,15 @@ /** | ||
/** | ||
* Add a value to as part of a comma-separated list | ||
* @param k The environment key to add to | ||
*/ | ||
static addToList(k: string, value: string): string[] { | ||
const values = Env.getList(k) ?? []; | ||
if (!values.includes(value)) { | ||
values.push(value); | ||
} | ||
process.env[k] = values.join(','); | ||
return values; | ||
} | ||
/** | ||
* Read value as a comma-separated list | ||
@@ -24,0 +37,0 @@ * @param k The environment key to search for |
@@ -30,5 +30,2 @@ import { Env } from './env'; | ||
/** The list of the profiles */ | ||
get profiles(): string[] { return Env.getList('TRV_PROFILES', []); }, | ||
/** Get list of resource paths */ | ||
@@ -41,3 +38,3 @@ get resourcePaths(): string[] { return Env.getList('TRV_RESOURCES', []); }, | ||
/** Get node major version */ | ||
get nodeVersion(): string { return process.version.replace('v', '').split('.')[0]; }, | ||
get nodeVersion(): number { return +(process.version.replace('v', '').split('.')[0]); }, | ||
@@ -48,4 +45,3 @@ /** Export as plain object */ | ||
envName: this.envName || '<unset>', debug: this.debug, devMode: this.devMode, test: this.test, | ||
dynamic: this.dynamic, profiles: this.profiles, resourcePaths: this.resourcePaths, | ||
nodeVersion: this.nodeVersion | ||
dynamic: this.dynamic, resourcePaths: this.resourcePaths, nodeVersion: this.nodeVersion | ||
}; | ||
@@ -63,9 +59,5 @@ } | ||
const resources = [...cfg.resourcePaths ?? [], ...GlobalEnv.resourcePaths]; | ||
const profiles = new Set([...GlobalEnv.profiles, ...(cfg.profiles ?? [])]); | ||
const envName = (cfg.envName ?? GlobalEnv.envName) || readNodeEnv(); | ||
profiles.delete(GlobalEnv.envName); | ||
profiles.add(envName); | ||
Object.assign(set, { | ||
@@ -76,3 +68,2 @@ NODE_ENV: detectNodeEnv(envName), | ||
TRV_DYNAMIC: cfg.dynamic ?? GlobalEnv.dynamic, | ||
TRV_PROFILES: [...profiles].sort().join(','), | ||
TRV_RESOURCES: resources.join(',') | ||
@@ -79,0 +70,0 @@ }); |
102098
23
2204
385
Updated@types/node@^20.8.10