2017-05-25 16:41:29 +03:00
|
|
|
const { readFile, writeFile, exists } = require('mz/fs');
|
|
|
|
const main = require('apr-main');
|
2017-05-23 16:27:04 +03:00
|
|
|
const path = require('path');
|
|
|
|
|
|
|
|
// TODO: this will need to happen for prod and test too
|
2017-05-25 16:41:29 +03:00
|
|
|
|
|
|
|
const enhancedConfigPath = path.join(__dirname, './webpack.config.dev.js');
|
|
|
|
|
2017-05-18 21:21:33 +03:00
|
|
|
const configPath = path.join(
|
|
|
|
__dirname,
|
|
|
|
'../node_modules/react-scripts/config/webpack.config.dev.js'
|
|
|
|
);
|
|
|
|
const orignalConfigPath = path.join(
|
|
|
|
__dirname,
|
|
|
|
'../node_modules/react-scripts/config/webpack.config.dev.original.js'
|
|
|
|
);
|
2017-05-23 16:27:04 +03:00
|
|
|
|
2017-05-25 23:03:39 +03:00
|
|
|
main(
|
|
|
|
(async () => {
|
|
|
|
const orignalConfigPathExists = await exists(orignalConfigPath);
|
2017-05-25 16:41:29 +03:00
|
|
|
|
2017-05-25 23:03:39 +03:00
|
|
|
if (!orignalConfigPathExists) {
|
|
|
|
const orignalConfig = await readFile(configPath, 'utf-8');
|
|
|
|
await writeFile(orignalConfigPath, orignalConfig);
|
|
|
|
}
|
2017-05-18 21:21:33 +03:00
|
|
|
|
2017-05-25 23:03:39 +03:00
|
|
|
const enhancedConfig = await readFile(enhancedConfigPath);
|
|
|
|
await writeFile(configPath, enhancedConfig);
|
|
|
|
})()
|
|
|
|
);
|