Check the integrity of SFCC cartridges that shouldn't be modified.
Warning
DEPRECATED
There are easier ways to detect that something has changed in SFRA core cartridges.
Example:
Using GitHub actions labeler can be used to mark PRs with a label when a change on SFRA core cartridges is included.
# .github/labeler.yml sfra-change: - cartridges/app_storefront_base/**/* - cartridges/bm_app_storefront_base/**/* - modules/server/**/*
yarn add sfcc-cartridge-integrity-check --dev
Salesforce Commerce Cloud (SFCC) introduced the concept of cartridges that shouldn't be modified with their Storefront Reference Architecture (SFRA).
To protect your customization projects from (unintented) modifications of such cartridges here is a small tool to check these cartridges. The git hash of the last commit in the cartridge is used to check if there is a modification. Also the uncommitted files will be checked and a warning will be shown.
const cartridgeIntegrity = require('./cartridgeIntegrity')
// retrieve this data from a file
const integrityData = {
'app_storefront_base': 'SHA',
}
const { checkCartridgeIntegrity, generateCartridgeIntegrityDataFile } = cartridgeIntegrity({
readOnlyCartridges: [
'app_storefront_base',
],
integrityData,
customizationProject: true, // if false integrity won't be checked
})
checkCartridgeIntegrity()
You can generate a file containing the integrity data as JSON.
generateCartridgeIntegrityDataFile('./path/to/file.json')
MIT © 2023 Jens Simon