Skip to content
This repository was archived by the owner on Apr 19, 2024. It is now read-only.

Commit 0d40961

Browse files
committed
release: public 2.2.0
JIRA-Ref: release/2.2.0
0 parents  commit 0d40961

File tree

380 files changed

+16969
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

380 files changed

+16969
-0
lines changed

.app-eleventy.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
const cc = require('config-chain');
2+
3+
const conf = cc(cc.find('.jam-on/app/conf.json'));
4+
5+
function appConfigFunc(eleventyConfig) {
6+
eleventyConfig.addPassthroughCopy({
7+
'src/assets': conf.get('assetsDestination'),
8+
});
9+
}
10+
11+
const appConfigObj = {
12+
dir: {
13+
input: 'src',
14+
output: 'dist',
15+
},
16+
};
17+
18+
module.exports = {
19+
configFunc: appConfigFunc,
20+
configObj: appConfigObj,
21+
};

.core-eleventy.js

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
const fs = require('fs');
2+
const matter = require('gray-matter');
3+
const MarkdownIt = require('markdown-it');
4+
const cc = require('config-chain');
5+
6+
const globalLocaleStrings = require('./src/_data/core/core-locale-strings.json');
7+
const appLocaleStrings = require('./src/_data/app/app-locale-strings.json');
8+
9+
const localeStrings = { ...globalLocaleStrings, ...appLocaleStrings };
10+
11+
const appConf = cc(cc.find('.jam-on/app/conf.json'));
12+
const appVersionMetadata = cc(cc.find('.jam-on/app/versionMetadata.json'));
13+
let toolkitVersion;
14+
15+
try {
16+
toolkitVersion = appVersionMetadata.get('tagOrBranch');
17+
} catch (e) {
18+
try {
19+
toolkitVersion = appConf.get('toolkitPackageJSONVersion');
20+
} catch {
21+
toolkitVersion = 'version undetermined';
22+
/* eslint-disable no-console */
23+
console.warn(
24+
"Your version of the Ontario.ca Jamstack Toolkit can't be determined and some features may not work correctly; you can try performing an upgrade to the latest release using the `jam-on.mjs` CLI to resolve this issue, or contact the Ontario.ca Service Integration team for help.",
25+
);
26+
/* eslint-enable no-console */
27+
}
28+
}
29+
30+
function coreConfigFunc(eleventyConfig) {
31+
const md = new MarkdownIt({
32+
html: true,
33+
});
34+
35+
eleventyConfig.addFilter('markdown', (content) => md.renderInline(content));
36+
eleventyConfig.addShortcode('toolkitVersion', () => toolkitVersion);
37+
eleventyConfig.addShortcode(
38+
'currentYear',
39+
() => `${String(new Date().getFullYear())}`,
40+
);
41+
eleventyConfig.addShortcode(
42+
'currentShortYear',
43+
() => `${String(new Date().getFullYear()).slice(-2)}`,
44+
);
45+
/* eslint-disable func-names */
46+
eleventyConfig.addFilter('localeString', function (key) {
47+
/* eslint-enable func-names */
48+
// Solution for accessing page front matter from https://stackoverflow.com/a/67746326
49+
50+
const { page } = this.ctx;
51+
const str = fs.readFileSync(page.inputPath, 'utf8');
52+
const { data } = matter(str);
53+
const lang = data.lang || 'en';
54+
let localeString;
55+
56+
if (key.includes('.')) {
57+
const keyArr = key.split('.');
58+
localeString = localeStrings[keyArr.shift()];
59+
if (keyArr.length > 0) {
60+
keyArr.forEach((k) => {
61+
localeString = localeString[k];
62+
});
63+
}
64+
} else {
65+
localeString = localeStrings[key];
66+
}
67+
if (Array.isArray(localeString)) {
68+
localeString = localeString.map((string) => string[lang]);
69+
return localeString;
70+
}
71+
72+
return `${localeString[lang]}`;
73+
});
74+
}
75+
76+
const coreConfigObj = {
77+
pathPrefix: '/',
78+
};
79+
80+
module.exports = {
81+
configFunc: coreConfigFunc,
82+
configObj: coreConfigObj,
83+
};

.eleventy.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
const core = require('./.core-eleventy');
2+
const app = require('./.app-eleventy');
3+
4+
module.exports = (eleventyConfig) => {
5+
core.configFunc(eleventyConfig);
6+
app.configFunc(eleventyConfig);
7+
8+
// Return your Object options:
9+
return { ...core.configObj, ...app.configObj };
10+
};

.eslintrc.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
module.exports = {
2+
env: {
3+
browser: true,
4+
commonjs: true,
5+
es2021: true,
6+
node: true,
7+
},
8+
extends: 'airbnb-base',
9+
overrides: [],
10+
ignorePatterns: ['!.*', 'dist/**', 'node_modules/**', 'src/assets/vendor/**'],
11+
parser: '@babel/eslint-parser',
12+
parserOptions: {
13+
requireConfigFile: false,
14+
},
15+
plugins: ['prettier'],
16+
root: true,
17+
};

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
dist
3+
tmp
4+
tests_output
5+
logs

.htmlvalidate.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"extends": ["html-validate:recommended"],
3+
"rules": {
4+
"void-style": "off",
5+
"prefer-button": "off",
6+
"svg-focusable": "off",
7+
"no-trailing-whitespace": "off",
8+
"long-title": "off"
9+
}
10+
}

.htmlvalidateignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
src/jamstack-toolkit/assets/vendor/**
2+
dist/assets/vendor/**
3+
tests_output

.jam-on/app/conf.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"assetsDestination": "example-pages/assets",
3+
"englishRoot": "example-pages",
4+
"frenchRoot": "pages-dexemple",
5+
"toolkitPackageJSONVersion": "not an initialized project"
6+
}

.jam-on/core/templates/README.njk

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# {{ projectName }}
2+
3+
Built with the [Ontario.ca Jamstack Toolkit](https://github.com/ongov/Ontario.ca-Jamstack-Toolkit) - see `README.jamstack` for more details.
4+
5+
## Project Description
6+
7+
{{ projectDescription }}
8+
9+
## About this README.md file
10+
11+
README files are a place to tell others about a project right in the source code repository. This one has been generated automatically for you when you set up your new project.
12+
13+
[Make a README](https://www.makeareadme.com/) is one place to learn about creating a good README file.
14+
15+
## Suggested Information
16+
17+
For projects meant to be deployed to Ontario.ca (this is probably why you're using the *Ontario.ca Jamstack Toolkit, after all), we recommend putting in at least the following information to start:
18+
19+
* What is the purpose of the project?
20+
* Who should someone contact to get further information about it?
21+
* How would a new developer get started working on the project?

.jam-on/core/templates/en.njk

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
layout: core/layout.njk
3+
title: "Ontario.ca Jamstack Toolkit"
4+
description: "The best way to start building applications for Ontario.ca."
5+
fr_page_url: "/{{ frenchRoot }}"
6+
date: {{ createDate }}
7+
published_date: {{ createDate }}
8+
---
9+
English Page.

0 commit comments

Comments
 (0)