1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-11-24 08:12:24 +02:00

Doc: Added sponsors and automatically build sponsor list on README

This commit is contained in:
Laurent Cozic 2021-07-26 18:21:19 +01:00
parent 8920db5537
commit 361802273d
11 changed files with 96 additions and 23 deletions

View File

@ -867,6 +867,9 @@ packages/lib/Synchronizer.js.map
packages/lib/TaskQueue.d.ts packages/lib/TaskQueue.d.ts
packages/lib/TaskQueue.js packages/lib/TaskQueue.js
packages/lib/TaskQueue.js.map packages/lib/TaskQueue.js.map
packages/lib/array.d.ts
packages/lib/array.js
packages/lib/array.js.map
packages/lib/commands/historyBackward.d.ts packages/lib/commands/historyBackward.d.ts
packages/lib/commands/historyBackward.js packages/lib/commands/historyBackward.js
packages/lib/commands/historyBackward.js.map packages/lib/commands/historyBackward.js.map

3
.gitignore vendored
View File

@ -852,6 +852,9 @@ packages/lib/Synchronizer.js.map
packages/lib/TaskQueue.d.ts packages/lib/TaskQueue.d.ts
packages/lib/TaskQueue.js packages/lib/TaskQueue.js
packages/lib/TaskQueue.js.map packages/lib/TaskQueue.js.map
packages/lib/array.d.ts
packages/lib/array.js
packages/lib/array.js.map
packages/lib/commands/historyBackward.d.ts packages/lib/commands/historyBackward.d.ts
packages/lib/commands/historyBackward.js packages/lib/commands/historyBackward.js
packages/lib/commands/historyBackward.js.map packages/lib/commands/historyBackward.js.map

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@ -64,19 +64,21 @@ The Web Clipper is a browser extension that allows you to save web pages and scr
# Sponsors # Sponsors
<a href="https://seirei.ne.jp"><img title="Serei Network" width="256" src="https://joplinapp.org/images/sponsors/SeireiNetwork.png"/></a> <a href="https://usrigging.com/"><img title="U.S. Ringing Supply" width="256" src="https://joplinapp.org/images/sponsors/RingingSupply.svg"/></a> <a href="https://tranio.com/italy/"><img title="Tranio" width="256" src="https://joplinapp.org/images/sponsors/Tranio.png"/></a> <!-- SPONSORS-ORG -->
<a href="https://www.hosting.de/nextcloud/?mtm_campaign=managed-nextcloud&amp;mtm_kwd=joplinapp&amp;mtm_source=joplinapp-github&amp;mtm_medium=banner"><img title="Hosting.de" width="256" src="https://joplinapp.org/images/sponsors/HostingDe.png"/></a> <a href="https://usrigging.com/"><img title="U.S. Ringing Supply" width="256" src="https://joplinapp.org/images/sponsors/RingingSupply.svg"/></a> <a href="https://seirei.ne.jp"><img title="Serei Network" width="256" src="https://joplinapp.org/images/sponsors/SeireiNetwork.png"/></a> <a href="https://tranio.com/italy/"><img title="Tranio" width="256" src="https://joplinapp.org/images/sponsors/Tranio.png"/></a>
<!-- SPONSORS-ORG -->
* * * * * *
<!-- SPONSORS --> <!-- SPONSORS-GITHUB -->
| | | | | | | | | |
| :---: | :---: | :---: | :---: | | :---: | :---: | :---: | :---: |
| <img width="50" src="https://avatars2.githubusercontent.com/u/215668?s=96&v=4"/></br>[avanderberg](https://github.com/avanderberg) | <img width="50" src="https://avatars2.githubusercontent.com/u/3061769?s=96&v=4"/></br>[c-nagy](https://github.com/c-nagy) | <img width="50" src="https://avatars2.githubusercontent.com/u/70780798?s=96&v=4"/></br>[cabottech](https://github.com/cabottech) | <img width="50" src="https://avatars2.githubusercontent.com/u/67130?s=96&v=4"/></br>[chr15m](https://github.com/chr15m) | | <img width="50" src="https://avatars2.githubusercontent.com/u/215668?s=96&v=4"/></br>[avanderberg](https://github.com/avanderberg) | <img width="50" src="https://avatars2.githubusercontent.com/u/3061769?s=96&v=4"/></br>[c-nagy](https://github.com/c-nagy) | <img width="50" src="https://avatars2.githubusercontent.com/u/70780798?s=96&v=4"/></br>[cabottech](https://github.com/cabottech) | <img width="50" src="https://avatars2.githubusercontent.com/u/67130?s=96&v=4"/></br>[chr15m](https://github.com/chr15m) |
| <img width="50" src="https://avatars2.githubusercontent.com/u/4862947?s=96&v=4"/></br>[chrootlogin](https://github.com/chrootlogin) | <img width="50" src="https://avatars2.githubusercontent.com/u/1307332?s=96&v=4"/></br>[dbrandonjohnson](https://github.com/dbrandonjohnson) | <img width="50" src="https://avatars2.githubusercontent.com/u/1439535?s=96&v=4"/></br>[fbloise](https://github.com/fbloise) | <img width="50" src="https://avatars2.githubusercontent.com/u/38898566?s=96&v=4"/></br>[h4sh5](https://github.com/h4sh5) | | <img width="50" src="https://avatars2.githubusercontent.com/u/4862947?s=96&v=4"/></br>[chrootlogin](https://github.com/chrootlogin) | <img width="50" src="https://avatars2.githubusercontent.com/u/82579431?s=96&v=4"/></br>[clmntsl](https://github.com/clmntsl) | <img width="50" src="https://avatars2.githubusercontent.com/u/1307332?s=96&v=4"/></br>[dbrandonjohnson](https://github.com/dbrandonjohnson) | <img width="50" src="https://avatars2.githubusercontent.com/u/1439535?s=96&v=4"/></br>[fbloise](https://github.com/fbloise) |
| <img width="50" src="https://avatars2.githubusercontent.com/u/37297218?s=96&v=4"/></br>[Jesssullivan](https://github.com/Jesssullivan) | <img width="50" src="https://avatars2.githubusercontent.com/u/1248504?s=96&v=4"/></br>[joesfer](https://github.com/joesfer) | <img width="50" src="https://avatars2.githubusercontent.com/u/24908652?s=96&v=4"/></br>[konishi-t](https://github.com/konishi-t) | <img width="50" src="https://avatars2.githubusercontent.com/u/1788010?s=96&v=4"/></br>[maxtruxa](https://github.com/maxtruxa) | | <img width="50" src="https://avatars2.githubusercontent.com/u/38898566?s=96&v=4"/></br>[h4sh5](https://github.com/h4sh5) | <img width="50" src="https://avatars2.githubusercontent.com/u/37297218?s=96&v=4"/></br>[Jesssullivan](https://github.com/Jesssullivan) | <img width="50" src="https://avatars2.githubusercontent.com/u/1248504?s=96&v=4"/></br>[joesfer](https://github.com/joesfer) | <img width="50" src="https://avatars2.githubusercontent.com/u/24908652?s=96&v=4"/></br>[konishi-t](https://github.com/konishi-t) |
| <img width="50" src="https://avatars2.githubusercontent.com/u/29300939?s=96&v=4"/></br>[mcejp](https://github.com/mcejp) | <img width="50" src="https://avatars2.githubusercontent.com/u/1168659?s=96&v=4"/></br>[nicholashead](https://github.com/nicholashead) | <img width="50" src="https://avatars2.githubusercontent.com/u/5782817?s=96&v=4"/></br>[piccobit](https://github.com/piccobit) | <img width="50" src="https://avatars2.githubusercontent.com/u/47742?s=96&v=4"/></br>[ravenscroftj](https://github.com/ravenscroftj) | | <img width="50" src="https://avatars2.githubusercontent.com/u/1788010?s=96&v=4"/></br>[maxtruxa](https://github.com/maxtruxa) | <img width="50" src="https://avatars2.githubusercontent.com/u/29300939?s=96&v=4"/></br>[mcejp](https://github.com/mcejp) | <img width="50" src="https://avatars2.githubusercontent.com/u/1168659?s=96&v=4"/></br>[nicholashead](https://github.com/nicholashead) | <img width="50" src="https://avatars2.githubusercontent.com/u/5782817?s=96&v=4"/></br>[piccobit](https://github.com/piccobit) |
| <img width="50" src="https://avatars2.githubusercontent.com/u/73081837?s=96&v=4"/></br>[thismarty](https://github.com/thismarty) | <img width="50" src="https://avatars2.githubusercontent.com/u/15859362?s=96&v=4"/></br>[thomasbroussard](https://github.com/thomasbroussard) | | | | <img width="50" src="https://avatars2.githubusercontent.com/u/47742?s=96&v=4"/></br>[ravenscroftj](https://github.com/ravenscroftj) | <img width="50" src="https://avatars2.githubusercontent.com/u/73081837?s=96&v=4"/></br>[thismarty](https://github.com/thismarty) | <img width="50" src="https://avatars2.githubusercontent.com/u/15859362?s=96&v=4"/></br>[thomasbroussard](https://github.com/thomasbroussard) | |
<!-- SPONSORS --> <!-- SPONSORS-GITHUB -->
<!-- TOC --> <!-- TOC -->
# Table of contents # Table of contents

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@ -80,4 +80,15 @@ ArrayUtils.mergeOverlappingIntervals = function(intervals, limit) {
return stack; return stack;
}; };
ArrayUtils.shuffle = function(array) {
array = array.slice();
for (let i = array.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
const temp = array[i];
array[i] = array[j];
array[j] = temp;
}
return array;
};
module.exports = ArrayUtils; module.exports = ArrayUtils;

16
packages/lib/array.ts Normal file
View File

@ -0,0 +1,16 @@
export function shuffle<T>(array: T[]): T[] {
array = array.slice();
for (let i = array.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
const temp = array[i];
array[i] = array[j];
array[j] = temp;
}
return array;
}
export function unique<T>(array: T[]): T[] {
return array.filter(function(elem, index, self) {
return index === self.indexOf(elem);
});
}

View File

@ -71,6 +71,10 @@
{ {
"name": "konishi-t", "name": "konishi-t",
"id": "24908652" "id": "24908652"
},
{
"name": "clmntsl",
"id": "82579431"
} }
], ],
"orgs": [ "orgs": [
@ -88,6 +92,12 @@
"url": "https://tranio.com/italy/", "url": "https://tranio.com/italy/",
"title": "Tranio", "title": "Tranio",
"imageName": "Tranio.png" "imageName": "Tranio.png"
},
{
"url": "https://www.hosting.de/nextcloud/?mtm_campaign=managed-nextcloud&mtm_kwd=joplinapp&mtm_source=joplinapp-github&mtm_medium=banner",
"urlWebsite": "https://www.hosting.de/nextcloud/?mtm_campaign=managed-nextcloud&mtm_kwd=joplinapp&mtm_source=joplinapp-webseite&mtm_medium=banner",
"title": "Hosting.de",
"imageName": "HostingDe.png"
} }
] ]
} }

View File

@ -1,17 +1,15 @@
import { readFile } from 'fs-extra'; import { readFile } from 'fs-extra';
import { insertContentIntoFile, rootDir } from './tool-utils'; import { insertContentIntoFile, rootDir } from './tool-utils';
import markdownUtils, { MarkdownTableHeader, MarkdownTableJustify, MarkdownTableRow } from '@joplin/lib/markdownUtils'; import markdownUtils, { MarkdownTableHeader, MarkdownTableJustify, MarkdownTableRow } from '@joplin/lib/markdownUtils';
const ArrayUtils = require('@joplin/lib/ArrayUtils');
const { escapeHtml } = require('@joplin/lib/string-utils');
import { GithubSponsor, OrgSponsor, Sponsors } from './website/utils/types';
const readmePath = `${rootDir}/README.md`; const readmePath = `${rootDir}/README.md`;
const sponsorsPath = `${rootDir}/packages/tools/sponsors.json`; const sponsorsPath = `${rootDir}/packages/tools/sponsors.json`;
interface Sponsor { async function createGitHubSponsorTable(sponsors: GithubSponsor[]): Promise<string> {
name: string; sponsors = sponsors.slice();
id: string;
}
async function main() {
const sponsors: Sponsor[] = (JSON.parse(await readFile(sponsorsPath, 'utf8'))).github;
sponsors.sort((a, b) => { sponsors.sort((a, b) => {
return a.name.toLowerCase() < b.name.toLowerCase() ? -1 : +1; return a.name.toLowerCase() < b.name.toLowerCase() ? -1 : +1;
@ -49,13 +47,36 @@ async function main() {
if (!sponsor) break; if (!sponsor) break;
} }
const mdTable = markdownUtils.createMarkdownTable(headers, rows); return markdownUtils.createMarkdownTable(headers, rows);
}
async function createOrgSponsorTable(sponsors: OrgSponsor[]): Promise<string> {
sponsors = ArrayUtils.shuffle(sponsors);
const output: string[] = [];
for (const sponsor of sponsors) {
output.push(`<a href="${escapeHtml(sponsor.url)}"><img title="${escapeHtml(sponsor.title)}" width="256" src="https://joplinapp.org/images/sponsors/${escapeHtml(sponsor.imageName)}"/></a>`);
}
return output.join(' ');
}
async function main() {
const sponsors: Sponsors = JSON.parse(await readFile(sponsorsPath, 'utf8'));
await insertContentIntoFile( await insertContentIntoFile(
readmePath, readmePath,
'<!-- SPONSORS -->\n', '<!-- SPONSORS-GITHUB -->\n',
'\n<!-- SPONSORS -->', '\n<!-- SPONSORS-GITHUB -->',
mdTable await createGitHubSponsorTable(sponsors.github)
);
await insertContentIntoFile(
readmePath,
'<!-- SPONSORS-ORG -->\n',
'\n<!-- SPONSORS-ORG -->',
await createOrgSponsorTable(sponsors.orgs)
); );
} }

View File

@ -2,8 +2,9 @@ import * as fs from 'fs-extra';
import { insertContentIntoFile, rootDir } from '../tool-utils'; import { insertContentIntoFile, rootDir } from '../tool-utils';
import { pressCarouselItems } from './utils/pressCarousel'; import { pressCarouselItems } from './utils/pressCarousel';
import { getMarkdownIt, loadMustachePartials, markdownToPageHtml, renderMustache } from './utils/render'; import { getMarkdownIt, loadMustachePartials, markdownToPageHtml, renderMustache } from './utils/render';
import { Env, PlanPageParams, Sponsors, TemplateParams } from './utils/types'; import { Env, OrgSponsor, PlanPageParams, Sponsors, TemplateParams } from './utils/types';
import { getPlans, StripePublicConfig } from '@joplin/lib/utils/joplinCloud'; import { getPlans, StripePublicConfig } from '@joplin/lib/utils/joplinCloud';
import { shuffle } from '@joplin/lib/array';
const dirname = require('path').dirname; const dirname = require('path').dirname;
const glob = require('glob'); const glob = require('glob');
const path = require('path'); const path = require('path');
@ -42,7 +43,6 @@ async function getDonateLinks() {
} }
function replaceGitHubByWebsiteLinks(md: string) { function replaceGitHubByWebsiteLinks(md: string) {
// let output = md.replace(/https:\/\/github.com\/laurent22\/joplin\/blob\/master\/readme\/(.*?)\/index\.md(#[^\s)]+|)/g, 'https://joplinapp.org/$1');
return md return md
.replace(/https:\/\/github.com\/laurent22\/joplin\/blob\/dev\/readme\/(.*?)\.md(#[^\s)]+|)/g, '/$1/$2') .replace(/https:\/\/github.com\/laurent22\/joplin\/blob\/dev\/readme\/(.*?)\.md(#[^\s)]+|)/g, '/$1/$2')
.replace(/https:\/\/github.com\/laurent22\/joplin\/blob\/dev\/README\.md(#[^\s)]+|)/g, '/help/$1'); .replace(/https:\/\/github.com\/laurent22\/joplin\/blob\/dev\/README\.md(#[^\s)]+|)/g, '/help/$1');
@ -182,7 +182,13 @@ async function updateDownloadPage(downloadButtonsHtml: Record<string, string>) {
async function loadSponsors(): Promise<Sponsors> { async function loadSponsors(): Promise<Sponsors> {
const sponsorsPath = `${rootDir}/packages/tools/sponsors.json`; const sponsorsPath = `${rootDir}/packages/tools/sponsors.json`;
return JSON.parse(await fs.readFile(sponsorsPath, 'utf8')); const output: Sponsors = JSON.parse(await fs.readFile(sponsorsPath, 'utf8'));
output.orgs = shuffle<OrgSponsor>(output.orgs.map(o => {
if (o.urlWebsite) o.url = o.urlWebsite;
return o;
}));
return output;
} }
async function main() { async function main() {

View File

@ -5,13 +5,14 @@ export enum Env {
Prod = 'prod', Prod = 'prod',
} }
interface GithubSponsor { export interface GithubSponsor {
name: string; name: string;
id: string; id: string;
} }
interface OrgSponsor { export interface OrgSponsor {
url: string; url: string;
urlWebsite?: string;
title: string; title: string;
imageName: string; imageName: string;
} }