obsidian-launcher 3.0.1 → 3.0.2

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Jesse Hines
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,136 @@
1
- # obsidian-launcher
1
+ # Obsidian Launcher [![](https://img.shields.io/npm/v/obsidian-launcher)](https://www.npmjs.com/package/obsidian-launcher)
2
2
 
3
- TODO
3
+ `obsidian-launcher` is a package for downloading and launching different versions of [Obsidian](https://obsidian.md) for testing Obsidian plugins. It can download and launch different versions of Obsidian, install plugins and themes into Obsidian vaults, and launch sandboxed Obsidian instances with isolated user configuration directories. You can use it as either a JavaScript package or as a command line interface.
4
+
5
+ The primary use case for this package is to allow [wdio-obsidian-service](../wdio-obsidian-service/README.md) to automatically download Obsidian when testing plugins with WebdriverIO. However, it can also be used as a stand-alone package if you want to use the CLI to compare Obsidian versions during plugin development.
6
+
7
+ ## Example Usage
8
+ You can run the CLI via `npx`, e.g.:
9
+ ```bash
10
+ npx obsidian-launcher watch --version 1.8.10 --copy --plugin . test/vault
11
+ ```
12
+ This will download and launch Obsidian 1.8.10 with a sandboxed configuration directory so you don't need to worry about it interfering with your system Obsidian installation. You can even launch multiple different versions of Obsidian side-by-side. See [below](#cli) for CLI docs.
13
+
14
+ To use the JavaScript API, use the `ObsidianLauncher` class, e.g.:
15
+ ```js
16
+ import ObsidianLauncher from "obsidian-launcher"
17
+ const launcher = new ObsidianLauncher();
18
+ const {proc} = await launcher.launch({
19
+ appVersion: "1.8.10",
20
+ vault: "path/to/my/vault",
21
+ copy: true, // open a copy of the vault in Obsidian
22
+ plugins: [
23
+ "path/to/my/plugin", // install a local plugin
24
+ {id: "dataview"}, // install a community plugin
25
+ ],
26
+ })
27
+ ```
28
+
29
+ ## Obsidian App vs Installer Versions
30
+ Obsidian Desktop is distributed in two parts, the "installer" which is the executable containing Electron, and the "app" which is a bundle of JavaScript containing the Obsidian code. Obsidian's self-update system only updates the app JS bundle, and not the base installer/Electron version. This makes Obsidian's auto-update fast as it only needs to download a few MiB of JS instead of all of Electron. But, it means different users with the same Obsidian app version may be running on different versions of Electron, which can cause subtle differences in plugin behavior. Most ObsidianLauncher methods take both an `appVersion` and an `installerVersion` parameter, allowing you to test the same Obsidian app version on different versions of Electron.
31
+
32
+ `appVersion` can be set to one of:
33
+ - a specific version string like "1.7.7"
34
+ - "latest": run the latest non-beta Obsidian version
35
+ - "latest-beta": run the latest beta Obsidian version (or latest if there is no current beta)
36
+ - To download Obsidian beta versions you'll need to have an Obsidian Insiders account
37
+ - "earliest": run the `minAppVersion` set in your plugin's `manifest.json`
38
+
39
+ `installerVersion` can be set to one of:
40
+ - a specific version string like "1.7.7"
41
+ - "latest": run the latest Obsidian installer compatible with `appVersion`
42
+ - "earliest": run the oldest Obsidian installer compatible with `appVersion`
43
+
44
+ ### Platform Support
45
+ `obsidian-launcher` works for Obsidian Desktop on Windows, Linux, and MacOS.
46
+
47
+ Windows firewall will sometimes complain about NodeJS on launch, you can just cancel the popup it makes.
48
+
49
+ ## API Docs
50
+ API docs for the package are available [here](https://jesse-r-s-hines.github.io/wdio-obsidian-service/obsidian-launcher/README.html).
51
+
52
+ ## CLI
53
+ ```bash
54
+ npx obsidian-launcher [subcommand] ...
55
+ ```
56
+
57
+ ### Plugin and Theme format
58
+ Several commands can take a list of plugins and themes to install. You can specify the `--plugin` and `--theme` arguments multiple times to install multiple plugins/themes. The format should be one of:
59
+ - `<path>`: Path to a local plugin/theme to install
60
+ - `repo:<github-repo>`: GitHub repo of the plugin/theme to install, e.g. `repo:SilentVoid13/Templater`
61
+ - `id:<community-id>`: For plugins, id of a community plugin, e.g. `id:templater-obsidian`
62
+ - `name:<community-name>`: For themes, name of a community theme, e.g. `name:Minimal`
63
+
64
+ You can install a specific version of a plugin or theme with `-p id:myplugin@1.2.3`.
65
+
66
+ ### launch
67
+ Download and launch Obsidian, opening the specified vault.
68
+
69
+ The Obsidian instance will have a sandboxed configuration directory. You can use this command to compare plugin behavior on different versions of Obsidian without messing with your system installation of Obsidian.
70
+
71
+ You can pass arguments through to the Obsidian executable using `--`:
72
+ ```bash
73
+ npx obsidian-launcher launch ./vault -- --remote-debugging-port=9222
74
+ ```
75
+
76
+ Arguments:
77
+ - `vault`: Vault to open
78
+
79
+ Options:
80
+ - `-v, --version <version>`: Obsidian app version to run (default: "latest")
81
+ - `-i, --installer <version>`: Obsidian installer version to run (default: "earliest")
82
+ - `-p, --plugin <plugin>`: Plugin(s) to install
83
+ - `-t, --theme <plugin>`: Theme(s) to install
84
+ - `--copy`: Copy the vault first
85
+ - `-c, --cache <cache>`: Directory to use as the download cache (default: OBSIDIAN_CACHE env var or ~/.obsidian-cache)
86
+
87
+ ### watch
88
+ Downloads Obsidian and opens a vault, then watches for changes to plugins and themes.
89
+
90
+ Takes the same arguments as the `launch` command but watches for changes to any local plugins or themes and updates the vault. Automatically installs `pjeby/hot-reload` so plugins will hot reload as they are updated.
91
+
92
+ Arguments:
93
+ - `vault`: Vault to open
94
+
95
+ Options:
96
+ - `-v, --version <version>`: Obsidian app version to run (default: "latest")
97
+ - `-i, --installer <version>`: Obsidian installer version to run (default: "latest")
98
+ - `-p, --plugin <plugin>`: Plugin(s) to install
99
+ - `-t, --theme <plugin>`: Theme to install
100
+ - `--copy`: Copy the vault first
101
+ - `-c, --cache <cache>`: Directory to use as the download cache (default: OBSIDIAN_CACHE env var or ~/.obsidian-cache)
102
+
103
+ ### install
104
+ Install plugins and themes into an Obsidian vault.
105
+
106
+ Arguments:
107
+ - `vault`: Vault to install into
108
+
109
+ Options:
110
+ - `-p, --plugin <plugin>`: Plugin(s) to install
111
+ - `-t, --theme <plugin>`: Theme(s) to install.
112
+ - `-c, --cache <cache>`: Directory to use as the download cache (default: OBSIDIAN_CACHE env var or ~/.obsidian-cache)
113
+
114
+ ### download
115
+ Download Obsidian to the cache.
116
+
117
+ Pre-download Obsidian to the cache. Pass asset to select what variant to download, which can be one of:
118
+ - app: Download the desktop app JS bundle
119
+ - installer: Download the desktop installer
120
+ - desktop: Download both the desktop app bundle and installer (the default)
121
+ - apk: Download the mobile app APK file
122
+
123
+ Arguments:
124
+ - `asset`: Obsidian asset to download (default: "desktop")
125
+
126
+ Options:
127
+ - `-v, --version <version>`: Obsidian version (default: "latest")
128
+ - `-i, --installer <version>`: Obsidian installer version (default: "earliest")
129
+ - `--platform <platform>`: Platform of the installer, one of linux, win32, darwin. (default: system platform)
130
+ - `--arch <arch>`: Architecture of the installer, one of arm64, ia32, x64. (default: system arch)
131
+ - `-c, --cache <cache>`: Directory to use as the download cache (default: OBSIDIAN_CACHE env var or ~/.obsidian-cache)
132
+
133
+ ## Obsidian CLI
134
+ Obsidian has its [own CLI](https://obsidian.md/help/cli) which connects to the running Obsidian instance and lets you run commands against it. The Obsidian CLI will still work with Obsidian instances launched via obsidian-launcher as long as you only run one Obsidian instance at a time. With multiple instances, obsidian-launcher's sandboxing interferes with the Obsidian CLI connection.
135
+
136
+ Note, the Obsidian CLI requires Obsidian app>=1.12.7 with installer>=1.12.7
package/dist/7z.cjs ADDED
@@ -0,0 +1,41 @@
1
+ "use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }require('./chunk-UMVJ7W6K.cjs');
2
+
3
+ // src/7z.js
4
+ var _path = require('path'); var _path2 = _interopRequireDefault(_path);
5
+ var _7zwasm = require('7z-wasm'); var _7zwasm2 = _interopRequireDefault(_7zwasm);
6
+ async function main() {
7
+ const sevenZip = await _7zwasm2.default.default({
8
+ // stdin: () => {},
9
+ stdout: (charCode) => {
10
+ if (charCode !== null) {
11
+ process.stdout.write(String.fromCharCode(charCode));
12
+ }
13
+ },
14
+ quit: (code) => {
15
+ if (code) {
16
+ process.exit(code);
17
+ }
18
+ }
19
+ });
20
+ const chmodOrig = sevenZip.FS.chmod.bind(sevenZip.FS);
21
+ sevenZip.FS.chmod = function(path2, mode, dontFollow) {
22
+ if (!mode) {
23
+ return;
24
+ }
25
+ chmodOrig(path2, mode, dontFollow);
26
+ };
27
+ const cwd = process.cwd();
28
+ const hostRoot = _path2.default.parse(cwd).root;
29
+ const hostDir = _path2.default.relative(hostRoot, cwd).split(_path2.default.sep).join("/");
30
+ const mountRoot = "/nodefs";
31
+ sevenZip.FS.mkdir(mountRoot);
32
+ sevenZip.FS.mount(sevenZip.NODEFS, { root: hostRoot }, mountRoot);
33
+ sevenZip.FS.chdir(mountRoot + "/" + hostDir);
34
+ var args = process.argv.slice(2);
35
+ sevenZip.callMain(args);
36
+ }
37
+ main().catch((e) => {
38
+ console.error(e);
39
+ process.exit(-1);
40
+ });
41
+ //# sourceMappingURL=7z.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/wdio-obsidian-service/wdio-obsidian-service/packages/obsidian-launcher/dist/7z.cjs","../src/7z.js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AAM,UAAA,EAAY,SAAA;AAClB,EAAA,QAAA,CAAS,EAAA,CAAG,KAAA,CAAM,SAAS,CAAA;AAC3B,EAAA,QAAA,CAAS,EAAA,CAAG,KAAA,CAAM,QAAA,CAAS,MAAA,EAAQ,EAAE,IAAA,EAAM,SAAS,CAAA,EAAG,SAAS,CAAA;AAChE,EAAA,QAAA,CAAS,EAAA,CAAG,KAAA,CAAM,UAAA,EAAY,IAAA,EAAM,OAAO,CAAA;AAE3C,EAAA,IAAI,KAAA,EAAO,OAAA,CAAQ,IAAA,CAAK,KAAA,CAAM,CAAC,CAAA;AAC/B,EAAA,QAAA,CAAS,QAAA,CAAS,IAAI,CAAA;AAC1B;AAEA,IAAA,CAAK,CAAA,CAAE,KAAA,CAAM,CAAA,CAAA,EAAA,GAAK;AACd,EAAA,OAAA,CAAQ,KAAA,CAAM,CAAC,CAAA;AACf,EAAA,OAAA,CAAQ,IAAA,CAAK,CAAA,CAAE,CAAA;AACnB,CAAC,CAAA","file":"/home/runner/work/wdio-obsidian-service/wdio-obsidian-service/packages/obsidian-launcher/dist/7z.cjs","sourcesContent":[null,"/**\n * Script wrapper for 7z-wasm. 7z-wasm comes with it's own CLI, but getting the binary path can be flaky depending on\n * how wdio-obsidian-service is installed. This also lets us customize it a bit. This does need to be called as a\n * subprocess to avoid blocking the main thread.\n */\nimport path from \"path\";\nimport SevenZip from \"7z-wasm\"\n\nasync function main() {\n const sevenZip = await SevenZip.default({\n // stdin: () => {},\n stdout: (charCode) => {\n if (charCode !== null) {\n process.stdout.write(String.fromCharCode(charCode));\n }\n },\n quit: (code) => {\n if (code) {\n process.exit(code);\n }\n }\n });\n // HACK: The WASM 7-Zip sets file mode to 000 when extracting tar archives, making it impossible to extract sub-folders\n const chmodOrig = sevenZip.FS.chmod.bind(sevenZip.FS);\n sevenZip.FS.chmod = function(path, mode, dontFollow) {\n if (!mode) {\n return;\n }\n chmodOrig(path, mode, dontFollow);\n };\n\n const cwd = process.cwd();\n const hostRoot = path.parse(cwd).root;\n const hostDir = path.relative(hostRoot, cwd).split(path.sep).join(\"/\");\n const mountRoot = \"/nodefs\";\n sevenZip.FS.mkdir(mountRoot);\n sevenZip.FS.mount(sevenZip.NODEFS, { root: hostRoot }, mountRoot);\n sevenZip.FS.chdir(mountRoot + \"/\" + hostDir);\n\n var args = process.argv.slice(2);\n sevenZip.callMain(args);\n}\n\nmain().catch(e => {\n console.error(e);\n process.exit(-1);\n});\n"]}
package/dist/7z.d.cts ADDED
@@ -0,0 +1,2 @@
1
+
2
+ export { }
package/dist/7z.d.ts ADDED
@@ -0,0 +1,2 @@
1
+
2
+ export { }
package/dist/7z.js ADDED
@@ -0,0 +1,39 @@
1
+ // src/7z.js
2
+ import path from "path";
3
+ import SevenZip from "7z-wasm";
4
+ async function main() {
5
+ const sevenZip = await SevenZip.default({
6
+ // stdin: () => {},
7
+ stdout: (charCode) => {
8
+ if (charCode !== null) {
9
+ process.stdout.write(String.fromCharCode(charCode));
10
+ }
11
+ },
12
+ quit: (code) => {
13
+ if (code) {
14
+ process.exit(code);
15
+ }
16
+ }
17
+ });
18
+ const chmodOrig = sevenZip.FS.chmod.bind(sevenZip.FS);
19
+ sevenZip.FS.chmod = function(path2, mode, dontFollow) {
20
+ if (!mode) {
21
+ return;
22
+ }
23
+ chmodOrig(path2, mode, dontFollow);
24
+ };
25
+ const cwd = process.cwd();
26
+ const hostRoot = path.parse(cwd).root;
27
+ const hostDir = path.relative(hostRoot, cwd).split(path.sep).join("/");
28
+ const mountRoot = "/nodefs";
29
+ sevenZip.FS.mkdir(mountRoot);
30
+ sevenZip.FS.mount(sevenZip.NODEFS, { root: hostRoot }, mountRoot);
31
+ sevenZip.FS.chdir(mountRoot + "/" + hostDir);
32
+ var args = process.argv.slice(2);
33
+ sevenZip.callMain(args);
34
+ }
35
+ main().catch((e) => {
36
+ console.error(e);
37
+ process.exit(-1);
38
+ });
39
+ //# sourceMappingURL=7z.js.map
package/dist/7z.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/7z.js"],"sourcesContent":["/**\n * Script wrapper for 7z-wasm. 7z-wasm comes with it's own CLI, but getting the binary path can be flaky depending on\n * how wdio-obsidian-service is installed. This also lets us customize it a bit. This does need to be called as a\n * subprocess to avoid blocking the main thread.\n */\nimport path from \"path\";\nimport SevenZip from \"7z-wasm\"\n\nasync function main() {\n const sevenZip = await SevenZip.default({\n // stdin: () => {},\n stdout: (charCode) => {\n if (charCode !== null) {\n process.stdout.write(String.fromCharCode(charCode));\n }\n },\n quit: (code) => {\n if (code) {\n process.exit(code);\n }\n }\n });\n // HACK: The WASM 7-Zip sets file mode to 000 when extracting tar archives, making it impossible to extract sub-folders\n const chmodOrig = sevenZip.FS.chmod.bind(sevenZip.FS);\n sevenZip.FS.chmod = function(path, mode, dontFollow) {\n if (!mode) {\n return;\n }\n chmodOrig(path, mode, dontFollow);\n };\n\n const cwd = process.cwd();\n const hostRoot = path.parse(cwd).root;\n const hostDir = path.relative(hostRoot, cwd).split(path.sep).join(\"/\");\n const mountRoot = \"/nodefs\";\n sevenZip.FS.mkdir(mountRoot);\n sevenZip.FS.mount(sevenZip.NODEFS, { root: hostRoot }, mountRoot);\n sevenZip.FS.chdir(mountRoot + \"/\" + hostDir);\n\n var args = process.argv.slice(2);\n sevenZip.callMain(args);\n}\n\nmain().catch(e => {\n console.error(e);\n process.exit(-1);\n});\n"],"mappings":";AAKA,OAAO,UAAU;AACjB,OAAO,cAAc;AAErB,eAAe,OAAO;AAClB,QAAM,WAAW,MAAM,SAAS,QAAQ;AAAA;AAAA,IAEpC,QAAQ,CAAC,aAAa;AAClB,UAAI,aAAa,MAAM;AACnB,gBAAQ,OAAO,MAAM,OAAO,aAAa,QAAQ,CAAC;AAAA,MACtD;AAAA,IACJ;AAAA,IACA,MAAM,CAAC,SAAS;AACZ,UAAI,MAAM;AACN,gBAAQ,KAAK,IAAI;AAAA,MACrB;AAAA,IACJ;AAAA,EACJ,CAAC;AAED,QAAM,YAAY,SAAS,GAAG,MAAM,KAAK,SAAS,EAAE;AACpD,WAAS,GAAG,QAAQ,SAASA,OAAM,MAAM,YAAY;AACjD,QAAI,CAAC,MAAM;AACP;AAAA,IACJ;AACA,cAAUA,OAAM,MAAM,UAAU;AAAA,EACpC;AAEA,QAAM,MAAM,QAAQ,IAAI;AACxB,QAAM,WAAW,KAAK,MAAM,GAAG,EAAE;AACjC,QAAM,UAAU,KAAK,SAAS,UAAU,GAAG,EAAE,MAAM,KAAK,GAAG,EAAE,KAAK,GAAG;AACrE,QAAM,YAAY;AAClB,WAAS,GAAG,MAAM,SAAS;AAC3B,WAAS,GAAG,MAAM,SAAS,QAAQ,EAAE,MAAM,SAAS,GAAG,SAAS;AAChE,WAAS,GAAG,MAAM,YAAY,MAAM,OAAO;AAE3C,MAAI,OAAO,QAAQ,KAAK,MAAM,CAAC;AAC/B,WAAS,SAAS,IAAI;AAC1B;AAEA,KAAK,EAAE,MAAM,OAAK;AACd,UAAQ,MAAM,CAAC;AACf,UAAQ,KAAK,EAAE;AACnB,CAAC;","names":["path"]}