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

Dependency resolution for examples #576

Closed
davidmytton opened this issue Apr 12, 2024 · 3 comments · Fixed by #559
Closed

Dependency resolution for examples #576

davidmytton opened this issue Apr 12, 2024 · 3 comments · Fixed by #559

Comments

@davidmytton
Copy link
Contributor

With https://github.com/arcjet/arcjet/issues/1397 adding the Vercel deploy button requires referencing the repo path to clone. This installs the dependencies in the build on Vercel, but as we reference our own packages as relative files the install fails.

"@arcjet/next": "file:../../arcjet-next",

It seems like there are a couple of options to solve this:

  1. We change the dependency to point to latest which is what next.js does for its examples. The downside of this seems to be that it would pull the latest version from NPM, which would mean we couldn't test against the development HEAD

https://github.com/vercel/next.js/blob/c2b62d49c75f25c5f3423c370c9dbf8cc51b67ba/examples/api-routes/package.json#L9

  1. We could add an override to the root package.json which would apply when we install the deps for the example within repo, but then the example package.json would reference latest when cloned in isolation. Will this work with how we have set up the workspace?

For discussion @blaine-arcjet

Build failed

Screenshot 2024-04-12 at 9 37 53 AM

@blaine-arcjet
Copy link
Contributor

@davidmytton Are we planning to add this button to all our examples or just https://github.com/arcjet/arcjet-js/tree/main/examples/nextjs-example

If it is just the nextjs-example, then I think:

  1. We can leave it in this repository
  2. Switch to latest
  3. Remove it from CI

If you want to add it to every example, we should probably create separate "template" repositories for each and keep a single "kitchen sink" example in this monorepo that tests everything on HEAD. Ref #72

@davidmytton
Copy link
Contributor Author

We won't add it to every example, but we may do a 2-3 to show off different things in different ways. Building a full "kitchen sink" example app is a good idea for both Vercel and our own examples, like NextAuth does with https://next-auth-example.vercel.app/ but something we can do later.

So @danni-popova let's keep it in this repo with latest and remove from CI. When we have a few more we can split them into their own repos.

@davidmytton
Copy link
Contributor Author

Updated the React Hook Form example in 0d20768 which we can use an our first example template because it has the nice UI and shows off all 3 primitives. Pending review from @blaine-arcjet in #559.

@trunk-io trunk-io bot closed this as completed in #559 Apr 16, 2024
trunk-io bot pushed a commit that referenced this issue Apr 16, 2024
Added new Next.js + React Hook Form example. Also adds the Vercel Deploy button ref arcjet/arcjet#1397 and closes #576.
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 a pull request may close this issue.

2 participants