Skip to content

Commit

Permalink
Updated to latest generator-joplin. Updated dependencies. Removed mar…
Browse files Browse the repository at this point in the history
…kdown-it-multimd-table fork.
  • Loading branch information
FelisDiligens committed Jul 15, 2023
1 parent 876e5fc commit bac23e5
Show file tree
Hide file tree
Showing 20 changed files with 7,366 additions and 4,290 deletions.
13 changes: 12 additions & 1 deletion GENERATOR_DOC.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ npm install -g generator-joplin
Then generate your new project:

```bash
yo joplin
yo --node-package-manager npm joplin
```

## Development
Expand All @@ -39,6 +39,10 @@ To build the plugin, simply run `npm run dist`.

The project is setup to use TypeScript, although you can change the configuration to use plain JavaScript.

## Updating the manifest version number

You can run `npm run updateVersion` to bump the patch part of the version number, so for example 1.0.3 will become 1.0.4. This script will update both the package.json and manifest.json version numbers so as to keep them in sync.

## Publishing the plugin

To publish the plugin, add it to npmjs.com by running `npm publish`. Later on, a script will pick up your plugin and add it automatically to the Joplin plugin repository as long as the package satisfies these conditions:
Expand Down Expand Up @@ -67,6 +71,13 @@ By default, the compiler (webpack) is going to compile `src/index.ts` only (as w

To get such an external script file to compile, you need to add it to the `extraScripts` array in `plugin.config.json`. The path you add should be relative to /src. For example, if you have a file in "/src/webviews/index.ts", the path should be set to "webviews/index.ts". Once compiled, the file will always be named with a .js extension. So you will get "webviews/index.js" in the plugin package, and that's the path you should use to reference the file.

## More information

- [Joplin Plugin API](https://joplinapp.org/api/references/plugin_api/classes/joplin.html)
- [Joplin Data API](https://joplinapp.org/api/references/rest_api/)
- [Joplin Plugin Manifest](https://joplinapp.org/api/references/plugin_manifest/)
- Ask for help on the [forum](https://discourse.joplinapp.org/) or our [Discord channel](https://discord.gg/VSj7AFHvpq)

## License

MIT © Laurent Cozic
39 changes: 2 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@
<td>
<a href="https://github.com/laurent22/joplin/tree/dev/packages/generator-joplin">generator-joplin</a>,
<a href="https://github.com/FelisDiligens/md-table-tools">md-table-tools</a>,
<a href="https://github.com/mixmark-io/turndown">turndown</a>,
<a href="https://github.com/redbug312/markdown-it-multimd-table">markdown-it-multimd-table</a>
<a href="https://github.com/mixmark-io/turndown">turndown</a>
</td>
</tr>
<tr>
Expand Down Expand Up @@ -174,38 +173,4 @@ If you like this plugin, consider to support me on ☕ ko-fi:

## Development

<details>
<summary>Text from "generator-joplin"</summary>

This is a template to create a new Joplin plugin.

The main two files you will want to look at are:

- `/src/index.ts`, which contains the entry point for the plugin source code.
- `/src/manifest.json`, which is the plugin manifest. It contains information such as the plugin a name, version, etc.

## Building the plugin

The plugin is built using Webpack, which creates the compiled code in `/dist`. A JPL archive will also be created at the root, which can use to distribute the plugin.

To build the plugin, simply run `npm run dist`.

The project is setup to use TypeScript, although you can change the configuration to use plain JavaScript.

### Workaround: Building fails on NodeJS LTS

```bash
export NODE_OPTIONS=--openssl-legacy-provider
```
> Source: https://stackoverflow.com/a/69746937

## Updating the plugin framework

To update the plugin framework, run `npm run update`.

In general this command tries to do the right thing - in particular it's going to merge the changes in package.json and .gitignore instead of overwriting. It will also leave "/src" as well as README.md untouched.

The file that may cause problem is "webpack.config.js" because it's going to be overwritten. For that reason, if you want to change it, consider creating a separate JavaScript file and include it in webpack.config.js. That way, when you update, you only have to restore the line that include your file.

</details>
For information on how to build or publish the plugin, please see [GENERATOR_DOC.md](./GENERATOR_DOC.md)
5 changes: 4 additions & 1 deletion api/Joplin.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import JoplinSettings from './JoplinSettings';
import JoplinContentScripts from './JoplinContentScripts';
import JoplinClipboard from './JoplinClipboard';
import JoplinWindow from './JoplinWindow';
import BasePlatformImplementation from '../BasePlatformImplementation';
/**
* This is the main entry point to the Joplin API. You can access various services using the provided accessors.
*
Expand All @@ -34,7 +35,8 @@ export default class Joplin {
private contentScripts_;
private clipboard_;
private window_;
constructor(implementation: any, plugin: Plugin, store: any);
private implementation_;
constructor(implementation: BasePlatformImplementation, plugin: Plugin, store: any);
get data(): JoplinData;
get clipboard(): JoplinClipboard;
get window(): JoplinWindow;
Expand Down Expand Up @@ -65,4 +67,5 @@ export default class Joplin {
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/nativeModule)
*/
require(_path: string): any;
versionInfo(): Promise<import("./types").VersionInfo>;
}
23 changes: 23 additions & 0 deletions api/JoplinData.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ModelType } from '../../../BaseModel';
import Plugin from '../Plugin';
import { Path } from './types';
/**
* This module provides access to the Joplin data API: https://joplinapp.org/api/references/rest_api/
Expand Down Expand Up @@ -39,6 +40,8 @@ import { Path } from './types';
export default class JoplinData {
private api_;
private pathSegmentRegex_;
private plugin;
constructor(plugin: Plugin);
private serializeApiBody;
private pathToString;
get(path: Path, query?: any): Promise<any>;
Expand All @@ -47,4 +50,24 @@ export default class JoplinData {
delete(path: Path, query?: any): Promise<any>;
itemType(itemId: string): Promise<ModelType>;
resourcePath(resourceId: string): Promise<string>;
/**
* Gets an item user data. User data are key/value pairs. The `key` can be any
* arbitrary string, while the `value` can be of any type supported by
* [JSON.stringify](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#description)
*
* User data is synchronised across devices, and each value wil be merged based on their timestamp:
*
* - If value is modified by client 1, then modified by client 2, it will take the value from client 2
* - If value is modified by client 1, then deleted by client 2, the value will be deleted after merge
* - If value is deleted by client 1, then updated by client 2, the value will be restored and set to the value from client 2 after merge
*/
userDataGet<T>(itemType: ModelType, itemId: string, key: string): Promise<T>;
/**
* Sets a note user data. See {@link JoplinData.userDataGet} for more details.
*/
userDataSet<T>(itemType: ModelType, itemId: string, key: string, value: T): Promise<void>;
/**
* Deletes a note user data. See {@link JoplinData.userDataGet} for more details.
*/
userDataDelete(itemType: ModelType, itemId: string, key: string): Promise<void>;
}
2 changes: 1 addition & 1 deletion api/JoplinSettings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export interface ChangeEvent {
*/
keys: string[];
}
export declare type ChangeHandler = (event: ChangeEvent) => void;
export type ChangeHandler = (event: ChangeEvent) => void;
/**
* This API allows registering new settings and setting sections, as well as getting and setting settings. Once a setting has been registered it will appear in the config screen and be editable by the user.
*
Expand Down
8 changes: 4 additions & 4 deletions api/JoplinWorkspace.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Disposable, MenuItem } from './types';
export interface EditContextMenuFilterObject {
items: MenuItem[];
}
declare type FilterHandler<T> = (object: T) => Promise<void>;
type FilterHandler<T> = (object: T) => Promise<void>;
declare enum ItemChangeEventType {
Create = 1,
Update = 2,
Expand All @@ -19,9 +19,9 @@ interface SyncStartEvent {
interface ResourceChangeEvent {
id: string;
}
declare type ItemChangeHandler = (event: ItemChangeEvent) => void;
declare type SyncStartHandler = (event: SyncStartEvent) => void;
declare type ResourceChangeHandler = (event: ResourceChangeEvent) => void;
type ItemChangeHandler = (event: ItemChangeEvent) => void;
type SyncStartHandler = (event: SyncStartEvent) => void;
type ResourceChangeHandler = (event: ResourceChangeEvent) => void;
/**
* 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
Expand Down
6 changes: 6 additions & 0 deletions api/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,12 @@ export enum ModelType {
Command = 16,
}

export interface VersionInfo {
version: string;
profileVersion: number;
syncVersion: number;
}

// =================================================================
// Menu types
// =================================================================
Expand Down
Binary file removed lib/felisdiligens-md-table-tools-1.0.0.tgz
Binary file not shown.
Binary file removed lib/markdown-it-multimd-table-4.2.0.tgz
Binary file not shown.
Loading

0 comments on commit bac23e5

Please sign in to comment.