mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-21 09:38:01 +02:00
Plugin Repo: Added plugin download links on README page
This commit is contained in:
parent
b3ce5fbc48
commit
fa9c08be06
@ -1584,6 +1584,9 @@ packages/plugin-repo-cli/lib/types.js.map
|
|||||||
packages/plugin-repo-cli/lib/updateReadme.d.ts
|
packages/plugin-repo-cli/lib/updateReadme.d.ts
|
||||||
packages/plugin-repo-cli/lib/updateReadme.js
|
packages/plugin-repo-cli/lib/updateReadme.js
|
||||||
packages/plugin-repo-cli/lib/updateReadme.js.map
|
packages/plugin-repo-cli/lib/updateReadme.js.map
|
||||||
|
packages/plugin-repo-cli/lib/updateReadme.test.d.ts
|
||||||
|
packages/plugin-repo-cli/lib/updateReadme.test.js
|
||||||
|
packages/plugin-repo-cli/lib/updateReadme.test.js.map
|
||||||
packages/plugins/ToggleSidebars/api/index.d.ts
|
packages/plugins/ToggleSidebars/api/index.d.ts
|
||||||
packages/plugins/ToggleSidebars/api/index.js
|
packages/plugins/ToggleSidebars/api/index.js
|
||||||
packages/plugins/ToggleSidebars/api/index.js.map
|
packages/plugins/ToggleSidebars/api/index.js.map
|
||||||
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -1569,6 +1569,9 @@ packages/plugin-repo-cli/lib/types.js.map
|
|||||||
packages/plugin-repo-cli/lib/updateReadme.d.ts
|
packages/plugin-repo-cli/lib/updateReadme.d.ts
|
||||||
packages/plugin-repo-cli/lib/updateReadme.js
|
packages/plugin-repo-cli/lib/updateReadme.js
|
||||||
packages/plugin-repo-cli/lib/updateReadme.js.map
|
packages/plugin-repo-cli/lib/updateReadme.js.map
|
||||||
|
packages/plugin-repo-cli/lib/updateReadme.test.d.ts
|
||||||
|
packages/plugin-repo-cli/lib/updateReadme.test.js
|
||||||
|
packages/plugin-repo-cli/lib/updateReadme.test.js.map
|
||||||
packages/plugins/ToggleSidebars/api/index.d.ts
|
packages/plugins/ToggleSidebars/api/index.d.ts
|
||||||
packages/plugins/ToggleSidebars/api/index.js
|
packages/plugins/ToggleSidebars/api/index.js
|
||||||
packages/plugins/ToggleSidebars/api/index.js.map
|
packages/plugins/ToggleSidebars/api/index.js.map
|
||||||
|
@ -2,6 +2,14 @@
|
|||||||
|
|
||||||
This tool is used to build the plugin repository at https://github.com/joplin/plugins
|
This tool is used to build the plugin repository at https://github.com/joplin/plugins
|
||||||
|
|
||||||
# Publishing
|
## Testing
|
||||||
|
|
||||||
|
To test the tool with existing packages, the best is to:
|
||||||
|
|
||||||
|
- Create a separate copy of the plugin repo
|
||||||
|
- Reset back a few commits
|
||||||
|
- Run with the --dry-run option: `plugin-repo-cli build ~/src/joplin-plugins-test/ --dry-run`
|
||||||
|
|
||||||
|
## Publishing
|
||||||
|
|
||||||
To publish it, run `npm run publishAll` from the root.
|
To publish it, run `npm run publishAll` from the root.
|
@ -1,11 +1,5 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
|
||||||
// To test the tool with existing packages, the best is to:
|
|
||||||
//
|
|
||||||
// - Create a separate copy of the plugin repo
|
|
||||||
// - Reset back a few commits
|
|
||||||
// - Run with the --dry-run option: `plugin-repo-cli build ~/src/joplin-plugins-test/ --dry-run`
|
|
||||||
|
|
||||||
import * as fs from 'fs-extra';
|
import * as fs from 'fs-extra';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import * as process from 'process';
|
import * as process from 'process';
|
||||||
|
68
packages/plugin-repo-cli/lib/updateReadme.test.ts
Normal file
68
packages/plugin-repo-cli/lib/updateReadme.test.ts
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
import * as fs from 'fs-extra';
|
||||||
|
import updateReadme from './updateReadme';
|
||||||
|
|
||||||
|
describe('updateReadme', () => {
|
||||||
|
|
||||||
|
test('should update the README file', async () => {
|
||||||
|
const manifests: any = {
|
||||||
|
'io.github.jackgruber.copytags': {
|
||||||
|
'manifest_version': 1,
|
||||||
|
'id': 'io.github.jackgruber.copytags',
|
||||||
|
'app_min_version': '1.6.2',
|
||||||
|
'version': '1.0.1',
|
||||||
|
'name': 'Tagging',
|
||||||
|
'description': 'Plugin to extend the Joplin tagging menu with a coppy all tags and a tagging dialog with more control. (Formerly Copy Tags).',
|
||||||
|
'author': 'JackGruber',
|
||||||
|
'homepage_url': 'https://github.com/JackGruber/joplin-plugin-tagging/blob/master/README.md',
|
||||||
|
'repository_url': 'https://github.com/JackGruber/joplin-plugin-tagging',
|
||||||
|
'keywords': [
|
||||||
|
'duplicate',
|
||||||
|
'copy',
|
||||||
|
'tags',
|
||||||
|
'tagging',
|
||||||
|
'tag',
|
||||||
|
],
|
||||||
|
'_publish_hash': 'sha256:88daaf234a9b47e5644a8de6f830a801d12edbe41ea5364d994773e89eeafeef',
|
||||||
|
'_publish_commit': 'master:64c0510e3236df7788a8d10ec28dcfbb4c2bdbb7',
|
||||||
|
'_npm_package_name': 'joplin-plugin-copytags',
|
||||||
|
},
|
||||||
|
'joplin.plugin.ambrt.backlinksToNote': {
|
||||||
|
'manifest_version': 1,
|
||||||
|
'id': 'joplin.plugin.ambrt.backlinksToNote',
|
||||||
|
'app_min_version': '1.7',
|
||||||
|
'version': '2.0.10',
|
||||||
|
'name': 'Automatic Backlinks to note',
|
||||||
|
'description': 'Creates backlinks to opened note, also in automatic way',
|
||||||
|
'author': 'ambrt',
|
||||||
|
'homepage_url': 'https://discourse.joplinapp.org/t/insert-referencing-notes-backlinks-plugin/13632',
|
||||||
|
'_publish_hash': 'sha256:b5dec8d00f19e34c4fe1dc0ed380b6743aa7debfd8f600ead0d6866ba21466f1',
|
||||||
|
'_publish_commit': 'master:05020664a6a7f567c466e3fbad1d7e7ec64dc369',
|
||||||
|
'_npm_package_name': 'joplin-plugin-backlinks',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const tempFilePath = `${__dirname}/test_README.md`;
|
||||||
|
await fs.writeFile(tempFilePath, '<!-- PLUGIN_LIST -->\n<!-- PLUGIN_LIST -->');
|
||||||
|
|
||||||
|
await updateReadme(tempFilePath, manifests);
|
||||||
|
|
||||||
|
const content = await fs.readFile(tempFilePath, 'utf8');
|
||||||
|
|
||||||
|
// Check header
|
||||||
|
expect(content.includes('| | | Name | Version | Description | Author |')).toBe(true);
|
||||||
|
|
||||||
|
// Check plugin content
|
||||||
|
expect(content.includes('https://github.com/JackGruber/joplin-plugin-tagging/blob/master/README.md')).toBe(true);
|
||||||
|
expect(content.includes('https://github.com/joplin/plugins/raw/master/plugins/joplin.plugin.ambrt.backlinksToNote/plugin.jpl')).toBe(true);
|
||||||
|
expect(content.includes('Automatic Backlinks to note')).toBe(true);
|
||||||
|
expect(content.includes('2.0.10')).toBe(true);
|
||||||
|
expect(content.includes('Creates backlinks to opened note, also in automatic way')).toBe(true);
|
||||||
|
expect(content.includes('ambrt')).toBe(true);
|
||||||
|
|
||||||
|
// Check that it keeps the markers
|
||||||
|
expect(content.split('<!-- PLUGIN_LIST -->').length - 1).toBe(2);
|
||||||
|
|
||||||
|
await fs.remove(tempFilePath);
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
@ -2,20 +2,36 @@ import * as fs from 'fs-extra';
|
|||||||
import markdownUtils, { MarkdownTableHeader, MarkdownTableRow } from '@joplin/lib/markdownUtils';
|
import markdownUtils, { MarkdownTableHeader, MarkdownTableRow } from '@joplin/lib/markdownUtils';
|
||||||
|
|
||||||
export default async function(readmePath: string, manifests: any) {
|
export default async function(readmePath: string, manifests: any) {
|
||||||
const rows: MarkdownTableRow[] = [];
|
let rows: MarkdownTableRow[] = [];
|
||||||
|
|
||||||
for (const pluginId in manifests) {
|
for (const pluginId in manifests) {
|
||||||
rows.push(manifests[pluginId]);
|
rows.push(manifests[pluginId]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rows = rows.map(row => {
|
||||||
|
return {
|
||||||
|
...row,
|
||||||
|
download_url: `https://github.com/joplin/plugins/raw/master/plugins/${row.id}/plugin.jpl`,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
const headers: MarkdownTableHeader[] = [
|
const headers: MarkdownTableHeader[] = [
|
||||||
{
|
{
|
||||||
name: 'homepage_url',
|
name: 'homepage_url',
|
||||||
label: ' ',
|
label: ' ',
|
||||||
filter: (value: string) => {
|
filter: (value: string) => {
|
||||||
|
if (!value) return '-';
|
||||||
return `[🏠](${markdownUtils.escapeLinkUrl(value)})`;
|
return `[🏠](${markdownUtils.escapeLinkUrl(value)})`;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'download_url',
|
||||||
|
label: ' ',
|
||||||
|
filter: (value: string) => {
|
||||||
|
if (!value) return '-';
|
||||||
|
return `[⬇️](${markdownUtils.escapeLinkUrl(value)})`;
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'name',
|
name: 'name',
|
||||||
label: 'Name',
|
label: 'Name',
|
||||||
|
Loading…
Reference in New Issue
Block a user