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

Commit

Permalink
release: public 1.3.1
Browse files Browse the repository at this point in the history
JIRA-Ref: release/1.3.1
  • Loading branch information
aharnum-ods committed Mar 7, 2023
0 parents commit fcc9ffc
Show file tree
Hide file tree
Showing 374 changed files with 15,995 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .app-eleventy.js
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,
};
83 changes: 83 additions & 0 deletions .core-eleventy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
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');
const cc = require('config-chain');

var appConf = cc(cc.find('.jam-on/app/conf.json'));
var appVersionMetadata = cc(cc.find('.jam-on/app/versionMetadata.json'));
var toolkitVersion;

try {
toolkitVersion = appVersionMetadata.get('tagOrBranch');
} catch (e) {
try {
toolkitVersion = appConf.get('toolkitPackageJSONVersion');
} catch (e) {
toolkitVersion = 'version undetermined';
console.warn(
"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."
);
}
}

coreConfigFunc = function (eleventyConfig) {
const md = new markdownIt({
html: true,
});

eleventyConfig.addFilter('markdown', (content) => {
return md.renderInline(content);
});

eleventyConfig.addShortcode('toolkitVersion', () => toolkitVersion);

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,
};
10 changes: 10 additions & 0 deletions .eleventy.js
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 };
};
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
dist
tmp
10 changes: 10 additions & 0 deletions .htmlvalidate.json
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"
}
}
2 changes: 2 additions & 0 deletions .htmlvalidateignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
src/jamstack-toolkit/assets/vendor/**
dist/assets/vendor/**
6 changes: 6 additions & 0 deletions .jam-on/app/conf.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"assetsDestination": "example-pages/assets",
"englishRoot": "example-pages",
"frenchRoot": "pages-dexemple",
"toolkitPackageJSONVersion": "not an initialized project"
}
21 changes: 21 additions & 0 deletions .jam-on/core/templates/README.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# {{ projectName }}

Built with the [Ontario.ca Jamstack Toolkit](https://github.com/ongov/Ontario.ca-Jamstack-Toolkit) - see `README.jamstack` for more details.

## Project Description

{{ projectDescription }}

## About this README.md file

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.

[Make a README](https://www.makeareadme.com/) is one place to learn about creating a good README file.

## Suggested Information

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:

* What is the purpose of the project?
* Who should someone contact to get further information about it?
* How would a new developer get started working on the project?
9 changes: 9 additions & 0 deletions .jam-on/core/templates/en.njk
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.
10 changes: 10 additions & 0 deletions .jam-on/core/templates/fr.njk
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
31 changes: 31 additions & 0 deletions .jam-on/core/templates/package.njk
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"
}
}
16 changes: 16 additions & 0 deletions .jam-on/core/templates/redirect.njk
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 %}
47 changes: 47 additions & 0 deletions .jam-on/core/templates/test.njk
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`));
});
});
});
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v17.0.1
21 changes: 21 additions & 0 deletions .pre-commit-config.yaml
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]
9 changes: 9 additions & 0 deletions .prettierignore
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
17 changes: 17 additions & 0 deletions .prettierrc.json
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
}
}
]
}
5 changes: 5 additions & 0 deletions CONTRIBUTING.fr.md
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.
5 changes: 5 additions & 0 deletions CONTRIBUTING.md
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.
Loading

0 comments on commit fcc9ffc

Please sign in to comment.