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

implement add commands #1380

Merged
merged 3 commits into from
May 28, 2024
Merged

implement add commands #1380

merged 3 commits into from
May 28, 2024

Conversation

pistachiobaby
Copy link
Contributor

@pistachiobaby pistachiobaby commented Apr 16, 2024

Implements the add commands for generating routes, actions, fields, and models in a gadget project. All from the CLI.

Example of some of the commands that have been adde:

// adding a model

ggt add model post # adds a post model at api/models/post
ggt add model myNamespace/post # adds a model at api/models/myNamespace/post

ggt add model post title:string # adds a model at api/models/post and a title field with type string

// adding a field
ggt add field post/body:string # adds a field body with type string to the post model

// adding an action

ggt add action post/publish # adds a model action at api/models/post/actions/publish.js
ggt add action doAThing # adds a global action at actions/doAThing.js
ggt add action nested/doADifferentThing # adds a global action at actions/nested/doADifferentThing.js

// adding a route
ggt add route GET hello-world # adds a route at api/routes/GET-hello-world.js
ggt add route profile # adds a frontend route at web/routes/profile.jsx

Everything is done through the gadget edit api, that way ggt doesn't sweat about the actual implementation of generating these files.

Should be merged in once, https://github.com/gadget-inc/gadget/pull/11187, is merged into main.

Copy link

changeset-bot bot commented Apr 16, 2024

🦋 Changeset detected

Latest commit: 2fc7ea3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
ggt Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Collaborator

@scott-rc scott-rc left a comment

Choose a reason for hiding this comment

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

Nice! LGTM 👍

Don't forget to add a changeset so that our CHANGELOG is updated when we release this. There are docs on how to add a changeset here: https://github.com/gadget-inc/ggt/blob/main/CONTRIBUTING.md#pull-requests

src/services/command/command.ts Outdated Show resolved Hide resolved
src/commands/add.ts Outdated Show resolved Hide resolved
src/commands/add.ts Outdated Show resolved Hide resolved
src/commands/add.ts Outdated Show resolved Hide resolved
Copy link
Collaborator

@scott-rc scott-rc left a comment

Choose a reason for hiding this comment

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

Couple more nits, but still looks great! 👍

src/commands/add.ts Outdated Show resolved Hide resolved
src/commands/add.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@jcao49 jcao49 left a comment

Choose a reason for hiding this comment

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

Looks good!! 👍

@pistachiobaby pistachiobaby force-pushed the add-commands branch 2 times, most recently from 874d03d to 572ffde Compare April 24, 2024 19:39
@pistachiobaby pistachiobaby requested review from scott-rc and jcao49 and removed request for scott-rc and jcao49 April 24, 2024 19:39
@pistachiobaby pistachiobaby marked this pull request as draft May 9, 2024 02:20
@pistachiobaby pistachiobaby requested a review from infiton May 9, 2024 02:20
@pistachiobaby pistachiobaby marked this pull request as ready for review May 10, 2024 00:01
@pistachiobaby pistachiobaby merged commit 8d8d922 into main May 28, 2024
7 checks passed
@pistachiobaby pistachiobaby deleted the add-commands branch May 28, 2024 15:38
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.

None yet

4 participants