Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
JackGruber committed Jan 11, 2024
2 parents bd49c66 + cae6000 commit a8f29fd
Show file tree
Hide file tree
Showing 12 changed files with 60 additions and 19 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## not released

## v1.3.6 (2024-01-11)

- Add: Screenshots / icon for [https://joplinapp.org/plugins/](https://joplinapp.org/plugins/)

## v1.3.5 (2023-12-26)

- Fix: #64 With single JEX backups, some notebooks were backuped/exported twice
Expand Down
9 changes: 1 addition & 8 deletions GENERATOR_DOC.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This documentation describes how to create a plugin, and how to work with the pl
First, install [Yeoman](http://yeoman.io) and generator-joplin using [npm](https://www.npmjs.com/) (we assume you have pre-installed [node.js](https://nodejs.org/)).

```bash
npm install -g yo
npm install -g yo@4.3.1
npm install -g generator-joplin
```

Expand Down Expand Up @@ -56,13 +56,6 @@ In general this command tries to do the right thing - in particular it's going t

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.

### Simple backup changes to `webpack.config.js`

To support including `7zip-bin` in the plugin's built `.jpl` file, the following changes are made:

- Added `node: { __dirname: 'mock' },` to the plugin `baseConfig`. This causes `7zip-bin` to return a more correct path to `7za` (e.g. `/linux/x64/7za` instead of `/tmp/.mount_Joplin/resources/app.asar/services/plugins/linux/x64/7za`).
- Added a `new CopyPlugin({ ... })` to `pluginConfig`'s `plugins` object to copy `7zip-bin` from `node_modules` to the `dist` directory.

## External script files

By default, the compiler (webpack) is going to compile `src/index.ts` only (as well as any file it imports), and any other file will simply be copied to the plugin package. In some cases this is sufficient, however if you have [content scripts](https://joplinapp.org/api/references/plugin_api/classes/joplincontentscripts.html) or [webview scripts](https://joplinapp.org/api/references/plugin_api/classes/joplinviewspanels.html#addscript) you might want to compile them too, in particular in these two cases:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Joplin Backup Plugin
# Joplin Backup Plugin <img src=img/icon_32.png>

A plugin to extend Joplin with a manual and automatic backup function.

Expand Down
28 changes: 28 additions & 0 deletions img/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/icon_256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/icon_32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img/main.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/showcase1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "joplin-plugin-backup",
"version": "1.3.5",
"version": "1.3.6",
"scripts": {
"dist": "webpack --env joplin-plugin-config=buildMain && webpack --env joplin-plugin-config=buildExtraScripts && webpack --env joplin-plugin-config=createArchive",
"prepare": "npm run dist && husky install",
Expand Down
17 changes: 14 additions & 3 deletions src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 1,
"id": "io.github.jackgruber.backup",
"app_min_version": "2.1.3",
"version": "1.3.5",
"version": "1.3.6",
"name": "Simple Backup",
"description": "Plugin to create manual and automatic backups.",
"author": "JackGruber",
Expand All @@ -18,6 +18,17 @@
"archive"
],
"categories": ["productivity", "files"],
"screenshots": [],
"icons": {}
"screenshots": [
{
"src": "img/main.png",
"label": "Screenshot: Showing the basic settings"
},
{
"src": "img/showcase1.png",
"label": "Screenshot: Showing the advanced settings"
}
],
"icons": {
"256": "img/icon_256.png"
}
}
13 changes: 9 additions & 4 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,19 +93,24 @@ function validateCategories(categories) {

function validateScreenshots(screenshots) {
if (!screenshots) return null;
// eslint-disable-next-line github/array-foreach -- Old code before rule was applied
screenshots.forEach(screenshot => {
for (const screenshot of screenshots) {
if (!screenshot.src) throw new Error('You must specify a src for each screenshot');

// Avoid attempting to download and verify URL screenshots.
if (screenshot.src.startsWith('https://') || screenshot.src.startsWith('http://')) {
continue;
}

const screenshotType = screenshot.src.split('.').pop();
if (!allPossibleScreenshotsType.includes(screenshotType)) throw new Error(`${screenshotType} is not a valid screenshot type. Valid types are: \n${allPossibleScreenshotsType}\n`);

const screenshotPath = path.resolve(srcDir, screenshot.src);
const screenshotPath = path.resolve(rootDir, screenshot.src);

// Max file size is 1MB
const fileMaxSize = 1024;
const fileSize = fs.statSync(screenshotPath).size / 1024;
if (fileSize > fileMaxSize) throw new Error(`Max screenshot file size is ${fileMaxSize}KB. ${screenshotPath} is ${fileSize}KB`);
});
}
}

function readManifest(manifestPath) {
Expand Down

0 comments on commit a8f29fd

Please sign in to comment.