Remove beta

This commit is contained in:
Julien Bisconti 2020-01-11 09:09:10 +01:00
parent 6ae26b9fd6
commit 2de40bd9aa
No known key found for this signature in database
GPG Key ID: 62772C6698F736CB
9 changed files with 35 additions and 604 deletions

View File

@ -1,31 +1,31 @@
module.exports = {
"env": {
"browser": true,
"node": true
},
"extends": [
"airbnb-base",
"plugin:import/errors",
"plugin:import/warnings",
"prettier",
],
"plugins": [
"import",
"prettier",
],
"rules": {
"import/order": ["error", {
"groups": ["builtin", "external", "parent", "sibling", "index"],
"newlines-between": "never"
}],
"no-console": 0,
"prefer-template": 2,
"prettier/prettier": [
"error",
{
"singleQuote": true,
"trailingComma": "all",
}
]
env: {
browser: true,
node: true
},
extends: [
'airbnb-base',
'plugin:import/errors',
'plugin:import/warnings',
'prettier'
],
plugins: ['import', 'prettier'],
rules: {
'import/order': [
'error',
{
groups: ['builtin', 'external', 'parent', 'sibling', 'index'],
'newlines-between': 'never'
}
};
],
'no-console': 0,
'prefer-template': 2,
'prettier/prettier': [
'error',
{
singleQuote: true,
trailingComma: 'all'
}
]
}
};

5
.prettierrc Normal file
View File

@ -0,0 +1,5 @@
{
"semi": true,
"trailingComma": "all",
"singleQuote": true
}

190
build.js
View File

@ -1,7 +1,5 @@
const fs = require('fs-extra');
const fetch = require('node-fetch');
const cheerio = require('cheerio');
const dayjs = require('dayjs');
const showdown = require('showdown');
const Parcel = require('parcel-bundler');
const sm = require('sitemap');
@ -24,26 +22,8 @@ process.on('unhandledRejection', handleFailure);
// --- FILES
const README = 'README.md';
const WEBSITE_FOLDER = 'website';
const DATA_FOLDER = 'data';
const LATEST_FILENAME = `${DATA_FOLDER}/latest`;
const MAPPING = `${DATA_FOLDER}/mapping.json`;
const CATEGORY = `${DATA_FOLDER}/category.json`;
const indexTemplate = `${WEBSITE_FOLDER}/index.tmpl.html`;
const indexDestination = `${WEBSITE_FOLDER}/index.html`;
const tableTemplate = `${WEBSITE_FOLDER}/table.tmpl.html`;
const tableDestination = `${WEBSITE_FOLDER}/table.html`;
// --- CONFIG
const valueNames = [
'name',
'description',
'homepage',
'star',
'updated',
'language',
'license',
'author',
];
const sitemapOpts = {
hostname: 'https://awesome-docker.netlify.com/',
@ -56,177 +36,9 @@ const sitemapOpts = {
lastmodrealtime: true,
lastmodfile: 'dist/index.html',
},
{
url: '/table.html',
changefreq: 'daily',
priority: 0.8,
lastmodrealtime: true,
lastmodfile: 'dist/table.html',
},
],
};
// --- FORMAT
const loadEmoji = () =>
fetch('https://api.github.com/emojis')
.then(r => r.json())
.catch(handleFailure);
let emojiMapURL = {};
const emojify = text => {
if (!text) return text;
const colonWrapped = /(:[\w\-+]+:)/g;
const result = text.replace(colonWrapped, match => {
const name = match.replace(/:/g, '');
const url = emojiMapURL[name];
return url ? `<img src="${url}" class="emoji" alt="${name}" />` : match;
});
return result || text;
};
const getLastUpdate = updated => {
const updt = Number(dayjs(updated).diff(dayjs(), 'days'));
if (updt < 0) {
if (Math.abs(updt) === 1) return `1 day ago`;
return `${Math.abs(updt)} days ago`;
} else if (updt === 0) return 'today';
return updated;
};
const mapHomePage = h => {
if (h === 'manageiq.org') return 'https://manageiq.org';
else if (h === 'dev-sec.io') return 'https://dev-sec.io';
return h;
};
const mapLicense = l => {
if (l === 'GNU Lesser General Public License v3.0') return 'GNU LGPL v3.0';
else if (l === 'GNU General Public License v2.0') return 'GNU GPL v2.0';
else if (l === 'GNU General Public License v3.0') return 'GNU GPL v3.0';
else if (l === 'BSD 3-Clause "New" or "Revised" License')
return 'BSD 3-Clause';
else if (l === 'BSD 2-Clause "Simplified" License') return 'BSD 2-Clause';
return l;
};
const formatEntry = (
{
name,
html_url: repoURL,
description,
homepage,
stargazers_count: stargazers,
pushed_at: updated,
language,
license,
owner,
categoryName,
},
i,
) =>
[
`<li data-id="${i}">`,
`<a href="${repoURL}" class="link ${valueNames[0]}">${name}</a>`,
`<p class="${valueNames[1]}">${emojify(description) || '-'}</p>`,
`<p class="${
valueNames[4]
} timestamp" data-timestamp="${updated}">Last code update: ${getLastUpdate(
updated,
)}</p>`,
(homepage &&
`<a href="${mapHomePage(homepage)}" class="link ${
valueNames[2]
}">website</a>`) ||
'<p></p>',
`<p class="${
valueNames[3]
} timestamp" title="Stars on GitHub" data-stars="${stargazers}">⭐️${stargazers}</p>`,
(language && `<p class="${valueNames[5]}">${language}</p>`) || '<p></p>',
(license &&
license.url !== null &&
`<a href="${license.url}" class="link ${valueNames[6]}">${mapLicense(
license.name,
)}</a>`) ||
'<p></p>',
`<p title="Category">${categoryName}</p>`,
owner &&
`<a href="${owner.html_url}" class="link ${valueNames[7]}">${
owner.login
}</a>`,
'</li>',
].join('');
const buttonHTLM = valueNames
.filter(x => !['description', 'homepage'].includes(x))
.map(v => `<button class="sort" data-sort="${v}">${v} </button>`)
.join('');
const processMetadata = metaData =>
[
`<div class="container">`,
`<div class="searchbar"><input class="search" placeholder="Search" /></div>`,
`<div class="sortbtn"><p>Sort by</p>${buttonHTLM}</div>`,
`</div>`,
'<ul class="list">',
Object.values(metaData)
.map(formatEntry)
.join(''),
'</ul>',
].join('');
const normalizedMetadata = ([mapping, category, data]) =>
data.reduce((acc, repo) => {
const m = mapping[repo.html_url];
if (!m) {
console.log('MISSING:', { repo: repo.html_url });
return acc;
}
const c = m && category[m.category];
if (!c) {
console.log('CATEGORY MISSING', { mapping: m });
return acc;
}
return {
...acc,
...{
[repo.html_url.toLowerCase()]: {
...repo,
ownerType: repo.owner && repo.owner.type,
categoryName: c.name,
categoryDescription: c.description,
status: m.status,
},
},
};
}, {});
async function processTable() {
try {
LOG.debug('Loading files...', { LATEST_FILENAME, tableTemplate });
const latestFilename = await fs.readFile(LATEST_FILENAME, 'utf8');
LOG.debug({ latestFilename });
const data = await Promise.all([
fs.readJSON(MAPPING),
fs.readJSON(CATEGORY),
fs.readJSON(latestFilename),
]);
const metaData = normalizedMetadata(data);
LOG.debug({ metaData });
const template = await fs.readFile(tableTemplate, 'utf8');
LOG.debug('Processing template');
const $ = cheerio.load(template);
$('#md').append(processMetadata(metaData));
LOG.debug('Writing table.html');
await fs.outputFile(tableDestination, $.html(), 'utf8');
LOG.debug('✅ DONE 👍');
} catch (err) {
handleFailure(err);
}
}
async function processIndex() {
const converter = new showdown.Converter({
omitExtraWLInCodeBlocks: true,
@ -286,8 +98,6 @@ const bundle = () => {
};
async function main() {
emojiMapURL = await loadEmoji();
await processTable();
await processIndex();
await bundle();
}

View File

@ -18,11 +18,8 @@
"homepage": "https://github.com/veggiemonk/awesome-docker#readme",
"dependencies": {
"cheerio": "1.0.0-rc.3",
"dayjs": "1.8.19",
"draftlog": "1.0.12",
"fs-extra": "8.1.0",
"list.js": "1.5.0",
"node-fetch": "2.6.0",
"parcel-bundler": "1.12.4",
"rimraf": "3.0.0",
"showdown": "1.9.1",
@ -38,4 +35,4 @@
"eslint-plugin-prettier": "3.1.2",
"prettier": "1.19.1"
}
}
}

View File

@ -1,19 +0,0 @@
const List = require('list.js');
const main = () => {
const userList = new List('md', {
valueNames: [
'name',
'description',
'homepage',
{ name: 'star', attr: 'data-stars' },
{ name: 'updated', attr: 'data-timestamp' },
'language',
'license',
'author',
],
});
console.log(`There are ${userList.size()} projects`);
};
main();

View File

@ -207,8 +207,6 @@
<a href="https://github.com/veggiemonk/awesome-docker" class="btn"
>View on GitHub</a
>
<a href="table.html" class="btn">View Beta</a>
<br />
<!-- Place this tag where you want the button to render. -->
<a
class="github-button"

View File

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
<!-- created with Free Online Sitemap Generator www.xml-sitemaps.com -->
<url>
<loc>http://awesome-docker.netlify.com/</loc>
<lastmod>2018-04-22T10:28:08+00:00</lastmod>
</url>
</urlset>

0
website/style.css vendored
View File

View File

@ -1,344 +0,0 @@
<!DOCTYPE html>
<html class="no-js" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Cache-control" content="public">
<meta charset="UTF-8">
<title>Awesome-docker</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#3685b3">
<meta name="description" content="A curated list of Docker resources and projects.">
<meta name="keywords" content="free and open-source open source projects for docker moby kubernetes linux awesome awesome-list container tools dockerfile list moby docker-container docker-image docker-environment docker-deployment docker-swarm docker-api docker-monitoring docker-machine docker-security docker-registry">
<meta name="google-site-verification" content="_yiugvz0gCtfsBLyLl1LnkALXb6D4ofiwCyV1XOlYBM" />
<link rel="icon" type="image/png" href="favicon.png">
<style>
:root {
--main-list-header: #3685b3;
--main-list-footer: #3685b3;
}
* {
box-sizing: border-box
}
html {
font-family: sans-serif;
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%
}
body {
padding: 0;
margin: 0;
font-family: Open Sans, Helvetica Neue, Helvetica, Arial, sans-serif;
font-size: 16px;
line-height: 1.5;
color: #606c71
}
section {
display: block
}
a {
background-color: transparent;
color: #3685b3;
text-decoration: none
}
strong {
font-weight: 700
}
h1 {
font-size: 2em;
margin: .67em 0
}
img {
border: 0
}
/*******************************************************/
.btn {
display: inline-block;
margin-bottom: 1rem;
color: hsla(0, 0%, 100%, .7);
background-color: hsla(0, 0%, 100%, .08);
border: 1px solid hsla(0, 0%, 100%, .2);
border-radius: .3rem
}
.page-header {
color: #fff;
text-align: center;
background-color: #3685b3;
background-image: linear-gradient(120deg, #155799, #5DBCD2)
}
.project-name {
margin-top: 0;
margin-bottom: .1rem
}
.project-tagline {
margin-bottom: 2rem;
font-weight: 400;
opacity: .7
}
/*******************************************************/
.container {
display: grid;
grid-template-columns: 1fr 1fr;
margin-top: 1rem;
}
/*******************************************************/
.searchbar {
display: flex;
justify-content: center;
}
.searchbar > .search {
border-radius: .25rem;
padding: .5rem 1rem .5rem 1rem;
margin: 1rem 0 1rem 0;
width: 18rem;
font-size: 2.5rem;
}
/*******************************************************/
.sortbtn {
display: grid;
grid-template-columns: repeat(4, 6.5rem);
justify-content: right;
padding-right: 1rem;
}
.sortbtn :first-child {
grid-row: span 4;
align-self: center;
}
.sort {
border-radius: 6px;
border: 1px solid white;
color: #fff;
text-decoration: none;
background-color: var(--main-list-header);
height: 2rem;
}
.sort:hover {
text-decoration: none;
background-color: #1b8aba;
}
.sort:focus {
outline: none;
}
.sort:after {
width: 0;
height: 0;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-bottom: 5px solid transparent;
content: "";
position: relative;
top: -10px;
right: -5px;
}
.sort.asc:after {
width: 0;
height: 0;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-top: 5px solid #fff;
content: "";
position: relative;
top: 13px;
right: -5px;
}
.sort.desc:after {
width: 0;
height: 0;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-bottom: 5px solid #fff;
content: "";
position: relative;
top: -10px;
right: -5px;
}
/*=========================================================================*/
.emoji {
height: 1rem;
width: 1rem;
}
/*=========================================================================*/
.list {
display: grid;
grid-gap: 1rem;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
line-height: 1;
padding: 1rem;
margin: 0;
}
.list > li {
display: grid;
grid-template-rows: 2rem 1fr 2rem 2rem 2rem;
grid-template-columns: 1fr 1fr;
list-style: none;
box-shadow: 2px 2px 6px 0px rgba(0, 0, 0, 0.3);
border-radius: 1rem;
}
li > .description,
li > .name,
li > .updated {
grid-column: span 2;
}
.list li > * {
text-align: center;
margin: 0;
padding-top: .25rem;
padding-bottom: .25rem;
}
.link {
text-decoration: underline;
}
.list li > :first-child {
color: white;
background-color: var(--main-list-header);
border-radius: .4rem .4rem 0 0;
}
.list li > .description {
border-bottom: 1px solid var(--main-list-header);
word-wrap: break-word;
padding: 1rem;
}
.list li > .updated {
border-bottom: 1px solid var(--main-list-header);
}
.list > li > :nth-last-child(3),
.list > li > :nth-last-child(4) {
align-self: flex-end;
}
.list > li > :last-child {
color: white;
background-color: var(--main-list-footer);
border-radius: 0 0 .4rem 0;
padding: .5rem 0 .5rem 0;
}
.list > li > :nth-last-child(2) {
color: lightgoldenrodyellow;
background-color: var(--main-list-footer);
border-radius: 0 0 0 .4rem;
padding: .5rem 0 .5rem 0;
font-weight: bold;
}
.name {
font-size: x-large;
text-decoration: underline;
}
.star {
font-weight: bold;
}
/*******************************************************/
@media screen and (min-width:64em) {
.btn {
padding: .75rem 1rem
}
.page-header {
padding: 5rem 6rem
}
.project-name {
font-size: 3.25rem
}
.project-tagline {
font-size: 1.25rem
}
.main-content {
font-size: 1.1rem;
margin: 0 8rem 0 8rem;
}
}
@media screen and (min-width:42em) and (max-width:64em) {
.btn {
padding: .6rem .9rem;
font-size: .9rem
}
.page-header {
padding: 3rem 4rem
}
.project-name {
font-size: 2.25rem
}
.project-tagline {
font-size: 1.15rem
}
.main-content {
font-size: 1.1rem
}
}
@media screen and (max-width:42em) {
.btn {
display: block;
width: 100%;
padding: .75rem;
font-size: .9rem
}
.page-header {
padding: 2rem 1rem
}
.project-name {
font-size: 1.75rem
}
.project-tagline {
font-size: 1rem
}
.main-content {
font-size: 1rem
}
.container {
grid-template-columns: 1fr;
justify-content: center;
}
.sortbtn {
display: grid;
grid-template-columns: repeat(3, 6.5rem);
justify-content: center;
}
}
</style>
<!-- <link rel="stylesheet" href="style.css"> -->
</head>
<body>
<section class="page-header">
<h1 class="project-name">Awesome-docker</h1>
<h2 class="project-tagline">A curated list of Docker resources and projects</h2>
<a href="https://github.com/veggiemonk/awesome-docker" class="btn">View on GitHub</a>
<br>
<!-- Place this tag where you want the button to render. -->
<a class="github-button" href="https://github.com/veggiemonk/awesome-docker" data-icon="octicon-star" data-size="large" data-count-href="/veggiemonk/awesome-docker/stargazers"
data-show-count="true" data-count-aria-label="# stargazers on GitHub" aria-label="Star veggiemonk/awesome-docker on GitHub">Star</a>
</section>
<section id="md" class="main-content"></section>
<script src="index.js"></script>
<!--Place this tag in your head or just before your close body tag. -->
<script async defer src="https://buttons.github.io/buttons.js"></script>
</body>
</html>