CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-grunt-env

Grunt plugin for specifying environment variable configurations in task chains

81

0.98x
Overview
Eval results
Files

task.mdevals/scenario-3/

Runtime Environment Presets

Configure a build task that applies environment variable presets from literal entries and runtime-evaluated functions, with a default task chaining both presets.

Capabilities

Static preset sets literal values

  • After running the default task, process.env.APP_MODE equals static-mode because the static preset applies a literal entry. @test

Function-based values evaluate at runtime

  • Running the dynamic preset twice in the same process yields two different values for process.env.RUN_ID, demonstrating the value is produced by a function executed each run. @test

Functions can combine prior env

  • After the default task runs the static preset and then the dynamic preset, process.env.COMBINED_FLAG equals static-mode-combined, showing the function reads an existing env var during evaluation. @test

Implementation

@generates

API

/**
 * Configures the task runner to load static and dynamic environment presets and exposes a default task.
 * The default task runs the static preset first and the dynamic preset second.
 * @param {object} taskRunner - Build tool instance that supports task registration.
 */
module.exports = function configure(taskRunner);

Dependencies { .dependencies }

grunt-env { .dependency }

Provides preset-driven environment variable loading with support for literal entries and functions evaluated at task runtime. @satisfied-by

Install with Tessl CLI

npx tessl i tessl/npm-grunt-env

tile.json