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

feat: basic create-frames cli tool #143

Merged
merged 4 commits into from
Mar 26, 2024
Merged

feat: basic create-frames cli tool #143

merged 4 commits into from
Mar 26, 2024

Conversation

michalkvasnicak
Copy link
Collaborator

@michalkvasnicak michalkvasnicak commented Mar 5, 2024

Change Summary

This PR adds create-frames package which can be used to init a project using a template.

TODO

  • - create-frames cli tool
  • - add next starter template
  • - consider removing fs-extra and use just node:fs
  • - hono template
  • - express template
  • - remix template

Merge Checklist

  • PR has a Changeset
  • PR includes documentation if necessary
  • PR updates the boilerplates if necessary

Copy link

vercel bot commented Mar 5, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
frames-js ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 26, 2024 3:25pm
framesjs-debugger ❌ Failed (Inspect) Mar 26, 2024 3:25pm

@michalkvasnicak
Copy link
Collaborator Author

@davidfurlong ready for review

@davidfurlong
Copy link
Contributor

how do we test this locally?

@michalkvasnicak
Copy link
Collaborator Author

@davidfurlong I did not find a way to do that. What I do is just running the ./bin.js from anywhere and that's it. Also I tried yarn pack after yarn build (from root) to check if the package contains also templates.

@davidfurlong
Copy link
Contributor

Can you document local testing in the readme and then also run the debugger on startup? This is what currently shows up which makes it hard for users to use

Screenshot 2024-03-08 at 14 36 40

@michalkvasnicak
Copy link
Collaborator Author

@davidfurlong I improved the installation of dependencies by providing a comment. Also I improved readme files a little and changed the dev command in next template to run the app in debugger by default. In my opinion that's great dev experience, what do you think?

const previousFrame = getPreviousFrame<State>(searchParams);

const frameMessage = await getFrameMessage(previousFrame.postBody, {
// remove if you aren't using @frames.js/debugger or you just don't want to use the debugger hub
Copy link
Contributor

Choose a reason for hiding this comment

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

how does this work with deploying to production?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hm that would need a check if you are running on NODE_ENV=production and remove it in that case, if that's what is on your mind.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added the condition

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@davidfurlong is this ok with you?

params.t ||
(await select({
message: "Choose a template for the project",
options: getTemplates().map((template) => ({
Copy link
Contributor

Choose a reason for hiding this comment

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

would be great to have the existing templates here

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

that way you would need to update the list manually each time.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think it is better to keep this as is otherwise it could easily happen that you forget to add a template here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah ok now I think I understand what you mean. Moving templates from starter to standalone templates.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I added 2 more templates based on starters from examples folder. Would you like to get rid of examples altogether? I think that would be better to do in different PR.

packages/create-frames/README.md Show resolved Hide resolved
@davidfurlong
Copy link
Contributor

we should probably also update the docs to use this

<HomePage.InstallPackage name="frames.js" type="install" />
<HomePage.InstallPackage name="frames" type="init" />
Copy link
Contributor

Choose a reason for hiding this comment

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

i think we should leave the install as the initial call to action since we have create-frames in the quickstart section

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

docs/pages/index.mdx Outdated Show resolved Hide resolved
Copy link
Contributor

@stephancill stephancill left a comment

Choose a reason for hiding this comment

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

would be great if we could deduplicate the examples and the templates but that might be out of scope for this PR. otherwise looks good to me!

@@ -0,0 +1,29 @@
{
"name": "template-next",
Copy link
Contributor

Choose a reason for hiding this comment

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

is there a way for us to maybe deduplicate the framesjs-starter code?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I would like that but that would require a lot of work, so perhaps it is better to split it to another PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

agreed

feat: add next simple template

fix: ignore some files when copying templates

chore: remove fs-extra dep

chore: add changeset

remove comment

chore: improve dependencies installation and run app in debugger by default

chore: improve debugger hub comment

chore: document installation

chore: remove debug hub usage in case of production build

chore: add two more examples based on starters

chore: update to new dep
@michalkvasnicak
Copy link
Collaborator Author

@stephancill it is ready.

@stephancill stephancill merged commit 7ba28f0 into dev Mar 26, 2024
6 of 7 checks passed
@stephancill stephancill deleted the feat/cli-tool branch March 26, 2024 15:49
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.

3 participants