From df8bf029a69ab4132ff636961d9ecfc1854b1e18 Mon Sep 17 00:00:00 2001 From: Zixuan Chen Date: Fri, 12 Apr 2024 17:33:28 +0800 Subject: [PATCH] chore: experimentally publish to jsr --- loro-js/deno/.vscode/settings.json | 3 +++ loro-js/deno/deno.json | 5 +++++ loro-js/deno/mod.ts | 1 + loro-js/deno/test.ts | 13 +++++++++++++ 4 files changed, 22 insertions(+) create mode 100644 loro-js/deno/.vscode/settings.json create mode 100644 loro-js/deno/deno.json create mode 100644 loro-js/deno/mod.ts create mode 100644 loro-js/deno/test.ts diff --git a/loro-js/deno/.vscode/settings.json b/loro-js/deno/.vscode/settings.json new file mode 100644 index 00000000..cbac5697 --- /dev/null +++ b/loro-js/deno/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "deno.enable": true +} diff --git a/loro-js/deno/deno.json b/loro-js/deno/deno.json new file mode 100644 index 00000000..f1a9d757 --- /dev/null +++ b/loro-js/deno/deno.json @@ -0,0 +1,5 @@ +{ + "name": "@loro/loro", + "version": "0.1.0", + "exports": "./mod.ts" +} diff --git a/loro-js/deno/mod.ts b/loro-js/deno/mod.ts new file mode 100644 index 00000000..96f8df8c --- /dev/null +++ b/loro-js/deno/mod.ts @@ -0,0 +1 @@ +export * from "npm:loro-crdt@0.14.2"; diff --git a/loro-js/deno/test.ts b/loro-js/deno/test.ts new file mode 100644 index 00000000..274db3ec --- /dev/null +++ b/loro-js/deno/test.ts @@ -0,0 +1,13 @@ +import { Loro } from "./mod.ts"; +import { expect } from 'npm:expect' + +Deno.test("test", () => { + const doc = new Loro(); + const text = doc.getText("text"); + text.insert(0, "123") + expect(text.toString()).toEqual("123"); + text.insert(0, "123") + expect(text.toString()).toEqual("123123"); + const docB = Loro.fromSnapshot(doc.exportSnapshot()); + expect(docB.getText('text').toString()).toEqual("123123"); +})