ascentiaci / ascentiaci.ca

Ascentia Career Institute Main Marketing Site
1 stars 1 forks source link

Edits-june-3 #46

Closed fireball8931 closed 1 month ago

fireball8931 commented 1 month ago

Linked to #45 Should build.

[ ] - Will need to add TM to the env variables

trunk-io[bot] commented 1 month ago

Merging to main in this repository is managed by Trunk.

github-actions[bot] commented 1 month ago

Risk Level 3 - /home/runner/work/ascentiaci.ca/ascentiaci.ca/scripts/injectBrand.js

  1. The try-catch block added around the file read and write operations is a good practice for error handling. However, the removal of the actual file read and write operations is concerning as it might break the functionality. Ensure that the file operations are still performed within the try block.

  2. The brand variable is used in the console log but is not defined within the scope of the try-catch block. Ensure that brand is accessible or passed correctly.

  3. The pagesToUpdate array and the subsequent loop to call replaceOrPrependLocals is a good addition for scalability. However, ensure that the paths are correct and accessible.

  4. The removal of the SCSS content update logic might break the styling updates. Ensure that this logic is either moved or replaced appropriately.

Example of fixing the file read and write operations within the try block:

try {
  let fileContent = fs.readFileSync(fileLocation, \"utf8\");
  const startLocals = \"<!-- START LOCALS -->\";
  const endLocals = \"<!-- END LOCALS -->\";
  const startIndex = fileContent.indexOf(startLocals);
  const endIndex = fileContent.indexOf(endLocals) + endLocals.length;
  if (startIndex === -1 || endIndex === -1) {
    fileContent = newLocals + \"\
\" + fileContent;
  } else {
    fileContent = fileContent.slice(0, startIndex) + newLocals + fileContent.slice(endIndex);
  }
  fs.writeFileSync(fileLocation, fileContent, \"utf8\");
  console.log(`✅ ${filePath} updated successfully with new Locals. ${brand} injected\
`);
} catch (error) {
  console.error(`❌ Error updating ${filePath}:`, error);
}

🛠️📄⚠️


Powered by Code Review GPT

cloudflare-pages[bot] commented 1 month ago

Deploying elevareci-ca with  Cloudflare Pages  Cloudflare Pages

Latest commit: 17e0e23
Status: ✅  Deploy successful!
Preview URL: https://378d7210.elevareci-ca.pages.dev
Branch Preview URL: https://edits-june3.elevareci-ca.pages.dev

View logs

cloudflare-pages[bot] commented 1 month ago

Deploying ascentiaci-ca with  Cloudflare Pages  Cloudflare Pages

Latest commit: 17e0e23
Status: ✅  Deploy successful!
Preview URL: https://c485659a.ascentiaci-ca.pages.dev
Branch Preview URL: https://edits-june3.ascentiaci-ca.pages.dev

View logs