monorepo-env
TypeScript icon, indicating that this package has built-in type declarations

0.0.7 • Public • Published

Monorepo Env

npm version npm downloads License Nuxt

Automatically merge/share env files between monorepo root and project.

Features

  • 🌍 Supports both Nuxt & Vite
  • 📦 Zero config. Get started without any hassle
  • ⚙️ Automatic Nuxt runtime env handling
  • 🔗 Loads env from Nuxt layers
  • 📃 Auto generated types for env variables

Nuxt Setup

Install the module to your Nuxt application with one command:

npx nuxi module add monorepo-env

That's it! You can now use monorepo-env in your Nuxt app ✨

Nuxt Runtime

Only NUXT_ prefixed variables are exposed to nuxt runtime (when enabled).

NUXT_KEY=my-private-key
NUXT_PUBLIC_KEY=my-public-key

The above env variables will become this in nuxt runtime:

$config.key
$config.public.key

Vite Setup

Add the dependency

pnpm add -D monorepo-env

Setup vite.config.ts

import { defineConfig } from 'vite'
import MonorepoENV from 'monorepo-env/vite'

defineConfig({
  plugins: [
    MonorepoENV()
  ]
})

Contribution

Local development
# Install dependencies
npm install

# Generate type stubs
npm run dev:prepare

# Develop with the playground
npm run dev

# Build the playground
npm run dev:build

# Run ESLint
npm run lint

# Run Vitest
npm run test
npm run test:watch

# Release new version
npm run release

Readme

Keywords

Package Sidebar

Install

npm i monorepo-env

Weekly Downloads

6

Version

0.0.7

License

MIT

Unpacked Size

17.1 kB

Total Files

21

Last publish

Collaborators

  • dapotatoman