mirror of
https://github.com/yldio/copilot.git
synced 2024-11-14 07:10:05 +02:00
73899b2784
checks if the webpack backup exists already before trying to create it
29 lines
851 B
JavaScript
29 lines
851 B
JavaScript
const { readFile, writeFile, exists } = require('mz/fs');
|
|
const main = require('apr-main');
|
|
const path = require('path');
|
|
|
|
// TODO: this will need to happen for prod and test too
|
|
|
|
const enhancedConfigPath = path.join(__dirname, './webpack.config.dev.js');
|
|
|
|
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'
|
|
);
|
|
|
|
main((async () => {
|
|
const orignalConfigPathExists = await exists(orignalConfigPath);
|
|
|
|
if (!orignalConfigPathExists) {
|
|
const orignalConfig = await readFile(configPath, 'utf-8');
|
|
await writeFile(orignalConfigPath, orignalConfig);
|
|
}
|
|
|
|
const enhancedConfig = await readFile(enhancedConfigPath);
|
|
await writeFile(configPath, enhancedConfig)
|
|
})());
|