Skip to content

Commit

Permalink
Merge pull request #3 from mmoschovas/installed_modules_update
Browse files Browse the repository at this point in the history
Installed Modules array update
  • Loading branch information
robertrmartinez authored May 3, 2021
2 parents 6bf6510 + 612cb73 commit a7bd86d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/packageBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ function generatePackageManifests(config, prebidManifest, codeManifest, relative
}

if (Array.isArray(pkg.modules)) {
manifest.moduleList = pkg.modules;
manifest.modules = _.filter(manifest.modules, (modulePath, module) => pkg.modules.includes(module));
}
});
Expand Down Expand Up @@ -106,7 +107,8 @@ function buildFromManifest(cwd, manifest, modules, codes) {
}))).then(results => results.filter(result => result).join('\n'))
]).then(results => {
results.push(manifest.postfix);
return results.join('\n');
manifest.moduleList = manifest.moduleList || [];
return results.join('\n').replace(/installedModules(\s||'')=(\s||'')\[\]/i, `installedModules=${JSON.stringify(manifest.moduleList)}`);
}).catch(err => {
setTimeout(() => { throw err });
});
Expand Down
11 changes: 11 additions & 0 deletions tests/packageBuilder.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ describe('the builder', () => {
"modules": [
"../prebid/0.27.1/appnexusBidAdapter.js"
],
"moduleList": [
"appnexusBidAdapter",
],
"code": [
"../code/34cb974.js"
],
Expand Down Expand Up @@ -131,6 +134,10 @@ describe('the builder', () => {
"../prebid/1.0.0/appnexusBidAdapter.js",
"../prebid/1.0.0/rubiconBidAdapter.js"
],
"moduleList": [
"appnexusBidAdapter",
"rubiconBidAdapter",
],
"postfix": "pbjs.processQueue();"
},
"pub3-site2.json": {
Expand Down Expand Up @@ -209,6 +216,10 @@ describe('the builder', () => {
"../prebid/0.29.0/appnexusBidAdapter.js",
"../prebid/0.29.0/rubiconBidAdapter.js"
],
"moduleList": [
"appnexusBidAdapter",
"rubiconBidAdapter",
],
"postfix": "pbjs.processQueue();"
},
"pub4-site1.json": {
Expand Down

0 comments on commit a7bd86d

Please sign in to comment.