forked from nicolevanderhoeven/obsidian-vault-changelog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
313 lines (303 loc) · 59.7 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
'use strict';
var obsidian = require('obsidian');
/******************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/* global Reflect, Promise */
var extendStatics = function(d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
function __extends(d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
function __awaiter(thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
}
function __generator(thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
}
var DEFAULT_SETTINGS = {
numberOfFilesToShow: 10,
changelogFilePath: "",
watchVaultChange: false,
excludePaths: "",
};
var Changelog = /** @class */ (function (_super) {
__extends(Changelog, _super);
function Changelog() {
return _super !== null && _super.apply(this, arguments) || this;
}
Changelog.prototype.onload = function () {
return __awaiter(this, void 0, void 0, function () {
var _this = this;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
console.log("Loading Changelog plugin Qwxlea");
return [4 /*yield*/, this.loadSettings()];
case 1:
_a.sent();
this.addSettingTab(new ChangelogSettingsTab(this.app, this));
this.addCommand({
id: "update",
name: "update",
callback: function () { return _this.writeChangelog(); },
hotkeys: [],
});
this.watchVaultChange = obsidian.debounce(this.watchVaultChange.bind(this), 200, false);
this.registerWatchVaultEvents();
return [2 /*return*/];
}
});
});
};
Changelog.prototype.registerWatchVaultEvents = function () {
if (this.settings.watchVaultChange) {
this.registerEvent(this.app.vault.on("modify", this.watchVaultChange));
this.registerEvent(this.app.vault.on("delete", this.watchVaultChange));
this.registerEvent(this.app.vault.on("rename", this.watchVaultChange));
}
else {
this.app.vault.off("modify", this.watchVaultChange);
this.app.vault.off("delete", this.watchVaultChange);
this.app.vault.off("rename", this.watchVaultChange);
}
};
Changelog.prototype.watchVaultChange = function (file) {
if (file.path === this.settings.changelogFilePath) {
return;
}
else {
this.writeChangelog();
}
};
Changelog.prototype.writeChangelog = function () {
return __awaiter(this, void 0, void 0, function () {
var changelog;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
changelog = this.buildChangelog();
return [4 /*yield*/, this.writeInFile(this.settings.changelogFilePath, changelog)];
case 1:
_a.sent();
return [2 /*return*/];
}
});
});
};
Changelog.prototype.buildChangelog = function () {
var _this = this;
var pathsToExclude = this.settings.excludePaths.split(',');
var cache = this.app.metadataCache;
var files = this.app.vault.getMarkdownFiles();
var recentlyEditedFiles = files
// Remove changelog file from recentlyEditedFiles list
.filter(function (recentlyEditedFile) {
return recentlyEditedFile.path !== _this.settings.changelogFilePath;
})
// Remove files from paths to be excluded from recentlyEditedFiles list
.filter(function (recentlyEditedFile) {
var i;
var keep = true;
for (i = 0; i < pathsToExclude.length; i++) {
if (recentlyEditedFile.path.startsWith(pathsToExclude[i].trim())) {
keep = false;
break;
}
}
return keep;
})
// exclude if specifically told not to
.filter(function (recentlyEditedFile) {
var frontMatter = cache.getFileCache(recentlyEditedFile).frontmatter;
if (frontMatter && frontMatter.publish === false) {
return false;
}
return true;
})
.sort(function (a, b) { return (a.stat.mtime < b.stat.mtime ? 1 : -1); })
.slice(0, this.settings.numberOfFilesToShow);
var changelogContent = "";
var header = "";
for (var _i = 0, recentlyEditedFiles_1 = recentlyEditedFiles; _i < recentlyEditedFiles_1.length; _i++) {
var recentlyEditedFile = recentlyEditedFiles_1[_i];
// TODO: make date format configurable (and validate it)
var humanTime = window
.moment(recentlyEditedFile.stat.mtime)
// date is already shown in the titles
.format("YYYY-MM-DD HH[h]mm");
if (header != humanTime.substring(0, 10)) {
header = humanTime.substring(0, 10);
changelogContent += "## ".concat(header, "\n");
}
changelogContent += "- ".concat(humanTime.substring(10, 16), " \u00B7 [[").concat(recentlyEditedFile.basename, "]]\n");
}
return changelogContent;
};
Changelog.prototype.writeInFile = function (filePath, content) {
return __awaiter(this, void 0, void 0, function () {
var file;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
file = this.app.vault.getAbstractFileByPath(filePath);
if (!(file instanceof obsidian.TFile)) return [3 /*break*/, 2];
return [4 /*yield*/, this.app.vault.modify(file, content)];
case 1:
_a.sent();
return [3 /*break*/, 3];
case 2:
new obsidian.Notice("Couldn't write changelog: check the file path");
_a.label = 3;
case 3: return [2 /*return*/];
}
});
});
};
Changelog.prototype.loadSettings = function () {
return __awaiter(this, void 0, void 0, function () {
var _a, _b, _c, _d;
return __generator(this, function (_e) {
switch (_e.label) {
case 0:
_a = this;
_c = (_b = Object).assign;
_d = [{}, DEFAULT_SETTINGS];
return [4 /*yield*/, this.loadData()];
case 1:
_a.settings = _c.apply(_b, _d.concat([_e.sent()]));
return [2 /*return*/];
}
});
});
};
Changelog.prototype.saveSettings = function () {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.saveData(this.settings)];
case 1:
_a.sent();
return [2 /*return*/];
}
});
});
};
Changelog.prototype.onunload = function () {
console.log("Unloading Changelog plugin");
};
return Changelog;
}(obsidian.Plugin));
var ChangelogSettingsTab = /** @class */ (function (_super) {
__extends(ChangelogSettingsTab, _super);
function ChangelogSettingsTab(app, plugin) {
var _this = _super.call(this, app, plugin) || this;
_this.plugin = plugin;
return _this;
}
ChangelogSettingsTab.prototype.display = function () {
var _this = this;
var containerEl = this.containerEl;
containerEl.empty();
var settings = this.plugin.settings;
new obsidian.Setting(containerEl)
.setName("Changelog note location")
.setDesc("Changelog file absolute path (including the extension)")
.addText(function (text) {
text
.setPlaceholder("Example: Folder/Changelog.md")
.setValue(settings.changelogFilePath)
.onChange(function (value) {
settings.changelogFilePath = value;
_this.plugin.saveSettings();
});
});
new obsidian.Setting(containerEl)
.setName("Number of recent files in changelog")
.setDesc("Number of most recently edited files to show in the changelog")
.addText(function (text) {
return text
.setValue(String(settings.numberOfFilesToShow))
.onChange(function (value) {
if (!isNaN(Number(value))) {
settings.numberOfFilesToShow = Number(value);
_this.plugin.saveSettings();
}
});
});
new obsidian.Setting(containerEl)
.setName("Automatically update changelog")
.setDesc("Automatically update changelog on any vault change (modification, renaming or deletion of a note)")
.addToggle(function (toggle) {
return toggle
.setValue(_this.plugin.settings.watchVaultChange)
.onChange(function (value) {
_this.plugin.settings.watchVaultChange = value;
_this.plugin.saveSettings();
_this.plugin.registerWatchVaultEvents();
});
});
new obsidian.Setting(containerEl)
.setName("Excluded paths")
.setDesc("Paths or folders to ignore from changelog, separated by a comma")
.addText(function (text) {
text
.setPlaceholder("Example: Meetings,People")
.setValue(settings.excludePaths)
.onChange(function (value) {
settings.excludePaths = value;
_this.plugin.saveSettings();
});
});
};
return ChangelogSettingsTab;
}(obsidian.PluginSettingTab));
module.exports = Changelog;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWFpbi5qcyIsInNvdXJjZXMiOlsibm9kZV9tb2R1bGVzL3RzbGliL3RzbGliLmVzNi5qcyIsIm1haW4udHMiXSwic291cmNlc0NvbnRlbnQiOlsiLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKlxyXG5Db3B5cmlnaHQgKGMpIE1pY3Jvc29mdCBDb3Jwb3JhdGlvbi5cclxuXHJcblBlcm1pc3Npb24gdG8gdXNlLCBjb3B5LCBtb2RpZnksIGFuZC9vciBkaXN0cmlidXRlIHRoaXMgc29mdHdhcmUgZm9yIGFueVxyXG5wdXJwb3NlIHdpdGggb3Igd2l0aG91dCBmZWUgaXMgaGVyZWJ5IGdyYW50ZWQuXHJcblxyXG5USEUgU09GVFdBUkUgSVMgUFJPVklERUQgXCJBUyBJU1wiIEFORCBUSEUgQVVUSE9SIERJU0NMQUlNUyBBTEwgV0FSUkFOVElFUyBXSVRIXHJcblJFR0FSRCBUTyBUSElTIFNPRlRXQVJFIElOQ0xVRElORyBBTEwgSU1QTElFRCBXQVJSQU5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b250aW51ZTtcclxuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKCEodCA9IF8udHJ5cywgdCA9IHQubGVuZ3RoID4gMCAmJiB0W3QubGVuZ3RoIC0gMV0pICYmIChvcFswXSA9PT0gNiB8fCBvcFswXSA9PT0gMikpIHsgXyA9IDA7IGNvbnRpbnVlOyB9XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKG9wWzBdID09PSAzICYmICghdCB8fCAob3BbMV0gPiB0WzBdICYmIG9wWzFdIDwgdFszXSkpKSB7IF8ubGFiZWwgPSBvcFsxXTsgYnJlYWs7IH1cclxuICAgICAgICAgICAgICAgICAgICBpZiAob3BbMF0gPT09IDYgJiYgXy5sYWJlbCA8IHRbMV0pIHsgXy5sYWJlbCA9IHRbMV07IHQgPSBvcDsgYnJlYWs7IH1cclxuICAgICAgICAgICAgICAgICAgICBpZiAodCAmJiBfLmxhYmVsIDwgdFsyXSkgeyBfLmxhYmVsID0gdFsyXTsgXy5vcHMucHVzaChvcCk7IGJyZWFrOyB9XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKHRbMl0pIF8ub3BzLnBvcCgpO1xyXG4gICAgICAgICAgICAgICAgICAgIF8udHJ5cy5wb3AoKTsgY29udGludWU7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgb3AgPSBib2R5LmNhbGwodGhpc0FyZywgXyk7XHJcbiAgICAgICAgfSBjYXRjaCAoZSkgeyBvcCA9IFs2LCBlXTsgeSA9IDA7IH0gZmluYWxseSB7IGYgPSB0ID0gMDsgfVxyXG4gICAgICAgIGlmIChvcFswXSAmIDUpIHRocm93IG9wWzFdOyByZXR1cm4geyB2YWx1ZTogb3BbMF0gPyBvcFsxXSA6IHZvaWQgMCwgZG9uZTogdHJ1ZSB9O1xyXG4gICAgfVxyXG59XHJcblxyXG5leHBvcnQgdmFyIF9fY3JlYXRlQmluZGluZyA9IE9iamVjdC5jcmVhdGUgPyA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