Skip to content

Commit a70d81e

Browse files
authored
Upgrade site building components (and clean up) (#425)
1 parent 3db1496 commit a70d81e

File tree

19 files changed

+3449
-3979
lines changed

19 files changed

+3449
-3979
lines changed

.eleventy.js

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,31 @@ const yaml = require('js-yaml');
22
const navigationPlugin = require('@11ty/eleventy-navigation');
33
const path = require('path');
44

5-
// Generate the shortened commit hash and create (overwrite) `build_info.json`
6-
// file. This file will eventually be added to the footer of the page.
7-
const writeBuildInfoToFile = () => {
8-
const version = require('./package.json').version;
9-
const commitHash = require('child_process')
10-
.execSync('git rev-parse --short HEAD').toString().trim();
11-
const commitDate = require('child_process')
12-
.execSync('git show -s --format=%cd --date=short').toString().trim();
13-
const currentYear = (new Date()).getFullYear();
14-
const jsonData = JSON.stringify({
15-
version: version,
16-
revision: commitHash,
17-
lastUpdated: commitDate,
18-
copyrightYear: currentYear
5+
module.exports = function (eleventyConfig) {
6+
eleventyConfig.addGlobalData('build_info', () => {
7+
const version = require('./package.json').version;
8+
const commitHash = require('child_process')
9+
.execSync('git rev-parse --short HEAD')
10+
.toString()
11+
.trim();
12+
const commitDate = require('child_process')
13+
.execSync('git show -s --format=%cd --date=short')
14+
.toString()
15+
.trim();
16+
const currentYear = new Date().getFullYear();
17+
return {
18+
version: version,
19+
revision: commitHash,
20+
lastUpdated: commitDate,
21+
copyrightYear: currentYear,
22+
};
1923
});
20-
const fs = require('fs');
21-
fs.writeFileSync('src/_data/build_info.json', jsonData);
22-
};
23-
24-
module.exports = function(eleventyConfig) {
25-
writeBuildInfoToFile();
2624

2725
// See .eleventyignore for files to ignore.
2826
eleventyConfig.setUseGitIgnore(false);
2927

3028
// To enable YAML files in `_data`.
31-
eleventyConfig.addDataExtension('yaml', contents => yaml.load(contents));
29+
eleventyConfig.addDataExtension('yaml', (contents) => yaml.load(contents));
3230

3331
// To handle relative paths and basic navigation via breadcrumbs.
3432
eleventyConfig.addPlugin(navigationPlugin);
@@ -82,11 +80,11 @@ module.exports = function(eleventyConfig) {
8280
'src/sitemap.xml',
8381
'src/lib/**/*.js',
8482
'src/lib/**/*.html',
85-
].map(path => eleventyConfig.addPassthroughCopy(path));
83+
].map((path) => eleventyConfig.addPassthroughCopy(path));
8684

8785
// eleventyConfig.addPassthroughCopy('src/favicon');
8886

8987
return {
90-
dir: {input: 'src'}
88+
dir: { input: 'src' },
9189
};
9290
};

.github/workflows/ci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ jobs:
2929
if [ -n "$FILES" ]; then
3030
echo "Linting changed files:"
3131
echo "$FILES"
32-
echo "$FILES" | xargs npx prettier --check
3332
echo "$FILES" | grep -E '\.(js|jsx|ts|tsx)$' | xargs npx eslint || true
3433
else
3534
echo "No relevant files changed."

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.DS_Store
2+
.vscode/
23
node_modules/
34
_site/
45

.prettierrc.json

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)