This repository has been archived by the owner on Apr 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JIRA-Ref: release/1.1.0
- Loading branch information
0 parents
commit 7a76233
Showing
352 changed files
with
15,631 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
const cc = require('config-chain'); | ||
|
||
var conf = cc(cc.find('.jam-on/app/conf.json')); | ||
|
||
appConfigFunc = function (eleventyConfig) { | ||
eleventyConfig.addPassthroughCopy({ | ||
'src/assets': conf.get('assetsDestination'), | ||
}); | ||
}; | ||
|
||
appConfigObj = { | ||
dir: { | ||
input: 'src', | ||
output: 'dist', | ||
}, | ||
}; | ||
|
||
module.exports = { | ||
configFunc: appConfigFunc, | ||
configObj: appConfigObj, | ||
}; |
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,63 @@ | ||
const globalLocaleStrings = require('./src/_data/core/core-locale-strings.json'); | ||
const appLocaleStrings = require('./src/_data/app/app-locale-strings.json'); | ||
const localeStrings = { ...globalLocaleStrings, ...appLocaleStrings }; | ||
|
||
const fs = require('fs'); | ||
const matter = require('gray-matter'); | ||
const markdownIt = require('markdown-it'); | ||
|
||
coreConfigFunc = function (eleventyConfig) { | ||
const md = new markdownIt({ | ||
html: true, | ||
}); | ||
|
||
eleventyConfig.addFilter('markdown', (content) => { | ||
return md.renderInline(content); | ||
}); | ||
|
||
eleventyConfig.addShortcode( | ||
'currentYear', | ||
() => `${String(new Date().getFullYear())}` | ||
); | ||
eleventyConfig.addShortcode( | ||
'currentShortYear', | ||
() => `${String(new Date().getFullYear()).slice(-2)}` | ||
); | ||
|
||
eleventyConfig.addFilter('localeString', function (key) { | ||
// Solution for accessing page front matter from https://stackoverflow.com/a/67746326 | ||
|
||
var page = this.ctx.page; | ||
var str = fs.readFileSync(page.inputPath, 'utf8'); | ||
var data = matter(str).data; | ||
var lang = data.lang || 'en'; | ||
|
||
if (key.includes('.')) { | ||
var keyArr = key.split('.'); | ||
var localeString = localeStrings[keyArr.shift()]; | ||
if (keyArr.length > 0) { | ||
keyArr.forEach((key) => { | ||
localeString = localeString[key]; | ||
}); | ||
} | ||
} else { | ||
var localeString = localeStrings[key]; | ||
} | ||
if (Array.isArray(localeString)) { | ||
localeString = localeString.map((str) => { | ||
return str[lang]; | ||
}); | ||
return localeString; | ||
} | ||
return `${localeString[lang]}`; | ||
}); | ||
}; | ||
|
||
coreConfigObj = { | ||
pathPrefix: '/', | ||
}; | ||
|
||
module.exports = { | ||
configFunc: coreConfigFunc, | ||
configObj: coreConfigObj, | ||
}; |
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,10 @@ | ||
const core = require('./.core-eleventy.js'); | ||
const app = require('./.app-eleventy.js'); | ||
|
||
module.exports = function (eleventyConfig) { | ||
core.configFunc(eleventyConfig); | ||
app.configFunc(eleventyConfig); | ||
|
||
// Return your Object options: | ||
return { ...core.configObj, ...app.configObj }; | ||
}; |
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 @@ | ||
node_modules | ||
dist |
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,10 @@ | ||
{ | ||
"extends": ["html-validate:recommended"], | ||
"rules": { | ||
"void-style": "off", | ||
"prefer-button": "off", | ||
"svg-focusable": "off", | ||
"no-trailing-whitespace": "off", | ||
"long-title": "off" | ||
} | ||
} |
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 @@ | ||
src/jamstack-toolkit/assets/vendor/** | ||
dist/assets/vendor/** |
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,5 @@ | ||
{ | ||
"assetsDestination": "example-pages/assets", | ||
"englishRoot": "example-pages", | ||
"frenchRoot": "pages-dexemple" | ||
} |
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,9 @@ | ||
--- | ||
layout: core/layout.njk | ||
title: "Ontario.ca Jamstack Toolkit" | ||
description: "The best way to start building applications for Ontario.ca." | ||
fr_page_url: "/{{ frenchRoot }}" | ||
date: {{ createDate }} | ||
published_date: {{ createDate }} | ||
--- | ||
English Page. |
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,10 @@ | ||
--- | ||
layout: core/layout.njk | ||
title: "Boîte à outils Jamstack Ontario.ca" | ||
description: "La meilleure façon de commencer à créer des applications pour Ontario.ca." | ||
lang: fr | ||
en_page_url: "/{{ englishRoot }}" | ||
date: {{ createDate }} | ||
published_date: {{ createDate }} | ||
--- | ||
French Page |
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,31 @@ | ||
{ | ||
"name": "{{ projectName }}", | ||
"version": "0.0.1", | ||
"description": "{{ projectDescription }}", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "npm run build && mocha", | ||
"lint": "rm -rf dist && eleventy & npm run htmlValidateDist", | ||
"build": "rm -rf dist && eleventy", | ||
"serve": "eleventy --serve", | ||
"htmlValidateSrc": "html-validate src/**/*.njk", | ||
"htmlValidateDist": "html-validate dist/**/*.html", | ||
"formatCode": "npx prettier --write .", | ||
"installDesignSystem": "export DS_VERSION=0.12.13 && export DS_ZIP_NAME=ontario-design-system.zip && export VEN_DIR=src/assets/vendor && export DS_UNZIP_DIR=$VEN_DIR/ontario-design-system && curl https://designsystem.ontario.ca/dist/ontario-design-system-dist-$DS_VERSION.zip > $VEN_DIR/$DS_ZIP_NAME && unzip -o $VEN_DIR/$DS_ZIP_NAME -d $DS_UNZIP_DIR && rm $VEN_DIR/$DS_ZIP_NAME && rm $DS_UNZIP_DIR/version-release-notes-*.* && rm -rf $DS_UNZIP_DIR/html-samples && rm $DS_UNZIP_DIR/index.html && rm $DS_UNZIP_DIR/package.json && rm -rf $DS_UNZIP_DIR/styles/components && rm -rf $DS_UNZIP_DIR/styles/sass && rm -rf $DS_UNZIP_DIR/fonts/ds-fonts.zip" | ||
}, | ||
"author": "", | ||
"license": "", | ||
"devDependencies": { | ||
"@11ty/eleventy": "^1.0.1", | ||
"commander": "^9.3.0", | ||
"dotenv": "^16.0.0", | ||
"fs-extra": "^10.1.0", | ||
"html-validate": "^6.1.0", | ||
"inquirer": "^9.0.0", | ||
"mocha": "^9.1.3", | ||
"prettier": "2.6.2", | ||
"simple-git": "^3.10.0", | ||
"uuid": "^8.3.2", | ||
"validate-npm-package-name": "^4.0.0" | ||
} | ||
} |
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,16 @@ | ||
--- | ||
redirect: "/{{ englishRoot }}" | ||
--- | ||
{% raw %} | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="refresh" content="0; url='{{ redirect }}'" /> | ||
<title>Redirecting...</title> | ||
</head> | ||
<body> | ||
Redirecting to: <a href="{{ redirect }}">{{ redirect }}</a> | ||
</body> | ||
</html> | ||
{% endraw %} |
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,47 @@ | ||
const assert = require('assert'); | ||
const fs = require('fs'); | ||
|
||
const enRoot = '{{ englishRoot }}'; | ||
const frRoot = '{{ frenchRoot }}'; | ||
const assetsDestination = '{{ assetsDestination }}'; | ||
const odsDir = `dist/${assetsDestination}/vendor/ontario-design-system`; | ||
const enPageLocation = `dist/${enRoot}/index.html`; | ||
const frPageLocation = `dist/${frRoot}/index.html`; | ||
const expectedNoDsFiles = 5; | ||
|
||
describe('Site generation', function () { | ||
describe('Top-level redirect page present', function () { | ||
it('should generate a top-level redirect page', function () { | ||
assert(fs.existsSync('dist/index.html')); | ||
}); | ||
}); | ||
describe('English-language example page present', function () { | ||
it('should generate an English-language example page', function () { | ||
assert(fs.existsSync(enPageLocation)); | ||
}); | ||
}); | ||
describe('French-language example page present', function () { | ||
it('should generate a French-language example page', function () { | ||
assert(fs.existsSync(frPageLocation)); | ||
}); | ||
}); | ||
describe('Ontario design system inclusion', function () { | ||
it('should copy over the design system assets', function () { | ||
assert( | ||
fs.existsSync(odsDir), | ||
'Expected directory for design system not found' | ||
); | ||
const actualLength = fs.readdirSync(odsDir).length; | ||
const expectedLength = expectedNoDsFiles; | ||
assert( | ||
actualLength === expectedLength, | ||
`The expected number of files in design system directory were not found, expected ${expectedLength}, got ${actualLength}` | ||
); | ||
}); | ||
}); | ||
describe('Site CSS file present', function () { | ||
it('Should copy over the site CSS file', function () { | ||
assert(fs.existsSync(`dist/${assetsDestination}/css/style.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 @@ | ||
v17.0.1 |
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,21 @@ | ||
# See https://pre-commit.com for more information | ||
# See https://pre-commit.com/hooks.html for more hooks | ||
repos: | ||
- repo: https://git.ontariogovernment.ca/service-integration/team-tools/pre-commit | ||
rev: d913f473ee7720857a67e5bbabdde3c6a4307096 | ||
hooks: | ||
- id: npm-run-test | ||
always_run: true | ||
stages: [commit] | ||
- id: npm-run-lint | ||
always_run: true | ||
stages: [commit] | ||
- id: npm-run-format-code | ||
always_run: true | ||
stages: [commit] | ||
- id: check-whitespace | ||
always_run: true | ||
stages: [commit] | ||
- id: add-jira-ref | ||
always_run: true | ||
stages: [prepare-commit-msg] |
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,9 @@ | ||
# ignore artifacts | ||
node_modules | ||
dist | ||
|
||
# ignore design system | ||
src/assets/vendor/* | ||
|
||
# ignore njk files | ||
*.njk |
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,17 @@ | ||
{ | ||
"printWidth": 80, | ||
"tabWidth": 2, | ||
"semi": true, | ||
"singleQuote": true, | ||
"trailingComma": "es5", | ||
"bracketSpacing": true, | ||
"bracketSameLine": true, | ||
"overrides": [ | ||
{ | ||
"files": "*.md", | ||
"options": { | ||
"singleQuote": false | ||
} | ||
} | ||
] | ||
} |
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,5 @@ | ||
# Contribuer à la boîte à outils Jamstack Ontario.ca | ||
|
||
[Disponible en anglais](CONTRIBUTING.md) | ||
|
||
Pour des renseignements sur la façon de contribuer à la boîte à outils Jamstack Ontario.ca, consultez la section des lignes directrices sur les contributions de la documentation affichée dans l’équipe de la trousse Jamstack Ontario.ca dans Microsoft Teams. |
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,5 @@ | ||
# Contributing to the Ontario.ca Jamstack Toolkit | ||
|
||
[Available in French](CONTRIBUTING.fr.md) | ||
|
||
For information on how to contribute to the Ontario.ca Jamstack Toolkit, check out the contribution guidelines section of the documentation posted in the Ontario.ca Jamstack Toolkit team in Microsoft Teams. |
Oops, something went wrong.