-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to start app with mirage
- Loading branch information
Wil Wilsman
committed
Sep 19, 2018
1 parent
c555329
commit ddbe957
Showing
5 changed files
with
56 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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: ['./test/bigtest/network/boot'].concat(config.entry) | ||
}); | ||
} else { | ||
return config; | ||
} | ||
}; | ||
} | ||
} | ||
|
||
module.exports = { | ||
hasAllPerms: true, | ||
|
||
aliases: { | ||
'@folio/stripes-core': '.' | ||
}, | ||
|
||
// Custom command extension | ||
plugins: { | ||
serve: miragePlugin | ||
} | ||
}; |
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 @@ | ||
import withTranslations from '../../helpers/translations'; | ||
|
||
export default function defaultScenarion(server) { | ||
withTranslations(server); | ||
} |
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