@nuxtjs/dotenv
Advanced tools
Comparing version 1.4.1 to 1.4.2
const consola = require('consola') | ||
module.exports = consola.withScope('nuxt:dotenv') | ||
module.exports = consola.withTag('nuxt:dotenv') |
@@ -28,3 +28,3 @@ const { readFileSync, accessSync, constants } = require('fs') | ||
if (options.systemvars) { | ||
Object.keys(process.env).map((key) => { | ||
Object.keys(process.env).forEach((key) => { | ||
if (!(key in envConfig)) { | ||
@@ -31,0 +31,0 @@ envConfig[key] = process.env[key] |
{ | ||
"name": "@nuxtjs/dotenv", | ||
"version": "1.4.1", | ||
"description": "A nuxt.js module that loads your .env file into your context options", | ||
"version": "1.4.2", | ||
"description": "A Nuxt.js module that loads your .env file into your context options", | ||
"repository": "nuxt-community/dotenv-module", | ||
"license": "MIT", | ||
@@ -9,34 +10,32 @@ "contributors": [ | ||
], | ||
"files": [ | ||
"lib" | ||
], | ||
"main": "lib/module.js", | ||
"repository": "nuxt-community/dotenv-module", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"scripts": { | ||
"dev": "nuxt test/fixture/basic", | ||
"lint": "eslint --ext .js,.vue lib test", | ||
"test": "yarn lint && jest", | ||
"release": "yarn test && standard-version && git push --follow-tags && npm publish" | ||
"release": "yarn test && standard-version && git push --follow-tags && npm publish", | ||
"test": "yarn lint && jest" | ||
}, | ||
"files": [ | ||
"lib" | ||
], | ||
"dependencies": { | ||
"consola": "^2.10.1", | ||
"dotenv": "^8.1.0" | ||
"consola": "^3.2.3", | ||
"dotenv": "^8.2.0" | ||
}, | ||
"devDependencies": { | ||
"@commitlint/cli": "latest", | ||
"@commitlint/config-conventional": "latest", | ||
"@nuxtjs/eslint-config": "^1.1.2", | ||
"codecov": "latest", | ||
"eslint": "^6.3.0", | ||
"get-port": "latest", | ||
"husky": "^3.0.5", | ||
"jest": "^24.9.0", | ||
"nuxt-edge": "^2.10.0-26138895.e9c4bcfe", | ||
"request": "latest", | ||
"request-promise-native": "latest", | ||
"standard-version": "latest" | ||
"@commitlint/cli": "^18.4.2", | ||
"@commitlint/config-conventional": "^18.4.2", | ||
"@nuxtjs/eslint-config": "^12.0.0", | ||
"@nuxtjs/module-test-utils": "^1.6.3", | ||
"@types/jest": "^29.5.8", | ||
"codecov": "^3.8.3", | ||
"eslint": "^8.53.0", | ||
"eslint-plugin-jest": "^27.6.0", | ||
"husky": "^8.0.3", | ||
"jest": "^29.7.0", | ||
"nuxt-edge": "^2.17.2-28284499.5674f49", | ||
"standard-version": "^9.5.0" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} |
@@ -9,6 +9,8 @@ # @nuxtjs/dotenv | ||
> A nuxt.js module that loads your .env file into your context options | ||
> A Nuxt.js module that loads your .env file into your context options | ||
[📖 **Release Notes**](./CHANGELOG.md) | ||
:warning: With Nuxt v2.13 you might want to migrate from @nuxtjs/dotenv module to use the [new runtime config](https://nuxtjs.org/blog/moving-from-nuxtjs-dotenv-to-runtime-config). | ||
## Features | ||
@@ -23,10 +25,12 @@ | ||
```bash | ||
yarn add @nuxtjs/dotenv # or npm install @nuxtjs/dotenv | ||
yarn add --dev @nuxtjs/dotenv # or npm install --save-dev @nuxtjs/dotenv | ||
``` | ||
2. Add `@nuxtjs/dotenv` to the `modules` section of `nuxt.config.js` | ||
2. Add `@nuxtjs/dotenv` to the `buildModules` section of `nuxt.config.js` | ||
:warning: If you are using a Nuxt version previous than **v2.9** you have to install module as a `dependency` (No `--dev` or `--save-dev` flags) and also use `modules` section in `nuxt.config.js` instead of `buildModules`. | ||
```js | ||
{ | ||
modules: [ | ||
export default { | ||
buildModules: [ | ||
// Simple usage | ||
@@ -44,4 +48,4 @@ '@nuxtjs/dotenv', | ||
```js | ||
{ | ||
modules: [ | ||
export default { | ||
buildModules: [ | ||
'@nuxtjs/dotenv' | ||
@@ -59,9 +63,11 @@ ], | ||
- Type: `Array[String]` | ||
- Default: `null` | ||
If you want to restrict what's accessible into the context, you can can pass to the module options an `only` array with the keys you want to allow. | ||
If you want to restrict what's accessible into the context, | ||
you can pass to the module options an `only` array with the keys you want to allow. | ||
```js | ||
{ | ||
modules: [ | ||
export default { | ||
buildModules: [ | ||
['@nuxtjs/dotenv', { only: ['some_key'] }] | ||
@@ -74,9 +80,11 @@ ] | ||
- Type: `String` | ||
- Default: `srcDir` | ||
By default, the we'll be loading the `.env` file from the root of your project. If you want to change the path of the folder where we can find the `.env` file, then use the `path` option. | ||
By default, the we'll be loading the `.env` file from the root of your project. | ||
If you want to change the path of the folder where we can find the `.env` file, then use the `path` option. | ||
```js | ||
{ | ||
modules: [ | ||
export default { | ||
buildModules: [ | ||
['@nuxtjs/dotenv', { path: '/path/to/my/global/env/' }] | ||
@@ -93,2 +101,3 @@ ] | ||
- Type: `Boolean` | ||
- Default: `false` | ||
@@ -100,4 +109,4 @@ | ||
```js | ||
{ | ||
modules: [ | ||
export default { | ||
buildModules: [ | ||
['@nuxtjs/dotenv', { systemvars: true }] | ||
@@ -110,2 +119,3 @@ ] | ||
- Type: `String` | ||
- Default: `.env` | ||
@@ -116,4 +126,4 @@ | ||
```js | ||
{ | ||
modules: [ | ||
export default { | ||
buildModules: [ | ||
['@nuxtjs/dotenv', { filename: '.env.prod' }] | ||
@@ -127,3 +137,3 @@ ] | ||
After creating your .env file in the project root, simply run your usual `yarn dev` or `npm run dev`. | ||
The variable inside the .env file will be added to the context (`context.env`) and process (`process.env`) | ||
The variable inside the .env file will be added to the context (`context.env`) and process (`process.env`). | ||
@@ -135,3 +145,3 @@ ## Using .env file in nuxt.config.js | ||
If you need to use variables from your .env file at this moment, | ||
just append `require('dotenv').config()` to your `nuxt.config.js` : | ||
just prepend `require('dotenv').config()` to your `nuxt.config.js`: | ||
@@ -141,3 +151,3 @@ ```js | ||
module.exports = { | ||
export default { | ||
// your usual nuxt config. | ||
@@ -150,8 +160,2 @@ } | ||
## Development | ||
1. Clone this repository | ||
2. Install dependencies using `yarn install` or `npm install` | ||
3. Start development server using `npm run dev` | ||
## License | ||
@@ -158,0 +162,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
169
7748
5
1
+ Addedconsola@3.2.3(transitive)
- Removedconsola@2.15.3(transitive)
Updatedconsola@^3.2.3
Updateddotenv@^8.2.0