Ran Joplin update command

This commit is contained in:
Franco Speziali 2022-04-24 22:19:45 +02:00
parent e860fcbf79
commit 675308db50
5 changed files with 38 additions and 4 deletions

View File

@ -15,7 +15,7 @@ import { Command } from './types';
* *
* * [Main screen commands](https://github.com/laurent22/joplin/tree/dev/packages/app-desktop/gui/MainScreen/commands) * * [Main screen commands](https://github.com/laurent22/joplin/tree/dev/packages/app-desktop/gui/MainScreen/commands)
* * [Global commands](https://github.com/laurent22/joplin/tree/dev/packages/app-desktop/commands) * * [Global commands](https://github.com/laurent22/joplin/tree/dev/packages/app-desktop/commands)
* * [Editor commands](https://github.com/laurent22/joplin/tree/dev/packages/app-desktop/gui/NoteEditor/commands/editorCommandDeclarations.ts) * * [Editor commands](https://github.com/laurent22/joplin/tree/dev/packages/app-desktop/gui/NoteEditor/editorCommandDeclarations.ts)
* *
* To view what arguments are supported, you can open any of these files * To view what arguments are supported, you can open any of these files
* and look at the `execute()` command. * and look at the `execute()` command.

View File

@ -16,8 +16,12 @@ interface ItemChangeEvent {
interface SyncStartEvent { interface SyncStartEvent {
withErrors: boolean; withErrors: boolean;
} }
interface ResourceChangeEvent {
id: string;
}
declare type ItemChangeHandler = (event: ItemChangeEvent) => void; declare type ItemChangeHandler = (event: ItemChangeEvent) => void;
declare type SyncStartHandler = (event: SyncStartEvent) => void; declare type SyncStartHandler = (event: SyncStartEvent) => void;
declare type ResourceChangeHandler = (event: ResourceChangeEvent) => void;
/** /**
* The workspace service provides access to all the parts of Joplin that * The workspace service provides access to all the parts of Joplin that
* are being worked on - i.e. the currently selected notes or notebooks as * are being worked on - i.e. the currently selected notes or notebooks as
@ -42,6 +46,11 @@ export default class JoplinWorkspace {
* Called when the content of the current note changes. * Called when the content of the current note changes.
*/ */
onNoteChange(handler: ItemChangeHandler): Promise<Disposable>; onNoteChange(handler: ItemChangeHandler): Promise<Disposable>;
/**
* Called when a resource is changed. Currently this handled will not be
* called when a resource is added or deleted.
*/
onResourceChange(handler: ResourceChangeHandler): Promise<void>;
/** /**
* Called when an alarm associated with a to-do is triggered. * Called when an alarm associated with a to-do is triggered.
*/ */

View File

@ -297,7 +297,7 @@ export interface MenuItem {
/** /**
* Set to "separator" to create a divider line * Set to "separator" to create a divider line
*/ */
type?: string; type?: ('normal' | 'separator' | 'submenu' | 'checkbox' | 'radio');
/** /**
* Accelerator associated with the menu item * Accelerator associated with the menu item
@ -364,6 +364,12 @@ export enum SettingItemType {
Button = 6, Button = 6,
} }
export enum SettingItemSubType {
FilePathAndArgs = 'file_path_and_args',
FilePath = 'file_path', // Not supported on mobile!
DirectoryPath = 'directory_path', // Not supported on mobile!
}
export enum AppType { export enum AppType {
Desktop = 'desktop', Desktop = 'desktop',
Mobile = 'mobile', Mobile = 'mobile',
@ -381,6 +387,12 @@ export interface SettingItem {
value: any; value: any;
type: SettingItemType; type: SettingItemType;
/**
* Currently only used to display a file or directory selector. Always set
* `type` to `SettingItemType.String` when using this property.
*/
subType?: SettingItemSubType;
label: string; label: string;
description?: string; description?: string;

View File

@ -33,5 +33,8 @@
"dependencies": { "dependencies": {
"date-fns": "^2.28.0", "date-fns": "^2.28.0",
"yaml": "^1.10.2" "yaml": "^1.10.2"
} },
"files": [
"publish"
]
} }

View File

@ -29,6 +29,7 @@ const userConfig = Object.assign({}, {
const manifestPath = `${srcDir}/manifest.json`; const manifestPath = `${srcDir}/manifest.json`;
const packageJsonPath = `${rootDir}/package.json`; const packageJsonPath = `${rootDir}/package.json`;
const allPossibleCategories = ['appearance', 'developer tools', 'productivity', 'themes', 'integrations', 'viewer', 'search', 'tags', 'editor', 'files', 'personal knowledge management'];
const manifest = readManifest(manifestPath); const manifest = readManifest(manifestPath);
const pluginArchiveFilePath = path.resolve(publishDir, `${manifest.id}.jpl`); const pluginArchiveFilePath = path.resolve(publishDir, `${manifest.id}.jpl`);
const pluginInfoFilePath = path.resolve(publishDir, `${manifest.id}.json`); const pluginInfoFilePath = path.resolve(publishDir, `${manifest.id}.json`);
@ -67,10 +68,19 @@ function currentGitInfo() {
} }
} }
function validateCategories(categories) {
if (!categories) return null;
if ((categories.length !== new Set(categories).size)) throw new Error('Repeated categories are not allowed');
categories.forEach(category => {
if (!allPossibleCategories.includes(category)) throw new Error(`${category} is not a valid category. Please make sure that the category name is lowercase. Valid Categories are: \n${allPossibleCategories}\n`);
});
}
function readManifest(manifestPath) { function readManifest(manifestPath) {
const content = fs.readFileSync(manifestPath, 'utf8'); const content = fs.readFileSync(manifestPath, 'utf8');
const output = JSON.parse(content); const output = JSON.parse(content);
if (!output.id) throw new Error(`Manifest plugin ID is not set in ${manifestPath}`); if (!output.id) throw new Error(`Manifest plugin ID is not set in ${manifestPath}`);
validateCategories(output.categories);
return output; return output;
} }