Skip to content

Commit

Permalink
Avoid duplicate checks for Heroku deploys
Browse files Browse the repository at this point in the history
The `render` function now has its own checks to avoid using the HTML from the fixture files, so we can consolidate them into one and avoid having two slightly different checks in different parts of the code.
  • Loading branch information
36degrees committed Jan 17, 2024
1 parent 75c6832 commit e3651dc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 1 addition & 3 deletions packages/govuk-frontend-review/src/app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,7 @@ export default async () => {
const componentView = render(componentName, {
context: fixture.options,
env,

// Skip Nunjucks render from cache in development
fixture: flags.isDevelopment ? undefined : fixture
fixture
})

let bodyClasses = 'app-template__body'
Expand Down
6 changes: 4 additions & 2 deletions shared/lib/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,10 @@ function render(componentName, options) {
const macroName = componentNameToMacroName(componentName)
const macroPath = `govuk/components/${componentName}/macro.njk`

// Use built fixtures (if they exist) on CI to optimise for speed
if (process.env.CI === 'true' && options?.fixture?.html) {
// On Heroku / CI we know we're running against an up-to-date build so we can
// use the generated HTML from the component JSON (where it exists) to make
// things faster
if ((process.env.HEROKU_APP || process.env.CI) && options?.fixture?.html) {
return options.fixture.html
}

Expand Down

0 comments on commit e3651dc

Please sign in to comment.