mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
update
This commit is contained in:
parent
0cdefcc61a
commit
284c75fcf5
@ -1974,9 +1974,15 @@ packages/tools/update-readme-download.js.map
|
||||
packages/tools/update-readme-sponsors.d.ts
|
||||
packages/tools/update-readme-sponsors.js
|
||||
packages/tools/update-readme-sponsors.js.map
|
||||
packages/tools/updateMarkdownDoc.d.ts
|
||||
packages/tools/updateMarkdownDoc.js
|
||||
packages/tools/updateMarkdownDoc.js.map
|
||||
packages/tools/website/build.d.ts
|
||||
packages/tools/website/build.js
|
||||
packages/tools/website/build.js.map
|
||||
packages/tools/website/updateDownloadPage.d.ts
|
||||
packages/tools/website/updateDownloadPage.js
|
||||
packages/tools/website/updateDownloadPage.js.map
|
||||
packages/tools/website/utils/frontMatter.d.ts
|
||||
packages/tools/website/utils/frontMatter.js
|
||||
packages/tools/website/utils/frontMatter.js.map
|
||||
|
6
.gitignore
vendored
6
.gitignore
vendored
@ -1957,9 +1957,15 @@ packages/tools/update-readme-download.js.map
|
||||
packages/tools/update-readme-sponsors.d.ts
|
||||
packages/tools/update-readme-sponsors.js
|
||||
packages/tools/update-readme-sponsors.js.map
|
||||
packages/tools/updateMarkdownDoc.d.ts
|
||||
packages/tools/updateMarkdownDoc.js
|
||||
packages/tools/updateMarkdownDoc.js.map
|
||||
packages/tools/website/build.d.ts
|
||||
packages/tools/website/build.js
|
||||
packages/tools/website/build.js.map
|
||||
packages/tools/website/updateDownloadPage.d.ts
|
||||
packages/tools/website/updateDownloadPage.js
|
||||
packages/tools/website/updateDownloadPage.js.map
|
||||
packages/tools/website/utils/frontMatter.d.ts
|
||||
packages/tools/website/utils/frontMatter.js
|
||||
packages/tools/website/utils/frontMatter.js.map
|
||||
|
@ -13,6 +13,7 @@
|
||||
"buildApiDoc": "npm start --prefix=packages/app-cli -- apidoc ../../readme/api/references/rest_api.md",
|
||||
"buildCommandIndex": "gulp buildCommandIndex",
|
||||
"buildDoc": "./packages/tools/build-all.sh",
|
||||
"updateMarkdownDoc": "node ./packages/tools/updateMarkdownDoc",
|
||||
"buildPluginDoc": "typedoc --name 'Joplin Plugin API Documentation' --mode file -theme './Assets/PluginDocTheme/' --readme './Assets/PluginDocTheme/index.md' --excludeNotExported --excludeExternals --excludePrivate --excludeProtected --out docs/api/references/plugin_api packages/lib/services/plugins/api/",
|
||||
"buildSettingJsonSchema": "npm start --prefix=packages/app-cli -- settingschema ../../docs/schema/settings.json",
|
||||
"buildTranslations": "npm run tsc && node packages/tools/build-translation.js",
|
||||
|
@ -5,10 +5,10 @@ ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
git pull
|
||||
|
||||
echo "---------------------------------------------------"
|
||||
echo "$ROOT_DIR/update-readme-download.js..."
|
||||
echo "---------------------------------------------------"
|
||||
node "$ROOT_DIR/update-readme-download.js"
|
||||
# echo "---------------------------------------------------"
|
||||
# echo "$ROOT_DIR/update-readme-download.js..."
|
||||
# echo "---------------------------------------------------"
|
||||
# node "$ROOT_DIR/update-readme-download.js"
|
||||
|
||||
echo "---------------------------------------------------"
|
||||
echo "$ROOT_DIR/build-release-stats.js..."
|
||||
|
@ -4,6 +4,7 @@ const fetch = require('node-fetch');
|
||||
const fs = require('fs-extra');
|
||||
const { dirname } = require('@joplin/lib/path-utils');
|
||||
const markdownUtils = require('@joplin/lib/markdownUtils').default;
|
||||
const yargParser = require('yargs-parser');
|
||||
|
||||
const rootDir = dirname(dirname(__dirname));
|
||||
|
||||
@ -55,6 +56,11 @@ function createChangeLog(releases) {
|
||||
}
|
||||
|
||||
async function main() {
|
||||
const argv = yargParser(process.argv);
|
||||
const types = argv.types ? argv.types.split(',') : ['stats', 'changelog'];
|
||||
|
||||
console.info(`Building docs: ${types.join(', ')}`);
|
||||
|
||||
const rows = [];
|
||||
|
||||
const totals = {
|
||||
@ -99,8 +105,15 @@ async function main() {
|
||||
pageNum++;
|
||||
}
|
||||
|
||||
const changelogText = createChangeLog(rows);
|
||||
await fs.writeFile(`${rootDir}/readme/changelog.md`, changelogText);
|
||||
if (types.includes('changelog')) {
|
||||
console.info('Build stats: Updating changelog...');
|
||||
const changelogText = createChangeLog(rows);
|
||||
await fs.writeFile(`${rootDir}/readme/changelog.md`, changelogText);
|
||||
}
|
||||
|
||||
if (!types.includes('stats')) return;
|
||||
|
||||
console.info('Build stats: Updating stats...');
|
||||
|
||||
const grandTotal = totals.windows_count + totals.mac_count + totals.linux_count;
|
||||
totals.windows_percent = totals.windows_count / grandTotal;
|
||||
|
@ -1,9 +1,8 @@
|
||||
import { readFile } from 'fs-extra';
|
||||
import { insertContentIntoFile, rootDir } from './tool-utils';
|
||||
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 { escapeHtml } = require('@joplin/lib/string-utils');
|
||||
|
||||
const readmePath = `${rootDir}/README.md`;
|
||||
const sponsorsPath = `${rootDir}/packages/tools/sponsors.json`;
|
||||
@ -51,7 +50,7 @@ async function createGitHubSponsorTable(sponsors: GithubSponsor[]): Promise<stri
|
||||
}
|
||||
|
||||
async function createOrgSponsorTable(sponsors: OrgSponsor[]): Promise<string> {
|
||||
sponsors = ArrayUtils.shuffle(sponsors);
|
||||
// sponsors = ArrayUtils.shuffle(sponsors);
|
||||
|
||||
const output: string[] = [];
|
||||
|
||||
|
30
packages/tools/updateMarkdownDoc.ts
Normal file
30
packages/tools/updateMarkdownDoc.ts
Normal file
@ -0,0 +1,30 @@
|
||||
import { chdir } from 'process';
|
||||
import { execCommand2, rootDir, gitRepoCleanTry } from './tool-utils';
|
||||
import updateDownloadPage from './website/updateDownloadPage';
|
||||
|
||||
async function main() {
|
||||
const doGitOperations = false;
|
||||
|
||||
if (doGitOperations) {
|
||||
await gitRepoCleanTry();
|
||||
await execCommand2(['git', 'pull', '--rebase']);
|
||||
}
|
||||
|
||||
await execCommand2(['node', `${rootDir}/packages/tools/update-readme-download.js`]);
|
||||
await execCommand2(['node', `${rootDir}/packages/tools/build-release-stats.js`, '--types=changelog']);
|
||||
chdir(rootDir);
|
||||
await execCommand2(['npm', 'run', 'buildApiDoc']);
|
||||
await updateDownloadPage();
|
||||
|
||||
if (doGitOperations) {
|
||||
await execCommand2(['git', 'add', '-A']);
|
||||
await execCommand2(['git', 'commit', '-m', 'Update Markdown doc']);
|
||||
await execCommand2(['git', 'pull', '--rebase']);
|
||||
await execCommand2(['git', 'push']);
|
||||
}
|
||||
}
|
||||
|
||||
main().catch((error) => {
|
||||
console.error('Fatal error', error);
|
||||
process.exit(1);
|
||||
});
|
@ -1,5 +1,5 @@
|
||||
import { readFileSync, readFile, mkdirpSync, writeFileSync, remove, copy, pathExistsSync } from 'fs-extra';
|
||||
import { insertContentIntoFile, rootDir } from '../tool-utils';
|
||||
import { rootDir } from '../tool-utils';
|
||||
import { pressCarouselItems } from './utils/pressCarousel';
|
||||
import { getMarkdownIt, loadMustachePartials, markdownToPageHtml, renderMustache } from './utils/render';
|
||||
import { AssetUrls, Env, OrgSponsor, PlanPageParams, Sponsors, TemplateParams } from './utils/types';
|
||||
@ -169,37 +169,6 @@ function makeHomePageMd() {
|
||||
return md;
|
||||
}
|
||||
|
||||
async function createDownloadButtonsHtml(readmeMd: string): Promise<Record<string, string>> {
|
||||
const output: Record<string, string> = {};
|
||||
output['windows'] = readmeMd.match(/(<a href=.*?Joplin-Setup-.*?<\/a>)/)[0];
|
||||
output['macOs'] = readmeMd.match(/(<a href=.*?Joplin-.*\.dmg.*?<\/a>)/)[0];
|
||||
output['linux'] = readmeMd.match(/(<a href=.*?Joplin-.*\.AppImage.*?<\/a>)/)[0];
|
||||
output['android'] = readmeMd.match(/(<a href='https:\/\/play.google.com\/store\/apps\/details\?id=net\.cozic\.joplin.*?<\/a>)/)[0];
|
||||
output['ios'] = readmeMd.match(/(<a href='https:\/\/itunes\.apple\.com\/us\/app\/joplin\/id1315599797.*?<\/a>)/)[0];
|
||||
|
||||
for (const [k, v] of Object.entries(output)) {
|
||||
if (!v) throw new Error(`Could not get download element for: ${k}`);
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
async function updateDownloadPage(downloadButtonsHtml: Record<string, string>) {
|
||||
const desktopButtonsHtml = [
|
||||
downloadButtonsHtml['windows'],
|
||||
downloadButtonsHtml['macOs'],
|
||||
downloadButtonsHtml['linux'],
|
||||
];
|
||||
|
||||
const mobileButtonsHtml = [
|
||||
downloadButtonsHtml['android'],
|
||||
downloadButtonsHtml['ios'],
|
||||
];
|
||||
|
||||
await insertContentIntoFile(`${rootDir}/readme/download.md`, '<!-- DESKTOP-DOWNLOAD-LINKS -->', '<!-- DESKTOP-DOWNLOAD-LINKS -->', desktopButtonsHtml.join(' '));
|
||||
await insertContentIntoFile(`${rootDir}/readme/download.md`, '<!-- MOBILE-DOWNLOAD-LINKS -->', '<!-- MOBILE-DOWNLOAD-LINKS -->', mobileButtonsHtml.join(' '));
|
||||
}
|
||||
|
||||
async function loadSponsors(): Promise<Sponsors> {
|
||||
const sponsorsPath = `${rootDir}/packages/tools/sponsors.json`;
|
||||
const output: Sponsors = JSON.parse(await readFile(sponsorsPath, 'utf8'));
|
||||
@ -244,8 +213,7 @@ async function main() {
|
||||
|
||||
const readmeMd = makeHomePageMd();
|
||||
|
||||
const downloadButtonsHtml = await createDownloadButtonsHtml(readmeMd);
|
||||
await updateDownloadPage(downloadButtonsHtml);
|
||||
// await updateDownloadPage(readmeMd);
|
||||
|
||||
// =============================================================
|
||||
// HELP PAGE
|
||||
|
41
packages/tools/website/updateDownloadPage.ts
Normal file
41
packages/tools/website/updateDownloadPage.ts
Normal file
@ -0,0 +1,41 @@
|
||||
import { readFile } from 'fs-extra';
|
||||
import { rootDir, insertContentIntoFile } from '../tool-utils';
|
||||
|
||||
async function getReadmeMd() {
|
||||
return readFile(`${rootDir}/README.md`, 'utf8');
|
||||
}
|
||||
|
||||
async function createDownloadButtonsHtml(readmeMd: string): Promise<Record<string, string>> {
|
||||
const output: Record<string, string> = {};
|
||||
output['windows'] = readmeMd.match(/(<a href=.*?Joplin-Setup-.*?<\/a>)/)[0];
|
||||
output['macOs'] = readmeMd.match(/(<a href=.*?Joplin-.*\.dmg.*?<\/a>)/)[0];
|
||||
output['linux'] = readmeMd.match(/(<a href=.*?Joplin-.*\.AppImage.*?<\/a>)/)[0];
|
||||
output['android'] = readmeMd.match(/(<a href='https:\/\/play.google.com\/store\/apps\/details\?id=net\.cozic\.joplin.*?<\/a>)/)[0];
|
||||
output['ios'] = readmeMd.match(/(<a href='https:\/\/itunes\.apple\.com\/us\/app\/joplin\/id1315599797.*?<\/a>)/)[0];
|
||||
|
||||
for (const [k, v] of Object.entries(output)) {
|
||||
if (!v) throw new Error(`Could not get download element for: ${k}`);
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
export default async function updateDownloadPage(readmeMd: string = null) {
|
||||
readmeMd = readmeMd === null ? await getReadmeMd() : readmeMd;
|
||||
|
||||
const downloadButtonsHtml = await createDownloadButtonsHtml(readmeMd);
|
||||
|
||||
const desktopButtonsHtml = [
|
||||
downloadButtonsHtml['windows'],
|
||||
downloadButtonsHtml['macOs'],
|
||||
downloadButtonsHtml['linux'],
|
||||
];
|
||||
|
||||
const mobileButtonsHtml = [
|
||||
downloadButtonsHtml['android'],
|
||||
downloadButtonsHtml['ios'],
|
||||
];
|
||||
|
||||
await insertContentIntoFile(`${rootDir}/readme/download.md`, '<!-- DESKTOP-DOWNLOAD-LINKS -->', '<!-- DESKTOP-DOWNLOAD-LINKS -->', desktopButtonsHtml.join(' '));
|
||||
await insertContentIntoFile(`${rootDir}/readme/download.md`, '<!-- MOBILE-DOWNLOAD-LINKS -->', '<!-- MOBILE-DOWNLOAD-LINKS -->', mobileButtonsHtml.join(' '));
|
||||
}
|
Loading…
Reference in New Issue
Block a user