Migration (v5 to v6)
Upgrade to envapt v6, which removes positional decorators and reads NODE_ENV=test as test.
v6 removes the positional decorator form and changes what NODE_ENV=test resolves to.
Upgrading further? v7 makes the decorators TC39 accessor decorators by default. See Migration (v6 to v7).
Decorators
The positional @Envapt('KEY', fallback, converter) form, deprecated in v5, is removed. Use the options object, or a sugar decorator for the common case. The no-argument @Envapt('KEY') form is unchanged.
// v5 (removed in v6)
@Envapt('PORT', 8080, Number)
// v6 options object
@Envapt('PORT', { converter: Converters.Number, fallback: 8080 })
// v6 sugar decorator, shorter than the old positional form
@EnvNum('PORT', 8080)The sugar decorators @EnvNum, @EnvStr, @EnvBool, @EnvUrl, and @EnvTime each wrap a built-in converter, so you pass only the key and the fallback. If the second argument isn't an options object, the decorator now throws EnvaptError with InvalidUserDefinedConfig when the class is defined, so a leftover positional call stops the app at startup. The internal InferPrimitiveFallbackType type is removed with the overload.
Behavior changes to watch
This change compiles without edits but runs differently from v5. Check it before upgrading.
NODE_ENV=testresolves toEnvironment.Test. Jest and vitest setNODE_ENV=test, so under either oneEnvapter.isTestreturns true andisDevelopmentreturns false. v5.1 and earlier returned true fromisDevelopmentthere. Vite'sMODE=testalso resolves toEnvironment.Test. This first shipped by mistake in the 5.2.0 minor, which is deprecated on npm. If you branch onisDevelopmentinside tests, switch toisTestor setEnvapter.environmentyourself, as Environment shows.