CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/npm-grunt-env

tessl install tessl/npm-grunt-env@1.0.0

Grunt plugin for specifying environment variable configurations in task chains

Agent Success

Agent success rate when using this tile

81%

Improvement

Agent success rate improvement when using this tile compared to baseline

0.99x

Baseline

Agent success rate without this tile

82%

task.mdevals/scenario-4/

Conditional Environment Merge

Configure a Grunt helper that merges environment values from a config file and inline defaults without clobbering existing settings. It should expose two environment targets, defaults and production, that can be run to populate process.env. Both targets should read key/value pairs from config/env.json before applying their conditional rules.

Capabilities

Adds defaults without overwriting existing values

  • Starting with process.env.LOG_LEVEL="warn" and no API_BASE, running the defaults target leaves LOG_LEVEL unchanged and sets API_BASE to http://localhost:4000. @test

Replaces only present keys

  • Starting with process.env.NODE_ENV="staging" and FEATURE_FLAG unset, running the production target updates NODE_ENV to production but leaves FEATURE_FLAG undefined. @test

Combines file values with conditional rules

  • Given config/env.json containing { "PORT": "9000", "SERVICE_NAME": "billing" } and process.env.SERVICE_NAME preset to frontend, running the production target yields PORT="9000" and SERVICE_NAME="billing" while preserving any other preexisting env entries. @test

Implementation

@generates

API

/**
 * Registers environment targets for conditional merging of process.env values.
 * @param {import('grunt')} grunt - Grunt instance used to configure and run tasks.
 */
module.exports = function configureEnv(grunt);

Dependencies { .dependencies }

grunt-env { .dependency }

Grunt plugin for applying environment configurations with conditional merges.

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/grunt-env@1.0.x
tile.json