Skip to content

Commit

Permalink
docs: add code titles to code blocks to emphasize Synco reqs
Browse files Browse the repository at this point in the history
Co-authored-by: Alex Sklar <[email protected]>
Co-authored-by: Erik Margetis <[email protected]>
  • Loading branch information
3 people committed Apr 18, 2024
1 parent 2e7b93b commit fc66659
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion docs/core-concepts/mutators.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Because mutators are just high-level Javascript functions, the developer gains a

The function `increment` below is an example of a mutator:

```javascript
```js title="/src/mutators.js"
function increment(tx, { key, delta }) {
const prev = tx.get(key);
const next = (prev ?? 0) + delta;
Expand Down
2 changes: 1 addition & 1 deletion docs/core-concepts/rooms.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The primary unit of collaboration within a Syncosaurus application is the **room

In Syncosaurus, the room name is specified by passing it to the `launch` method of a `Syncosaurus` instance:

```js
```js title="/src/components/App.jsx"
import mutators from './mutators.js';

const synco = new Syncosaurus({
Expand Down
2 changes: 1 addition & 1 deletion docs/core-concepts/subscriptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ At the implementation level, a *subscription* is represented by the return value

Here is a simple implementation of a subscription and its query:

```javascript
```js
const count = useSubscribe(synco, (tx) => tx.get('count'), 0)
```

Expand Down
12 changes: 7 additions & 5 deletions docs/getting-started/add-to-existing-project.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ sidebar_position: 2

# Add to an Existing Project

To add Syncosaurus to an existing React-based project:
To add Syncosaurus to an existing React-based project, first navigate to the root directory of your application.
Then, run the following command in your terminal:

1. Navigate to the root directory of your application
2. Run the command `npx syncosaurus setup`
```shell
npx syncosaurus setup
```

That's it! Make sure to correctly configure your Syncosaurus application before deployment - see here for details.

Expand All @@ -17,7 +19,7 @@ Note that Syncosaurus currently only supports applications built with either Rea

A local development environment makes it significantly easier to rapidly iterate, test, and debug your application in a consistent, controlled setting. Syncosaurus comes built-in with a local Syncosaurus server.

If you added Syncosaurus to an existing project and are not using Vite as your build tool, run the same command with the `-b` or `-backendOnly` flag enabled:
If you have added Syncosaurus to an existing project and are not using Vite as your frontend build tool, run the same command with the `-backendOnly` or `-b` flag enabled:

```shell
npx syncosaurus dev -b
Expand All @@ -37,7 +39,7 @@ Press 'x' to gracefully shut down the server

Make sure to update your `server` value in your Syncosaurus constructor calls in your application code:

```javascript
```js title="/src/components/App.jsx"
import mutators from './mutators.js';

const synco = new Syncosaurus({
Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started/start-a-new-project.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Press 'x' to gracefully shut down both servers

Make sure to update your `server` value in your Syncosaurus constructor calls in your application code:

```javascript
```js title="/src/components/App.jsx"
import mutators from './mutators.js';

const synco = new Syncosaurus({
Expand Down
6 changes: 3 additions & 3 deletions docs/guides/authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The Syncosaurus framework supports token-based authentication. JSON web tokens a

To use a token, you can directly pass a *token string* to the `Syncosaurus` constructor as the `auth` key's value:

```js
```js title="/src/components/App.jsx"
import mutators from './mutators.js';

const synco = new Syncosaurus({
Expand All @@ -26,7 +26,7 @@ const synco = new Syncosaurus({

You can also pass an *asynchronous function* that returns a token string to the `Syncosaurus` constructor as the `auth` key's value:

```js
```js title="/src/components/App.jsx"
import mutators from './mutators.js';
import getToken from './auth-client.js';

Expand All @@ -43,7 +43,7 @@ const synco = new Syncosaurus({

Next, an `authHandler` function needs to be defined:

```js
```js title="/src/authHandler.js"
const authServerUrl = `https://www.myAuthServer.com`;

export default async function authHandler(token) {
Expand Down

0 comments on commit fc66659

Please sign in to comment.