1
0
mirror of https://github.com/yldio/copilot.git synced 2024-12-04 00:50:09 +02:00
copilot/legacy/frontend/scripts/postinstall.js

36 lines
1.1 KiB
JavaScript
Raw Normal View History

2017-05-23 16:27:04 +03:00
const fs = require('fs');
const path = require('path');
// TODO: this will need to happen for prod and test too
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');
const enhancedConfigPath = path.join(__dirname, './webpack.config.dev.js');
// bit of healthy callback hell for making it spicy
fs.readFile(configPath, (error, orignalConfig) => {
if(error) {
console.log('Original config read error', error);
}
else {
fs.writeFile(orignalConfigPath, orignalConfig, (error) => {
if(error) {
console.log('Original config write error', error);
}
else {
fs.readFile(enhancedConfigPath, (error, enhancedConfig) => {
if(error) {
console.log('Enhanced config read error', error);
}
else {
fs.writeFile(configPath, enhancedConfig, (error) => {
if(error) {
console.log('Enhanced config write error', error);
}
})
}
})
}
})
}
})