joyent-portal/legacy/frontend/scripts/postinstall.js
Sérgio Ramos 8295bd6882 chore: initial lerna setup
this shall be a progressive process
2017-05-25 10:56:50 +01:00

36 lines
1.1 KiB
JavaScript

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);
}
})
}
})
}
})
}
})