mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-07-23 04:52:58 +00:00
Centralise setup tool Commonlib selection
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
// Keep CouchDB database-version negotiation isolated from Setup URI generation.
|
||||
// The exact release must match utils/livesync-commonlib-version.ts; the setup
|
||||
// tool suite checks every static specifier before release.
|
||||
export { checkRemoteVersion } from "npm:@vrtmrz/livesync-commonlib@0.1.0-rc.4/compat/pouchdb/negotiation";
|
||||
export { PouchDB } from "npm:@vrtmrz/livesync-commonlib@0.1.0-rc.4/compat/pouchdb/pouchdb-browser";
|
||||
@@ -1,5 +1,4 @@
|
||||
import { PouchDB } from "npm:@vrtmrz/livesync-commonlib@0.1.0-rc.4/compat/pouchdb/pouchdb-browser";
|
||||
import { checkRemoteVersion } from "npm:@vrtmrz/livesync-commonlib@0.1.0-rc.4/compat/pouchdb/negotiation";
|
||||
import { checkRemoteVersion, PouchDB } from "./livesync-commonlib.ts";
|
||||
|
||||
export interface CouchDBProvisioningOptions {
|
||||
hostname: string;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { decodeSettingsFromSetupURI } from "npm:@vrtmrz/livesync-commonlib@0.1.0-rc.4/compat/API/processSetting";
|
||||
import { DEFAULT_SETTINGS } from "npm:@vrtmrz/livesync-commonlib@0.1.0-rc.4/settings";
|
||||
import {
|
||||
decodeSettingsFromSetupURI,
|
||||
DEFAULT_SETTINGS,
|
||||
} from "../setup/livesync-commonlib.ts";
|
||||
|
||||
function assert(condition: unknown, message: string): asserts condition {
|
||||
if (!condition) throw new Error(message);
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
import { LIVESYNC_COMMONLIB_VERSION } from "./livesync-commonlib-version.ts";
|
||||
|
||||
function assert(condition: unknown, message: string): asserts condition {
|
||||
if (!condition) throw new Error(message);
|
||||
}
|
||||
|
||||
Deno.test("standalone utilities select one exact Commonlib registry version", async () => {
|
||||
const facadeURLs = [
|
||||
new URL("./setup/livesync-commonlib.ts", import.meta.url),
|
||||
new URL("./couchdb/livesync-commonlib.ts", import.meta.url),
|
||||
];
|
||||
const selectedVersions = (
|
||||
await Promise.all(facadeURLs.map((url) => Deno.readTextFile(url)))
|
||||
).flatMap((source) =>
|
||||
[...source.matchAll(
|
||||
/npm:@vrtmrz\/livesync-commonlib@([^/"]+)\//gu,
|
||||
)].map((match) => match[1])
|
||||
);
|
||||
|
||||
assert(selectedVersions.length > 0, "no Commonlib npm specifier was found");
|
||||
assert(
|
||||
selectedVersions.every((version) => version === LIVESYNC_COMMONLIB_VERSION),
|
||||
`Commonlib specifiers do not all select ${LIVESYNC_COMMONLIB_VERSION}: ${
|
||||
selectedVersions.join(", ")
|
||||
}`,
|
||||
);
|
||||
});
|
||||
@@ -0,0 +1,5 @@
|
||||
// The standalone Deno utilities deliberately remain pinned to one immutable
|
||||
// Commonlib registry release. Static npm specifiers cannot interpolate this
|
||||
// value, so livesync-commonlib-version.test.ts verifies the domain-specific
|
||||
// facades against it.
|
||||
export const LIVESYNC_COMMONLIB_VERSION = "0.1.0-rc.4";
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
# Utilities
|
||||
|
||||
These utilities support self-hosted CouchDB provisioning and Setup URI generation. They consume the immutable `@vrtmrz/livesync-commonlib@0.1.0-rc.4` registry package directly; the utility lockfile records its resolved package integrity.
|
||||
These utilities support self-hosted CouchDB provisioning and Setup URI generation. They consume an exact immutable `@vrtmrz/livesync-commonlib` registry version declared in `livesync-commonlib-version.ts`; the utility lockfile records its resolved package integrity. The setup-tool test keeps the domain-specific static npm specifiers aligned with that declaration. Update the declaration, the two facades, and the lockfile together when selecting a newer release.
|
||||
|
||||
## CouchDB provisioning
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { decodeSettingsFromSetupURI } from "npm:@vrtmrz/livesync-commonlib@0.1.0-rc.4/compat/API/processSetting";
|
||||
import { DEFAULT_SETTINGS } from "npm:@vrtmrz/livesync-commonlib@0.1.0-rc.4/settings";
|
||||
import {
|
||||
decodeSettingsFromSetupURI,
|
||||
DEFAULT_SETTINGS,
|
||||
} from "./livesync-commonlib.ts";
|
||||
import { generateSetupURI } from "./generate_setup_uri.ts";
|
||||
|
||||
function assert(condition: unknown, message: string): asserts condition {
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { encodeSettingsToSetupURI } from "npm:@vrtmrz/livesync-commonlib@0.1.0-rc.4/compat/API/processSetting";
|
||||
import { generateP2PRoomId } from "npm:@vrtmrz/livesync-commonlib@0.1.0-rc.4/compat/common/utils";
|
||||
import { upsertRemoteConfigurationInPlace } from "npm:@vrtmrz/livesync-commonlib@0.1.0-rc.4/remote-configurations";
|
||||
import {
|
||||
createNewVaultSettings,
|
||||
encodeSettingsToSetupURI,
|
||||
generateP2PRoomId,
|
||||
type ObsidianLiveSyncSettings,
|
||||
P2P_DEFAULT_SETTINGS,
|
||||
PREFERRED_BASE,
|
||||
PREFERRED_JOURNAL_SYNC,
|
||||
PREFERRED_SETTING_SELF_HOSTED,
|
||||
} from "npm:@vrtmrz/livesync-commonlib@0.1.0-rc.4/settings";
|
||||
upsertRemoteConfigurationInPlace,
|
||||
} from "./livesync-commonlib.ts";
|
||||
|
||||
export type SetupRemoteType = "couchdb" | "s3" | "p2p";
|
||||
export type SetupGeneratorEnvironment = Readonly<
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
// Keep Setup URI generation on its own static Commonlib module graph. This is
|
||||
// intentionally separate from the CouchDB facade so that a raw-URL invocation
|
||||
// does not load the PouchDB browser adapter.
|
||||
export {
|
||||
decodeSettingsFromSetupURI,
|
||||
encodeSettingsToSetupURI,
|
||||
} from "npm:@vrtmrz/livesync-commonlib@0.1.0-rc.4/compat/API/processSetting";
|
||||
export { generateP2PRoomId } from "npm:@vrtmrz/livesync-commonlib@0.1.0-rc.4/compat/common/utils";
|
||||
export { upsertRemoteConfigurationInPlace } from "npm:@vrtmrz/livesync-commonlib@0.1.0-rc.4/remote-configurations";
|
||||
export {
|
||||
createNewVaultSettings,
|
||||
DEFAULT_SETTINGS,
|
||||
P2P_DEFAULT_SETTINGS,
|
||||
PREFERRED_BASE,
|
||||
PREFERRED_JOURNAL_SYNC,
|
||||
PREFERRED_SETTING_SELF_HOSTED,
|
||||
} from "npm:@vrtmrz/livesync-commonlib@0.1.0-rc.4/settings";
|
||||
export type { ObsidianLiveSyncSettings } from "npm:@vrtmrz/livesync-commonlib@0.1.0-rc.4/settings";
|
||||
Reference in New Issue
Block a user