Skip to content

Commit

Permalink
Merge pull request #55 from DEFRA/TGC-455-application-version-meta-tag
Browse files Browse the repository at this point in the history
add version meta tag
  • Loading branch information
swdpcomputing authored Nov 7, 2024
2 parents 25ba3ff + 4878e1e commit 7a34e2b
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 25 deletions.
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ffc-grants-eligibility-checker",
"description": "FFC Grant Eligibility Checker",
"version": "1.0.24",
"version": "1.0.25",
"license": "OGL-UK-3.0",
"contributors": [
"Andrew Folga <[email protected]>",
Expand Down
38 changes: 23 additions & 15 deletions src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import errorPages from './config/plugins/error-pages.js';
import { exampleGrantMachineService } from './config/machines/example-grant-machine.js';
import statusCodes, { OK } from './constants/status-codes.js';
import { fileURLToPath } from 'url';
import { createRequire } from 'module';
const require = createRequire(import.meta.url);
const pkg = require('../package.json');

const __dirname = path.dirname(fileURLToPath(import.meta.url));

Expand All @@ -29,21 +32,26 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
* - serviceName: The name of the service.
* - pageTitle: The title of the page.
*/
export const getConfig = () => ({
port: appConfig.port,
host: appConfig.host,
stripTrailingSlash: true,
stylesheetsPath: path.resolve(__dirname, '..', 'public', 'stylesheets'),
viewsPath: path.resolve(__dirname, '..'),
njkEnv: njk.configure(viewConfig.paths),
context: {
version: appConfig.version,
assets: viewConfig.assets.app,
govAssets: viewConfig.assets.gov,
serviceName: appConfig.name,
pageTitle: appConfig.name
}
});
export const getConfig = () => {
const njkEnv = njk.configure(viewConfig.paths);
njkEnv.addGlobal('appVersion', pkg.version);

return {
port: appConfig.port,
host: appConfig.host,
stripTrailingSlash: true,
stylesheetsPath: path.resolve(__dirname, '..', 'public', 'stylesheets'),
viewsPath: path.resolve(__dirname, '..'),
njkEnv,
context: {
version: appConfig.version,
assets: viewConfig.assets.app,
govAssets: viewConfig.assets.gov,
serviceName: appConfig.name,
pageTitle: appConfig.name
}
};
};

/**
* Creates and configures an instance of a Hapi server.
Expand Down
1 change: 1 addition & 0 deletions src/views/layout.njk
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
{% endblock %}
{% block head %}
<meta name="robots" content="noindex, nofollow" />
<meta name="application-version" content="{{ appVersion }}">
<link rel="stylesheet" href="/eligibility-checker/stylesheets/main.css" />
<link rel="icon" type="image/svg+xml" href="/eligibility-checker/assets/images/favicon.svg">
{% endblock %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ exports[`error-pages plugin snapshot should match BAD_REQUEST snapshot 1`] = `
<meta name="robots" content="noindex, nofollow" />
<meta name="application-version" content="1.0.25">
<link rel="stylesheet" href="/eligibility-checker/stylesheets/main.css" />
<link rel="icon" type="image/svg+xml" href="/eligibility-checker/assets/images/favicon.svg">
Expand Down Expand Up @@ -236,6 +237,7 @@ exports[`error-pages plugin snapshot should match FORBIDDEN snapshot 1`] = `
<meta name="robots" content="noindex, nofollow" />
<meta name="application-version" content="1.0.25">
<link rel="stylesheet" href="/eligibility-checker/stylesheets/main.css" />
<link rel="icon" type="image/svg+xml" href="/eligibility-checker/assets/images/favicon.svg">
Expand Down Expand Up @@ -456,6 +458,7 @@ exports[`error-pages plugin snapshot should match INTERNAL_SERVER_ERROR snapshot
<meta name="robots" content="noindex, nofollow" />
<meta name="application-version" content="1.0.25">
<link rel="stylesheet" href="/eligibility-checker/stylesheets/main.css" />
<link rel="icon" type="image/svg+xml" href="/eligibility-checker/assets/images/favicon.svg">
Expand Down Expand Up @@ -675,6 +678,7 @@ exports[`error-pages plugin snapshot should match NOT_FOUND snapshot 1`] = `
<meta name="robots" content="noindex, nofollow" />
<meta name="application-version" content="1.0.25">
<link rel="stylesheet" href="/eligibility-checker/stylesheets/main.css" />
<link rel="icon" type="image/svg+xml" href="/eligibility-checker/assets/images/favicon.svg">
Expand Down
1 change: 1 addition & 0 deletions test/integration/narrow/__snapshots__/start.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ exports[`Start Page snapshot should match snapshot 1`] = `
<meta name="robots" content="noindex, nofollow" />
<meta name="application-version" content="1.0.25">
<link rel="stylesheet" href="/eligibility-checker/stylesheets/main.css" />
<link rel="icon" type="image/svg+xml" href="/eligibility-checker/assets/images/favicon.svg">
Expand Down

0 comments on commit 7a34e2b

Please sign in to comment.