1.1.3 • Published 1 month ago

rollup-plugin-typed-dotenv v1.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

rollup-plugin-typed-dotenv

npm version CI/CD codecov CodeFactor GitHub

About

Rollup plugin of dotenv

Detail

When this plug-in replaces code with environment variables, it converts to an appropriate form (for String, enclose it in double quotes, etc.) according to the plugin settings.

Sample of the source code

BEFORE

// main.js
console.log(process.env.ROLLUP_VALUE_STRING);
console.log(process.env.ROLLUP_VALUE_NUMBER);
console.log(process.env.ROLLUP_VALUE_FALSE);
#.env
ROLLUP_VALUE_STRING=Test value
ROLLUP_VALUE_NUMBER=2
ROLLUP_VALUE_FALSE=FALSE

AFTER

// main.js
console.log('Test value');
console.log(2);
console.log(false);

Installation

  1. NPM

    npm install -D rollup-plugin-typed-dotenv
  2. Yarn

    yarn add -D rollup-plugin-typed-dotenv

Usage

Options

envDir

Type:string
Default: process.cwd()
directory in which to search for env files.

envPrefix

Type:string
Default: ROLLUP_
Only enviroment valiable which has this prefix is exposed to javascript code.

envKey

Type:string
Default: NODE_ENV
Key used to search for .env files for environment in which an application is running

preventAssignment

See document of rollup-plugin-replace

values

define type of environment valiables

{
  ROLLUP_VALUE_STRING: 'string',
  ROLLUP_VALUE_NUMBER: 'number',
  ROLLUP_VALUE_FALSE: 'boolean',
}
Supported types
  • string
  • number
  • boolean
1.1.3

1 month ago

1.1.2

7 months ago

1.1.1

9 months ago

1.1.0

9 months ago

1.0.1

9 months ago

1.0.0

9 months ago