Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Do not create browser builds in tests; use bootstrap build for publishing * Test that the command object can be modified in the config file
- Loading branch information
1 parent
d9b479d
commit d5a910d
Showing
8 changed files
with
121 additions
and
84 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
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: 'allows cleaning up and modifying the command args in the config file', | ||
command: 'rollup --config rollup.config.js --some-option="foo" --another-option=42', | ||
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,7 @@ | ||
assert.deepEqual(COMMAND_OPTIONS, { | ||
_: [], | ||
config: 'rollup.config.js', | ||
c: 'rollup.config.js', | ||
'some-option': 'foo', | ||
'another-option': 42 | ||
}); |
15 changes: 15 additions & 0 deletions
15
test/cli/samples/config-function-modify-command/rollup.config.js
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,15 @@ | ||
import replace from 'rollup-plugin-replace'; | ||
|
||
export default commandOptions => { | ||
const COMMAND_OPTIONS = JSON.stringify(commandOptions); | ||
delete commandOptions['some-option']; | ||
delete commandOptions['another-option']; | ||
commandOptions.format = 'cjs'; | ||
return { | ||
input: 'main.js', | ||
onwarn(warning) { | ||
throw new Error(`Unexpected warning: ${warning.message}`); | ||
}, | ||
plugins: [replace({ COMMAND_OPTIONS })] | ||
}; | ||
}; |
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
module.exports = { | ||
description: 'if config returns a function then this will be called with command args', | ||
command: 'rollup --config rollup.config.js --silent --some-option="foo" --another-option=42', | ||
description: | ||
'if the config file returns a function then this will be called with the command args', | ||
command: 'rollup --config rollup.config.js --silent', | ||
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
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