├── .editorconfig ├── .eslintignore ├── .eslintrc ├── .github └── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── .gitignore ├── .npmrc ├── LICENSE ├── README.md ├── build ├── bump ├── esbuild.config.mjs ├── images ├── fig1.png ├── fig2.png └── fig3.png ├── main.ts ├── manifest.json ├── package.json ├── tsconfig.json ├── version-bump.mjs └── versions.json /.editorconfig: -------------------------------------------------------------------------------- 1 | # top-most EditorConfig file 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | end_of_line = lf 7 | insert_final_newline = true 8 | indent_style = tab 9 | indent_size = 4 10 | tab_width = 4 11 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | 3 | main.js 4 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | "parser": "@typescript-eslint/parser", 4 | "env": { "node": true }, 5 | "plugins": [ 6 | "@typescript-eslint" 7 | ], 8 | "extends": [ 9 | "eslint:recommended", 10 | "plugin:@typescript-eslint/eslint-recommended", 11 | "plugin:@typescript-eslint/recommended" 12 | ], 13 | "parserOptions": { 14 | "sourceType": "module" 15 | }, 16 | "rules": { 17 | "no-unused-vars": "off", 18 | "@typescript-eslint/no-unused-vars": ["error", { "args": "none" }], 19 | "@typescript-eslint/ban-ts-comment": "off", 20 | "no-prototype-builtins": "off", 21 | "@typescript-eslint/no-empty-function": "off" 22 | } 23 | } -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **System** 27 | - Obsidian Version: 28 | - OS: [e.g. macOS]: 29 | - OS Version: 30 | 31 | **Additional context** 32 | Add any other context about the problem here. 33 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # vscode 2 | .vscode 3 | 4 | B# Intellij 5 | *.iml 6 | .idea 7 | 8 | # npm 9 | node_modules 10 | 11 | # Don't include the compiled main.js file in the repo. 12 | # They should be uploaded to GitHub releases instead. 13 | main.js 14 | 15 | # Exclude sourcemaps 16 | *.map 17 | 18 | # obsidian 19 | data.json 20 | 21 | # Exclude macOS Finder (System Explorer) View States 22 | .DS_Store 23 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | tag-version-prefix="" -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Optimize Canvas Connections 2 | 3 | Suppose you start a canvas. 4 | 5 | ![Figure 1](https://github.com/felixchenier/obsidian-optimize-canvas-connections/raw/master/images/fig1.png) 6 | 7 | Then you move everything around while you brainstorm. The connections between notes may quickly become a mess. 8 | 9 | ![Figure 2](https://github.com/felixchenier/obsidian-optimize-canvas-connections/raw/master/images/fig2.png) 10 | 11 | This simple plugin automatically reconnect notes together, using their nearest edges. 12 | 13 | Select the notes to reconnect, then run command: 14 | 15 | `Optimize Canvas Connections: Optimize selection (preserve axes)` 16 | 17 | or 18 | 19 | `Optimize Canvas Connections: Optimize selection (shortest path)` 20 | 21 | 22 | ![Figure 3](https://github.com/felixchenier/obsidian-optimize-canvas-connections/raw/master/images/fig3.png) 23 | 24 | ## Shortest path 25 | 26 | The `shortest path` option reconnects notes using their nearest edges, always using the shortest path possible. This is the most drastic approach. 27 | 28 | ## Preserve axes 29 | 30 | The `preserve axes` option also reconnects notes using their nearest edges, but it respects the axes on which a connection originally begins and ends. For instance, a connection that begins on the right side of a note could be changed to begin from the left, but not from the top or bottom. Use this option to preserve meaning in vertical and horizontal flow (e.g., top-to-bottom = time, left-to-right = details). 31 | 32 | **In doubt, use `preserve axes`.** 33 | 34 | In both cases, when no note is selected, the optimization is applied to the whole canvas. 35 | -------------------------------------------------------------------------------- /build: -------------------------------------------------------------------------------- 1 | npm run build 2 | mkdir ~/Library/Mobile\ Documents/iCloud~md~obsidian/Documents/Notes/.obsidian/plugins/optimize-canvas-connections 3 | cp main.js ~/Library/Mobile\ Documents/iCloud~md~obsidian/Documents/Notes/.obsidian/plugins/optimize-canvas-connections/ 4 | cp manifest.json ~/Library/Mobile\ Documents/iCloud~md~obsidian/Documents/Notes/.obsidian/plugins/optimize-canvas-connections/ 5 | -------------------------------------------------------------------------------- /bump: -------------------------------------------------------------------------------- 1 | npm version patch 2 | 3 | -------------------------------------------------------------------------------- /esbuild.config.mjs: -------------------------------------------------------------------------------- 1 | import esbuild from "esbuild"; 2 | import process from "process"; 3 | import builtins from "builtin-modules"; 4 | 5 | const banner = 6 | `/* 7 | THIS IS A GENERATED/BUNDLED FILE BY ESBUILD 8 | if you want to view the source, please visit the github repository of this plugin 9 | */ 10 | `; 11 | 12 | const prod = (process.argv[2] === "production"); 13 | 14 | const context = await esbuild.context({ 15 | banner: { 16 | js: banner, 17 | }, 18 | entryPoints: ["main.ts"], 19 | bundle: true, 20 | external: [ 21 | "obsidian", 22 | "electron", 23 | "@codemirror/autocomplete", 24 | "@codemirror/collab", 25 | "@codemirror/commands", 26 | "@codemirror/language", 27 | "@codemirror/lint", 28 | "@codemirror/search", 29 | "@codemirror/state", 30 | "@codemirror/view", 31 | "@lezer/common", 32 | "@lezer/highlight", 33 | "@lezer/lr", 34 | ...builtins], 35 | format: "cjs", 36 | target: "es2018", 37 | logLevel: "info", 38 | sourcemap: prod ? false : "inline", 39 | treeShaking: true, 40 | outfile: "main.js", 41 | }); 42 | 43 | if (prod) { 44 | await context.rebuild(); 45 | process.exit(0); 46 | } else { 47 | await context.watch(); 48 | } 49 | -------------------------------------------------------------------------------- /images/fig1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/felixchenier/obsidian-optimize-canvas-connections/4ff3e1cdb52d66420af7b0a79c2b5250f4182443/images/fig1.png -------------------------------------------------------------------------------- /images/fig2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/felixchenier/obsidian-optimize-canvas-connections/4ff3e1cdb52d66420af7b0a79c2b5250f4182443/images/fig2.png -------------------------------------------------------------------------------- /images/fig3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/felixchenier/obsidian-optimize-canvas-connections/4ff3e1cdb52d66420af7b0a79c2b5250f4182443/images/fig3.png -------------------------------------------------------------------------------- /main.ts: -------------------------------------------------------------------------------- 1 | import { ItemView, App, Editor, MarkdownView, Modal, Notice, Plugin, PluginSettingTab, Setting } from 'obsidian'; 2 | 3 | export default class OptimizeCanvasConnectionsPlugin extends Plugin { 4 | 5 | async onload() { 6 | this.addCommand({ 7 | id: 'optimize-preserve-axes-selection', 8 | name: 'Optimize selection (preserve axes)', 9 | checkCallback: (checking: boolean) => { 10 | const canvasView = app.workspace.getActiveViewOfType(ItemView); 11 | if (canvasView?.getViewType() == "canvas") { 12 | if (!checking) { 13 | this.optimize('preserve-axes'); 14 | } 15 | return true; 16 | } 17 | return false; 18 | } 19 | }); 20 | this.addCommand({ 21 | id: 'optimize-shortest-path-selection', 22 | name: 'Optimize selection (shortest path)', 23 | checkCallback: (checking: boolean) => { 24 | const canvasView = app.workspace.getActiveViewOfType(ItemView); 25 | if (canvasView?.getViewType() == "canvas") { 26 | if (!checking) { 27 | this.optimize('shortest-path'); 28 | } 29 | return true; 30 | } 31 | return false; 32 | } 33 | }); 34 | } 35 | 36 | onunload() { 37 | 38 | } 39 | 40 | async optimize(option: string) { 41 | const canvasView = app.workspace.getActiveViewOfType(ItemView); 42 | 43 | // @ts-ignore 44 | const canvas = canvasView?.canvas; 45 | 46 | // Read current selection 47 | const currentSelection = canvas?.selection; 48 | let selectedIDs = new Array(); 49 | // @ts-ignore 50 | currentSelection.forEach(function(selection) { 51 | selectedIDs.push(selection.id); 52 | }) 53 | let applyToAll = false; 54 | if (selectedIDs.length == 0) { 55 | applyToAll = true; 56 | } 57 | 58 | // Go through every edge 59 | for (let [edgeKey, edge] of canvas['edges']) { 60 | 61 | // Find from and to nodes 62 | let fromNode = edge['from']['node']; 63 | let toNode = edge['to']['node']; 64 | 65 | // Calculate the many possibilities of distance 66 | 67 | let fromPossibilities = [edge['from']['side']]; // default = no change 68 | 69 | if (applyToAll || selectedIDs.includes(fromNode['id'])){ 70 | switch(option) { 71 | case "shortest-path": 72 | fromPossibilities = ['top', 'bottom', 'left', 'right']; 73 | break 74 | case "preserve-axes": 75 | switch(edge['from']['side']) { 76 | case 'top': 77 | case 'bottom': 78 | fromPossibilities = ['top', 'bottom']; 79 | break; 80 | case 'left': 81 | case 'right': 82 | fromPossibilities = ['left', 'right']; 83 | break; 84 | } 85 | } 86 | } 87 | 88 | let toPossibilities = [edge['to']['side']]; // default = no change 89 | 90 | if (applyToAll || selectedIDs.includes(toNode['id'])){ 91 | switch(option) { 92 | case "shortest-path": 93 | toPossibilities = ['top', 'bottom', 'left', 'right']; 94 | break 95 | case "preserve-axes": 96 | switch(edge['to']['side']) { 97 | case 'top': 98 | case 'bottom': 99 | toPossibilities = ['top', 'bottom']; 100 | break; 101 | case 'left': 102 | case 'right': 103 | toPossibilities = ['left', 'right']; 104 | break; 105 | } 106 | } 107 | } 108 | 109 | let distances = [] 110 | 111 | for (const fromSide of fromPossibilities) { 112 | 113 | let fromPoint = {'x': 0, 'y': 0}; 114 | if (fromSide == 'top') { 115 | fromPoint = {'x': fromNode['x'] + fromNode['width']/2, 'y': fromNode['y']}; 116 | } else if (fromSide == 'bottom') { 117 | fromPoint = {'x': fromNode['x'] + fromNode['width']/2, 'y': fromNode['y'] + fromNode['height']}; 118 | } else if (fromSide == 'left') { 119 | fromPoint = {'x': fromNode['x'], 'y': fromNode['y'] + fromNode['height']/2}; 120 | } else if (fromSide == 'right') { 121 | fromPoint = {'x': fromNode['x'] + fromNode['width'], 'y': fromNode['y'] + fromNode['height']/2}; 122 | } 123 | 124 | for (const toSide of toPossibilities) { 125 | 126 | let toPoint = {'x': 0, 'y': 0}; 127 | if (toSide == 'top') { 128 | toPoint = {'x': toNode['x'] + toNode['width']/2, 'y': toNode['y']}; 129 | } else if (toSide == 'bottom') { 130 | toPoint = {'x': toNode['x'] + toNode['width']/2, 'y': toNode['y'] + toNode['height']}; 131 | } else if (toSide == 'left') { 132 | toPoint = {'x': toNode['x'], 'y': toNode['y'] + toNode['height']/2}; 133 | } else if (toSide == 'right') { 134 | toPoint = {'x': toNode['x'] + toNode['width'], 'y': toNode['y'] + toNode['height']/2}; 135 | } 136 | 137 | distances.push({ 138 | 'fromSide': fromSide, 139 | 'toSide': toSide, 140 | 'distance': (toPoint.x - fromPoint.x) ** 2 + (toPoint.y - fromPoint.y) ** 2}); 141 | 142 | } 143 | } 144 | 145 | // Find the best one 146 | distances = distances.sort(function(a, b) { 147 | return a.distance - b.distance; 148 | }); 149 | 150 | // Assign it 151 | edge['from']['side'] = distances[0]['fromSide']; 152 | edge['to']['side'] = distances[0]['toSide']; 153 | edge.render(); 154 | 155 | } 156 | 157 | canvas.requestSave(); 158 | 159 | } 160 | 161 | 162 | } 163 | 164 | 165 | -------------------------------------------------------------------------------- /manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "optimize-canvas-connections", 3 | "name": "Optimize Canvas Connections", 4 | "version": "1.0.0", 5 | "minAppVersion": "1.1.9", 6 | "description": "An Obsidian plugin that declutters a canvas by reconnecting notes using their nearest edges.", 7 | "author": "Félix Chénier", 8 | "authorUrl": "https://felixchenier.uqam.ca", 9 | "isDesktopOnly": false 10 | } 11 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Optimize Canvas Connections", 3 | "version": "1.0.0", 4 | "description": "An Obsidian plugin that declutters a canvas by reconnecting notes using their nearest edges.", 5 | "main": "main.js", 6 | "scripts": { 7 | "dev": "node esbuild.config.mjs", 8 | "build": "tsc -noEmit -skipLibCheck && node esbuild.config.mjs production", 9 | "version": "node version-bump.mjs && git add manifest.json versions.json" 10 | }, 11 | "keywords": [], 12 | "author": "", 13 | "license": "MIT", 14 | "devDependencies": { 15 | "@types/node": "^16.11.6", 16 | "@typescript-eslint/eslint-plugin": "5.29.0", 17 | "@typescript-eslint/parser": "5.29.0", 18 | "builtin-modules": "3.3.0", 19 | "esbuild": "0.17.3", 20 | "obsidian": "latest", 21 | "tslib": "2.4.0", 22 | "typescript": "4.7.4" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "baseUrl": ".", 4 | "inlineSourceMap": true, 5 | "inlineSources": true, 6 | "module": "ESNext", 7 | "target": "ES6", 8 | "allowJs": true, 9 | "noImplicitAny": true, 10 | "moduleResolution": "node", 11 | "importHelpers": true, 12 | "isolatedModules": true, 13 | "strictNullChecks": true, 14 | "lib": [ 15 | "DOM", 16 | "ES5", 17 | "ES6", 18 | "ES7" 19 | ] 20 | }, 21 | "include": [ 22 | "**/*.ts" 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /version-bump.mjs: -------------------------------------------------------------------------------- 1 | import { readFileSync, writeFileSync } from "fs"; 2 | 3 | const targetVersion = process.env.npm_package_version; 4 | 5 | // read minAppVersion from manifest.json and bump version to target version 6 | let manifest = JSON.parse(readFileSync("manifest.json", "utf8")); 7 | const { minAppVersion } = manifest; 8 | manifest.version = targetVersion; 9 | writeFileSync("manifest.json", JSON.stringify(manifest, null, "\t")); 10 | 11 | // update versions.json with target version and minAppVersion from manifest.json 12 | let versions = JSON.parse(readFileSync("versions.json", "utf8")); 13 | versions[targetVersion] = minAppVersion; 14 | writeFileSync("versions.json", JSON.stringify(versions, null, "\t")); 15 | -------------------------------------------------------------------------------- /versions.json: -------------------------------------------------------------------------------- 1 | { 2 | "0.0.1": "1.1.9", 3 | "0.0.2": "1.1.9", 4 | "0.0.3": "1.1.9", 5 | "0.0.4": "1.1.9", 6 | "0.0.5": "1.1.9", 7 | "0.0.6": "1.1.9", 8 | "0.0.7": "1.1.9", 9 | "0.0.8": "1.1.9" 10 | "0.9.0": "1.1.9" 11 | "0.10.0": "1.1.9" 12 | "0.10.1": "1.1.9" 13 | "0.10.2": "1.1.9" 14 | "1.0.0": "1.1.9" 15 | } 16 | --------------------------------------------------------------------------------