Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Launch-Ready Strong Init #633

Merged
merged 13 commits into from
Dec 18, 2024
Merged

Launch-Ready Strong Init #633

merged 13 commits into from
Dec 18, 2024

Conversation

stopachka
Copy link
Contributor

@stopachka stopachka commented Dec 14, 2024

This gets strong init ready for prime time launch!

Try it out

Start by reading the docs, and follow the getting started examples:

https://instant-www-js-st1-jsv.vercel.app/docs

I went ahead and published an experimental version: 0.17.0-experimental.5. All the tutorials will include this tag :)

The PR

1. Update CLI, so init works without login

If the user wasn't logged in, npx instant-cli used to break. This led to a poor initial user experience.

I updated the command so if we aren't logged in, we prompt the user to log in and continue on.

CleanShot 2024-12-13 at 16 49 54@2x

2. Make init_experimental the default

I went ahead and all packages, so the strong init path is now the only path.

What this means for users

If a user was using normal init:

import { init } from '@instantdb/react'; 

const db = init({ appId })

Upgrading to 0.17.0 will be seamless. However, if they used to use a schema:

// Before
import { init } from '@instantdb/react'; 

type Schema = { ... } ;
const db = init<Schema>({ appId })

They'll need to do a one line change:

// After
import { init, BackwardsCompatibleSchema } from '@instantdb/react'; 

type Schema = { ... } ;
const db = init<BackwardsCompatibleSchema<Schema>>({ appId })

3. Update our docs UI

Our docs UI was feeling a bit cluttered:

  • The "On this page" sidebar was broken for many pages
  • The scrollbar always showed up
  • Links were jarringly bold
  • The layout width would change as you navigated different pages.

I made it so:

  • The "On this page" sidebar is a fixed width, and it looks okay
  • There are fewer bold colors
  • The layout width does not change

Here's how it looks now:

CleanShot 2024-12-13 at 16 56 56@2x

4. Support for ansi rendering

I wanted to paste in what a CLI result looked like. This is a bit of a hack, but I added a custom ansi tag in our markdoc. It's a bit of process, but we can share the CLI output in the docs like so:

image

5. Docs updates

I went through every page of the docs, and did updates:

  1. Updated our getting started examples
  2. Updated "Modeling Data", to use our schema file
  3. Updated InstaQL and InstaML, to include typesafety information
  4. Updated a bunch of other files, as I went through the docs one by one

6. Fixes "next page" and "previous page" in our intro sections

In our docs, when you were on the "Getting Started in React" page:

If you looked, the "Next Page" would be "Getting started in React Native".

But in reality, you would want the next page to be "Init".

I updated it so:

  1. The "next page" from the getting started sections all point to init
  2. The "previous page" from init jumps back to getting started with react

7. Temporarily Update docs to use 0.17.0-experimental.3

I wanted to make it easy for you to test the latest version, so included the tag on all instructions in the docs. I will remove that commit when we are ready to ship.


@nezaj @dwwoelfel @tonsky

Copy link

View Vercel preview at instant-www-js-st1-jsv.vercel.app.

Copy link
Contributor

@dwwoelfel dwwoelfel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Some thoughts as I went through the example:

  1. The next link on the react docs page goes to "React native" instead of "Working with data"

  2. It would be nice if you didn't have to provide an empty object for links and rooms if you're not using those. The types will fail if you leave out rooms, but if you leave out links, we'll throw a unhelpful "TypeError: Cannot convert undefined or null to object" error.

client/packages/cli/index.js Outdated Show resolved Hide resolved
client/www/components/docs/Ansi.jsx Show resolved Hide resolved
client/www/pages/docs/backend.md Outdated Show resolved Hide resolved
client/www/pages/docs/instaql.md Outdated Show resolved Hide resolved
@stopachka stopachka force-pushed the st1 branch 6 times, most recently from 8e018a6 to d0840e9 Compare December 17, 2024 01:13
@stopachka stopachka merged commit af0cb3f into main Dec 18, 2024
24 checks passed
@stopachka stopachka deleted the st1 branch December 18, 2024 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants