Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1768 from tivac/cli-multiple-envs
feat: let --environment be specified multiple times
- Loading branch information
Showing
4 changed files
with
37 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = { | ||
description: 'passes environment variables to config file via multiple --environment values', | ||
command: 'rollup --config --environment PRODUCTION,FOO:bar --environment SECOND,KEY:value --environment FOO:foo', | ||
execute: true | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
assert.equal( '__ENVIRONMENT__', 'production' ); | ||
assert.equal( '__FOO__', 'foo' ); | ||
assert.equal('__SECOND__', 'true'); | ||
assert.equal('__KEY__', "value"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
var replace = require( 'rollup-plugin-replace' ); | ||
|
||
module.exports = { | ||
input: 'main.js', | ||
output: { | ||
format: 'cjs' | ||
}, | ||
plugins: [ | ||
replace( { | ||
__ENVIRONMENT__: process.env.PRODUCTION ? 'production' : 'development', | ||
__FOO__: process.env.FOO, | ||
__SECOND__: process.env.SECOND, | ||
__KEY__: process.env.KEY | ||
} ) | ||
] | ||
}; |