bundling refactor

This commit is contained in:
Jan Prochazka
2024-11-15 11:49:25 +01:00
parent 51ce4f1bb5
commit 7392b223f4
22 changed files with 164 additions and 90 deletions

View File

@@ -1,5 +1,6 @@
const fs = require('fs');
const path = require('path');
const volatilePackages = require('./common/volatilePackages');
function adjustFile(file) {
const json = JSON.parse(fs.readFileSync(file, { encoding: 'utf-8' }));
@@ -11,6 +12,10 @@ function adjustFile(file) {
);
for (const depkey of ['dependencies', 'optionalDependencies']) {
for (const dependency of Object.keys(pluginJson[depkey] || {})) {
if (!volatilePackages.includes(dependency)) {
// add only voletile packages
continue;
}
if (!json[depkey]) {
json[depkey] = {};
}
@@ -34,3 +39,5 @@ function adjustFile(file) {
adjustFile('packages/api/package.json');
adjustFile('app/package.json');
fs.writeFileSync('common/useBundleExternals.js', "module.exports = 'true';", 'utf-8');