Compare commits

..

79 Commits

Author SHA1 Message Date
Guido D'Orsi
74b984fbe6 Merge pull request #1230 from garden-co/changeset-release/main
Version Packages
2025-01-21 16:53:36 +01:00
github-actions[bot]
f8e00204b4 Version Packages 2025-01-21 15:49:31 +00:00
Guido D'Orsi
76543df765 Merge pull request #1229 from garden-co/revert-custom-logger
Revert custom logger
2025-01-21 16:48:17 +01:00
Guido D'Orsi
15d4b2a5f7 chore: changeset 2025-01-21 16:44:37 +01:00
Guido D'Orsi
2e67f91fe0 Revert "feat: make it possible to customize the logger in cojson"
This reverts commit 5863badbb0.
2025-01-21 16:42:54 +01:00
Benjamin S. Leveritt
0eb21a3471 Merge pull request #1216 from boorad/feat/demo-auth-theme
fix: phone theme drives light/dark mode in Demo Auth
2025-01-20 13:27:19 +00:00
Guido D'Orsi
99e88d3497 Merge pull request #1220 from garden-co/changeset-release/main
Version Packages
2025-01-20 13:06:56 +01:00
github-actions[bot]
f09ce70d3c Version Packages 2025-01-20 11:57:26 +00:00
Guido D'Orsi
7d62e2735f Merge pull request #1219 from garden-co/custom-logger
feat: make it possible to customize the logger in cojson
2025-01-20 12:56:11 +01:00
Guido D'Orsi
5863badbb0 feat: make it possible to customize the logger in cojson 2025-01-20 12:34:31 +01:00
Guido D'Orsi
56d26222e7 Merge pull request #1214 from garden-co/feat/queue-optimization
perf: optimize queue processing under heavy load
2025-01-20 12:30:58 +01:00
Guido D'Orsi
bd34084104 Merge pull request #1218 from garden-co/feat/inspector-component
feat: in-app inspector component for react web
2025-01-20 12:27:09 +01:00
Guido D'Orsi
f5e6fe927d chore: clean deps 2025-01-20 12:21:56 +01:00
Guido D'Orsi
93c49639c2 feat: in-app inspector component 2025-01-19 19:58:07 +01:00
Brad Anderson
aabe7bef34 fix: phone theme drives light/dark mode in Demo Auth 2025-01-17 23:07:38 -05:00
Guido D'Orsi
909165d813 test: cover nested SchemaUnion 2025-01-18 00:27:33 +01:00
Guido D'Orsi
6bee742b65 Merge pull request #1207 from garden-co/changeset-release/main
Version Packages
2025-01-18 00:26:30 +01:00
github-actions[bot]
23486d01b9 Version Packages 2025-01-17 23:23:34 +00:00
Guido D'Orsi
b761d5a730 Merge pull request #1215 from garden-co/fix/auth-issues
fix: improve error management on initial auth, fixed an infinite loop when migration fails
2025-01-18 00:22:06 +01:00
Guido D'Orsi
9181e74fc8 chore: add ts-ignore on an error flagged by some Typescript versions 2025-01-18 00:14:54 +01:00
Guido D'Orsi
5e83864f41 fix: improve error management on initial auth, fixed an infinite loop when migration fails 2025-01-18 00:12:46 +01:00
Guido D'Orsi
789cf66de2 test: fix failing test 2025-01-17 20:00:44 +01:00
Guido D'Orsi
de5f2d6d5b Merge pull request #1213 from garden-co/fix/handle-unknown-covaule-types
perf: skip coValue content creation on access
2025-01-17 14:44:03 +01:00
Guido D'Orsi
4aa377dea7 chore: changeset 2025-01-17 14:42:05 +01:00
Guido D'Orsi
efbf3d84ac chore: changeset 2025-01-17 14:41:51 +01:00
Guido D'Orsi
b90393b43e perf: optimize queue processing under heavy load 2025-01-17 14:28:00 +01:00
Guido D'Orsi
31ae73fe0e perf: skip coValue content creation on access 2025-01-17 12:49:24 +01:00
Guido D'Orsi
7a5adfc4dc Merge pull request #1212 from garden-co/fix/handle-unknown-covaule-types
feat: handle unknown coValue content instead of triggering an error
2025-01-17 12:23:50 +01:00
Guido D'Orsi
850e264912 feat: handle unknown coValue content instead of triggering an error 2025-01-17 12:02:32 +01:00
Anselm Eickhoff
aa81779ad8 Update page.tsx 2025-01-17 09:59:40 +00:00
Guido D'Orsi
72c97c0835 Merge pull request #1208 from garden-co/0.9.8-changelog
docs: add the 0.9.8 changelog
2025-01-14 18:35:21 +01:00
Guido D'Orsi
12809a6733 docs: add the 0.9.8 changelog 2025-01-14 17:21:51 +01:00
Guido D'Orsi
c55aeff98e docs: fix CoMap load & subscribe docs example 2025-01-14 16:56:47 +01:00
Guido D'Orsi
16b76e401c docs: fix jazz-tools tsDoc generation 2025-01-14 16:48:42 +01:00
Guido D'Orsi
d2470efd6f test: add a test to cover an indirect communication between nodes 2025-01-14 16:45:11 +01:00
pax
1a97b1b77c Merge pull request #1205 from garden-co/JAZZ-647/fix-image-handling-in-rn-chat-demo
Fix image handling in RN Chat Demo
2025-01-14 17:43:54 +02:00
Guido D'Orsi
adde5b78f3 Merge pull request #1201 from garden-co/changeset-release/main
Version Packages
2025-01-14 16:24:28 +01:00
github-actions[bot]
06fd3a3686 Version Packages 2025-01-14 14:02:14 +00:00
Anselm Eickhoff
d231b6ae2a Merge pull request #1191 from garden-co/fix/create-jazz-app
Use example apps as starter with create-jazz-app
2025-01-14 14:00:52 +00:00
pax-k
f76274c19a chore: changeset 2025-01-14 15:15:59 +02:00
Benjamin S. Leveritt
e471fc5d23 Merge pull request #1204 from garden-co/jazz-648-homepage-generate-docs-pointing-to-wrong-jazz-react
Fix location of jazz-react entryPoint for docs gen
2025-01-14 13:15:35 +00:00
pax-k
cb1b602255 Merge remote-tracking branch 'upstream/main' into JAZZ-647/fix-image-handling-in-rn-chat-demo 2025-01-14 15:14:30 +02:00
pax-k
a728dbf632 fix: image handling in react-native 2025-01-14 15:14:06 +02:00
Benjamin S. Leveritt
84d06d180a Fix location of jazz-react entryPoint for docs gen 2025-01-14 13:13:18 +00:00
Benjamin S. Leveritt
342e4d9f5e Merge pull request #1173 from garden-co/jazz-534-richtext-changes
Improve coRichText support
2025-01-14 12:46:50 +00:00
Benjamin S. Leveritt
8eb92471ae Add changeset 2025-01-14 12:44:19 +00:00
Benjamin S. Leveritt
e5b93871f7 Add test for insertion at start 2025-01-14 08:22:04 +00:00
Benjamin S. Leveritt
896aeb571d Fix multiple insertions at start 2025-01-14 08:22:03 +00:00
Trisha Lim
3a9797ce75 Add changeset 2025-01-13 14:48:59 +00:00
Trisha Lim
b2f14c0339 Update examples README 2025-01-13 12:37:57 +00:00
Trisha Lim
2d7b4b6c82 Update create-jazz-app readme 2025-01-12 14:36:03 +00:00
Trisha Lim
68369c16da Clone example apps in create-jazz-app 2025-01-12 14:30:53 +00:00
Trisha Lim
f002110c28 Allow partial options in create-jazz-app 2025-01-12 13:53:37 +00:00
Benjamin S. Leveritt
466c5f695a Revert mark position calculations 2025-01-09 15:30:37 +00:00
Benjamin S. Leveritt
b6a70228ea Tidy up
Remove
2025-01-09 14:55:44 +00:00
Benjamin S. Leveritt
ac32c432da Fix test 2025-01-09 14:55:44 +00:00
Benjamin S. Leveritt
066ac6bf98 Add subscription test 2025-01-09 14:55:44 +00:00
Benjamin S. Leveritt
ccfa7d9943 Add sync test 2025-01-09 14:55:44 +00:00
Benjamin S. Leveritt
90c76a01a6 Fix up import/exports 2025-01-09 14:55:44 +00:00
Benjamin S. Leveritt
807b52cccf Remove unused test 2025-01-09 14:55:44 +00:00
Benjamin S. Leveritt
fb7c6c6bbf Fix removeMark implementation with tests 2025-01-09 14:55:44 +00:00
Benjamin S. Leveritt
12e619b990 Add tag type filter 2025-01-09 14:55:44 +00:00
Benjamin S. Leveritt
aba2f8110c Fix removeMark 2025-01-09 14:55:43 +00:00
Benjamin S. Leveritt
862e3fc7ed Fix insertMark 2025-01-09 14:55:43 +00:00
Benjamin S. Leveritt
51fc92759a Add .length method 2025-01-09 14:55:43 +00:00
Benjamin S. Leveritt
c8fac3381d Refactor mark validation fn 2025-01-09 14:55:43 +00:00
Benjamin S. Leveritt
9723090f91 Stablises mark resolution 2025-01-09 14:55:43 +00:00
Benjamin S. Leveritt
4783e08c69 Add annotations 2025-01-09 14:55:43 +00:00
Benjamin S. Leveritt
34959ff0ec Fixes formatting in tests 2025-01-09 14:55:43 +00:00
Benjamin S. Leveritt
bec9be84d5 Add subscription tests 2025-01-09 14:55:43 +00:00
Benjamin S. Leveritt
277ee9d7e4 Add test for sync and loading 2025-01-09 14:55:43 +00:00
Benjamin S. Leveritt
314518a87f Add tests for position ops 2025-01-09 14:55:43 +00:00
Benjamin S. Leveritt
c280fa11c3 Add test for splitting nested children 2025-01-09 14:55:43 +00:00
Benjamin S. Leveritt
929f5785a8 Fix docs
Passing tests

Remove duplicate `createPlainText` from inherited account
2025-01-09 14:55:43 +00:00
Benjamin S. Leveritt
9ae92c19ab Fix imports for coPlainText 2025-01-09 14:55:43 +00:00
Benjamin S. Leveritt
599bb7355e Fix comment 2025-01-09 14:55:43 +00:00
Benjamin S. Leveritt
ad76a2f44f Fix libs for coPlainText 2025-01-09 14:55:43 +00:00
Anselm Eickhoff
3a3ad44f13 More progress 2025-01-09 14:55:42 +00:00
Anselm Eickhoff
db01bfb0a8 More implementation 2025-01-09 14:55:42 +00:00
168 changed files with 6234 additions and 808 deletions

View File

@@ -1,5 +1,45 @@
# chat-rn-clerk
## 1.0.53
### Patch Changes
- jazz-react-native@0.9.12
- jazz-react-native-auth-clerk@0.9.12
- jazz-tools@0.9.12
- jazz-react-native-media-images@0.9.12
## 1.0.52
### Patch Changes
- jazz-react-native@0.9.11
- jazz-react-native-auth-clerk@0.9.11
- jazz-tools@0.9.11
- jazz-react-native-media-images@0.9.11
## 1.0.51
### Patch Changes
- f76274c: Fix image handling in react-native
- Updated dependencies [f76274c]
- Updated dependencies [5e83864]
- jazz-react-native@0.9.10
- jazz-tools@0.9.10
- jazz-react-native-auth-clerk@0.9.10
- jazz-react-native-media-images@0.9.10
## 1.0.50
### Patch Changes
- Updated dependencies [8eb9247]
- jazz-tools@0.9.9
- jazz-react-native@0.9.9
- jazz-react-native-auth-clerk@0.9.9
- jazz-react-native-media-images@0.9.9
## 1.0.49
### Patch Changes

View File

@@ -37,7 +37,13 @@
],
"expo-secure-store",
"expo-font",
"expo-router"
"expo-router",
[
"expo-image-picker",
{
"photosPermission": "The app accesses your photos to let you share them with your friends."
}
]
],
"extra": {
"eas": {

View File

@@ -2,8 +2,11 @@ import { Chat, Message } from "@/src/schema";
import { useNavigation } from "@react-navigation/native";
import clsx from "clsx";
import * as Clipboard from "expo-clipboard";
import * as ImagePicker from "expo-image-picker";
import { useLocalSearchParams } from "expo-router";
import { useAccount, useCoState } from "jazz-react-native";
import { ProgressiveImg } from "jazz-react-native";
import { createImage } from "jazz-react-native-media-images";
import { Group, ID } from "jazz-tools";
import { useEffect, useLayoutEffect, useState } from "react";
import React, {
@@ -16,6 +19,8 @@ import React, {
KeyboardAvoidingView,
TextInput,
Button,
Image,
ActivityIndicator,
} from "react-native";
export default function Conversation() {
@@ -25,6 +30,7 @@ export default function Conversation() {
const [message, setMessage] = useState("");
const loadedChat = useCoState(Chat, chat?.id, [{}]);
const navigation = useNavigation();
const [isUploading, setIsUploading] = useState(false);
useEffect(() => {
if (chat) return;
@@ -81,6 +87,32 @@ export default function Conversation() {
}
};
const handleImageUpload = async () => {
try {
const result = await ImagePicker.launchImageLibraryAsync({
mediaTypes: ImagePicker.MediaTypeOptions.Images,
base64: true,
quality: 0.7,
});
if (!result.canceled && result.assets[0].base64 && chat) {
setIsUploading(true);
const base64Uri = `data:image/jpeg;base64,${result.assets[0].base64}`;
const image = await createImage(base64Uri, {
owner: chat._owner,
maxSize: 2048,
});
chat.push(Message.create({ text: "", image }, { owner: chat._owner }));
}
} catch (error) {
Alert.alert("Error", "Failed to upload image");
} finally {
setIsUploading(false);
}
};
const renderMessageItem = ({ item }: { item: Message }) => {
const isMe = item._edits.text.by?.isMe;
return (
@@ -106,14 +138,27 @@ export default function Conversation() {
isMe ? "flex-row" : "flex-row",
)}
>
<Text
className={clsx(
!isMe ? "text-black" : "text-gray-200",
`text-md max-w-[85%]`,
)}
>
{item.text}
</Text>
{item.image && (
<ProgressiveImg image={item.image} maxWidth={1024}>
{({ src, res, originalSize }) => (
<Image
source={{ uri: src }}
className="w-48 h-48 rounded-lg mb-2"
resizeMode="cover"
/>
)}
</ProgressiveImg>
)}
{item.text && (
<Text
className={clsx(
!isMe ? "text-black" : "text-gray-200",
`text-md max-w-[85%]`,
)}
>
{item.text}
</Text>
)}
<Text
className={clsx(
"text-[10px] text-right ml-2",
@@ -147,6 +192,17 @@ export default function Conversation() {
className="p-3 bg-white border-t border-gray-300"
>
<SafeAreaView className="flex-row items-center gap-2">
<TouchableOpacity
onPress={handleImageUpload}
disabled={isUploading}
className="h-10 w-10 items-center justify-center"
>
{isUploading ? (
<ActivityIndicator size="small" color="#0000ff" />
) : (
<Text className="text-2xl">🖼</Text>
)}
</TouchableOpacity>
<TextInput
className="flex-1 rounded-full h-10 px-4 bg-gray-100 border border-gray-300 focus:border-blue-500 focus:bg-white"
value={message}

View File

@@ -1,7 +1,7 @@
{
"name": "chat-rn-clerk",
"main": "index.js",
"version": "1.0.49",
"version": "1.0.53",
"scripts": {
"build": "expo export -p ios",
"start": "expo start",
@@ -35,6 +35,7 @@
"expo-dev-client": "~5.0.5",
"expo-file-system": "^18.0.4",
"expo-font": "~13.0.1",
"expo-image-picker": "~16.0.4",
"expo-linking": "~7.0.3",
"expo-router": "~4.0.11",
"expo-secure-store": "~14.0.0",

View File

@@ -1,7 +1,8 @@
import { CoList, CoMap, co } from "jazz-tools";
import { CoList, CoMap, ImageDefinition, co } from "jazz-tools";
export class Message extends CoMap {
text = co.string;
image = co.optional.ref(ImageDefinition);
}
export class Chat extends CoList.Of(co.ref(Message)) {}

View File

@@ -1,5 +1,36 @@
# chat-rn
## 1.0.50
### Patch Changes
- jazz-react-native@0.9.12
- jazz-tools@0.9.12
## 1.0.49
### Patch Changes
- jazz-react-native@0.9.11
- jazz-tools@0.9.11
## 1.0.48
### Patch Changes
- Updated dependencies [f76274c]
- Updated dependencies [5e83864]
- jazz-react-native@0.9.10
- jazz-tools@0.9.10
## 1.0.47
### Patch Changes
- Updated dependencies [8eb9247]
- jazz-tools@0.9.9
- jazz-react-native@0.9.9
## 1.0.46
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "chat-rn",
"version": "1.0.46",
"version": "1.0.50",
"main": "index.js",
"scripts": {
"build": "expo export -p ios",

View File

@@ -1,5 +1,39 @@
# chat-vue
## 0.0.37
### Patch Changes
- jazz-browser@0.9.12
- jazz-tools@0.9.12
- jazz-vue@0.9.12
## 0.0.36
### Patch Changes
- jazz-browser@0.9.11
- jazz-tools@0.9.11
- jazz-vue@0.9.11
## 0.0.35
### Patch Changes
- Updated dependencies [5e83864]
- jazz-tools@0.9.10
- jazz-browser@0.9.10
- jazz-vue@0.9.10
## 0.0.34
### Patch Changes
- Updated dependencies [8eb9247]
- jazz-tools@0.9.9
- jazz-browser@0.9.9
- jazz-vue@0.9.9
## 0.0.33
### Patch Changes

View File

@@ -1,29 +1,59 @@
# Chat example with Jazz and Vue
## Installing & running the example locally
## Getting started
(This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation))
You can either
1. Clone the jazz repository, and run the app within the monorepo.
2. Or create a new Jazz project using this example as a template.
Start by downloading the [jazz repository](https://github.com/garden-co/jazz):
### Using the example as a template
Create a new Jazz project, and use this example as a template.
```bash
npx degit gardencmp/jazz jazz
npm create jazz-app@latest --example chat-vue --project-name chat-vue
```
or
```bash
npx create-jazz-app@latest --example chat-vue --project-name chat-vue
```
Go to the todo-vue example directory:
Go to the new project directory.
```bash
cd jazz/examples/chat-vue
cd chat-vue
```
Install and build dependencies:
Run the dev server.
```bash
npm run dev
```
### Using the monorepo
This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation).
Clone the jazz repository.
```bash
git clone https://github.com/garden-co/jazz.git
```
Install and build dependencies.
```bash
pnpm i && npx turbo build
```
Start the dev server:
Go to the example directory.
```bash
cd jazz/examples/chat-vue/
```
Start the dev server.
```bash
pnpm dev
```
Open [http://localhost:5173](http://localhost:5173) with your browser to see the result.
## Questions / problems / feedback
If you have feedback, let us know on [Discord](https://discord.gg/utDMjHYg42) or open an issue or PR to fix something that seems wrong.

View File

@@ -1,6 +1,6 @@
{
"name": "chat-vue",
"version": "0.0.33",
"version": "0.0.37",
"private": true,
"type": "module",
"scripts": {

View File

@@ -1,5 +1,40 @@
# jazz-example-chat
## 0.0.133
### Patch Changes
- jazz-react@0.9.12
- jazz-tools@0.9.12
- jazz-browser-media-images@0.9.12
## 0.0.132
### Patch Changes
- jazz-react@0.9.11
- jazz-tools@0.9.11
- jazz-browser-media-images@0.9.11
## 0.0.131
### Patch Changes
- f76274c: Fix image handling in react-native
- Updated dependencies [5e83864]
- jazz-react@0.9.10
- jazz-tools@0.9.10
- jazz-browser-media-images@0.9.10
## 0.0.130
### Patch Changes
- Updated dependencies [8eb9247]
- jazz-tools@0.9.9
- jazz-browser-media-images@0.9.9
- jazz-react@0.9.9
## 0.0.129
### Patch Changes

View File

@@ -2,30 +2,60 @@
Live version: [https://chat.jazz.tools](https://chat.jazz.tools)
## Installing & running the example locally
## Getting started
(This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation))
You can either
1. Clone the jazz repository, and run the app within the monorepo.
2. Or create a new Jazz project using this example as a template.
Start by downloading the [jazz repository](https://github.com/garden-co/jazz):
### Using the example as a template
Create a new Jazz project, and use this example as a template.
```bash
npx degit gardencmp/jazz jazz
npm create jazz-app@latest --example chat --project-name chat
```
or
```bash
npx create-jazz-app@latest --example chat --project-name chat
```
Go to the chat example directory:
Go to the new project directory.
```bash
cd jazz/examples/chat
cd chat
```
Install and build dependencies:
Run the dev server.
```bash
npm run dev
```
### Using the monorepo
This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation).
Clone the jazz repository.
```bash
git clone https://github.com/garden-co/jazz.git
```
Install and build dependencies.
```bash
pnpm i && npx turbo build
```
Start the dev server:
Go to the example directory.
```bash
cd jazz/examples/chat/
```
Start the dev server.
```bash
pnpm dev
```
Open [http://localhost:5173](http://localhost:5173) with your browser to see the result.
## Questions / problems / feedback
If you have feedback, let us know on [Discord](https://discord.gg/utDMjHYg42) or open an issue or PR to fix something that seems wrong.

View File

@@ -1,7 +1,7 @@
{
"name": "jazz-example-chat",
"private": true,
"version": "0.0.129",
"version": "0.0.133",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -35,7 +35,7 @@ export function ChatScreen(props: { chatID: ID<Chat> }) {
return;
}
createImage(file).then((image) => {
createImage(file, { owner: chat._owner }).then((image) => {
chat.push(Message.create({ text: file.name, image: image }, chat._owner));
});
};

View File

@@ -1,5 +1,39 @@
# minimal-auth-clerk
## 0.0.32
### Patch Changes
- jazz-react@0.9.12
- jazz-react-auth-clerk@0.9.12
- jazz-tools@0.9.12
## 0.0.31
### Patch Changes
- jazz-react@0.9.11
- jazz-react-auth-clerk@0.9.11
- jazz-tools@0.9.11
## 0.0.30
### Patch Changes
- Updated dependencies [5e83864]
- jazz-react@0.9.10
- jazz-tools@0.9.10
- jazz-react-auth-clerk@0.9.10
## 0.0.29
### Patch Changes
- Updated dependencies [8eb9247]
- jazz-tools@0.9.9
- jazz-react@0.9.9
- jazz-react-auth-clerk@0.9.9
## 0.0.28
### Patch Changes

View File

@@ -4,30 +4,60 @@ This is an example of how to use clerk authentication with Jazz.
Live version: https://clerk-demo.jazz.tools
## Installing & running the example locally
## Getting started
(This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation))
You can either
1. Clone the jazz repository, and run the app within the monorepo.
2. Or create a new Jazz project using this example as a template.
Start by downloading the [jazz repository](https://github.com/garden-co/jazz):
### Using the example as a template
Create a new Jazz project, and use this example as a template.
```bash
npx degit gardencmp/jazz jazz
npm create jazz-app@latest --start clerk --project-name clerk
```
or
```bash
npx create-jazz-app@latest --start clerk --project-name clerk
```
Go to the clerk example directory:
Go to the new project directory.
```bash
cd jazz/examples/clerk
cd clerk
```
Install and build dependencies:
Run the dev server.
```bash
npm run dev
```
### Using the monorepo
This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation).
Clone the jazz repository.
```bash
git clone https://github.com/garden-co/jazz.git
```
Install and build dependencies.
```bash
pnpm i && npx turbo build
```
Start the dev server:
Go to the example directory.
```bash
cd jazz/examples/clerk/
```
Start the dev server.
```bash
pnpm dev
```
Open [http://localhost:5173](http://localhost:5173) with your browser to see the result.
## Questions / problems / feedback
If you have feedback, let us know on [Discord](https://discord.gg/utDMjHYg42) or open an issue or PR to fix something that seems wrong.

View File

@@ -1,7 +1,7 @@
{
"name": "clerk",
"private": true,
"version": "0.0.28",
"version": "0.0.32",
"type": "module",
"scripts": {
"dev": "vite",
@@ -13,7 +13,7 @@
"dependencies": {
"@clerk/clerk-react": "^5.4.1",
"jazz-react": "workspace:*",
"jazz-react-auth-clerk": "workspace:0.9.8",
"jazz-react-auth-clerk": "workspace:0.9.12",
"jazz-tools": "workspace:*",
"react": "^18.3.1",
"react-dom": "^18.3.1"

View File

@@ -1,5 +1,35 @@
# file-share-svelte
## 0.0.17
### Patch Changes
- jazz-svelte@0.9.12
- jazz-tools@0.9.12
## 0.0.16
### Patch Changes
- jazz-svelte@0.9.11
- jazz-tools@0.9.11
## 0.0.15
### Patch Changes
- Updated dependencies [5e83864]
- jazz-tools@0.9.10
- jazz-svelte@0.9.10
## 0.0.14
### Patch Changes
- Updated dependencies [8eb9247]
- jazz-tools@0.9.9
- jazz-svelte@0.9.9
## 0.0.13
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "file-share-svelte",
"version": "0.0.13",
"version": "0.0.17",
"private": true,
"type": "module",
"scripts": {

View File

@@ -1,5 +1,39 @@
# form
## 0.0.28
### Patch Changes
- jazz-react@0.9.12
- jazz-tools@0.9.12
- jazz-browser-media-images@0.9.12
## 0.0.27
### Patch Changes
- jazz-react@0.9.11
- jazz-tools@0.9.11
- jazz-browser-media-images@0.9.11
## 0.0.26
### Patch Changes
- Updated dependencies [5e83864]
- jazz-react@0.9.10
- jazz-tools@0.9.10
- jazz-browser-media-images@0.9.10
## 0.0.25
### Patch Changes
- Updated dependencies [8eb9247]
- jazz-tools@0.9.9
- jazz-browser-media-images@0.9.9
- jazz-react@0.9.9
## 0.0.24
### Patch Changes

View File

@@ -17,30 +17,60 @@ converting it into a `BubbleTeaOrder`.
[See the full guide here.](https://jazz.tools/docs/react/design-patterns/form)
## Installing & running the example locally
## Getting started
(This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation))
You can either
1. Clone the jazz repository, and run the app within the monorepo.
2. Or create a new Jazz project using this example as a template.
Start by downloading the [jazz repository](https://github.com/garden-co/jazz):
### Using the example as a template
Create a new Jazz project, and use this example as a template.
```bash
npx degit gardencmp/jazz jazz
npm create jazz-app@latest --start form --project-name form
```
or
```bash
npx create-jazz-app@latest --start form --project-name form
```
Go to the form example directory:
Go to the new project directory.
```bash
cd jazz/examples/form
cd form
```
Install and build dependencies:
Run the dev server.
```bash
npm run dev
```
### Using the monorepo
This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation).
Clone the jazz repository.
```bash
git clone https://github.com/garden-co/jazz.git
```
Install and build dependencies.
```bash
pnpm i && npx turbo build
```
Start the dev server:
Go to the example directory.
```bash
cd jazz/examples/form/
```
Start the dev server.
```bash
pnpm dev
```
Open [http://localhost:5173](http://localhost:5173) with your browser to see the result.
## Questions / problems / feedback
If you have feedback, let us know on [Discord](https://discord.gg/utDMjHYg42) or open an issue or PR to fix something that seems wrong.

View File

@@ -1,7 +1,7 @@
{
"name": "form",
"private": true,
"version": "0.0.24",
"version": "0.0.28",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -1,5 +1,39 @@
# image-upload
## 0.0.30
### Patch Changes
- jazz-react@0.9.12
- jazz-tools@0.9.12
- jazz-browser-media-images@0.9.12
## 0.0.29
### Patch Changes
- jazz-react@0.9.11
- jazz-tools@0.9.11
- jazz-browser-media-images@0.9.11
## 0.0.28
### Patch Changes
- Updated dependencies [5e83864]
- jazz-react@0.9.10
- jazz-tools@0.9.10
- jazz-browser-media-images@0.9.10
## 0.0.27
### Patch Changes
- Updated dependencies [8eb9247]
- jazz-tools@0.9.9
- jazz-browser-media-images@0.9.9
- jazz-react@0.9.9
## 0.0.26
### Patch Changes

View File

@@ -4,30 +4,60 @@ This is an example of how to upload and render images with Jazz.
Live version: https://image-upload-demo.jazz.tools
## Installing & running the example locally
## Getting started
(This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation))
You can either
1. Clone the jazz repository, and run the app within the monorepo.
2. Or create a new Jazz project using this example as a template.
Start by downloading the [jazz repository](https://github.com/garden-co/jazz):
### Using the example as a template
Create a new Jazz project, and use this example as a template.
```bash
npx degit gardencmp/jazz jazz
npm create jazz-app@latest --example image-upload --project-name image-upload
```
or
```bash
npx create-jazz-app@latest --example image-upload --project-name image-upload
```
Go to the image-upload example directory:
Go to the new project directory.
```bash
cd jazz/examples/image-upload
cd image-upload
```
Install and build dependencies:
Run the dev server.
```bash
npm run dev
```
### Using the monorepo
This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation).
Clone the jazz repository.
```bash
git clone https://github.com/garden-co/jazz.git
```
Install and build dependencies.
```bash
pnpm i && npx turbo build
```
Start the dev server:
Go to the example directory.
```bash
cd jazz/examples/image-upload/
```
Start the dev server.
```bash
pnpm dev
```
Open [http://localhost:5173](http://localhost:5173) with your browser to see the result.
## Questions / problems / feedback
If you have feedback, let us know on [Discord](https://discord.gg/utDMjHYg42) or open an issue or PR to fix something that seems wrong.

View File

@@ -1,7 +1,7 @@
{
"name": "image-upload",
"private": true,
"version": "0.0.26",
"version": "0.0.30",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -1,5 +1,38 @@
# jazz-example-inspector
## 0.0.97
### Patch Changes
- Updated dependencies [15d4b2a]
- cojson-transport-ws@0.9.12
- cojson@0.9.12
## 0.0.96
### Patch Changes
- Updated dependencies [efbf3d8]
- Updated dependencies [5863bad]
- cojson@0.9.11
- cojson-transport-ws@0.9.11
## 0.0.95
### Patch Changes
- Updated dependencies [4aa377d]
- cojson@0.9.10
- cojson-transport-ws@0.9.10
## 0.0.94
### Patch Changes
- Updated dependencies [8eb9247]
- cojson@0.9.9
- cojson-transport-ws@0.9.9
## 0.0.93
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "jazz-inspector",
"name": "jazz-inspector-app",
"private": true,
"version": "0.0.93",
"version": "0.0.97",
"type": "module",
"scripts": {
"dev": "vite",
@@ -16,8 +16,8 @@
"@radix-ui/react-toast": "^1.1.4",
"class-variance-authority": "^0.7.0",
"clsx": "^2.0.0",
"cojson": "workspace:0.9.0",
"cojson-transport-ws": "workspace:0.9.0",
"cojson": "workspace:0.9.12",
"cojson-transport-ws": "workspace:0.9.12",
"hash-slash": "workspace:0.2.1",
"lucide-react": "^0.274.0",
"qrcode": "^1.5.3",

View File

@@ -1,5 +1,37 @@
# jazz-example-musicplayer
## 0.0.53
### Patch Changes
- jazz-inspector@0.9.12
- jazz-react@0.9.12
- jazz-tools@0.9.12
## 0.0.52
### Patch Changes
- jazz-inspector@0.9.11
- jazz-react@0.9.11
- jazz-tools@0.9.11
## 0.0.51
### Patch Changes
- Updated dependencies [5e83864]
- jazz-react@0.9.10
- jazz-tools@0.9.10
## 0.0.50
### Patch Changes
- Updated dependencies [8eb9247]
- jazz-tools@0.9.9
- jazz-react@0.9.9
## 0.0.49
### Patch Changes

View File

@@ -2,30 +2,60 @@
Live version: https://music-demo.jazz.tools
## Installing & running the example locally
## Getting started
(This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation))
You can either
1. Clone the jazz repository, and run the app within the monorepo.
2. Or create a new Jazz project using this example as a template.
Start by downloading the [jazz repository](https://github.com/garden-co/jazz):
### Using the example as a template
Create a new Jazz project, and use this example as a template.
```bash
npx degit gardencmp/jazz jazz
npm create jazz-app@latest --example music-player --project-name music-player
```
or
```bash
npx create-jazz-app@latest --example music-player --project-name music-player
```
Go to the music-player example directory:
Go to the new project directory.
```bash
cd jazz/examples/music-player
cd music-player
```
Install and build dependencies:
Run the dev server.
```bash
npm run dev
```
### Using the monorepo
This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation).
Clone the jazz repository.
```bash
git clone https://github.com/garden-co/jazz.git
```
Install and build dependencies.
```bash
pnpm i && npx turbo build
```
Start the dev server:
Go to the example directory.
```bash
cd jazz/examples/music-player/
```
Start the dev server.
```bash
pnpm dev
```
Open [http://localhost:5173](http://localhost:5173) with your browser to see the result.
## Questions / problems / feedback
If you have feedback, let us know on [Discord](https://discord.gg/utDMjHYg42) or open an issue or PR to fix something that seems wrong.

View File

@@ -1,7 +1,7 @@
{
"name": "jazz-example-music-player",
"private": true,
"version": "0.0.49",
"version": "0.0.53",
"type": "module",
"scripts": {
"dev": "vite",
@@ -18,8 +18,9 @@
"@radix-ui/react-toast": "^1.1.4",
"class-variance-authority": "^0.7.0",
"clsx": "^2.0.0",
"jazz-react": "workspace:0.9.8",
"jazz-tools": "workspace:0.9.8",
"jazz-react": "workspace:0.9.12",
"jazz-tools": "workspace:0.9.12",
"jazz-inspector": "workspace:*",
"lucide-react": "^0.274.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",

View File

@@ -1,4 +1,5 @@
import { Toaster } from "@/components/ui/toaster";
import { JazzInspector } from "jazz-inspector";
/* eslint-disable react-refresh/only-export-components */
import React from "react";
import ReactDOM from "react-dom/client";
@@ -71,6 +72,7 @@ function JazzAndAuth({ children }: { children: React.ReactNode }) {
AccountSchema={MusicaAccount}
>
{children}
<JazzInspector />
</JazzProvider>
<DemoAuthBasicUI appName="Jazz Music Player" state={state} />
</>

View File

@@ -1,5 +1,39 @@
# jazz-example-onboarding
## 0.0.34
### Patch Changes
- jazz-react@0.9.12
- jazz-tools@0.9.12
- jazz-browser-media-images@0.9.12
## 0.0.33
### Patch Changes
- jazz-react@0.9.11
- jazz-tools@0.9.11
- jazz-browser-media-images@0.9.11
## 0.0.32
### Patch Changes
- Updated dependencies [5e83864]
- jazz-react@0.9.10
- jazz-tools@0.9.10
- jazz-browser-media-images@0.9.10
## 0.0.31
### Patch Changes
- Updated dependencies [8eb9247]
- jazz-tools@0.9.9
- jazz-browser-media-images@0.9.9
- jazz-react@0.9.9
## 0.0.30
### Patch Changes

View File

@@ -1,29 +1,58 @@
# Onboarding example with Jazz and React
## Installing & running the example locally
## Getting started
(This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation))
You can either
1. Clone the jazz repository, and run the app within the monorepo.
2. Or create a new Jazz project using this example as a template.
Start by downloading the [jazz repository](https://github.com/garden-co/jazz):
### Using the example as a template
Create a new Jazz project, and use this example as a template.
```bash
npx degit gardencmp/jazz jazz
npm create jazz-app@latest --example onboarding --project-name onboarding
```
or
```bash
npx create-jazz-app@latest --example onboarding --project-name onboarding
```
Go to the onboarding example directory:
Go to the new project directory.
```bash
cd jazz/examples/onboarding
cd onboarding
```
Install and build dependencies:
Run the dev server.
```bash
npm run dev
```
### Using the monorepo
This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation).
Clone the jazz repository.
```bash
git clone https://github.com/garden-co/jazz.git
```
Install and build dependencies.
```bash
pnpm i && npx turbo build
```
Start the dev server:
Go to the example directory.
```bash
cd jazz/examples/onboarding/
```
Start the dev server.
```bash
pnpm dev
```
Open [http://localhost:5173](http://localhost:5173) with your browser to see the result.
## Questions / problems / feedback
If you have feedback, let us know on [Discord](https://discord.gg/utDMjHYg42) or open an issue or PR to fix something that seems wrong.

View File

@@ -1,7 +1,7 @@
{
"name": "jazz-example-onboarding",
"private": true,
"version": "0.0.30",
"version": "0.0.34",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -1,5 +1,35 @@
# organization
## 0.0.26
### Patch Changes
- jazz-react@0.9.12
- jazz-tools@0.9.12
## 0.0.25
### Patch Changes
- jazz-react@0.9.11
- jazz-tools@0.9.11
## 0.0.24
### Patch Changes
- Updated dependencies [5e83864]
- jazz-react@0.9.10
- jazz-tools@0.9.10
## 0.0.23
### Patch Changes
- Updated dependencies [8eb9247]
- jazz-tools@0.9.9
- jazz-react@0.9.9
## 0.0.22
### Patch Changes

View File

@@ -5,30 +5,60 @@ Different apps have different names for this concept, such as "teams" or "worksp
Refer to the [documentation](https://jazz.tools/docs/react/design-patterns/organization) for more information.
## Installing & running the example locally
## Getting started
(This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation))
You can either
1. Clone the jazz repository, and run the app within the monorepo.
2. Or create a new Jazz project using this example as a template.
Start by downloading the [jazz repository](https://github.com/garden-co/jazz):
### Using the example as a template
Create a new Jazz project, and use this example as a template.
```bash
npx degit gardencmp/jazz jazz
npm create jazz-app@latest --example organization --project-name organization
```
or
```bash
npx create-jazz-app@latest --example organization --project-name organization
```
Go to the organization example directory:
Go to the new project directory.
```bash
cd jazz/examples/organization
cd organization
```
Install and build dependencies:
Run the dev server.
```bash
npm run dev
```
### Using the monorepo
This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation).
Clone the jazz repository.
```bash
git clone https://github.com/garden-co/jazz.git
```
Install and build dependencies.
```bash
pnpm i && npx turbo build
```
Start the dev server:
Go to the example directory.
```bash
cd jazz/examples/organization/
```
Start the dev server.
```bash
pnpm dev
```
Open [http://localhost:5173](http://localhost:5173) with your browser to see the result.
## Questions / problems / feedback
If you have feedback, let us know on [Discord](https://discord.gg/utDMjHYg42) or open an issue or PR to fix something that seems wrong.

View File

@@ -1,7 +1,7 @@
{
"name": "organization",
"private": true,
"version": "0.0.22",
"version": "0.0.26",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -1,5 +1,29 @@
# passkey-svelte
## 0.0.21
### Patch Changes
- jazz-svelte@0.9.12
## 0.0.20
### Patch Changes
- jazz-svelte@0.9.11
## 0.0.19
### Patch Changes
- jazz-svelte@0.9.10
## 0.0.18
### Patch Changes
- jazz-svelte@0.9.9
## 0.0.17
### Patch Changes

View File

@@ -10,34 +10,59 @@ This example showcases how to:
- Manage authentication state
- Implement secure login/logout flows
## Getting Started
## Getting started
1. Clone the repository:
You can either
1. Clone the jazz repository, and run the app within the monorepo.
2. Or create a new Jazz project using this example as a template.
```sh
### Using the example as a template
Create a new Jazz project, and use this example as a template.
```bash
npm create jazz-app@latest --example passkey-svelte --project-name passkey-svelte
```
or
```bash
npx create-jazz-app@latest --example passkey-svelte --project-name passkey-svelte
```
Go to the new project directory.
```bash
cd passkey-svelte
```
Run the dev server.
```bash
npm run dev
```
### Using the monorepo
This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation).
Clone the jazz repository.
```bash
git clone https://github.com/garden-co/jazz.git
```
2. Navigate to the example directory:
```sh
cd examples/passkey-svelte
Install and build dependencies.
```bash
pnpm i && npx turbo build
```
3. Install dependencies:
```sh
pnpm install
Go to the example directory.
```bash
cd jazz/examples/passkey-svelte/
```
4. Start the development server:
```sh
Start the dev server.
```bash
pnpm dev
```
5. Open your browser and visit [http://localhost:5173](http://localhost:5173)
Open [http://localhost:5173](http://localhost:5173) with your browser to see the result.
## Learn More

View File

@@ -1,6 +1,6 @@
{
"name": "passkey-svelte",
"version": "0.0.17",
"version": "0.0.21",
"type": "module",
"private": true,
"scripts": {

View File

@@ -1,5 +1,35 @@
# minimal-auth-passkey
## 0.0.31
### Patch Changes
- jazz-react@0.9.12
- jazz-tools@0.9.12
## 0.0.30
### Patch Changes
- jazz-react@0.9.11
- jazz-tools@0.9.11
## 0.0.29
### Patch Changes
- Updated dependencies [5e83864]
- jazz-react@0.9.10
- jazz-tools@0.9.10
## 0.0.28
### Patch Changes
- Updated dependencies [8eb9247]
- jazz-tools@0.9.9
- jazz-react@0.9.9
## 0.0.27
### Patch Changes

View File

@@ -4,30 +4,59 @@ This is an example of how to use passkey authentication with Jazz.
Live version: https://passkey-demo.jazz.tools
## Installing & running the example locally
## Getting started
(This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation))
You can either
1. Clone the jazz repository, and run the app within the monorepo.
2. Or create a new Jazz project using this example as a template.
Start by downloading the [jazz repository](https://github.com/garden-co/jazz):
### Using the example as a template
Create a new Jazz project, and use this example as a template.
```bash
npx degit gardencmp/jazz jazz
npm create jazz-app@latest --example passkey --project-name passkey
```
or
```bash
npx create-jazz-app@latest --example passkey --project-name passkey
```
Go to the passkey example directory:
Go to the new project directory.
```bash
cd jazz/examples/passkey
cd passkey
```
Install and build dependencies:
Run the dev server.
```bash
npm run dev
```
### Using the monorepo
This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation).
Clone the jazz repository.
```bash
git clone https://github.com/garden-co/jazz.git
```
Install and build dependencies.
```bash
pnpm i && npx turbo build
```
Start the dev server:
Go to the example directory.
```bash
cd jazz/examples/passkey/
```
Start the dev server.
```bash
pnpm dev
```
Open [http://localhost:5173](http://localhost:5173) with your browser to see the result.
## Questions / problems / feedback
If you have feedback, let us know on [Discord](https://discord.gg/utDMjHYg42) or open an issue or PR to fix something that seems wrong.

View File

@@ -1,7 +1,7 @@
{
"name": "passkey",
"private": true,
"version": "0.0.27",
"version": "0.0.31",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -1,5 +1,35 @@
# jazz-password-manager
## 0.0.52
### Patch Changes
- jazz-react@0.9.12
- jazz-tools@0.9.12
## 0.0.51
### Patch Changes
- jazz-react@0.9.11
- jazz-tools@0.9.11
## 0.0.50
### Patch Changes
- Updated dependencies [5e83864]
- jazz-react@0.9.10
- jazz-tools@0.9.10
## 0.0.49
### Patch Changes
- Updated dependencies [8eb9247]
- jazz-tools@0.9.9
- jazz-react@0.9.9
## 0.0.48
### Patch Changes

View File

@@ -4,30 +4,60 @@ Live version: https://passwords-demo.jazz.tools
![Password Manager Screenshot](demo.png "Screenshot")
## Installing & running the example locally
## Getting started
(This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation))
You can either
1. Clone the jazz repository, and run the app within the monorepo.
2. Or create a new Jazz project using this example as a template.
Start by downloading the [jazz repository](https://github.com/garden-co/jazz):
### Using the example as a template
Create a new Jazz project, and use this example as a template.
```bash
npx degit gardencmp/jazz jazz
npm create jazz-app@latest --example password-manager --project-name password-manager
```
or
```bash
npx create-jazz-app@latest --example password-manager --project-name password-manager
```
Go to the password-manager example directory:
Go to the new project directory.
```bash
cd jazz/examples/password-manager
cd password-manager
```
Install and build dependencies:
Run the dev server.
```bash
npm run dev
```
### Using the monorepo
This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation).
Clone the jazz repository.
```bash
git clone https://github.com/garden-co/jazz.git
```
Install and build dependencies.
```bash
pnpm i && npx turbo build
```
Start the dev server:
Go to the example directory.
```bash
cd jazz/examples/password-manager/
```
Start the dev server.
```bash
pnpm dev
```
Open [http://localhost:5173](http://localhost:5173) with your browser to see the result.
## Structure
- [`src/components`](./src/components/): UI components

View File

@@ -1,7 +1,7 @@
{
"name": "jazz-password-manager",
"private": true,
"version": "0.0.48",
"version": "0.0.52",
"type": "module",
"scripts": {
"dev": "vite",
@@ -12,8 +12,8 @@
"clean-install": "rm -rf node_modules pnpm-lock.yaml && pnpm install"
},
"dependencies": {
"jazz-react": "workspace:0.9.8",
"jazz-tools": "workspace:0.9.8",
"jazz-react": "workspace:0.9.12",
"jazz-tools": "workspace:0.9.12",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-hook-form": "^7.41.5",

View File

@@ -1,5 +1,39 @@
# jazz-example-pets
## 0.0.150
### Patch Changes
- jazz-react@0.9.12
- jazz-tools@0.9.12
- jazz-browser-media-images@0.9.12
## 0.0.149
### Patch Changes
- jazz-react@0.9.11
- jazz-tools@0.9.11
- jazz-browser-media-images@0.9.11
## 0.0.148
### Patch Changes
- Updated dependencies [5e83864]
- jazz-react@0.9.10
- jazz-tools@0.9.10
- jazz-browser-media-images@0.9.10
## 0.0.147
### Patch Changes
- Updated dependencies [8eb9247]
- jazz-tools@0.9.9
- jazz-browser-media-images@0.9.9
- jazz-react@0.9.9
## 0.0.146
### Patch Changes

View File

@@ -2,30 +2,59 @@
Live version: https://pets-demo.jazz.tools/
## Installing & running the example locally
## Getting started
(This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation))
You can either
1. Clone the jazz repository, and run the app within the monorepo.
2. Or create a new Jazz project using this example as a template.
Start by downloading the [jazz repository](https://github.com/garden-co/jazz):
### Using the example as a template
Create a new Jazz project, and use this example as a template.
```bash
npx degit gardencmp/jazz jazz
npm create jazz-app@latest --example pets --project-name pets
```
or
```bash
npx create-jazz-app@latest --example pets --project-name pets
```
Go to the pets example directory:
Go to the new project directory.
```bash
cd jazz/examples/pets
cd pets
```
Install and build dependencies:
Run the dev server.
```bash
npm run dev
```
### Using the monorepo
This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation).
Clone the jazz repository.
```bash
git clone https://github.com/garden-co/jazz.git
```
Install and build dependencies.
```bash
pnpm i && npx turbo build
```
Start the dev server:
Go to the example directory.
```bash
cd jazz/examples/pets/
```
Start the dev server.
```bash
pnpm dev
```
Open [http://localhost:5173](http://localhost:5173) with your browser to see the result.
## Questions / problems / feedback

View File

@@ -1,7 +1,7 @@
{
"name": "jazz-example-pets",
"private": true,
"version": "0.0.146",
"version": "0.0.150",
"type": "module",
"scripts": {
"dev": "vite",
@@ -19,9 +19,9 @@
"@radix-ui/react-toast": "^1.1.4",
"class-variance-authority": "^0.7.0",
"clsx": "^2.0.0",
"jazz-browser-media-images": "workspace:0.9.8",
"jazz-react": "workspace:0.9.8",
"jazz-tools": "workspace:0.9.8",
"jazz-browser-media-images": "workspace:0.9.12",
"jazz-react": "workspace:0.9.12",
"jazz-tools": "workspace:0.9.12",
"lucide-react": "^0.274.0",
"qrcode": "^1.5.3",
"react": "^18.3.1",
@@ -41,7 +41,7 @@
"@vitejs/plugin-react-swc": "^3.3.2",
"autoprefixer": "^10.4.20",
"is-ci": "^3.0.1",
"jazz-run": "workspace:0.9.8",
"jazz-run": "workspace:0.9.12",
"postcss": "^8.4.27",
"tailwindcss": "^3.4.15",
"typescript": "~5.6.2",

View File

@@ -1,5 +1,39 @@
# reactions
## 0.0.30
### Patch Changes
- jazz-react@0.9.12
- jazz-tools@0.9.12
- jazz-browser-media-images@0.9.12
## 0.0.29
### Patch Changes
- jazz-react@0.9.11
- jazz-tools@0.9.11
- jazz-browser-media-images@0.9.11
## 0.0.28
### Patch Changes
- Updated dependencies [5e83864]
- jazz-react@0.9.10
- jazz-tools@0.9.10
- jazz-browser-media-images@0.9.10
## 0.0.27
### Patch Changes
- Updated dependencies [8eb9247]
- jazz-tools@0.9.9
- jazz-browser-media-images@0.9.9
- jazz-react@0.9.9
## 0.0.26
### Patch Changes

View File

@@ -2,30 +2,60 @@
Live version: [https://reactions-demo.jazz.tools](https://reactions-demo.jazz.tools)
## Installing & running the example locally
## Getting started
(This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation))
You can either
1. Clone the jazz repository, and run the app within the monorepo.
2. Or create a new Jazz project using this example as a template.
Start by downloading the [jazz repository](https://github.com/garden-co/jazz):
### Using the example as a template
Create a new Jazz project, and use this example as a template.
```bash
npx degit gardencmp/jazz jazz
npm create jazz-app@latest --example reactions --project-name reactions
```
or
```bash
npx create-jazz-app@latest --example reactions --project-name reactions
```
Go to the reactions example directory:
Go to the new project directory.
```bash
cd jazz/examples/reactions
cd reactions
```
Install and build dependencies:
Run the dev server.
```bash
npm run dev
```
### Using the monorepo
This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation).
Clone the jazz repository.
```bash
git clone https://github.com/garden-co/jazz.git
```
Install and build dependencies.
```bash
pnpm i && npx turbo build
```
Start the dev server:
Go to the example directory.
```bash
cd jazz/examples/reactions/
```
Start the dev server.
```bash
pnpm dev
```
Open [http://localhost:5173](http://localhost:5173) with your browser to see the result.
## Questions / problems / feedback
If you have feedback, let us know on [Discord](https://discord.gg/utDMjHYg42) or open an issue or PR to fix something that seems wrong.

View File

@@ -1,7 +1,7 @@
{
"name": "reactions",
"private": true,
"version": "0.0.26",
"version": "0.0.30",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -1,5 +1,39 @@
# todo-vue
## 0.0.35
### Patch Changes
- jazz-browser@0.9.12
- jazz-tools@0.9.12
- jazz-vue@0.9.12
## 0.0.34
### Patch Changes
- jazz-browser@0.9.11
- jazz-tools@0.9.11
- jazz-vue@0.9.11
## 0.0.33
### Patch Changes
- Updated dependencies [5e83864]
- jazz-tools@0.9.10
- jazz-browser@0.9.10
- jazz-vue@0.9.10
## 0.0.32
### Patch Changes
- Updated dependencies [8eb9247]
- jazz-tools@0.9.9
- jazz-browser@0.9.9
- jazz-vue@0.9.9
## 0.0.31
### Patch Changes

View File

@@ -1,29 +1,59 @@
# Todo list example with Jazz and Vue
## Installing & running the example locally
## Getting started
(This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation))
You can either
1. Clone the jazz repository, and run the app within the monorepo.
2. Or create a new Jazz project using this example as a template.
Start by downloading the [jazz repository](https://github.com/garden-co/jazz):
### Using the example as a template
Create a new Jazz project, and use this example as a template.
```bash
npx degit gardencmp/jazz jazz
npm create jazz-app@latest --example todo-vue --project-name todo-vue
```
or
```bash
npx create-jazz-app@latest --example todo-vue --project-name todo-vue
```
Go to the todo-vue example directory:
Go to the new project directory.
```bash
cd jazz/examples/todo-vue
cd todo-vue
```
Install and build dependencies:
Run the dev server.
```bash
npm run dev
```
### Using the monorepo
This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation).
Clone the jazz repository.
```bash
git clone https://github.com/garden-co/jazz.git
```
Install and build dependencies.
```bash
pnpm i && npx turbo build
```
Start the dev server:
Go to the example directory.
```bash
cd jazz/examples/todo-vue/
```
Start the dev server.
```bash
pnpm dev
```
Open [http://localhost:5173](http://localhost:5173) with your browser to see the result.
## Questions / problems / feedback
If you have feedback, let us know on [Discord](https://discord.gg/utDMjHYg42) or open an issue or PR to fix something that seems wrong.

View File

@@ -1,6 +1,6 @@
{
"name": "todo-vue",
"version": "0.0.31",
"version": "0.0.35",
"private": true,
"type": "module",
"scripts": {

View File

@@ -1,5 +1,35 @@
# jazz-example-todo
## 0.0.149
### Patch Changes
- jazz-react@0.9.12
- jazz-tools@0.9.12
## 0.0.148
### Patch Changes
- jazz-react@0.9.11
- jazz-tools@0.9.11
## 0.0.147
### Patch Changes
- Updated dependencies [5e83864]
- jazz-react@0.9.10
- jazz-tools@0.9.10
## 0.0.146
### Patch Changes
- Updated dependencies [8eb9247]
- jazz-tools@0.9.9
- jazz-react@0.9.9
## 0.0.145
### Patch Changes

View File

@@ -2,30 +2,60 @@
Live version: https://todo-demo.jazz.tools/
## Installing & running the example locally
## Getting started
(This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation))
You can either
1. Clone the jazz repository, and run the app within the monorepo.
2. Or create a new Jazz project using this example as a template.
Start by downloading the [jazz repository](https://github.com/garden-co/jazz):
### Using the example as a template
Create a new Jazz project, and use this example as a template.
```bash
npx degit gardencmp/jazz jazz
npm create jazz-app@latest --example todo --project-name todo
```
or
```bash
npx create-jazz-app@latest --example todo --project-name todo
```
Go to the todo example directory:
Go to the new project directory.
```bash
cd jazz/examples/todo
cd todo
```
Install and build dependencies:
Run the dev server.
```bash
npm run dev
```
### Using the monorepo
This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation).
Clone the jazz repository.
```bash
git clone https://github.com/garden-co/jazz.git
```
Install and build dependencies.
```bash
pnpm i && npx turbo build
```
Start the dev server:
Go to the example directory.
```bash
cd jazz/examples/todo/
```
Start the dev server.
```bash
pnpm dev
```
Open [http://localhost:5173](http://localhost:5173) with your browser to see the result.
## Structure
- [`src/basicComponents`](./src/basicComponents): simple components to build the UI, unrelated to Jazz (uses [shadcn/ui](https://ui.shadcn.com))

View File

@@ -1,7 +1,7 @@
{
"name": "jazz-example-todo",
"private": true,
"version": "0.0.145",
"version": "0.0.149",
"type": "module",
"scripts": {
"dev": "vite",
@@ -16,8 +16,8 @@
"@radix-ui/react-toast": "^1.1.4",
"class-variance-authority": "^0.7.0",
"clsx": "^2.0.0",
"jazz-react": "workspace:0.9.8",
"jazz-tools": "workspace:0.9.8",
"jazz-react": "workspace:0.9.12",
"jazz-tools": "workspace:0.9.12",
"lucide-react": "^0.274.0",
"qrcode": "^1.5.3",
"react": "^18.3.1",

View File

@@ -1,5 +1,35 @@
# version-history
## 0.0.27
### Patch Changes
- jazz-react@0.9.12
- jazz-tools@0.9.12
## 0.0.26
### Patch Changes
- jazz-react@0.9.11
- jazz-tools@0.9.11
## 0.0.25
### Patch Changes
- Updated dependencies [5e83864]
- jazz-react@0.9.10
- jazz-tools@0.9.10
## 0.0.24
### Patch Changes
- Updated dependencies [8eb9247]
- jazz-tools@0.9.9
- jazz-react@0.9.9
## 0.0.23
### Patch Changes

View File

@@ -2,30 +2,60 @@
A minimal example showing how to use Jazz's built-in version history to show and restore changes.
## Installing & running the example locally
## Getting started
(This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation))
You can either
1. Clone the jazz repository, and run the app within the monorepo.
2. Or create a new Jazz project using this example as a template.
Start by downloading the [jazz repository](https://github.com/garden-co/jazz):
### Using the example as a template
Create a new Jazz project, and use this example as a template.
```bash
npx degit gardencmp/jazz jazz
npm create jazz-app@latest --example version-history --project-name version-history
```
or
```bash
npx create-jazz-app@latest --example version-history --project-name version-history
```
Go to the version-history example directory:
Go to the new project directory.
```bash
cd jazz/examples/version-history
cd version-history
```
Install and build dependencies:
Run the dev server.
```bash
npm run dev
```
### Using the monorepo
This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation).
Clone the jazz repository.
```bash
git clone https://github.com/garden-co/jazz.git
```
Install and build dependencies.
```bash
pnpm i && npx turbo build
```
Start the dev server:
Go to the example directory.
```bash
cd jazz/examples/version-history/
```
Start the dev server.
```bash
pnpm dev
```
Open [http://localhost:5173](http://localhost:5173) with your browser to see the result.
## Questions / problems / feedback
If you have feedback, let us know on [Discord](https://discord.gg/utDMjHYg42) or open an issue or PR to fix something that seems wrong.

View File

@@ -1,7 +1,7 @@
{
"name": "version-history",
"private": true,
"version": "0.0.23",
"version": "0.0.27",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -61,14 +61,6 @@ const team: Array<TeamMember> = [
location: "Portsmouth, UK ",
github: "bensleveritt",
},
{
name: "Marina Orlova",
titles: ["Full-Stack Dev"],
location: "Tarragona, Spain ",
linkedin: "marina-orlova-52a34394",
github: "marinoska",
image: "marina.jpeg",
},
{
name: "Giordano Ricci",
titles: ["Full-Stack Dev", "DevOps"],

View File

@@ -240,24 +240,77 @@ In the demos, you'll find details on:
### Working with Images
To work with images in Jazz, import the `createImage` function from [`jazz-react-native-media-images`](https://github.com/garden-co/jazz/tree/main/packages/jazz-react-native-media-images).
Jazz provides a complete solution for handling images in React Native, including uploading, processing, and displaying them. Here's how to work with images:
#### Uploading Images
To upload images, use the `createImage` function from `jazz-react-native-media-images`. This function handles image processing and creates an `ImageDefinition` that can be stored in your Jazz covalues:
<CodeGroup>
```tsx
import { createImage } from "jazz-react-native-media-images";
import * as ImagePicker from 'expo-image-picker';
const base64ImageDataURI = "data:image/png;base64,...";
// Example: Image upload from device library
const handleImageUpload = async () => {
try {
const result = await ImagePicker.launchImageLibraryAsync({
mediaTypes: ImagePicker.MediaTypeOptions.Images,
base64: true, // Important: We need base64 data
quality: 0.7,
});
const image = await createImage(base64ImageDataURI, {
owner: newPetPost._owner,
maxSize: 2048, // optional: specify maximum image size
});
if (!result.canceled && result.assets[0].base64) {
const base64Uri = `data:image/jpeg;base64,${result.assets[0].base64}`;
someCovalue.image = image;
const image = await createImage(base64Uri, {
owner: someCovalue._owner, // Set appropriate owner
maxSize: 2048, // Optional: limit maximum image size
});
// Store the image in your covalue
someCovalue.image = image;
}
} catch (error) {
console.error('Failed to upload image:', error);
}
};
```
</CodeGroup>
For a complete implementation, please refer to [this](https://github.com/garden-co/jazz/blob/main/examples/pets/src/3_NewPetPostForm.tsx) demo.
#### Displaying Images
To display images, use the `ProgressiveImg` component from `jazz-react-native`. This component handles both images uploaded from React Native and desktop browsers:
<CodeGroup>
```tsx
import { ProgressiveImg } from "jazz-react-native";
import { Image } from "react-native";
// Inside your render function:
<ProgressiveImg image={someCovalue.image} maxWidth={1024}>
{({ src, res, originalSize }) => (
<Image
source={{ uri: src }}
style={{
width: 300, // Adjust size as needed
height: 300,
borderRadius: 8,
}}
resizeMode="cover"
/>
)}
</ProgressiveImg>
```
</CodeGroup>
The `ProgressiveImg` component:
- Automatically handles different image formats
- Provides progressive loading with placeholder images
- Supports different resolutions based on the `maxWidth` prop
- Works seamlessly with React Native's `Image` component
For a complete implementation example, see the [Chat Example](https://github.com/garden-co/jazz/blob/main/examples/chat-rn-clerk/app/chat/[chatId].tsx).
### Running your app

View File

@@ -0,0 +1,74 @@
import { ContentByFramework, CodeGroup } from '@/components/forMdx'
export const metadata = { title: "Upgrade to Jazz 0.9.0" };
# Jazz 0.9.8 - Without me!
<h2 className="not-prose text-sm text-stone-600 dark:text-stone-400 mb-5 pb-2 border-b">
14 January 2025
</h2>
<div>
We have simplified the API to make the "me" value always optional!
This removes the need of using `useAccount` like the 90% of the time!
</div>
<CodeGroup>
{/* prettier-ignore */}
```ts
import { useState } from "react";
import { Issue } from "./schema";
import { IssueComponent } from "./components/Issue.tsx";
function App() {
const [issue, setIssue] = useState<Issue>();
const createIssue = () => {
setIssue(Issue.create(
{
title: "Buy terrarium",
description: "Make sure it's big enough for 10 snails.",
estimate: 5,
status: "backlog",
}, // The owner defaults now to a group managed by the current user!
));
};
if (issue) {
return <IssueComponent issue={issue} />;
} else {
return <button onClick={createIssue}>Create Issue</button>;
}
}
```
</CodeGroup>
<div>
This also applies to the load API:
</div>
<CodeGroup>
{/* prettier-ignore */}
```ts
const issue = Issue.load(issueId, {})
```
</CodeGroup>
<div>
And `Group.create`:
</div>
<CodeGroup>
{/* prettier-ignore */}
```tsx
const group = Group.create()
const sharedIssue = Issue.create(payload, group)
group.addMember('everyone', 'reader')
```
</CodeGroup>
<div>
Everything is backward compatible, so no upgrade steps are required.
With this Jazz API becomes way more lean and more is coming!
</div>

View File

@@ -7,9 +7,18 @@ The Jazz docs are currently heavily work in progress, sorry about that!
## Quickstart
Run the following command to create a new Jazz project from one of our example apps:
<CodeGroup>
```sh
npx create-jazz-app
npm create jazz-app@latest
```
</CodeGroup>
or
<CodeGroup>
```sh
npx create-jazz-app@latest
```
</CodeGroup>

View File

@@ -13,7 +13,9 @@ export function DocNav({ className }: { className?: string }) {
return {
...headerItem,
items: headerItem.items
.filter((item) => !item.framework || item.framework === framework)
.filter(
(item) => !("framework" in item) || item.framework === framework,
)
.map((item) => {
if (!item.href?.startsWith("/docs")) return item;

View File

@@ -3,12 +3,11 @@ import { Application } from "typedoc";
for (const { packageName, entryPoint, tsconfig, typedocOptions } of [
{
packageName: "jazz-tools",
entryPoint: "index.web.ts",
tsconfig: "tsconfig.web.json",
entryPoint: "exports.ts",
},
{
packageName: "jazz-react",
entryPoint: "index.tsx",
entryPoint: "index.ts",
typedocOptions: {
skipErrorChecking: true, // TODO: remove this. Temporary workaround
},

View File

@@ -50,16 +50,27 @@ export const docNavigationItems = [
href: "/docs/project-setup/server-side",
done: 80,
},
],
},
{
name: "Updates",
items: [
{
// upgrade guides
name: "Enable local persistence",
name: "Jazz 0.9.8 - Without me!",
href: "/docs/upgrade/0-9-8",
done: 100,
},
{
// upgrade guides
name: "Jazz 0.9.2 - Local persistence on React Native",
href: "/docs/upgrade/react-native-local-persistence",
done: 100,
framework: "react-native",
},
{
// upgrade guides
name: "Upgrade to Jazz 0.9.0",
name: "Jazz 0.9.0 - Upgrade guide",
href: "/docs/upgrade/0-9-0",
done: 100,
},

View File

@@ -1,5 +1,38 @@
# cojson-storage-indexeddb
## 0.9.12
### Patch Changes
- Updated dependencies [15d4b2a]
- cojson-storage@0.9.12
- cojson@0.9.12
## 0.9.11
### Patch Changes
- Updated dependencies [efbf3d8]
- Updated dependencies [5863bad]
- cojson@0.9.11
- cojson-storage@0.9.11
## 0.9.10
### Patch Changes
- Updated dependencies [4aa377d]
- cojson@0.9.10
- cojson-storage@0.9.10
## 0.9.9
### Patch Changes
- Updated dependencies [8eb9247]
- cojson@0.9.9
- cojson-storage@0.9.9
## 0.9.0
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "cojson-storage-indexeddb",
"version": "0.9.0",
"version": "0.9.12",
"main": "dist/index.js",
"type": "module",
"types": "src/index.ts",

View File

@@ -1,5 +1,38 @@
# cojson-storage-sqlite
## 0.8.55
### Patch Changes
- Updated dependencies [15d4b2a]
- cojson-storage@0.9.12
- cojson@0.9.12
## 0.8.54
### Patch Changes
- Updated dependencies [efbf3d8]
- Updated dependencies [5863bad]
- cojson@0.9.11
- cojson-storage@0.9.11
## 0.8.53
### Patch Changes
- Updated dependencies [4aa377d]
- cojson@0.9.10
- cojson-storage@0.9.10
## 0.8.52
### Patch Changes
- Updated dependencies [8eb9247]
- cojson@0.9.9
- cojson-storage@0.9.9
## 0.8.51
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "cojson-storage-rn-sqlite",
"type": "module",
"version": "0.8.51",
"version": "0.8.55",
"main": "dist/index.js",
"types": "src/index.ts",
"license": "MIT",

View File

@@ -1,5 +1,40 @@
# cojson-storage-sqlite
## 0.9.12
### Patch Changes
- 15d4b2a: Revert the custom logger
- Updated dependencies [15d4b2a]
- cojson-storage@0.9.12
- cojson@0.9.12
## 0.9.11
### Patch Changes
- 5863bad: Wrap all the console logs with a logger class to make possible to customize the logger
- Updated dependencies [efbf3d8]
- Updated dependencies [5863bad]
- cojson@0.9.11
- cojson-storage@0.9.11
## 0.9.10
### Patch Changes
- Updated dependencies [4aa377d]
- cojson@0.9.10
- cojson-storage@0.9.10
## 0.9.9
### Patch Changes
- Updated dependencies [8eb9247]
- cojson@0.9.9
- cojson-storage@0.9.9
## 0.9.0
### Patch Changes

View File

@@ -1,13 +1,13 @@
{
"name": "cojson-storage-sqlite",
"type": "module",
"version": "0.9.0",
"version": "0.9.12",
"main": "dist/index.js",
"types": "src/index.ts",
"license": "MIT",
"dependencies": {
"better-sqlite3": "^11.7.0",
"cojson": "workspace:0.9.0",
"cojson": "workspace:0.9.12",
"cojson-storage": "workspace:*"
},
"devDependencies": {

View File

@@ -1,5 +1,36 @@
# cojson-storage
## 0.9.12
### Patch Changes
- 15d4b2a: Revert the custom logger
- Updated dependencies [15d4b2a]
- cojson@0.9.12
## 0.9.11
### Patch Changes
- 5863bad: Wrap all the console logs with a logger class to make possible to customize the logger
- Updated dependencies [efbf3d8]
- Updated dependencies [5863bad]
- cojson@0.9.11
## 0.9.10
### Patch Changes
- Updated dependencies [4aa377d]
- cojson@0.9.10
## 0.9.9
### Patch Changes
- Updated dependencies [8eb9247]
- cojson@0.9.9
## 0.9.0
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "cojson-storage",
"version": "0.9.0",
"version": "0.9.12",
"main": "dist/index.js",
"type": "module",
"types": "src/index.ts",

View File

@@ -1,5 +1,36 @@
# cojson-transport-nodejs-ws
## 0.9.12
### Patch Changes
- 15d4b2a: Revert the custom logger
- Updated dependencies [15d4b2a]
- cojson@0.9.12
## 0.9.11
### Patch Changes
- 5863bad: Wrap all the console logs with a logger class to make possible to customize the logger
- Updated dependencies [efbf3d8]
- Updated dependencies [5863bad]
- cojson@0.9.11
## 0.9.10
### Patch Changes
- Updated dependencies [4aa377d]
- cojson@0.9.10
## 0.9.9
### Patch Changes
- Updated dependencies [8eb9247]
- cojson@0.9.9
## 0.9.0
### Patch Changes

View File

@@ -1,12 +1,12 @@
{
"name": "cojson-transport-ws",
"type": "module",
"version": "0.9.0",
"version": "0.9.12",
"main": "dist/index.js",
"types": "src/index.ts",
"license": "MIT",
"dependencies": {
"cojson": "workspace:0.9.0",
"cojson": "workspace:0.9.12",
"typescript": "~5.6.2"
},
"scripts": {

View File

@@ -1,5 +1,30 @@
# cojson
## 0.9.12
### Patch Changes
- 15d4b2a: Revert the custom logger
## 0.9.11
### Patch Changes
- efbf3d8: Optimize queue management
- 5863bad: Wrap all the console logs with a logger class to make possible to customize the logger
## 0.9.10
### Patch Changes
- 4aa377d: Handle unkown coValue content type and optimize content access
## 0.9.9
### Patch Changes
- 8eb9247: Add CoPlainText and CoRichText covalues
## 0.9.0
### Patch Changes

View File

@@ -24,7 +24,7 @@
},
"type": "module",
"license": "MIT",
"version": "0.9.0",
"version": "0.9.12",
"devDependencies": {
"@opentelemetry/sdk-metrics": "^1.29.0",
"@types/jest": "^29.5.3",

View File

@@ -92,7 +92,7 @@ export class PeerState {
this.processing = true;
let entry: QueueEntry | undefined;
let entry: QueueEntry<SyncMessage> | undefined;
while ((entry = this.queue.pull())) {
// Awaiting the push to send one message at a time
// This way when the peer is "under pressure" we can enqueue all
@@ -129,7 +129,7 @@ export class PeerState {
}
private closeQueue() {
let entry: QueueEntry | undefined;
let entry: QueueEntry<SyncMessage> | undefined;
while ((entry = this.queue.pull())) {
// Using resolve here to avoid unnecessary noise in the logs
entry.resolve();

View File

@@ -18,11 +18,12 @@ function promiseWithResolvers<R>() {
};
}
export type QueueEntry = {
msg: SyncMessage;
export type QueueEntry<V> = {
msg: V;
promise: Promise<void>;
resolve: () => void;
reject: (_: unknown) => void;
next: QueueEntry<V> | undefined;
};
/**
@@ -33,10 +34,68 @@ type Tuple<T, N extends number, A extends unknown[] = []> = A extends {
}
? A
: Tuple<T, N, [...A, T]>;
type QueueTuple = Tuple<QueueEntry[], 8>;
type QueueTuple = Tuple<Queue<SyncMessage>, 8>;
class Queue<V> {
head: QueueEntry<V> | undefined = undefined;
tail: QueueEntry<V> | undefined = undefined;
push(msg: V) {
const { promise, resolve, reject } = promiseWithResolvers<void>();
const entry: QueueEntry<V> = {
msg,
promise,
resolve,
reject,
next: undefined,
};
if (this.head === undefined) {
this.head = entry;
} else {
if (this.tail === undefined) {
throw new Error("Tail is null but head is not");
}
this.tail.next = entry;
}
this.tail = entry;
return entry;
}
pull() {
const entry = this.head;
if (entry) {
this.head = entry.next;
}
if (this.head === undefined) {
this.tail = undefined;
}
return entry;
}
isNonEmpty() {
return this.head !== undefined;
}
}
export class PriorityBasedMessageQueue {
private queues: QueueTuple = [[], [], [], [], [], [], [], []];
private queues: QueueTuple = [
new Queue(),
new Queue(),
new Queue(),
new Queue(),
new Queue(),
new Queue(),
new Queue(),
new Queue(),
];
queueSizeCounter = metrics
.getMeter("cojson")
.createUpDownCounter("jazz.messagequeue.size", {
@@ -52,22 +111,19 @@ export class PriorityBasedMessageQueue {
constructor(private defaultPriority: CoValuePriority) {}
public push(msg: SyncMessage) {
const { promise, resolve, reject } = promiseWithResolvers<void>();
const entry: QueueEntry = { msg, promise, resolve, reject };
const priority = "priority" in msg ? msg.priority : this.defaultPriority;
this.getQueue(priority).push(entry);
const entry = this.getQueue(priority).push(msg);
this.queueSizeCounter.add(1, {
priority,
});
return promise;
return entry.promise;
}
public pull() {
const priority = this.queues.findIndex((queue) => queue.length > 0);
const priority = this.queues.findIndex((queue) => queue.isNonEmpty());
if (priority === -1) {
return;
@@ -77,6 +133,6 @@ export class PriorityBasedMessageQueue {
priority,
});
return this.queues[priority]?.shift();
return this.queues[priority]?.pull();
}
}

View File

@@ -35,12 +35,50 @@ export interface RawCoValue {
subscribe(listener: (coValue: this) => void): () => void;
}
export class RawUnknownCoValue implements RawCoValue {
id: CoID<this>;
core: CoValueCore;
constructor(core: CoValueCore) {
this.id = core.id as CoID<this>;
this.core = core;
}
get type() {
return this.core.header.type;
}
get headerMeta() {
return this.core.header.meta as JsonObject;
}
/** @category 6. Meta */
get group(): RawGroup {
return this.core.getGroup();
}
toJSON() {
return {};
}
atTime() {
return this;
}
subscribe(listener: (value: this) => void): () => void {
return this.core.subscribe((content) => {
listener(content as this);
});
}
}
export type AnyRawCoValue =
| RawCoMap
| RawGroup
| RawAccount
| Profile
| RawCoList
| RawCoPlainText
| RawCoStream
| RawBinaryCoStream;

View File

@@ -126,10 +126,7 @@ export class CoValueCore {
.expectCoValueLoaded(header.ruleset.group)
.subscribe((_groupUpdate) => {
this._cachedContent = undefined;
const newContent = this.getCurrentContent();
for (const listener of this.listeners) {
listener(newContent);
}
this.notifyUpdate("immediate");
});
}
}
@@ -244,11 +241,6 @@ export class CoValueCore {
signerID,
} satisfies InvalidSignatureError);
}
// const afterVerify = performance.now();
// console.log(
// "Verify took",
// afterVerify - beforeVerify
// );
this.doAddTransactions(
sessionID,
@@ -263,138 +255,6 @@ export class CoValueCore {
});
}
/*tryAddTransactionsAsync(
sessionID: SessionID,
newTransactions: Transaction[],
givenExpectedNewHash: Hash | undefined,
newSignature: Signature,
): ResultAsync<true, TryAddTransactionsError> {
const currentAsyncAddTransaction = this._currentAsyncAddTransaction;
let maybeAwaitPrevious:
| ResultAsync<void, TryAddTransactionsError>
| undefined;
let thisDone = () => {};
if (currentAsyncAddTransaction) {
// eslint-disable-next-line neverthrow/must-use-result
maybeAwaitPrevious = ResultAsync.fromSafePromise(
currentAsyncAddTransaction,
);
} else {
// eslint-disable-next-line neverthrow/must-use-result
maybeAwaitPrevious = ResultAsync.fromSafePromise(Promise.resolve());
this._currentAsyncAddTransaction = new Promise((resolve) => {
thisDone = resolve;
});
}
return maybeAwaitPrevious
.andThen((_previousDone) =>
this.node
.resolveAccountAgentAsync(
accountOrAgentIDfromSessionID(sessionID),
"Expected to know signer of transaction",
)
.andThen((agent) => {
const signerID = this.crypto.getAgentSignerID(agent);
const nTxBefore =
this.sessionLogs.get(sessionID)?.transactions
.length ?? 0;
// const beforeHash = performance.now();
return ResultAsync.fromSafePromise(
this.expectedNewHashAfterAsync(
sessionID,
newTransactions,
),
).andThen(({ expectedNewHash, newStreamingHash }) => {
// const afterHash = performance.now();
// console.log(
// "Hashing took",
// afterHash - beforeHash
// );
const nTxAfter =
this.sessionLogs.get(sessionID)?.transactions
.length ?? 0;
if (nTxAfter !== nTxBefore) {
const newTransactionLengthBefore =
newTransactions.length;
newTransactions = newTransactions.slice(
nTxAfter - nTxBefore,
);
console.warn(
"Transactions changed while async hashing",
{
nTxBefore,
nTxAfter,
newTransactionLengthBefore,
remainingNewTransactions:
newTransactions.length,
},
);
}
if (
givenExpectedNewHash &&
givenExpectedNewHash !== expectedNewHash
) {
return err({
type: "InvalidHash",
id: this.id,
expectedNewHash,
givenExpectedNewHash,
} satisfies InvalidHashError);
}
performance.mark("verifyStart" + this.id);
if (
!this.crypto.verify(
newSignature,
expectedNewHash,
signerID,
)
) {
return err({
type: "InvalidSignature",
id: this.id,
newSignature,
sessionID,
signerID,
} satisfies InvalidSignatureError);
}
performance.mark("verifyEnd" + this.id);
performance.measure(
"verify" + this.id,
"verifyStart" + this.id,
"verifyEnd" + this.id,
);
this.doAddTransactions(
sessionID,
newTransactions,
newSignature,
expectedNewHash,
newStreamingHash,
"deferred",
);
return ok(true as const);
});
}),
)
.map((trueResult) => {
thisDone();
return trueResult;
})
.mapErr((err) => {
thisDone();
return err;
});
}*/
private doAddTransactions(
sessionID: SessionID,
newTransactions: Transaction[],
@@ -432,12 +292,6 @@ export class CoValueCore {
);
if (sizeOfTxsSinceLastInbetweenSignature > MAX_RECOMMENDED_TX_SIZE) {
// console.log(
// "Saving inbetween signature for tx ",
// sessionID,
// transactions.length - 1,
// sizeOfTxsSinceLastInbetweenSignature
// );
signatureAfter[transactions.length - 1] = newSignature;
}
@@ -463,34 +317,40 @@ export class CoValueCore {
this._cachedDependentOn = undefined;
this._cachedNewContentSinceEmpty = undefined;
if (this.listeners.size > 0) {
if (notifyMode === "immediate") {
const content = this.getCurrentContent();
for (const listener of this.listeners) {
listener(content);
}
} else {
if (!this.nextDeferredNotify) {
this.nextDeferredNotify = new Promise((resolve) => {
setTimeout(() => {
this.nextDeferredNotify = undefined;
this.deferredUpdates = 0;
const content = this.getCurrentContent();
for (const listener of this.listeners) {
listener(content);
}
resolve();
}, 0);
});
}
this.deferredUpdates++;
}
}
this.notifyUpdate(notifyMode);
}
deferredUpdates = 0;
nextDeferredNotify: Promise<void> | undefined;
notifyUpdate(notifyMode: "immediate" | "deferred") {
if (this.listeners.size === 0) {
return;
}
if (notifyMode === "immediate") {
const content = this.getCurrentContent();
for (const listener of this.listeners) {
listener(content);
}
} else {
if (!this.nextDeferredNotify) {
this.nextDeferredNotify = new Promise((resolve) => {
setTimeout(() => {
this.nextDeferredNotify = undefined;
this.deferredUpdates = 0;
const content = this.getCurrentContent();
for (const listener of this.listeners) {
listener(content);
}
resolve();
}, 0);
});
}
this.deferredUpdates++;
}
}
subscribe(listener: (content?: RawCoValue) => void): () => void {
this.listeners.add(listener);
listener(this.getCurrentContent());

View File

@@ -1,11 +1,6 @@
import { CoValueCore } from "../coValueCore.js";
import { JsonObject } from "../jsonValue.js";
import {
DeletionOpPayload,
InsertionOpPayload,
OpID,
RawCoList,
} from "./coList.js";
import { DeletionOpPayload, OpID, RawCoList } from "./coList.js";
export type StringifiedOpID = string & { __stringifiedOpID: true };
@@ -88,33 +83,22 @@ export class RawCoPlainText<
text: string,
privacy: "private" | "trusting" = "private",
) {
const ops: InsertionOpPayload<string>[] = [];
let prevOpId: OpID | "start" | undefined = this.mapping.opIDbeforeIdx[idx];
if (!prevOpId) {
if (idx === 0) {
prevOpId = "start";
} else {
throw new Error("Invalid idx");
const graphemes = [...this._segmenter.segment(text)].map((g) => g.segment);
if (idx === 0) {
// For insertions at start, just prepend each character, in reverse
for (const grapheme of graphemes.reverse()) {
this.prepend(grapheme, 0, privacy);
}
} else {
// For other insertions, use append after the specified index
// We append in forward order to maintain the text order
let after = idx - 1;
for (const grapheme of graphemes) {
this.append(grapheme, after, privacy);
after++; // Move the insertion point forward for each grapheme
}
}
const nextTxId = this.core.nextTransactionID();
let changeIdx = 0;
for (const grapheme of this._segmenter.segment(text)) {
ops.push({
op: "app",
value: grapheme.segment,
after: prevOpId,
});
prevOpId = {
sessionID: nextTxId.sessionID,
txIndex: nextTxId.txIndex,
changeIdx,
};
changeIdx++;
}
this.core.makeTransaction(ops, privacy);
this.rebuildFromCore();
}
deleteRange(
@@ -131,7 +115,6 @@ export class RawCoPlainText<
op: "del",
insertion,
});
console.log("deleting idx", idx);
let nextIdx = idx + 1;
while (!this.mapping.opIDbeforeIdx[nextIdx] && nextIdx < to) {
nextIdx++;

View File

@@ -701,8 +701,8 @@ export class RawGroup<
}
/**
* Creates a new `CoList` within this group, with the specified specialized
* `CoList` type `L` and optional static metadata.
* Creates a new `CoPlainText` within this group, with the specified specialized
* `CoPlainText` type `T` and optional static metadata.
*
* @category 3. Value creation
*/

View File

@@ -1,3 +1,4 @@
import { RawUnknownCoValue } from "./coValue.js";
import type { CoValueCore } from "./coValueCore.js";
import { RawAccount, RawControlledAccount } from "./coValues/account.js";
import { RawCoList } from "./coValues/coList.js";
@@ -38,6 +39,6 @@ export function coreToCoValue(
return new RawCoStream(core);
}
} else {
throw new Error(`Unknown coValue type ${core.header.type}`);
return new RawUnknownCoValue(core);
}
}

View File

@@ -22,7 +22,7 @@ describe("PriorityBasedMessageQueue", () => {
const { queue } = setup();
expect(queue["defaultPriority"]).toBe(CO_VALUE_PRIORITY.MEDIUM);
expect(queue["queues"].length).toBe(8);
expect(queue["queues"].every((q) => q.length === 0)).toBe(true);
expect(queue["queues"].every((q) => !q.isNonEmpty())).toBe(true);
});
test("should push message with default priority", async () => {

View File

@@ -132,3 +132,22 @@ test("init the list correctly", () => {
"hello",
]);
});
test("Items prepended to start appear with latest first", () => {
const node = new LocalNode(...randomAnonymousAccountAndSessionID(), Crypto);
const coValue = node.createCoValue({
type: "colist",
ruleset: { type: "unsafeAllowAll" },
meta: null,
...Crypto.createdNowUnique(),
});
const content = expectList(coValue.getCurrentContent());
content.prepend("first", 0, "trusting");
content.prepend("second", 0, "trusting");
content.prepend("third", 0, "trusting");
expect(content.toJSON()).toEqual(["third", "second", "first"]);
});

View File

@@ -74,14 +74,60 @@ test("Can insert and delete in CoPlainText", () => {
content.insertAfter(5, " world", "trusting");
expect(content.toString()).toEqual("hello world");
content.insertAfter(0, "Hello, ", "trusting");
expect(content.toString()).toEqual("Hello, hello world");
console.log("first delete");
content.deleteRange({ from: 3, to: 8 }, "trusting");
expect(content.toString()).toEqual("helrld");
content.deleteRange({ from: 6, to: 12 }, "trusting");
expect(content.toString()).toEqual("Hello, world");
content.insertAfter(2, "😍", "trusting");
expect(content.toString()).toEqual("he😍lrld");
expect(content.toString()).toEqual("He😍llo, world");
console.log("second delete");
content.deleteRange({ from: 2, to: 4 }, "trusting");
expect(content.toString()).toEqual("helrld");
expect(content.toString()).toEqual("Hello, world");
});
test("Multiple items appended after start appear in correct order", () => {
const node = new LocalNode(...randomAnonymousAccountAndSessionID(), Crypto);
const coValue = node.createCoValue({
type: "coplaintext",
ruleset: { type: "unsafeAllowAll" },
meta: null,
...Crypto.createdNowUnique(),
});
const content = expectPlainText(coValue.getCurrentContent());
// Add multiple items in a single transaction, all after start
content.insertAfter(0, "h", "trusting");
content.insertAfter(1, "e", "trusting");
content.insertAfter(2, "y", "trusting");
// They should appear in insertion order (hey), not reversed (yeh)
expect(content.toString()).toEqual("hey");
});
test("Items inserted at start appear with latest first", () => {
const node = new LocalNode(...randomAnonymousAccountAndSessionID(), Crypto);
const coValue = node.createCoValue({
type: "coplaintext",
ruleset: { type: "unsafeAllowAll" },
meta: null,
...Crypto.createdNowUnique(),
});
const content = expectPlainText(coValue.getCurrentContent());
// Insert multiple items at the start
content.insertAfter(0, "first", "trusting");
content.insertAfter(0, "second", "trusting");
content.insertAfter(0, "third", "trusting");
// They should appear in reverse chronological order
// because newer items should appear before older items
expect(content.toString()).toEqual("thirdsecondfirst");
});

View File

@@ -1,11 +1,14 @@
import { expect, test, vi } from "vitest";
import { Transaction } from "../coValueCore.js";
import { CoValueCore, Transaction } from "../coValueCore.js";
import { MapOpPayload } from "../coValues/coMap.js";
import { WasmCrypto } from "../crypto/WasmCrypto.js";
import { stableStringify } from "../jsonStringify.js";
import { LocalNode } from "../localNode.js";
import { Role } from "../permissions.js";
import { randomAnonymousAccountAndSessionID } from "./testUtils.js";
import {
createTestNode,
randomAnonymousAccountAndSessionID,
} from "./testUtils.js";
const Crypto = await WasmCrypto.create();
@@ -191,3 +194,30 @@ test("New transactions in a group correctly update owned values, including subsc
expect(map.core.getValidSortedTransactions().length).toBe(0);
});
test("creating a coValue with a group should't trigger automatically a content creation (performance)", () => {
const node = createTestNode();
const group = node.createGroup();
const getCurrentContentSpy = vi.spyOn(
CoValueCore.prototype,
"getCurrentContent",
);
const groupSpy = vi.spyOn(group.core, "getCurrentContent");
getCurrentContentSpy.mockClear();
node.createCoValue({
type: "comap",
ruleset: { type: "ownedByGroup", group: group.id },
meta: null,
...Crypto.createdNowUnique(),
});
// It's called once for the group and never for the coValue
expect(getCurrentContentSpy).toHaveBeenCalledTimes(1);
expect(groupSpy).toHaveBeenCalledTimes(1);
getCurrentContentSpy.mockRestore();
});

View File

@@ -12,8 +12,10 @@ import { connectedPeers, newQueuePair } from "../streamUtils.js";
import type { SyncMessage } from "../sync.js";
import {
blockMessageTypeOnOutgoingPeer,
connectTwoPeers,
createTestMetricReader,
createTestNode,
loadCoValueOrFail,
randomAnonymousAccountAndSessionID,
tearDownTestMetricReader,
waitFor,
@@ -1645,6 +1647,28 @@ function createTwoConnectedNodes() {
};
}
test("a value created on one node can be loaded on anotehr node even if not directly connected", async () => {
const userA = createTestNode();
const userB = createTestNode();
const serverA = createTestNode();
const serverB = createTestNode();
const core = createTestNode();
connectTwoPeers(userA, serverA, "client", "server");
connectTwoPeers(userB, serverB, "client", "server");
connectTwoPeers(serverA, core, "client", "server");
connectTwoPeers(serverB, core, "client", "server");
const group = userA.createGroup();
const map = group.createMap();
map.set("key1", "value1", "trusting");
await map.core.waitForSync();
const mapOnUserB = await loadCoValueOrFail(userB, map.id);
expect(mapOnUserB.get("key1")).toBe("value1");
});
describe("SyncManager - knownStates vs optimisticKnownStates", () => {
test("knownStates and optimisticKnownStates are the same when the coValue is fully synced", async () => {
const { client, jazzCloud } = createTwoConnectedNodes();
@@ -1961,6 +1985,25 @@ describe("waitForSyncWithPeer", () => {
});
});
test("Should not crash when syncing an unknown coValue type", async () => {
const { client, jazzCloud } = createTwoConnectedNodes();
const coValue = client.createCoValue({
type: "ooops" as any,
ruleset: { type: "unsafeAllowAll" },
meta: null,
...Crypto.createdNowUnique(),
});
await coValue.waitForSync();
const coValueOnTheOtherNode = await loadCoValueOrFail(
jazzCloud,
coValue.getCurrentContent().id,
);
expect(coValueOnTheOtherNode.id).toBe(coValue.id);
});
describe("metrics", () => {
afterEach(() => {
tearDownTestMetricReader();

View File

@@ -33,6 +33,25 @@ export function createTestNode() {
return new LocalNode(admin, session, Crypto);
}
export function connectTwoPeers(
a: LocalNode,
b: LocalNode,
aRole: "client" | "server",
bRole: "client" | "server",
) {
const [aAsPeer, bAsPeer] = connectedPeers(
"peer:" + a.account.id,
"peer:" + b.account.id,
{
peer1role: aRole,
peer2role: bRole,
},
);
a.syncManager.addPeer(bAsPeer);
b.syncManager.addPeer(aAsPeer);
}
export async function createTwoConnectedNodes(
node1Role: Peer["role"],
node2Role: Peer["role"],

View File

@@ -1,5 +1,11 @@
# create-jazz-app
## 0.1.7
### Patch Changes
- 3a9797c: Add example param to create-jazz-app
## 0.1.6
### Patch Changes

View File

@@ -14,7 +14,7 @@
You can create a new Jazz app in two ways:
### Interactive Mode
### Interactive mode
Simply run:
@@ -33,7 +33,7 @@ Then follow the interactive prompts to select your:
- Package manager
- Project name
### Command Line Mode
### Command line mode
Or specify all options directly:
@@ -41,7 +41,18 @@ Or specify all options directly:
npm create jazz-app@latest -- --starter react-demo-auth --project-name my-app --package-manager npm
```
## Available Starters
### Start with an example app
You can use any of our example apps as a template for your own app, instead of choosing one of the starters.
Use the `--example` parameter, and pass
the directory name of the example app found [here](https://github.com/garden-co/jazz/tree/main/examples).
```bash
npm create jazz-app@latest --example chat
```
## Available starters
Currently implemented starters:
@@ -55,12 +66,12 @@ Currently implemented starters:
More starters coming soon! Check the help menu (`create-jazz-app --help`) for the latest list.
## System Requirements
## System requirements
- Node.js 14.0.0 or later
- Package manager of your choice (npm, yarn, pnpm, bun, or deno)
## What Happens When You Run It?
## What happens when you run it?
1. 🎭 Prompts for your preferences (or uses command line arguments)
2. 📥 Clones the appropriate starter template

View File

@@ -5,7 +5,7 @@
"types": "src/index.ts",
"type": "module",
"license": "MIT",
"version": "0.1.6",
"version": "0.1.7",
"bin": {
"create-jazz-app": "./dist/index.js"
},

View File

@@ -15,10 +15,19 @@ const program = new Command();
const jazzGradient = gradient(["#FF4D4D", "#FF9900", "#FFD700"]);
type PackageManager = "npm" | "yarn" | "pnpm" | "bun" | "deno";
type ScaffoldOptions = {
starter: FrameworkAuthPair;
template: FrameworkAuthPair | string;
projectName: string;
packageManager: "npm" | "yarn" | "pnpm" | "bun" | "deno";
packageManager: PackageManager;
};
type PromptOptions = {
starter?: FrameworkAuthPair;
example?: string;
projectName?: string;
packageManager?: PackageManager;
};
async function getLatestPackageVersions(
@@ -66,18 +75,21 @@ async function getLatestPackageVersions(
}
async function scaffoldProject({
starter,
template,
projectName,
packageManager,
}: ScaffoldOptions): Promise<void> {
console.log("\n" + jazzGradient.multiline("Jazz App Creator\n"));
const starterConfig = frameworkToAuthExamples[starter];
const starterConfig = frameworkToAuthExamples[
template as FrameworkAuthPair
] || { name: template, repo: "garden-co/jazz/examples/" + template };
if (!starterConfig) {
throw new Error(`Invalid starter: ${starter}`);
throw new Error(`Invalid template: ${template}`);
}
const devCommand = starter === "react-native-expo-clerk-auth" ? "ios" : "dev";
const devCommand =
template === "react-native-expo-clerk-auth" ? "ios" : "dev";
if (!starterConfig.repo) {
throw new Error(
@@ -87,7 +99,7 @@ async function scaffoldProject({
// Step 2: Clone starter
const cloneSpinner = ora({
text: chalk.blue(`Cloning starter: ${chalk.bold(starterConfig.name)}`),
text: chalk.blue(`Cloning template: ${chalk.bold(starterConfig.name)}`),
spinner: "dots",
}).start();
@@ -154,7 +166,7 @@ async function scaffoldProject({
}
// Additional setup for React Native
if (starter === "react-native-expo-clerk-auth") {
if (template === "react-native-expo-clerk-auth") {
const rnSpinner = ora({
text: chalk.blue("Setting up React Native project..."),
spinner: "dots",
@@ -194,12 +206,20 @@ module.exports = withNativeWind(config, { input: "./src/global.css" });
);
}
async function promptUser(): Promise<ScaffoldOptions> {
async function promptUser(
partialOptions: PromptOptions,
): Promise<ScaffoldOptions> {
console.log("\n" + jazzGradient.multiline("Jazz App Creator\n"));
console.log(chalk.blue.bold("Let's create your Jazz app! 🎷\n"));
const answers = (await inquirer.prompt([
{
const questions = [];
if (partialOptions.starter && partialOptions.example) {
throw new Error("Please specify either a starter or an example, not both.");
}
if (!partialOptions.example && !partialOptions.starter) {
questions.push({
type: "list",
name: "starter",
message: chalk.cyan("Choose a starter:"),
@@ -209,8 +229,11 @@ async function promptUser(): Promise<ScaffoldOptions> {
name: chalk.white(value.name),
value: key,
})),
},
{
});
}
if (!partialOptions.packageManager) {
questions.push({
type: "list",
name: "packageManager",
message: chalk.cyan("Choose a package manager:"),
@@ -222,26 +245,33 @@ async function promptUser(): Promise<ScaffoldOptions> {
{ name: chalk.white("deno"), value: "deno" },
],
default: "npm",
},
{
});
}
if (!partialOptions.projectName) {
questions.push({
type: "input",
name: "projectName",
message: chalk.cyan("Enter your project name:"),
validate: (input: string) =>
input ? true : chalk.red("Project name cannot be empty"),
},
])) as ScaffoldOptions;
});
}
return answers;
const answers = await inquirer.prompt(questions);
return {
...answers,
...partialOptions,
template: partialOptions.starter || partialOptions.example,
} as ScaffoldOptions;
}
function validateOptions(
options: Partial<ScaffoldOptions>,
): options is ScaffoldOptions {
function validateOptions(options: PromptOptions): options is ScaffoldOptions {
const errors: string[] = [];
if (!options.starter) {
errors.push("Starter template is required");
if (!options.starter && !options.example) {
errors.push("Starter or example template is required");
}
if (!options.projectName) {
errors.push("Project name is required");
@@ -271,6 +301,7 @@ function validateOptions(
program
.description(chalk.blue("CLI to generate Jazz starter projects"))
.option("-s, --starter <starter>", chalk.cyan("Starter template to use"))
.option("-e, --example <name>", chalk.cyan("Example project to use"))
.option("-n, --project-name <name>", chalk.cyan("Name of the project"))
.option(
"-p, --package-manager <manager>",
@@ -278,23 +309,30 @@ program
)
.action(async (options) => {
try {
// If all required options are provided, use them directly
if (options.starter && options.projectName && options.packageManager) {
const nonInteractiveOptions = {
starter: options.starter as FrameworkAuthPair,
projectName: options.projectName,
packageManager:
options.packageManager as ScaffoldOptions["packageManager"],
};
const partialOptions: PromptOptions = {};
// Validate will throw if invalid
validateOptions(nonInteractiveOptions);
await scaffoldProject(nonInteractiveOptions);
} else {
// Otherwise, fall back to interactive mode
const scaffoldOptions = await promptUser();
await scaffoldProject(scaffoldOptions);
if (options.starter && options.example) {
throw new Error(
chalk.red(
"Cannot specify both starter and example. Please choose one.",
),
);
}
if (options.starter)
partialOptions.starter = options.starter as FrameworkAuthPair;
if (options.example) partialOptions.example = options.example;
if (options.projectName) partialOptions.projectName = options.projectName;
if (options.packageManager)
partialOptions.packageManager =
options.packageManager as ScaffoldOptions["packageManager"];
// Get missing options through prompts
const scaffoldOptions = await promptUser(partialOptions);
// Validate will throw if invalid
validateOptions(scaffoldOptions);
await scaffoldProject(scaffoldOptions);
} catch (error: any) {
if (error instanceof Error && error.name === "ExitPromptError") {
console.log(chalk.yellow("\n👋 Until next time!\n"));

View File

@@ -1,5 +1,44 @@
# jazz-browser-media-images
## 0.9.12
### Patch Changes
- Updated dependencies [15d4b2a]
- cojson@0.9.12
- jazz-browser@0.9.12
- jazz-tools@0.9.12
## 0.9.11
### Patch Changes
- Updated dependencies [efbf3d8]
- Updated dependencies [5863bad]
- cojson@0.9.11
- jazz-browser@0.9.11
- jazz-tools@0.9.11
## 0.9.10
### Patch Changes
- Updated dependencies [4aa377d]
- Updated dependencies [5e83864]
- cojson@0.9.10
- jazz-tools@0.9.10
- jazz-browser@0.9.10
## 0.9.9
### Patch Changes
- Updated dependencies [8eb9247]
- Updated dependencies [8eb9247]
- jazz-tools@0.9.9
- cojson@0.9.9
- jazz-browser@0.9.9
## 0.9.8
### Patch Changes

View File

@@ -1,14 +1,14 @@
{
"name": "jazz-browser-auth-clerk",
"version": "0.9.8",
"version": "0.9.12",
"type": "module",
"main": "dist/index.js",
"types": "src/index.ts",
"license": "MIT",
"dependencies": {
"cojson": "workspace:0.9.0",
"jazz-browser": "workspace:0.9.8",
"jazz-tools": "workspace:0.9.8"
"cojson": "workspace:0.9.12",
"jazz-browser": "workspace:0.9.12",
"jazz-tools": "workspace:0.9.12"
},
"scripts": {
"format-and-lint": "biome check .",

View File

@@ -1,5 +1,35 @@
# jazz-browser-media-images
## 0.9.12
### Patch Changes
- jazz-browser@0.9.12
- jazz-tools@0.9.12
## 0.9.11
### Patch Changes
- jazz-browser@0.9.11
- jazz-tools@0.9.11
## 0.9.10
### Patch Changes
- Updated dependencies [5e83864]
- jazz-tools@0.9.10
- jazz-browser@0.9.10
## 0.9.9
### Patch Changes
- Updated dependencies [8eb9247]
- jazz-tools@0.9.9
- jazz-browser@0.9.9
## 0.9.8
### Patch Changes

Some files were not shown because too many files have changed in this diff Show More