joyent-portal/packages/cp-frontend/scripts/postinstall.js

40 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'
);
2017-05-23 16:27:04 +03:00
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) {
2017-05-23 16:27:04 +03:00
console.log('Original config read error', error);
} else {
fs.writeFile(orignalConfigPath, orignalConfig, error => {
if (error) {
2017-05-23 16:27:04 +03:00
console.log('Original config write error', error);
} else {
2017-05-23 16:27:04 +03:00
fs.readFile(enhancedConfigPath, (error, enhancedConfig) => {
if (error) {
2017-05-23 16:27:04 +03:00
console.log('Enhanced config read error', error);
} else {
fs.writeFile(configPath, enhancedConfig, error => {
if (error) {
2017-05-23 16:27:04 +03:00
console.log('Enhanced config write error', error);
}
});
2017-05-23 16:27:04 +03:00
}
});
2017-05-23 16:27:04 +03:00
}
});
2017-05-23 16:27:04 +03:00
}
});