Skip to content

Commit

Permalink
Merge pull request #229 from ceph/release/1.0.0
Browse files Browse the repository at this point in the history
v1.0.0 release 🎉
  • Loading branch information
adamduncan authored Jun 23, 2021
2 parents 581f762 + 69df840 commit d6b140a
Show file tree
Hide file tree
Showing 1,452 changed files with 131,725 additions and 6 deletions.
157 changes: 157 additions & 0 deletions .eleventy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
const fs = require('fs');

// Plugins
const eleventyNavigationPlugin = require('@11ty/eleventy-navigation');
const build = require('./src/_data/build');
const i18n = require('eleventy-plugin-i18n');
const markdownIt = require('markdown-it');
const markdownItAnchor = require('markdown-it-anchor');
const sitemap = require('@quasibit/eleventy-plugin-sitemap');
const translations = require('./src/_data/i18n');

module.exports = function (eleventyConfig) {
console.log(process.env.NODE_ENV);

// Hot-reload site on CSS changes
eleventyConfig.addWatchTarget('src/css');
eleventyConfig.addWatchTarget('src/_11ty');

// Collections
const collectionsDir = `./src/_11ty/collections`;
eleventyConfig.addCollection('primary', require(`${collectionsDir}/primary.js`));
eleventyConfig.addCollection('sitemap', require(`${collectionsDir}/sitemap.js`));

// Filters
const filtersDir = `./src/_11ty/filters`;
eleventyConfig.addFilter('chunkByYear', require(`${filtersDir}/chunkByYear.js`));
eleventyConfig.addFilter('cleanCardContent', require(`${filtersDir}/cleanCardContent.js`));
eleventyConfig.addFilter('cleanSearchRaw', require(`${filtersDir}/cleanSearchRaw.js`));
eleventyConfig.addFilter('endsWith', require(`${filtersDir}/endsWith.js`));
eleventyConfig.addFilter('formatDate', require(`${filtersDir}/formatDate.js`));
eleventyConfig.addFilter('formatDateRange', require(`${filtersDir}/formatDateRange.js`));
eleventyConfig.addFilter('getArticleType', require(`${filtersDir}/getArticleType.js`));
eleventyConfig.addFilter('getCollectionByTag', require(`${filtersDir}/getCollectionByTag.js`));
eleventyConfig.addFilter('getCollectionTags', require(`${filtersDir}/getCollectionTags.js`));
eleventyConfig.addFilter('getItems', require(`${filtersDir}/getItems.js`));
eleventyConfig.addFilter('getItemsByLocale', require(`${filtersDir}/getItemsByLocale.js`));
eleventyConfig.addFilter('getItemsInFuture', require(`${filtersDir}/getItemsInFuture.js`));
eleventyConfig.addFilter('getItemsInPast', require(`${filtersDir}/getItemsInPast.js`));
eleventyConfig.addFilter('getSingleDigitFromDate', require(`${filtersDir}/getSingleDigitFromDate.js`));
eleventyConfig.addFilter('isInFuture', require(`${filtersDir}/isInFuture.js`));
eleventyConfig.addFilter('objectValues', require(`${filtersDir}/objectValues.js`));
eleventyConfig.addFilter('randomize', require(`${filtersDir}/randomize.js`));
eleventyConfig.addFilter('removeHtml', require(`${filtersDir}/removeHtml.js`));
eleventyConfig.addFilter('removeTags', require(`${filtersDir}/removeTags.js`));
eleventyConfig.addFilter('startsWith', require(`${filtersDir}/startsWith.js`));
eleventyConfig.addFilter('truncate', require(`${filtersDir}/truncate.js`));

// Layout aliases — TBC if this is bringing enough benefit
eleventyConfig.addLayoutAlias('base', 'layouts/_base.njk');
eleventyConfig.addLayoutAlias('blog-post', 'layouts/blog-post.njk');
eleventyConfig.addLayoutAlias('case-study', 'layouts/case-study.njk');
eleventyConfig.addLayoutAlias('content', 'layouts/content.njk');
eleventyConfig.addLayoutAlias('content-simple', 'layouts/content-simple.njk');
eleventyConfig.addLayoutAlias('content-support', 'layouts/content-support.njk');
eleventyConfig.addLayoutAlias('event', 'layouts/event.njk');
eleventyConfig.addLayoutAlias('home', 'layouts/home.njk');
eleventyConfig.addLayoutAlias('press-release', 'layouts/press-release.njk');
eleventyConfig.addLayoutAlias('hub-community', 'layouts/hub-community.njk');
eleventyConfig.addLayoutAlias('hub-developers', 'layouts/hub-developers.njk');
eleventyConfig.addLayoutAlias('hub-discover', 'layouts/hub-discover.njk');
eleventyConfig.addLayoutAlias('hub-foundation', 'layouts/hub-foundation.njk');
eleventyConfig.addLayoutAlias('hub-news', 'layouts/hub-news.njk');
eleventyConfig.addLayoutAlias('hub-users', 'layouts/hub-users.njk');
eleventyConfig.addLayoutAlias('listing-blog-posts', 'layouts/listing-blog-posts.njk');
eleventyConfig.addLayoutAlias('listing-blog-post-categories', 'layouts/listing-blog-post-categories.njk');
eleventyConfig.addLayoutAlias('listing-blog-search', 'layouts/listing-blog-search.njk');
eleventyConfig.addLayoutAlias('listing-case-studies', 'layouts/listing-case-studies.njk');
eleventyConfig.addLayoutAlias('listing-case-study-categories', 'layouts/listing-case-study-categories.njk');
eleventyConfig.addLayoutAlias('listing-events', 'layouts/listing-events.njk');
eleventyConfig.addLayoutAlias('listing-event-categories', 'layouts/listing-event-categories.njk');
eleventyConfig.addLayoutAlias('listing-planet-ceph-articles', 'layouts/listing-planet-ceph-articles.njk');
eleventyConfig.addLayoutAlias('listing-press-releases', 'layouts/listing-press-releases.njk');
eleventyConfig.addLayoutAlias('listing-press-release-categories', 'layouts/listing-press-release-categories.njk');
eleventyConfig.addLayoutAlias('navigation', 'layouts/navigation.njk');

// Shortcodes
const shortcodesDir = `./src/_11ty/shortcodes`;
eleventyConfig.addShortcode('ArticleCard', require(`${shortcodesDir}/ArticleCard.js`));
eleventyConfig.addShortcode('YouTube', require(`${shortcodesDir}/YouTube.js`));

// Transforms
const transformsDir = `./src/_11ty/transforms`;
eleventyConfig.addTransform('htmlmin', require(`${transformsDir}/html-minifier.js`));

// Passthrough copy
eleventyConfig.addPassthroughCopy('./src/assets/**/*.json');

// Plugins
eleventyConfig.addPlugin(eleventyNavigationPlugin);
eleventyConfig.addPlugin(i18n, {
translations,
fallbackLocales: {
'*': 'en',
},
});
eleventyConfig.addPlugin(sitemap, {
sitemap: {
hostname: build.isProduction ? 'https://ceph.io' : 'https://develop.ceph.io',
},
});

// Markdown overrides
let markdownLibrary = markdownIt({
html: true,
linkify: true,
}).use(markdownItAnchor, {
level: [2, 3, 4, 5, 6],
permalink: true,
permalinkClass: 'link-anchor',
permalinkSymbol: '¶',
});

eleventyConfig.setLibrary('md', markdownLibrary);

// Run after the build ends
eleventyConfig.on('afterBuild', () => {
require('./scripts/search-index.js');
});

// Browsersync
eleventyConfig.setBrowserSyncConfig({
callbacks: {
ready: function (err, bs) {
bs.addMiddleware('*', (req, res) => {
// Dev mode redirect for root path to default language
if (req.url === '/') {
res.writeHead(302, {
location: '/en/',
});
res.end();
}

// 404 on --serve
// https://www.11ty.dev/docs/quicktips/not-found/#with-serve
const content_404 = fs.readFileSync('dist/en/404.html');
res.write(content_404);
res.writeHead(404);
res.end();
});
},
},
});

// Configuration
eleventyConfig.setDataDeepMerge(true);
// TBC if this is a bit heavy-handed
// See https://www.11ty.dev/docs/data-deep-merge/

return {
htmlTemplateEngine: 'njk',
markdownTemplateEngine: 'njk',
dir: {
input: 'src',
output: 'dist',
},
};
};
1 change: 1 addition & 0 deletions .eleventyignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src/**/README.md
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*.log
npm-debug.*

.DS_Store
node_modules
dist
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v14.2.0
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
dist
package.json
package-lock.json
32 changes: 32 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"singleQuote": true,
"arrowParens": "avoid",
"overrides": [
{
"files": "*.html",
"options": {
"printWidth": 140,
"jsxBracketSameLine": true
}
},
{
"files": "*.css",
"options": {
"printWidth": 140,
"singleQuote": false
}
},
{
"files": ".eleventy.js",
"options": {
"printWidth": 140
}
},
{
"files": "*.md",
"options": {
"singleQuote": false
}
}
]
}
9 changes: 9 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"editor.renderWhitespace": "all",
"editor.tabSize": 2,
"editor.formatOnSave": true,
"[json]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
"[javascript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
"[javascriptreact]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
"[html]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }
}
Loading

0 comments on commit d6b140a

Please sign in to comment.