![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Simple, TypeScript zero-dependency environment validation/initialization tool.
bool
, num
, date
and str
)transform()
wrapper for validator-functions includes if a value needs to be modified first.envalid
.This library does not load environment variables, but it provides a single function that will loop through an object and assignment an environment variable to each one. If the environment variable is undefined
or the incorrect type, then an error will be thrown.
The environment variable name will be constructed using the keys on the object. PascalCase
names will automatically be converted to UPPER_SNAKE_CASE
. So if your environment variable is NODE_ENV
then the key should be NodeEnv
on the object key. This will work for nested objects tool. The parent-object's key name will be prepended to whatever the child-properties's key is.
If you want to override the behavior for naming the environment variables, you can pass an array instead of a function. The first value in the array must be a string and will be used to pull the environment variable (no prepending is done). The second value must be a validator-function
If you want your environment variable value transformed before validation, there is a helper function export that your can wrap your validator function with. There are also 4 default validator-functions (bool
, num
, date
and str
) that come packaged by default.
Notes on validators:
str
function.date
will convert any valid date value (string
or number
) to a Date
object and make sure it's valid.bool
function:
false/true
, case doesn't matter0
: false
1
: true
no
: false
case doesn't matteryes
: true
case doesn't matterimport jetEnv, { bool, date, num, transform } from 'jet-env';
const Env = jetEnv({
NodeEnv: str, // NODE_ENV
IsLocal: bool, // IS_LOCAL
Port: num, // PORT
BackEndUrl: str, // BACK_END_URL
FrontEndUrl: str, // FRONT_ENV_URL
BypassDbConn: transform(JSON.parse, (arg) => arg === true),
S3BucketName: ['S3_BUCKET_NAME', str],
S3BucketUrl: str, // S3_BUCKET_URL
S3BucketExp: date, // S3_BUCKET_EXP
Aws: {
S3Credentials: {
AccessKeyId: str, // AWS_S3_CREDENTIALS_ACCESS_KEY_ID
SecretAccessKey: str, // AWS_S3_CREDENTIALS_SECRET_ACCESS_KEY
},
},
});
options
parameter as the second argument to jetEnv
. Here's a overview of the options
object:{
getValue?: (property: string, key?: string) => unknown; // Fetch the value, default is "=> process.env[property]"
variableNameFormatter?: (name: string) => string; // Set your own custom function for formatting environment-variable names from object keys.
onError?: (property: string) => void; // Change what happens when a validator-function fails (currently throws an error)
}
Happy Coding :)
FAQs
Simple, TypeScript zero-dependency environment validation/initialization tool.
The npm package jet-env receives a total of 0 weekly downloads. As such, jet-env popularity was classified as not popular.
We found that jet-env demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.