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

[cli] if no instant module found in package.json, prompt to install one #519

Merged
merged 3 commits into from
Nov 21, 2024

Conversation

stopachka
Copy link
Contributor

@stopachka stopachka commented Nov 21, 2024

Context
When we generate files for the user, we need some instant module to exist. This is because in schema.ts for example, we need to generate an import statement like:

import { i } from '@instantdb/react'

Previously:

  1. We only detected instantdb/react or instantdb/core.
  2. We would fail if they weren't there

This PR makes the CLI more helpful, by:

  1. Detecting react, core, react-native, and admin
  2. If none are detected, prodding the user to choose one and installing it for them.

When a module is detected:

CleanShot 2024-11-21 at 12 59 52@2x

If no module is detected:

CleanShot 2024-11-21 at 13 01 43@2x CleanShot 2024-11-21 at 13 01 12@2x

@dwwoelfel @nezaj

Copy link

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

@stopachka stopachka changed the title [cli][do-not-review] if no instant module found in package.json, prompt to install one [cli] if no instant module found in package.json, prompt to install one Nov 21, 2024
roar

roar

roar

roar

roar

roar

roar
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.

Delightful!

client/packages/cli/src/util/packageManager.js Outdated Show resolved Hide resolved
@stopachka stopachka merged commit 30090a3 into main Nov 21, 2024
26 checks passed
@stopachka stopachka deleted the getorinstall branch November 21, 2024 21:48
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