forked from folio-org/ui-checkout
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.stripesclirc.js
40 lines (37 loc) · 987 Bytes
/
.stripesclirc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
const webpack = require('webpack');
function mirage(config, enabled = false) {
if (enabled) {
console.info('Using Mirage Server'); // eslint-disable-line no-console
return Object.assign({}, config, {
entry: ['./test/bigtest/network/boot'].concat(config.entry)
});
} else {
return config;
}
}
const servePlugin = {
// Standard yargs options object
options: {
'mirage [scenario]': {
describe: 'Enable Mirage Server and specify a scenario',
type: 'string',
group: 'Mirage Server',
},
},
// Stripes CLI hook into "webpackOverrides"
beforeBuild: (options) => {
const mirageOption = options.mirage === true ? 'default' : options.mirage;
return (config) => {
config.plugins.push(new webpack.EnvironmentPlugin({
MIRAGE_SCENARIO: mirageOption || 'default'
}));
return mirage(config, mirageOption);
};
},
}
module.exports = {
hasAllPerms: true,
plugins: {
serve: servePlugin
}
};