forked from folio-org/stripes-smart-components
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.stripesclirc.js
46 lines (38 loc) · 1 KB
/
.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
41
42
43
44
45
46
const webpack = require('webpack');
const miragePlugin = {
// 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'
}));
if (!!mirageOption) {
console.info('Using Mirage Server'); // eslint-disable-line no-console
return Object.assign({}, config, {
entry: ['./tests/network/boot'].concat(config.entry)
});
} else {
return config;
}
};
}
}
module.exports = {
hasAllPerms: true,
aliases: {
'@folio/stripes-smart-components': '.'
},
// Custom command extension
plugins: {
serve: miragePlugin
}
};