mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-07-28 15:32:59 +00:00
Centralise setup tool Commonlib selection
This commit is contained in:
+1
-1
@@ -25,7 +25,7 @@
|
|||||||
"check": "npm run tsc-check && npm run tsc-check:apps && npm run lint && npm run lint:community -- --quiet && npm run svelte-check && npm run check:compatibility",
|
"check": "npm run tsc-check && npm run tsc-check:apps && npm run lint && npm run lint:community -- --quiet && npm run svelte-check && npm run check:compatibility",
|
||||||
"unittest": "deno test -A --no-check --coverage=cov_profile --v8-flags=--expose-gc --trace-leaks ./src/",
|
"unittest": "deno test -A --no-check --coverage=cov_profile --v8-flags=--expose-gc --trace-leaks ./src/",
|
||||||
"test:unit": "vitest run --config vitest.config.unit.ts",
|
"test:unit": "vitest run --config vitest.config.unit.ts",
|
||||||
"test:setup-tools": "bash utils/flyio/setenv.test.sh && deno test -A --config=utils/flyio/deno.jsonc --frozen --lock=utils/flyio/deno.lock utils/couchdb/provision.test.ts utils/setup/generate_setup_uri.test.ts utils/flyio/generate_setupuri.test.ts",
|
"test:setup-tools": "bash utils/flyio/setenv.test.sh && deno test -A --config=utils/flyio/deno.jsonc --frozen --lock=utils/flyio/deno.lock utils/livesync-commonlib-version.test.ts utils/couchdb/provision.test.ts utils/setup/generate_setup_uri.test.ts utils/flyio/generate_setupuri.test.ts",
|
||||||
"test:contract:contexts": "vitest run --config vitest.config.unit.ts src/modules/services/ObsidianServiceContext.unit.spec.ts src/apps/cli/services/NodeServiceContext.unit.spec.ts src/apps/browser/createLiveSyncBrowserServiceHub.unit.spec.ts",
|
"test:contract:contexts": "vitest run --config vitest.config.unit.ts src/modules/services/ObsidianServiceContext.unit.spec.ts src/apps/cli/services/NodeServiceContext.unit.spec.ts src/apps/browser/createLiveSyncBrowserServiceHub.unit.spec.ts",
|
||||||
"test:contract:context:webapp": "vitest run --config vitest.config.unit.ts src/apps/browser/createLiveSyncBrowserServiceHub.unit.spec.ts",
|
"test:contract:context:webapp": "vitest run --config vitest.config.unit.ts src/apps/browser/createLiveSyncBrowserServiceHub.unit.spec.ts",
|
||||||
"test:contract:context:cli": "npm run build --workspace self-hosted-livesync-cli && deno task --cwd src/apps/cli/testdeno test:setup-put-cat",
|
"test:contract:context:cli": "npm run build --workspace self-hosted-livesync-cli && deno task --cwd src/apps/cli/testdeno test:setup-put-cat",
|
||||||
|
|||||||
@@ -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, PouchDB } from "./livesync-commonlib.ts";
|
||||||
import { checkRemoteVersion } from "npm:@vrtmrz/livesync-commonlib@0.1.0-rc.4/compat/pouchdb/negotiation";
|
|
||||||
|
|
||||||
export interface CouchDBProvisioningOptions {
|
export interface CouchDBProvisioningOptions {
|
||||||
hostname: string;
|
hostname: string;
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import { decodeSettingsFromSetupURI } from "npm:@vrtmrz/livesync-commonlib@0.1.0-rc.4/compat/API/processSetting";
|
import {
|
||||||
import { DEFAULT_SETTINGS } from "npm:@vrtmrz/livesync-commonlib@0.1.0-rc.4/settings";
|
decodeSettingsFromSetupURI,
|
||||||
|
DEFAULT_SETTINGS,
|
||||||
|
} from "../setup/livesync-commonlib.ts";
|
||||||
|
|
||||||
function assert(condition: unknown, message: string): asserts condition {
|
function assert(condition: unknown, message: string): asserts condition {
|
||||||
if (!condition) throw new Error(message);
|
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
|
# 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
|
## CouchDB provisioning
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import { decodeSettingsFromSetupURI } from "npm:@vrtmrz/livesync-commonlib@0.1.0-rc.4/compat/API/processSetting";
|
import {
|
||||||
import { DEFAULT_SETTINGS } from "npm:@vrtmrz/livesync-commonlib@0.1.0-rc.4/settings";
|
decodeSettingsFromSetupURI,
|
||||||
|
DEFAULT_SETTINGS,
|
||||||
|
} from "./livesync-commonlib.ts";
|
||||||
import { generateSetupURI } from "./generate_setup_uri.ts";
|
import { generateSetupURI } from "./generate_setup_uri.ts";
|
||||||
|
|
||||||
function assert(condition: unknown, message: string): asserts condition {
|
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 {
|
import {
|
||||||
createNewVaultSettings,
|
createNewVaultSettings,
|
||||||
|
encodeSettingsToSetupURI,
|
||||||
|
generateP2PRoomId,
|
||||||
type ObsidianLiveSyncSettings,
|
type ObsidianLiveSyncSettings,
|
||||||
P2P_DEFAULT_SETTINGS,
|
P2P_DEFAULT_SETTINGS,
|
||||||
PREFERRED_BASE,
|
PREFERRED_BASE,
|
||||||
PREFERRED_JOURNAL_SYNC,
|
PREFERRED_JOURNAL_SYNC,
|
||||||
PREFERRED_SETTING_SELF_HOSTED,
|
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 SetupRemoteType = "couchdb" | "s3" | "p2p";
|
||||||
export type SetupGeneratorEnvironment = Readonly<
|
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