-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* enable google analytics for the service * bumping to 0.2.0 for build testing * moving webpack to prod dependencies as container needs it * adding in echo for ado build * trying to inject GA_ID into dockerfile build * setting GA cookie domains * sonarcloud stuff * taking out the GA_ID pipeline echos * updating variable to camel * tring to get client coverage not covered by sonar * removing config.js files from coverage report * excluding config.js files from sonar
- Loading branch information
Showing
11 changed files
with
1,366 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/sh | ||
webpack |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
#!/bin/sh | ||
rm -rf server/public | ||
npm run build:js | ||
npm run copy:static | ||
npm run build:css |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'use strict' | ||
// "sir" represents the global namespace for client side js across the service | ||
window.sir = { | ||
utils: { | ||
setupGoogleTagManager: () => { | ||
const gaId = process.env.GA_ID | ||
if (gaId) { | ||
const script = document.createElement('script') | ||
script.src = `https://www.googletagmanager.com/gtag/js?id=${gaId}` | ||
script.onload = () => { | ||
window.dataLayer = window.dataLayer || [] | ||
function gtag () { window.dataLayer.push(arguments) } | ||
gtag('js', new Date()) | ||
gtag('config', gaId, { cookie_domain: window.location.hostname }) | ||
} | ||
document.body.appendChild(script) | ||
} | ||
} | ||
} | ||
} | ||
|
||
// Just initialise GA for all page views atm, cookie banner and opt in is to come | ||
window.sir.utils.setupGoogleTagManager() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,8 @@ services: | |
build: | ||
context: ../ | ||
dockerfile: dockerfile | ||
args: | ||
- GA_ID | ||
ports: | ||
- "8000:8000" | ||
environment: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
FROM node:18-alpine | ||
|
||
LABEL author="DEFRA" | ||
ARG GA_ID | ||
ENV NODE_ENV=production | ||
ENV PORT=8000 | ||
|
||
|
Oops, something went wrong.