Put the cartridges list in dw.json for more performance
In SFCC we have cartridges, some projects can have more than 50 cartridges, in many times, a lot of cartridges are useless and we upload this cartridges every time when we start coding!
When we put the cartridge list in dw.json, we can upload only the cartridges really usefull.
We have this in default dw.json configuration:
{
"hostname": "your-host-name",
"username": "your-username",
"password": "your-password",
"code-version": "your-version"
}
To upload only the interesting cartridges, we need to added one more line before the code-version, the code line:
"cartridge": ["cartrdigeA","cartridgeB"],
To find every cartridge you really use in your project we can do this path in Business Manager
Administration > Sites > Manage Sites. Select the site you want to view and click in Settings tab
In the input, you gonna find something like this: cartrdigeA:cartridgeB
And you may be wondering "This format is wrong, now i need to type all of these 50 cartridges?"
I'm here to help you, just paste the cartridge list in the code below (javascript, you literraly can do this in the browser dev tools):
function formatCartridgeList(cartridgeList) {
const cartridges = cartridgeList.split(':');
const cartridgeNewList = cartridges.map(item => `"${item}"`).join(',');
const finalCartridgeList = `[${cartridgeNewList}]`;
console.log(finalCartridgeList);
}
formatCartridgeList("cartrdigeA:cartridgeB"); // <- your cartridge list HERE
And the output is gonna be like this:
["cartrdigeA","cartridgeB"]
Just paste in the dw.json cartridge key.
I really hope this can help someone, as I managed to reduce the number of cartridges in the project from 70 to 25, reducing the upload time considerably.