obsidian-launcher 0.3.1 → 0.4.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 +131 -1
- package/dist/{chunk-E67WPRVZ.cjs → chunk-D3Z4H7XZ.cjs} +109 -67
- package/dist/chunk-D3Z4H7XZ.cjs.map +1 -0
- package/dist/{chunk-D7KOZRZZ.js → chunk-K7DNIKI5.js} +109 -67
- package/dist/chunk-K7DNIKI5.js.map +1 -0
- package/dist/cli.cjs +9 -9
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.d.cts +1 -1
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +4 -4
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +125 -62
- package/dist/index.d.ts +125 -62
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/dist/chunk-D7KOZRZZ.js.map +0 -1
- package/dist/chunk-E67WPRVZ.cjs.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -11,6 +11,10 @@ type ObsidianVersionInfos = {
|
|
|
11
11
|
};
|
|
12
12
|
versions: ObsidianVersionInfo[];
|
|
13
13
|
};
|
|
14
|
+
/**
|
|
15
|
+
* Metadata about a specific Obsidian version, including the min/max compatible installer versions, download urls, and
|
|
16
|
+
* the internal electron version.
|
|
17
|
+
*/
|
|
14
18
|
type ObsidianVersionInfo = {
|
|
15
19
|
version: string;
|
|
16
20
|
minInstallerVersion?: string;
|
|
@@ -29,6 +33,9 @@ type ObsidianVersionInfo = {
|
|
|
29
33
|
chromeVersion?: string;
|
|
30
34
|
nodeVersion?: string;
|
|
31
35
|
};
|
|
36
|
+
/**
|
|
37
|
+
* Schema of entries in https://github.com/obsidianmd/obsidian-releases/HEAD/community-plugins.json
|
|
38
|
+
*/
|
|
32
39
|
type ObsidianCommunityPlugin = {
|
|
33
40
|
id: string;
|
|
34
41
|
name: string;
|
|
@@ -36,6 +43,9 @@ type ObsidianCommunityPlugin = {
|
|
|
36
43
|
description: string;
|
|
37
44
|
repo: string;
|
|
38
45
|
};
|
|
46
|
+
/**
|
|
47
|
+
* Schema of entries in https://github.com/obsidianmd/obsidian-releases/HEAD/community-css-themes.json
|
|
48
|
+
*/
|
|
39
49
|
type ObsidianCommunityTheme = {
|
|
40
50
|
name: string;
|
|
41
51
|
author: string;
|
|
@@ -43,25 +53,34 @@ type ObsidianCommunityTheme = {
|
|
|
43
53
|
screenshot: string;
|
|
44
54
|
modes: string[];
|
|
45
55
|
};
|
|
56
|
+
/** @inline */
|
|
46
57
|
type BasePluginEntry = {
|
|
47
58
|
/** Set false to install the plugin but start it disabled. Default true. */
|
|
48
59
|
enabled?: boolean;
|
|
49
60
|
};
|
|
61
|
+
/** @inline */
|
|
50
62
|
type LocalPluginEntry = BasePluginEntry & {
|
|
51
63
|
/** Path on disk to the plugin to install. */
|
|
52
64
|
path: string;
|
|
53
65
|
};
|
|
54
|
-
type DownloadedPluginEntry =
|
|
66
|
+
type DownloadedPluginEntry = {
|
|
67
|
+
/** If the plugin is enabled */
|
|
68
|
+
enabled: boolean;
|
|
69
|
+
/** Path on disk to the downloaded plugin. */
|
|
70
|
+
path: string;
|
|
71
|
+
/** Id of the plugin */
|
|
55
72
|
id: string;
|
|
56
73
|
/** Type of the plugin entry before downloading */
|
|
57
74
|
originalType: "local" | "github" | "community";
|
|
58
75
|
};
|
|
76
|
+
/** @inline */
|
|
59
77
|
type GitHubPluginEntry = BasePluginEntry & {
|
|
60
78
|
/** Github repo of the plugin to install, e.g. "some-user/some-plugin". */
|
|
61
79
|
repo: string;
|
|
62
80
|
/** Version of the plugin to install. Defaults to latest. */
|
|
63
81
|
version?: string;
|
|
64
82
|
};
|
|
83
|
+
/** @inline */
|
|
65
84
|
type CommunityPluginEntry = BasePluginEntry & {
|
|
66
85
|
/** Plugin ID to install from Obsidian community plugins. */
|
|
67
86
|
id: string;
|
|
@@ -70,11 +89,15 @@ type CommunityPluginEntry = BasePluginEntry & {
|
|
|
70
89
|
};
|
|
71
90
|
/**
|
|
72
91
|
* A plugin to install. Can be a simple string path to the local plugin to install, or an object.
|
|
73
|
-
* If an object set one of
|
|
74
|
-
*
|
|
75
|
-
*
|
|
92
|
+
* If an object set one of:
|
|
93
|
+
* - `path` to install a local plugin
|
|
94
|
+
* - `repo` to install a plugin from github
|
|
95
|
+
* - `id` to install a community plugin
|
|
96
|
+
*
|
|
97
|
+
* You can also pass `enabled: false` to install the plugin, but start it disabled by default.
|
|
76
98
|
*/
|
|
77
99
|
type PluginEntry = string | LocalPluginEntry | GitHubPluginEntry | CommunityPluginEntry;
|
|
100
|
+
/** @inline */
|
|
78
101
|
type BaseThemeEntry = {
|
|
79
102
|
/**
|
|
80
103
|
* Set false to install the theme but not enable it. Defaults to true.
|
|
@@ -82,84 +105,111 @@ type BaseThemeEntry = {
|
|
|
82
105
|
*/
|
|
83
106
|
enabled?: boolean;
|
|
84
107
|
};
|
|
108
|
+
/** @inline */
|
|
85
109
|
type LocalThemeEntry = BaseThemeEntry & {
|
|
86
110
|
/** Path on disk to the theme to install. */
|
|
87
111
|
path: string;
|
|
88
112
|
};
|
|
89
|
-
type DownloadedThemeEntry =
|
|
113
|
+
type DownloadedThemeEntry = {
|
|
114
|
+
/** If the theme is enabled */
|
|
115
|
+
enabled: boolean;
|
|
116
|
+
/** Path on disk to the downloaded theme. */
|
|
117
|
+
path: string;
|
|
118
|
+
/** Name of the theme */
|
|
90
119
|
name: string;
|
|
91
|
-
/** Type of the
|
|
120
|
+
/** Type of the theme entry before downloading */
|
|
92
121
|
originalType: "local" | "github" | "community";
|
|
93
122
|
};
|
|
123
|
+
/** @inline */
|
|
94
124
|
type GitHubThemeEntry = BaseThemeEntry & {
|
|
95
125
|
/** Github repo of the theme to install, e.g. "some-user/some-theme". */
|
|
96
126
|
repo: string;
|
|
97
127
|
};
|
|
128
|
+
/** @inline */
|
|
98
129
|
type CommunityThemeEntry = BaseThemeEntry & {
|
|
99
130
|
/** Theme name to install from Obsidian community themes. */
|
|
100
131
|
name: string;
|
|
101
132
|
};
|
|
102
133
|
/**
|
|
103
134
|
* A theme to install. Can be a simple string path to the local theme to install, or an object.
|
|
104
|
-
* If an object, set one of
|
|
105
|
-
*
|
|
106
|
-
*
|
|
135
|
+
* If an object, set one of:
|
|
136
|
+
* - `path` to install a local theme
|
|
137
|
+
* - `repo` to install a theme from github
|
|
138
|
+
* - `name` to install a community theme
|
|
139
|
+
*
|
|
140
|
+
* You can also pass `enabled: false` to install the theme, but start it disabled by default. You can only have one
|
|
141
|
+
* enabled theme, so if you pass multiple you need to disable all but one.
|
|
107
142
|
*/
|
|
108
143
|
type ThemeEntry = string | LocalThemeEntry | GitHubThemeEntry | CommunityThemeEntry;
|
|
109
144
|
|
|
110
145
|
/**
|
|
111
|
-
*
|
|
146
|
+
* Helper class that handles downloading and installing Obsidian versions, plugins, and themes and launching Obsidian
|
|
147
|
+
* with sandboxed configuration directories.
|
|
112
148
|
*/
|
|
113
149
|
declare class ObsidianLauncher {
|
|
114
150
|
readonly cacheDir: string;
|
|
115
151
|
readonly versionsUrl: string;
|
|
116
152
|
readonly communityPluginsUrl: string;
|
|
117
153
|
readonly communityThemesUrl: string;
|
|
154
|
+
readonly cacheDuration: number;
|
|
118
155
|
/** Cached metadata files and requests */
|
|
119
156
|
private metadataCache;
|
|
120
157
|
/**
|
|
121
158
|
* Construct an ObsidianLauncher.
|
|
122
|
-
* @param cacheDir Path to the cache directory. Defaults to "OBSIDIAN_CACHE" env var or ".obsidian-cache".
|
|
123
|
-
* @param versionsUrl Custom `obsidian-versions.json` url. Can be a file URL.
|
|
124
|
-
* @param communityPluginsUrl Custom `community-plugins.json` url. Can be a file URL.
|
|
125
|
-
* @param
|
|
159
|
+
* @param options.cacheDir Path to the cache directory. Defaults to "OBSIDIAN_CACHE" env var or ".obsidian-cache".
|
|
160
|
+
* @param options.versionsUrl Custom `obsidian-versions.json` url. Can be a file URL.
|
|
161
|
+
* @param options.communityPluginsUrl Custom `community-plugins.json` url. Can be a file URL.
|
|
162
|
+
* @param options.communityThemesUrl Custom `community-css-themes.json` url. Can be a file URL.
|
|
163
|
+
* @param options.cacheDuration If the cached version list is older than this (in ms), refetch it. Defaults to 30 minutes.
|
|
126
164
|
*/
|
|
127
165
|
constructor(options?: {
|
|
128
166
|
cacheDir?: string;
|
|
129
167
|
versionsUrl?: string;
|
|
130
168
|
communityPluginsUrl?: string;
|
|
131
169
|
communityThemesUrl?: string;
|
|
170
|
+
cacheDuration?: number;
|
|
132
171
|
});
|
|
133
172
|
/**
|
|
134
173
|
* Returns file content fetched from url as JSON. Caches content to dest and uses that cache if its more recent than
|
|
135
174
|
* cacheDuration ms or if there are network errors.
|
|
136
175
|
*/
|
|
137
176
|
private cachedFetch;
|
|
177
|
+
/**
|
|
178
|
+
* Get parsed content of the current project's manifest.json
|
|
179
|
+
*/
|
|
138
180
|
private getRootManifest;
|
|
139
|
-
/**
|
|
181
|
+
/**
|
|
182
|
+
* Get information about all available Obsidian versions.
|
|
183
|
+
*/
|
|
140
184
|
getVersions(): Promise<ObsidianVersionInfo[]>;
|
|
141
|
-
/**
|
|
185
|
+
/**
|
|
186
|
+
* Get information about all available community plugins.
|
|
187
|
+
*/
|
|
142
188
|
getCommunityPlugins(): Promise<ObsidianCommunityPlugin[]>;
|
|
143
|
-
/**
|
|
189
|
+
/**
|
|
190
|
+
* Get information about all available community themes.
|
|
191
|
+
*/
|
|
144
192
|
getCommunityThemes(): Promise<ObsidianCommunityTheme[]>;
|
|
145
193
|
/**
|
|
146
194
|
* Resolves Obsidian app and installer version strings to absolute versions.
|
|
147
|
-
* @param appVersion Obsidian version string or
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
195
|
+
* @param appVersion Obsidian version string or one of
|
|
196
|
+
* - "latest": Get the current latest non-beta Obsidian version
|
|
197
|
+
* - "latest-beta": Get the current latest beta Obsidian version (or latest is there is no current beta)
|
|
198
|
+
* - "earliest": Get the `minAppVersion` set in set in your `manifest.json`
|
|
199
|
+
* @param installerVersion Obsidian version string or one of
|
|
200
|
+
* - "latest": Get the latest Obsidian installer
|
|
201
|
+
* - "earliest": Get the oldest Obsidian installer compatible with the specified Obsidian app version
|
|
151
202
|
* @returns [appVersion, installerVersion] with any "latest" etc. resolved to specific versions.
|
|
152
203
|
*/
|
|
153
204
|
resolveVersions(appVersion: string, installerVersion?: string): Promise<[string, string]>;
|
|
154
205
|
/**
|
|
155
206
|
* Gets details about an Obsidian version.
|
|
156
|
-
* @param
|
|
157
|
-
* minAppVersion set in your manifest.json.
|
|
207
|
+
* @param appVersion Obsidian app version (see {@link resolveVersions} for format)
|
|
158
208
|
*/
|
|
159
|
-
getVersionInfo(
|
|
209
|
+
getVersionInfo(appVersion: string): Promise<ObsidianVersionInfo>;
|
|
160
210
|
/**
|
|
161
211
|
* Downloads the Obsidian installer for the given version and platform. Returns the file path.
|
|
162
|
-
* @param installerVersion
|
|
212
|
+
* @param installerVersion Obsidian installer version to download. (see {@link resolveVersions} for format)
|
|
163
213
|
*/
|
|
164
214
|
downloadInstaller(installerVersion: string): Promise<string>;
|
|
165
215
|
/**
|
|
@@ -169,7 +219,11 @@ declare class ObsidianLauncher {
|
|
|
169
219
|
private downloadInstallerFromVersionInfo;
|
|
170
220
|
/**
|
|
171
221
|
* Downloads the Obsidian asar for the given version and platform. Returns the file path.
|
|
172
|
-
*
|
|
222
|
+
*
|
|
223
|
+
* To download beta versions you'll need to have an Obsidian account with Catalyst and set the `OBSIDIAN_USERNAME`
|
|
224
|
+
* and `OBSIDIAN_PASSWORD` environment variables. 2FA needs to be disabled.
|
|
225
|
+
*
|
|
226
|
+
* @param appVersion Obsidian version to download (see {@link resolveVersions} for format)
|
|
173
227
|
*/
|
|
174
228
|
downloadApp(appVersion: string): Promise<string>;
|
|
175
229
|
/**
|
|
@@ -177,10 +231,11 @@ declare class ObsidianLauncher {
|
|
|
177
231
|
*
|
|
178
232
|
* wdio will download chromedriver from the Chrome for Testing API automatically (see
|
|
179
233
|
* https://github.com/GoogleChromeLabs/chrome-for-testing#json-api-endpoints). However, Google has only put
|
|
180
|
-
* chromedriver since v115.0.5763.0 in that API, so wdio can't download older versions of chromedriver
|
|
181
|
-
*
|
|
182
|
-
*
|
|
183
|
-
*
|
|
234
|
+
* chromedriver since v115.0.5763.0 in that API, so wdio can't automatically download older versions of chromedriver
|
|
235
|
+
* for old Electron versions. Here we download chromedriver for older versions ourselves using the @electron/get
|
|
236
|
+
* package which fetches chromedriver from https://github.com/electron/electron/releases.
|
|
237
|
+
*
|
|
238
|
+
* @param installerVersion Obsidian installer version (see {@link resolveVersions} for format)
|
|
184
239
|
*/
|
|
185
240
|
downloadChromedriver(installerVersion: string): Promise<string>;
|
|
186
241
|
/** Gets the latest version of a plugin. */
|
|
@@ -200,11 +255,13 @@ declare class ObsidianLauncher {
|
|
|
200
255
|
*/
|
|
201
256
|
private downloadCommunityPlugin;
|
|
202
257
|
/**
|
|
203
|
-
* Downloads a list of plugins to the cache and returns a list of
|
|
258
|
+
* Downloads a list of plugins to the cache and returns a list of `DownloadedPluginEntry` with the downloaded paths.
|
|
204
259
|
* Also adds the `id` property to the plugins based on the manifest.
|
|
205
260
|
*
|
|
206
261
|
* You can download plugins from GitHub using `{repo: "org/repo"}` and community plugins using `{id: 'plugin-id'}`.
|
|
207
262
|
* Local plugins will just be passed through.
|
|
263
|
+
*
|
|
264
|
+
* @param plugins List of plugins to download.
|
|
208
265
|
*/
|
|
209
266
|
downloadPlugins(plugins: PluginEntry[]): Promise<DownloadedPluginEntry[]>;
|
|
210
267
|
/** Gets the latest version of a theme. */
|
|
@@ -222,33 +279,35 @@ declare class ObsidianLauncher {
|
|
|
222
279
|
*/
|
|
223
280
|
private downloadCommunityTheme;
|
|
224
281
|
/**
|
|
225
|
-
* Downloads a list of themes to the cache and returns a list of
|
|
282
|
+
* Downloads a list of themes to the cache and returns a list of `DownloadedThemeEntry` with the downloaded paths.
|
|
226
283
|
* Also adds the `name` property to the plugins based on the manifest.
|
|
227
284
|
*
|
|
228
285
|
* You can download themes from GitHub using `{repo: "org/repo"}` and community themes using `{name: 'theme-name'}`.
|
|
229
286
|
* Local themes will just be passed through.
|
|
287
|
+
*
|
|
288
|
+
* @param themes List of themes to download
|
|
230
289
|
*/
|
|
231
290
|
downloadThemes(themes: ThemeEntry[]): Promise<DownloadedThemeEntry[]>;
|
|
232
291
|
/**
|
|
233
|
-
* Installs plugins into an Obsidian vault
|
|
234
|
-
* @param vault Path to the vault to install the
|
|
235
|
-
* @param plugins List plugins
|
|
292
|
+
* Installs plugins into an Obsidian vault
|
|
293
|
+
* @param vault Path to the vault to install the plugins in
|
|
294
|
+
* @param plugins List plugins to install
|
|
236
295
|
*/
|
|
237
296
|
installPlugins(vault: string, plugins: PluginEntry[]): Promise<void>;
|
|
238
297
|
/**
|
|
239
|
-
* Installs themes into an
|
|
240
|
-
* @param vault Path to the theme to install the
|
|
241
|
-
* @param themes
|
|
298
|
+
* Installs themes into an Obsidian vault
|
|
299
|
+
* @param vault Path to the theme to install the themes in
|
|
300
|
+
* @param themes List of themes to install
|
|
242
301
|
*/
|
|
243
302
|
installThemes(vault: string, themes: ThemeEntry[]): Promise<void>;
|
|
244
303
|
/**
|
|
245
|
-
* Sets up the config dir to use for the
|
|
304
|
+
* Sets up the config dir to use for the `--user-data-dir` in obsidian. Returns the path to the created config dir.
|
|
246
305
|
*
|
|
247
|
-
* @param appVersion Obsidian version
|
|
248
|
-
* @param installerVersion Obsidian version string.
|
|
249
|
-
* @param appPath Path to the asar file to install. Will download if omitted.
|
|
250
|
-
* @param vault Path to the vault to open in Obsidian.
|
|
251
|
-
* @param dest Destination path for the config dir. If omitted it will create
|
|
306
|
+
* @param params.appVersion Obsidian app version (see {@link resolveVersions} for format)
|
|
307
|
+
* @param params.installerVersion Obsidian version string.
|
|
308
|
+
* @param params.appPath Path to the asar file to install. Will download if omitted.
|
|
309
|
+
* @param params.vault Path to the vault to open in Obsidian.
|
|
310
|
+
* @param params.dest Destination path for the config dir. If omitted it will create a temporary directory.
|
|
252
311
|
*/
|
|
253
312
|
setupConfigDir(params: {
|
|
254
313
|
appVersion: string;
|
|
@@ -260,10 +319,10 @@ declare class ObsidianLauncher {
|
|
|
260
319
|
/**
|
|
261
320
|
* Sets up a vault for Obsidian, installing plugins and themes and optionally copying the vault to a temporary
|
|
262
321
|
* directory first.
|
|
263
|
-
* @param vault Path to the vault to open in Obsidian
|
|
264
|
-
* @param copy Whether to copy the vault to a tmpdir first. Default false
|
|
265
|
-
* @param plugins List of plugins to install in the vault
|
|
266
|
-
* @param themes List of themes to install in the vault
|
|
322
|
+
* @param params.vault Path to the vault to open in Obsidian
|
|
323
|
+
* @param params.copy Whether to copy the vault to a tmpdir first. Default false
|
|
324
|
+
* @param params.plugins List of plugins to install in the vault
|
|
325
|
+
* @param params.themes List of themes to install in the vault
|
|
267
326
|
* @returns Path to the copied vault (or just the path to the vault if copy is false)
|
|
268
327
|
*/
|
|
269
328
|
setupVault(params: {
|
|
@@ -276,21 +335,22 @@ declare class ObsidianLauncher {
|
|
|
276
335
|
* Downloads and launches Obsidian with a sandboxed config dir and a specifc vault open. Optionally install plugins
|
|
277
336
|
* and themes first.
|
|
278
337
|
*
|
|
279
|
-
* This is just a shortcut for calling downloadApp
|
|
338
|
+
* This is just a shortcut for calling `downloadApp`, `downloadInstaller`, `setupVault` and `setupConfDir`.
|
|
280
339
|
*
|
|
281
|
-
* @param appVersion Obsidian version
|
|
282
|
-
* @param installerVersion Obsidian version
|
|
283
|
-
*
|
|
284
|
-
* @param
|
|
285
|
-
* @param
|
|
286
|
-
* @param
|
|
287
|
-
* @param
|
|
288
|
-
* @param
|
|
289
|
-
* @
|
|
340
|
+
* @param params.appVersion Obsidian app version (see {@link resolveVersions} for format). Default "latest"
|
|
341
|
+
* @param params.installerVersion Obsidian installer version (see {@link resolveVersions} for format).
|
|
342
|
+
* Default "latest"
|
|
343
|
+
* @param params.vault Path to the vault to open in Obsidian
|
|
344
|
+
* @param params.copy Whether to copy the vault to a tmpdir first. Default false
|
|
345
|
+
* @param params.plugins List of plugins to install in the vault
|
|
346
|
+
* @param params.themes List of themes to install in the vault
|
|
347
|
+
* @param params.args CLI args to pass to Obsidian
|
|
348
|
+
* @param params.spawnOptions Options to pass to `spawn`
|
|
349
|
+
* @returns The launched child process and the created tmpdirs
|
|
290
350
|
*/
|
|
291
351
|
launch(params: {
|
|
292
|
-
appVersion
|
|
293
|
-
installerVersion
|
|
352
|
+
appVersion?: string;
|
|
353
|
+
installerVersion?: string;
|
|
294
354
|
copy?: boolean;
|
|
295
355
|
vault?: string;
|
|
296
356
|
plugins?: PluginEntry[];
|
|
@@ -312,13 +372,16 @@ declare class ObsidianLauncher {
|
|
|
312
372
|
}): Promise<ObsidianVersionInfos>;
|
|
313
373
|
/**
|
|
314
374
|
* Returns true if the Obsidian version is already in the cache.
|
|
375
|
+
* @param type on of "app" or "installer"
|
|
376
|
+
* @param version Obsidian app/installer version (see {@link resolveVersions} for format)
|
|
315
377
|
*/
|
|
316
378
|
isInCache(type: "app" | "installer", version: string): Promise<boolean>;
|
|
317
379
|
/**
|
|
318
|
-
* Returns true if we either have the
|
|
380
|
+
* Returns true if we either have the credentials to download the version or it's already in cache.
|
|
319
381
|
* This is only relevant for Obsidian beta versions, as they require Obsidian insider credentials to download.
|
|
382
|
+
* @param version Obsidian version (see {@link resolveVersions} for format)
|
|
320
383
|
*/
|
|
321
384
|
isAvailable(version: string): Promise<boolean>;
|
|
322
385
|
}
|
|
323
386
|
|
|
324
|
-
export { type
|
|
387
|
+
export { type DownloadedPluginEntry, type DownloadedThemeEntry, type ObsidianCommunityPlugin, type ObsidianCommunityTheme, ObsidianLauncher, type ObsidianVersionInfo, type ObsidianVersionInfos, type PluginEntry, type ThemeEntry, ObsidianLauncher as default };
|