@jackdbd/eleventy-plugin-ensure-env-vars
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

@jackdbd/eleventy-plugin-ensure-env-vars

npm version install size CodeCov badge Socket Badge

Eleventy plugin that checks environment variables before Eleventy builds your site.

Installation

npm install @jackdbd/eleventy-plugin-ensure-env-vars

⚠️ Peer Dependencies

This package defines 2 peer dependencies.

Peer Version range
@11ty/eleventy >=2.0.0 or 3.0.0-alpha.4
debug >=4.0.0

Usage

In your Eleventy config file:

import { ensureEnvVarsPlugin } from '@jackdbd/eleventy-plugin-ensure-env-vars'

export default function (eleventyConfig) {
  // some eleventy configuration...

  eleventyConfig.addPlugin(ensureEnvVarsPlugin, {
    envVars: ['DEBUG', 'NODE_ENV']
  })

  // some more eleventy configuration...
}

Configuration

Plugin options

Key Default Description
envVars `[
"ELEVENTY_ROOT",
"ELEVENTY_SOURCE",
"ELEVENTY_RUN_MODE"
]` Environment variables you want to be set when building your Eleventy site

Troubleshooting

This plugin uses the debug library for logging. You can control what's logged using the DEBUG environment variable.

For example, if you set your environment variables in a .envrc file, you can do:

# print all logging statements
export DEBUG=11ty-plugin:*

Dependencies

Package Version
zod ^3.22.4
zod-validation-error ^3.0.0

License

© 2022 - 2024 Giacomo Debidda // MIT License

Package Sidebar

Install

npm i @jackdbd/eleventy-plugin-ensure-env-vars

Weekly Downloads

60

Version

1.1.1

License

MIT

Unpacked Size

19.4 kB

Total Files

16

Last publish

Collaborators

  • jackdbd