joplin-plugin-backup 1.1.1 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,8 +2,35 @@
2
2
 
3
3
  A plugin to extend Joplin with a manual and automatic backup function.
4
4
 
5
+ <!-- markdownlint-disable MD033 -->
6
+ <!-- markdownlint-disable MD028 -->
7
+ <!-- markdownlint-disable MD007 -->
8
+
5
9
  <img src=img/main.jpg>
6
10
 
11
+ <!-- prettier-ignore-start -->
12
+ <!-- TOC depthfrom:2 orderedlist:false -->
13
+
14
+ - [Installation](#installation)
15
+ - [Automatic](#automatic)
16
+ - [Manual](#manual)
17
+ - [Usage](#usage)
18
+ - [Options](#options)
19
+ - [Keyboard Shortcuts](#keyboard-shortcuts)
20
+ - [What is backed up](#what-is-backed-up)
21
+ - [Restore](#restore)
22
+ - [Settings](#settings)
23
+ - [Notes](#notes)
24
+ - [FAQ](#faq)
25
+ - [Internal Joplin links betwen notes are lost](#internal-joplin-links-betwen-notes-are-lost)
26
+ - [Combine multiple JEX Files to one](#combine-multiple-jex-files-to-one)
27
+ - [Open a JEX Backup file](#open-a-jex-backup-file)
28
+ - [Changelog](#changelog)
29
+ - [Links](#links)
30
+
31
+ <!-- /TOC -->
32
+ <!-- prettier-ignore-end -->
33
+
7
34
  ## Installation
8
35
 
9
36
  ### Automatic
@@ -44,6 +71,8 @@ Go to `Tools > Options > Backup`
44
71
  | `Temporary export path` | The data is first exported into this path before it is copied to the backup `Backup path`. | `` |
45
72
  | `Backup set name` | Name of the backup set if multiple backups are to be keep. [Available moment tokens](https://momentjs.com/docs/#/displaying/format/), which can be used with `{<TOKEN>}` | `{YYYYMMDDHHmm}` |
46
73
  | `Single JEX` | Create only one JEX file for all, this option is recommended to prevent the loss of internal note links or folder structure during a restore! | `true` |
74
+ | `Export format` | Selection of the export format of the notes. | `jex` |
75
+ | `Command on Backup finish` | Execute command when backup is finished. | |
47
76
  | `Create Subfolder` | Create a sub folder `JoplinBackup` in the configured `Backup path`. Deactivate only if there is no other data in the `Backup path`! | `true` |
48
77
  | `Backup plugins` | Backup the plugin folder from the Joplin profile with all installed plugin jpl files. | `true` |
49
78
 
@@ -79,7 +108,7 @@ The notes are imported via `File > Import > JEX - Joplin Export File`.
79
108
  > Individual notes cannot be restored from the JEX file!
80
109
 
81
110
  The notes are imported additionally, no check for duplicates is performed.
82
- If the folder in which the note was located already exists in you Joplin, than the folder name is extended by one (1).
111
+ If the notebook in which the note was located already exists in your Joplin, then a "(1)" will be appended to the folder name.
83
112
 
84
113
  ## FAQ
85
114
 
@@ -88,7 +117,7 @@ If the folder in which the note was located already exists in you Joplin, than t
88
117
  If several JEX files are imported and the notes have links to each other, these links will be lost.
89
118
  Therefore it is recommended to create a Single JEX Backup!
90
119
 
91
- ### Compine multiple JEX Files to one
120
+ ### Combine multiple JEX Files to one
92
121
 
93
122
  By combining the JEX files into one, the Joplin internal links will work again after the import.
94
123
 
@@ -298,6 +298,51 @@ describe("Backup", function () {
298
298
  expect(fs.existsSync(expected)).toBe(true);
299
299
  });
300
300
 
301
+ it(`retention = 1, folder exist with same files and folder`, async () => {
302
+ const emptyFolder = path.join(testPath.activeBackupJob, "emptyFolder");
303
+ const emptyFolderCheck = path.join(
304
+ testPath.backupBasePath,
305
+ "emptyFolder"
306
+ );
307
+ const folderNotes = path.join(testPath.activeBackupJob, "notes");
308
+ const folderNotesCheck = path.join(testPath.backupBasePath, "notes");
309
+ const file1 = path.join(folderNotes, "file.txt");
310
+ const file1Check = path.join(folderNotesCheck, "file.txt");
311
+ const file2 = path.join(testPath.activeBackupJob, "file.txt");
312
+ const file2Check = path.join(testPath.backupBasePath, "file.txt");
313
+ const file3Check = path.join(testPath.backupBasePath, "fileStay.txt");
314
+ const file4Check = path.join(folderNotesCheck, "fileNo.txt");
315
+ backup.backupBasePath = testPath.backupBasePath;
316
+ backup.activeBackupPath = testPath.activeBackupJob;
317
+
318
+ fs.emptyDirSync(testPath.backupBasePath);
319
+ fs.emptyDirSync(emptyFolderCheck);
320
+ fs.emptyDirSync(folderNotesCheck);
321
+ fs.writeFileSync(file1Check, "old file");
322
+ fs.writeFileSync(file2Check, "old file");
323
+ fs.writeFileSync(file3Check, "old file");
324
+ fs.writeFileSync(file4Check, "old file");
325
+
326
+ fs.emptyDirSync(testPath.activeBackupJob);
327
+ fs.emptyDirSync(emptyFolder);
328
+ fs.emptyDirSync(folderNotes);
329
+ fs.writeFileSync(file1, "new file");
330
+ fs.writeFileSync(file2, "new file");
331
+
332
+ backup.backupRetention = 1;
333
+
334
+ expect(await backup.moveFinishedBackup()).toBe(testPath.backupBasePath);
335
+ expect(fs.existsSync(folderNotes)).toBe(false);
336
+ expect(fs.existsSync(folderNotesCheck)).toBe(true);
337
+ expect(fs.existsSync(emptyFolderCheck)).toBe(true);
338
+ expect(fs.existsSync(file1Check)).toBe(true);
339
+ expect(fs.existsSync(file2Check)).toBe(true);
340
+ expect(fs.existsSync(file3Check)).toBe(true);
341
+ expect(fs.existsSync(file4Check)).toBe(false);
342
+ expect(backup.log.error).toHaveBeenCalledTimes(0);
343
+ expect(backup.log.warn).toHaveBeenCalledTimes(0);
344
+ });
345
+
301
346
  it(`retention > 1, file exist`, async () => {
302
347
  backup.backupBasePath = testPath.backupBasePath;
303
348
  backup.activeBackupPath = testPath.activeBackupJob;
@@ -71,4 +71,79 @@ describe("Test helper", function () {
71
71
  );
72
72
  }
73
73
  });
74
+ it(`Compare versions`, async () => {
75
+ const testCases = [
76
+ {
77
+ version1: "2.9.12",
78
+ version2: "2.9.12",
79
+ expected: 0,
80
+ },
81
+ {
82
+ version1: "2.9.12",
83
+ version2: "2.9.13",
84
+ expected: -1,
85
+ },
86
+ {
87
+ version1: "2.9.13",
88
+ version2: "2.9.12",
89
+ expected: 1,
90
+ },
91
+ {
92
+ version1: "2.10.6",
93
+ version2: "2.9.12",
94
+ expected: 1,
95
+ },
96
+ {
97
+ version1: "3.10.6",
98
+ version2: "2.11.8",
99
+ expected: 1,
100
+ },
101
+ {
102
+ version1: "2.10.6",
103
+ version2: "3.11.8",
104
+ expected: -1,
105
+ },
106
+ {
107
+ version1: "2",
108
+ version2: "2.1",
109
+ expected: -1,
110
+ },
111
+ {
112
+ version1: "2.1",
113
+ version2: "2",
114
+ expected: 1,
115
+ },
116
+ {
117
+ version1: "3",
118
+ version2: "2",
119
+ expected: 1,
120
+ },
121
+ {
122
+ version1: "2",
123
+ version2: "2",
124
+ expected: 0,
125
+ },
126
+ {
127
+ version1: "3.11.8",
128
+ version2: "3.11.8-a",
129
+ expected: 0,
130
+ },
131
+ {
132
+ version1: "2",
133
+ version2: "",
134
+ expected: -2,
135
+ },
136
+ {
137
+ version1: "3.a.8",
138
+ version2: "3.11.8",
139
+ expected: -1,
140
+ },
141
+ ];
142
+
143
+ for (const testCase of testCases) {
144
+ expect(
145
+ await helper.versionCompare(testCase.version1, testCase.version2)
146
+ ).toBe(testCase.expected);
147
+ }
148
+ });
74
149
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "joplin-plugin-backup",
3
- "version": "1.1.1",
3
+ "version": "1.2.1",
4
4
  "scripts": {
5
5
  "dist": "webpack --joplin-plugin-config buildMain && webpack --joplin-plugin-config buildExtraScripts && webpack --joplin-plugin-config createArchive",
6
6
  "prepare": "npm run dist && husky install",
@@ -2,7 +2,7 @@
2
2
  "manifest_version": 1,
3
3
  "id": "io.github.jackgruber.backup",
4
4
  "app_min_version": "2.1.3",
5
- "version": "1.1.1",
5
+ "version": "1.2.1",
6
6
  "name": "Simple Backup",
7
7
  "description": "Plugin to create manual and automatic backups.",
8
8
  "author": "JackGruber",
@@ -16,6 +16,6 @@
16
16
  "7zip",
17
17
  "encrypted"
18
18
  ],
19
- "_publish_hash": "sha256:616b034ec484e83bf972adab454c9c00d23d9bd0b21574beba7915e42ff7415a",
20
- "_publish_commit": "master:98221472e60f34026ac739368c2831193f564654"
19
+ "_publish_hash": "sha256:ee3fee3a90fe21a1c656240f9e3506fd6651a7318f398a484c6c31bef425dec8",
20
+ "_publish_commit": "master:e4e8e6cff708bc7f181d2c18122084b7aeb4fb32"
21
21
  }