@madgex/fert 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +8 -0
- package/.eslintrc.js +15 -0
- package/.github/workflows/commits.yml +14 -0
- package/.github/workflows/release.yml +29 -0
- package/.husky/commit-msg +4 -0
- package/.husky/pre-commit +4 -0
- package/.prettierignore +2 -0
- package/.prettierrc.js +8 -0
- package/README.md +232 -0
- package/bin/cli.js +68 -0
- package/bin/commands/build-tasks/build-external-assets.js +16 -0
- package/bin/commands/build-tasks/build-tokens.js +119 -0
- package/bin/commands/build-tasks/bundle-ds-css.js +74 -0
- package/bin/commands/build-tasks/bundle-entry.js +43 -0
- package/bin/commands/build.js +42 -0
- package/bin/commands/dev-server.js +50 -0
- package/bin/commands/init.js +207 -0
- package/bin/commands/publish-tasks/asset-store-uploader.js +94 -0
- package/bin/commands/publish-tasks/get-aws-parameter.js +41 -0
- package/bin/commands/publish.js +51 -0
- package/bin/utils/cpid-lookup.js +47 -0
- package/bin/utils/index.js +121 -0
- package/bin/utils/resolve-external-assets.js +77 -0
- package/commitlint.config.cjs +1 -0
- package/constants.js +36 -0
- package/delivery/git.cer +22 -0
- package/delivery/jenkinsfile +93 -0
- package/package.json +84 -0
- package/repo-templates/globals/fert.config.js +4 -0
- package/repo-templates/globals/jenkinsfile +4 -0
- package/repo-templates/template-basic/_gitignore +5 -0
- package/repo-templates/template-basic/brand.json +21 -0
- package/repo-templates/template-basic/package.json +13 -0
- package/repo-templates/template-basic/public/favicon.ico +0 -0
- package/repo-templates/template-basic/public/fonts/mdgx-icons.eot +0 -0
- package/repo-templates/template-basic/public/fonts/mdgx-icons.svg +71 -0
- package/repo-templates/template-basic/public/fonts/mdgx-icons.ttf +0 -0
- package/repo-templates/template-basic/public/fonts/mdgx-icons.woff +0 -0
- package/repo-templates/template-basic/public/fonts/my-font.woff +1 -0
- package/repo-templates/template-basic/public/images/logo.png +0 -0
- package/repo-templates/template-basic/src/css/styles.scss +12 -0
- package/repo-templates/template-basic/src/index.js +3 -0
- package/repo-templates/template-basic/templates/footer.njk +14 -0
- package/repo-templates/template-basic/templates/header.njk +14 -0
- package/repo-templates/template-bigworkbag/_gitignore +5 -0
- package/repo-templates/template-bigworkbag/brand.json +21 -0
- package/repo-templates/template-bigworkbag/package.json +13 -0
- package/repo-templates/template-bigworkbag/public/favicon.ico +0 -0
- package/repo-templates/template-bigworkbag/public/fonts/mdgx-icons.eot +0 -0
- package/repo-templates/template-bigworkbag/public/fonts/mdgx-icons.svg +71 -0
- package/repo-templates/template-bigworkbag/public/fonts/mdgx-icons.ttf +0 -0
- package/repo-templates/template-bigworkbag/public/fonts/mdgx-icons.woff +0 -0
- package/repo-templates/template-bigworkbag/public/fonts/my-font.woff +1 -0
- package/repo-templates/template-bigworkbag/public/images/logo.png +0 -0
- package/repo-templates/template-bigworkbag/public/images/user-menu-pointer.svg +4 -0
- package/repo-templates/template-bigworkbag/src/css/breakpoints.scss +17 -0
- package/repo-templates/template-bigworkbag/src/css/clicky-menu.scss +52 -0
- package/repo-templates/template-bigworkbag/src/css/desktop-main-nav.scss +25 -0
- package/repo-templates/template-bigworkbag/src/css/desktop-user-nav.scss +127 -0
- package/repo-templates/template-bigworkbag/src/css/footer.scss +77 -0
- package/repo-templates/template-bigworkbag/src/css/header-top.scss +29 -0
- package/repo-templates/template-bigworkbag/src/css/leaderboard-ad.scss +22 -0
- package/repo-templates/template-bigworkbag/src/css/mobile-main-nav.scss +68 -0
- package/repo-templates/template-bigworkbag/src/css/mobile-user-nav.scss +49 -0
- package/repo-templates/template-bigworkbag/src/css/reset.scss +91 -0
- package/repo-templates/template-bigworkbag/src/css/styles.scss +19 -0
- package/repo-templates/template-bigworkbag/src/css/top-bar.scss +13 -0
- package/repo-templates/template-bigworkbag/src/css/typography.scss +20 -0
- package/repo-templates/template-bigworkbag/src/css/util.scss +28 -0
- package/repo-templates/template-bigworkbag/src/css/variables.scss +9 -0
- package/repo-templates/template-bigworkbag/src/index.js +3 -0
- package/repo-templates/template-bigworkbag/src/js/clicky-menus.js +178 -0
- package/repo-templates/template-bigworkbag/src/js/no-js.js +10 -0
- package/repo-templates/template-bigworkbag/templates/context/footer-nav.njk +27 -0
- package/repo-templates/template-bigworkbag/templates/context/main-nav.njk +32 -0
- package/repo-templates/template-bigworkbag/templates/context/user-nav.njk +17 -0
- package/repo-templates/template-bigworkbag/templates/footer.njk +68 -0
- package/repo-templates/template-bigworkbag/templates/header.njk +54 -0
- package/repo-templates/template-bigworkbag/templates/includes/desktop-main-nav-items.njk +18 -0
- package/repo-templates/template-bigworkbag/templates/includes/desktop-user-nav/loggedin-items.njk +28 -0
- package/repo-templates/template-bigworkbag/templates/includes/desktop-user-nav/loggedout-items.njk +9 -0
- package/repo-templates/template-bigworkbag/templates/includes/desktop-user-nav/submenu-items.njk +18 -0
- package/repo-templates/template-bigworkbag/templates/includes/desktop-user-nav/user-nav.njk +24 -0
- package/repo-templates/template-bigworkbag/templates/includes/dev-console-context.njk +7 -0
- package/repo-templates/template-bigworkbag/templates/includes/mobile-main-nav-items.njk +25 -0
- package/repo-templates/template-bigworkbag/templates/includes/mobile-user-nav/loggedin-items.njk +33 -0
- package/repo-templates/template-bigworkbag/templates/includes/mobile-user-nav/loggedout-items.njk +16 -0
- package/repo-templates/template-bigworkbag/templates/includes/mobile-user-nav/user-nav.njk +24 -0
- package/repo-templates/template-bigworkbag/templates/svgs/arrow-down.svg +3 -0
- package/repo-templates/template-bigworkbag/templates/svgs/arrow-left.svg +3 -0
- package/repo-templates/template-bigworkbag/templates/svgs/arrow-right.svg +3 -0
- package/repo-templates/template-bigworkbag/templates/svgs/arrow-up.svg +3 -0
- package/repo-templates/template-bigworkbag/templates/svgs/cart.svg +3 -0
- package/repo-templates/template-bigworkbag/templates/svgs/facebook.svg +3 -0
- package/repo-templates/template-bigworkbag/templates/svgs/linkedin.svg +3 -0
- package/repo-templates/template-bigworkbag/templates/svgs/profile.svg +5 -0
- package/repo-templates/template-bigworkbag/templates/svgs/star-filled.svg +3 -0
- package/repo-templates/template-bigworkbag/templates/svgs/star-outline.svg +3 -0
- package/repo-templates/template-bigworkbag/templates/svgs/twitter.svg +3 -0
- package/repo-templates/template-bigworkbag/templates/svgs/youtube.svg +3 -0
- package/repo-templates/template-bigworkbag/templates/translations/da.njk +26 -0
- package/repo-templates/template-bigworkbag/templates/translations/de.njk +26 -0
- package/repo-templates/template-bigworkbag/templates/translations/en.njk +26 -0
- package/repo-templates/template-bigworkbag/templates/translations/es.njk +26 -0
- package/repo-templates/template-bigworkbag/templates/translations/fr.njk +26 -0
- package/repo-templates/template-bigworkbag/templates/translations/nb.njk +26 -0
- package/repo-templates/template-bigworkbag/templates/translations/nl.njk +26 -0
- package/repo-templates/template-bigworkbag/templates/translations/sv.njk +26 -0
- package/repo-templates/template-bigworkbag/templates/translations/zh-cn.njk +26 -0
- package/server/extensions/error-logging.js +25 -0
- package/server/index.js +98 -0
- package/server/plugins/hapi-vite.js +61 -0
- package/server/routes/public.js +29 -0
- package/server/routes/views.js +46 -0
- package/server/templates/furniture.njk +67 -0
- package/server/templates/page1.njk +37 -0
- package/server/view-manager.js +59 -0
- package/shared/Dockerfile.brandingRepoPublish +28 -0
- package/shared/README.md +4 -0
- package/vite.config.js +14 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
module.exports = [
|
|
2
|
+
{
|
|
3
|
+
method: 'get',
|
|
4
|
+
path: '/_/jobseekers-frontend/assets/{p*}',
|
|
5
|
+
handler: {
|
|
6
|
+
directory: {
|
|
7
|
+
path: ['./dist', './public'],
|
|
8
|
+
},
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
method: 'get',
|
|
13
|
+
path: '/public/{p*}',
|
|
14
|
+
handler: {
|
|
15
|
+
directory: {
|
|
16
|
+
path: ['./public/'],
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
// try guess the favicon location to prevent 500 errors
|
|
22
|
+
{
|
|
23
|
+
method: 'get',
|
|
24
|
+
path: '/favicon.ico',
|
|
25
|
+
handler: {
|
|
26
|
+
file: './public/favicon.ico',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
];
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const Joi = require('joi');
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
method: 'GET',
|
|
5
|
+
path: '/{page*}',
|
|
6
|
+
handler: async (request, h) => {
|
|
7
|
+
const { page } = request.params;
|
|
8
|
+
|
|
9
|
+
// we'll pass over the headers as ModHeader may be used but
|
|
10
|
+
// remove the browsers 'accept-encoding' header otherwise
|
|
11
|
+
// content will come back gzipped!
|
|
12
|
+
const filteredHeaders = request.headers;
|
|
13
|
+
delete filteredHeaders['accept-encoding'];
|
|
14
|
+
|
|
15
|
+
const podletResponse = await request.server.inject({
|
|
16
|
+
url: `/_podlet/${request.path}`,
|
|
17
|
+
method: request.method,
|
|
18
|
+
headers: filteredHeaders,
|
|
19
|
+
auth: request.auth.isAuthenticated ? request.auth : null,
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
if (podletResponse.statusCode === 200) {
|
|
23
|
+
try {
|
|
24
|
+
podletResponse.result = JSON.parse(podletResponse.result);
|
|
25
|
+
} catch (err) {
|
|
26
|
+
console.error('Unable to parse podlet response', err);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return h.view(page, {
|
|
31
|
+
auth: request.auth,
|
|
32
|
+
podletResponse,
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
options: {
|
|
36
|
+
validate: {
|
|
37
|
+
params: Joi.object({
|
|
38
|
+
page: Joi.string().empty(['', null]).default('page1'),
|
|
39
|
+
}),
|
|
40
|
+
},
|
|
41
|
+
auth: {
|
|
42
|
+
strategy: 'mock-user',
|
|
43
|
+
mode: 'try',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8"/>
|
|
5
|
+
<title>{{ title | default('Frontend Rollout Tool') }}</title>
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
7
|
+
|
|
8
|
+
{%- for link in fertConfig.externalAssets.links %}
|
|
9
|
+
<link {%- for key, value in link %} {{ key }}="{{ value }}" {%- endfor %}/>
|
|
10
|
+
{%- endfor -%}
|
|
11
|
+
|
|
12
|
+
{%- for script in fertConfig.externalAssets.scripts %}
|
|
13
|
+
<script {%- for key, value in script %} {{ key }}="{{ value }}" {%- endfor %}></script>
|
|
14
|
+
{%- endfor -%}
|
|
15
|
+
|
|
16
|
+
</head>
|
|
17
|
+
<body {%- if auth.isAuthenticated %} class="is-signed-in" {% endif %}>
|
|
18
|
+
<section class="layout">
|
|
19
|
+
<div id="site-container" class="mds-site-container">
|
|
20
|
+
|
|
21
|
+
{%- if podletResponse.statusCode === 200 -%}
|
|
22
|
+
{{ podletResponse.result.headerHtml | safe }}
|
|
23
|
+
{%- else -%}
|
|
24
|
+
<div style="all: revert; margin: 10px; border: 5px solid red; padding: 20px; font-family: sans-serif;">
|
|
25
|
+
<h2>Header render error:</h2>
|
|
26
|
+
<pre>{{ podletResponse.result | dump(2) | safe }}</pre>
|
|
27
|
+
</div>
|
|
28
|
+
{%- endif %}
|
|
29
|
+
|
|
30
|
+
<main class="mds-main mds-padding-top-b5" role="main" id="main">
|
|
31
|
+
<div class="mds-wrapper">
|
|
32
|
+
{% block main %}Page does not override main block{% endblock %}
|
|
33
|
+
</div>
|
|
34
|
+
</main>
|
|
35
|
+
|
|
36
|
+
{% if podletResponse.statusCode === 200 -%}
|
|
37
|
+
{{ podletResponse.result.footerHtml | safe }}
|
|
38
|
+
{%- endif %}
|
|
39
|
+
|
|
40
|
+
</div>
|
|
41
|
+
</section>
|
|
42
|
+
|
|
43
|
+
{% if isFertDevelopment %}
|
|
44
|
+
<!-- development only - vite client/HMR & fert entry script -->
|
|
45
|
+
{{ viteClientScript | safe }}
|
|
46
|
+
{{ fertEntryScript | safe }}
|
|
47
|
+
{%- endif %}
|
|
48
|
+
|
|
49
|
+
{# Adding leaderboard placeholder to help with styling #}
|
|
50
|
+
<script type="text/javascript">
|
|
51
|
+
document.onreadystatechange = () => {
|
|
52
|
+
if (document.readyState === "interactive") {
|
|
53
|
+
const body = document.querySelector('body');
|
|
54
|
+
const leaderboardContainer = document.querySelector('#ad-leaderboard');
|
|
55
|
+
body.classList.add('js');
|
|
56
|
+
if (leaderboardContainer) {
|
|
57
|
+
const ad = document.createElement("div");
|
|
58
|
+
ad.setAttribute("style", "width:728px;height:90px;background-color:#f0f8ff;border:1px solid #14f;padding:20px;text-align:center;");
|
|
59
|
+
const text = document.createTextNode("Leaderboard ad");
|
|
60
|
+
ad.appendChild(text);
|
|
61
|
+
leaderboardContainer.appendChild(ad);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
</script>
|
|
66
|
+
</body>
|
|
67
|
+
</html>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{% extends "furniture.njk" %}
|
|
2
|
+
|
|
3
|
+
{% block main %}
|
|
4
|
+
<ul class="mds-list mds-list--inline mds-list--pipe">
|
|
5
|
+
<li class="mds-list__item">
|
|
6
|
+
{%- if not auth.isAuthenticated -%}<a href="/?loggedin">{%- endif -%}Signed in version{%- if not auth.isAuthenticated -%}</a>{%- endif -%}
|
|
7
|
+
</li>
|
|
8
|
+
<li class="mds-list__item">
|
|
9
|
+
{%- if auth.isAuthenticated -%}<a href="/">{%- endif -%}Signed out version{%- if auth.isAuthenticated -%}</a>{%- endif -%}
|
|
10
|
+
</li>
|
|
11
|
+
</ul>
|
|
12
|
+
|
|
13
|
+
<div class="mds-grid-row">
|
|
14
|
+
<div class="mds-grid-col-12 mds-grid-col-lg-9 ">
|
|
15
|
+
<div class="mds-surface">
|
|
16
|
+
<div class="mds-surface__inner">
|
|
17
|
+
<h1>Page title</h1>
|
|
18
|
+
<h2>Text</h2>
|
|
19
|
+
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas tempus tortor nulla, id viverra lacus maximus vel.
|
|
20
|
+
In tincidunt ultrices neque in maximus. Donec leo lectus, aliquet vel molestie lacinia, elementum vel arcu. Integer
|
|
21
|
+
iaculis diam non mattis eleifend. Curabitur et tempus felis. Vestibulum tempor nec libero id blandit. Duis fermentum
|
|
22
|
+
pulvinar eleifend. Vestibulum pellentesque mauris sed augue finibus, sit amet laoreet felis fermentum. Donec in dolor id
|
|
23
|
+
elit cursus pellentesque.</p>
|
|
24
|
+
<p><a href="#">Link</a><p>
|
|
25
|
+
<p><button class="mds-button">Button</button></p>
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
<div class="mds-grid-col-12 mds-grid-col-lg-3">
|
|
30
|
+
<div class="mds-branded-container mds-branded-container--1 mds-padding-b4 mds-padding-bottom-b5 mds-margin-bottom-b5">
|
|
31
|
+
<h2 class="mds-font-great-primer">Branded Container</h2>
|
|
32
|
+
<p class="mds-margin-bottom-b4">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
|
|
33
|
+
<a href="#" draggable="false" class="mds-button mds-button--neutral mds-button--small">Lorem ipsum</a>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
{% endblock %}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
const Nunjucks = require('nunjucks');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
4
|
+
module.exports = (server) => {
|
|
5
|
+
const fertConfig = server.fertConfig();
|
|
6
|
+
|
|
7
|
+
return {
|
|
8
|
+
engines: {
|
|
9
|
+
njk: {
|
|
10
|
+
compile: (src, options) => {
|
|
11
|
+
const template = Nunjucks.compile(
|
|
12
|
+
src,
|
|
13
|
+
options.environment,
|
|
14
|
+
options.filename
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
return (context) => {
|
|
18
|
+
return template.render(context);
|
|
19
|
+
};
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
prepare: (options, next) => {
|
|
23
|
+
const env = Nunjucks.configure(options.path, {
|
|
24
|
+
watch: false,
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
// pass nunjucks env for use in Vision
|
|
28
|
+
options.compileOptions.environment = env;
|
|
29
|
+
|
|
30
|
+
return next();
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
path: [
|
|
35
|
+
path.join(fertConfig.workingDir, './pages'), // user-created 'pages'
|
|
36
|
+
path.join(__dirname, './templates'), // fert-local base templates
|
|
37
|
+
],
|
|
38
|
+
isCached: false,
|
|
39
|
+
async context(request) {
|
|
40
|
+
const currFertConfig = server.fertConfig();
|
|
41
|
+
const viteServerOrigin = request.server.viteServerOrigin();
|
|
42
|
+
const viteClientURL = new URL('/@vite/client', viteServerOrigin);
|
|
43
|
+
const fertEntryURL = new URL(currFertConfig.entry, viteServerOrigin);
|
|
44
|
+
|
|
45
|
+
const viteClientScript = `<script type="module" src="${viteClientURL}"></script>`;
|
|
46
|
+
const fertEntryScript = `<script type="module" src="${fertEntryURL}"></script>`;
|
|
47
|
+
|
|
48
|
+
return {
|
|
49
|
+
isFertDevelopment: true,
|
|
50
|
+
viteServerOrigin,
|
|
51
|
+
viteClientURL,
|
|
52
|
+
viteClientScript,
|
|
53
|
+
fertEntryURL,
|
|
54
|
+
fertEntryScript,
|
|
55
|
+
fertConfig: currFertConfig,
|
|
56
|
+
};
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
FROM node:18-alpine
|
|
2
|
+
|
|
3
|
+
ENV HOME=/app/
|
|
4
|
+
|
|
5
|
+
ARG NPM_TOKEN
|
|
6
|
+
ARG GIT_USERNAME
|
|
7
|
+
ARG GIT_PASSWORD
|
|
8
|
+
|
|
9
|
+
RUN apk add git
|
|
10
|
+
|
|
11
|
+
# Create app directory
|
|
12
|
+
RUN mkdir $HOME
|
|
13
|
+
WORKDIR $HOME
|
|
14
|
+
COPY . $HOME
|
|
15
|
+
|
|
16
|
+
RUN \
|
|
17
|
+
pwd && \
|
|
18
|
+
ls -la && \
|
|
19
|
+
git config --global user.email "mds-branding@madgex.com" && \
|
|
20
|
+
git config --global user.name "mds-branding" && \
|
|
21
|
+
git config --global credential.username ${GIT_USERNAME} && \
|
|
22
|
+
git config --global credential.helper "!echo password=${GIT_PASSWORD}; echo"
|
|
23
|
+
|
|
24
|
+
RUN echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc && \
|
|
25
|
+
npm install && \
|
|
26
|
+
rm -f .npmrc
|
|
27
|
+
|
|
28
|
+
RUN npm run build
|
package/shared/README.md
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
The docker file in this folder (`Dockerfile.brandingRepoPublish`) will be used by Jenkins to build and publish the repo assets to S3.
|
|
2
|
+
|
|
3
|
+
When changes are pushed on a project repo, Jenkins will clone this repo, extract the docker file and use it to build and publish the assets to S3.
|
|
4
|
+
If the changes are on a branch other than master, the assets will be sent to the jb-dev S3 bucket. If the changes are pushed to master, they will be sent to the production bucket.
|
package/vite.config.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const { defineConfig } = require('vite');
|
|
2
|
+
const { viteStaticCopy } = require('vite-plugin-static-copy');
|
|
3
|
+
|
|
4
|
+
module.exports = defineConfig({
|
|
5
|
+
build: {
|
|
6
|
+
// generate manifest.json in outDir
|
|
7
|
+
manifest: true,
|
|
8
|
+
},
|
|
9
|
+
plugins: [
|
|
10
|
+
viteStaticCopy({
|
|
11
|
+
targets: [{ src: 'templates/*', dest: 'templates' }],
|
|
12
|
+
}),
|
|
13
|
+
],
|
|
14
|
+
});
|