mirror of
https://github.com/yldio/copilot.git
synced 2024-11-14 23:30:05 +02:00
7f1d731dc6
* refactor: config() from mutation to query * refactor(cp-frontend): remove unused dependency * feat(portal-watch): expose getContainers() and compose tags * fix(portal-watch): assert services by name AND hash * feat(portal-data): expose importable and import APIs * fix(portal-data): add missing dependencies * feat(portal-api): expose import/importable * feat(cp-gql-schema): add import/importable * feat(cp-frontend): import existing project * style(portal-watch): lint * style(portal-data): lint * chore: update lockfile
42 lines
1.0 KiB
JavaScript
42 lines
1.0 KiB
JavaScript
const { readFile, writeFile, exists } = require('mz/fs');
|
|
const main = require('apr-main');
|
|
const forEach = require('apr-for-each');
|
|
const path = require('path');
|
|
|
|
const ROOT = path.join(__dirname, '../node_modules/react-scripts/config');
|
|
const configs = ['webpack.config.dev', 'webpack.config.prod'];
|
|
|
|
const toCopy = [
|
|
'patch-webpack-config',
|
|
'webpack.config.dev',
|
|
'webpack.config.prod'
|
|
];
|
|
|
|
const backup = async file => {
|
|
const backupPath = path.join(ROOT, `${file}.original.js`);
|
|
const backupExists = await exists(backupPath);
|
|
|
|
if (backupExists) {
|
|
return;
|
|
}
|
|
|
|
const originalPath = path.join(ROOT, `${file}.js`);
|
|
const orignalConfig = await readFile(originalPath, 'utf-8');
|
|
return writeFile(backupPath, orignalConfig);
|
|
};
|
|
|
|
const copy = async file => {
|
|
const srcPath = path.join(__dirname, `${file}.js`);
|
|
const destPath = path.join(ROOT, `${file}.js`);
|
|
|
|
const src = await readFile(srcPath, 'utf-8');
|
|
return writeFile(destPath, src);
|
|
};
|
|
|
|
main(
|
|
(async () => {
|
|
await forEach(configs, backup);
|
|
await forEach(toCopy, copy);
|
|
})()
|
|
);
|