-
Notifications
You must be signed in to change notification settings - Fork 24
feat(cli-2.0): initial draft #28
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: Eldad A. Fux <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some suggestions
temp | ||
├── appwrite.json | ||
└── FunctionOne | ||
├── .appwrite |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be some information regarding .appwrite
file will be useful as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to have everything in appwrite.json
? I think it's a bit confusing to have two different types of config files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe most major configs are done using appwrite.json then .appwrite can be used for API keys and project keys as it'll be hidden by default right? Aslong as we remind users not to commit .appwrite they can share their project with ease
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreeing with @kodumbeats - If we are going to have a .appwrite
directory, why not have config.yaml
in there (example, how .git is setup) or just have appwrite.yaml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lohanidamodar .appwrite
is actually the folder which some runtimes use to store their dependencies like Python and ruby . Similar to node modules in npm projects
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kodumbeats appwrite.json
is a file that is expected to be a part of version control since it will have all the information related to a project like the collections, functions and so on and hence allow them to recreate their project environment . Having secrets in this file doesn't seem like a good idea
018-cli-2.0/018-cli-2.0.md
Outdated
|
||
|
||
# Usage 2 | ||
appwrite generate function --name="FunctionTwo" --runtime=node-16.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be we can introduce one more parameter here --template
which should be a link to an accessible github repository/branch so that devs can customize to use their own templates as well as our more advance templates, even our demos can be used as template easily using this feature?
"path" : "./FunctionOne", | ||
"command" : "python main.py", | ||
"runtime": "python3.9", | ||
// This section is useful when we allow cloud functions to be tested locally |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JSON can't have comments 😉
# Usage 2 | ||
appwrite deploy functions --all | ||
# Deploys all the functions specified in appwrite.json | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about adding a 4th usage for CI environments to deploy some of the projects functions:
appwrite deploy functions --names "My awesome function 💪, FunctionTwo" or
appwrite deploy functions --names "My awesome function 💪" "FunctionTwo"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this and others, I believe we should name space the commands functions deploy
(and looking further down, site deploy -y
|
||
```sh | ||
# Usage 1 | ||
appwrite deploy functions --confirm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For simplicity of use, one of --confirm
or --all
could be a default
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This almost feels like an -i --interactive
mode, like an interactive rebase in git?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could also follow the common CLI trends with -y
instead of a --confirm or --all
Here are some example usages | ||
```sh | ||
# Usage 1 | ||
appwrite init function --functionId="abc" --name="FunctionOne" --runtime=python-3.9 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could allow runtime
to be a language and use the latest version available by default? e.g.:
appwrite init function --functionId="abc" --name="FunctionOne" --runtime=python
Which would use python-3.9
or whichever is newest at the time
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like above: appwrite function init
-- This helps when printing help screens too, because you can. order them by the namespaces for readable grouping
|
||
After the implementation of this RFC, the CLI will behave more like the Appwrite Console rather than a Server SDK. This accounts for a new form of Authentication that is similar to the way we handle logins in the Appwrite console. We use a cookie. | ||
|
||
We will introduce a new command `appwrite login` that will work in one of either ways. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to pick one or the other? I understand that we should think to support OAuth login, but it's not a great CLI experience if a browser is required to login.
# Usage 3 | ||
appwrite init function | ||
|
||
Give your function an ID |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to validate this ID with the Key validator as a part of the CLI? We could provide real-time feedback even before a request is made.
--> | ||
|
||
This RFC is inspired by the Firebase CLI. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the Fission CLI have any insights to offer?
https://docs.fission.io/docs/usage/function/functions/
Local testingDefining testing environments inside
I can see a solution where instead of "vars" we have "tests" objects like this:
This is a pretty simple example because we might be looking for more statements such as
.appwriteignoreIf we build the application, we only want to deploy the Also, if we have a build process in place, I may have Database setupSince we can set up sites and function, can we also add an option to define collection structure using appwrite CLI? There could be |
Function templatesCurrent RFC includes command:
For python, it generates files What if we want to use Typescript? In the end, we are still going to use Node (or Deno) runtime, but the function structure needs to be way different. First of all, we need In my opinion, the init function could get one more parameter:
There will be multiple |
The current CLI is pretty slow because it has to spin up a docker container to execute one command and then tear down. In addition, passing objects into the CLI is incredibly difficult because of how the data is passed into the container and parsed via the CLI code (Discord conversation) Any plans on rewriting the CLI to not be a docker image like this? |
}, | ||
], | ||
"hosting": [] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to suggest YAML or even TOML, support for them everywhere, easier to read and less prone to type-o frustration with quotes and such. Also... comments.
|
||
```sh | ||
appwrite init | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
its this to add the Appwrite stack, to setup for functions or just create the config file with the project id? If project, will it also create the project for us on our endpoints?
@christyjacob4, what are the next steps on this? |
preview
https://github.com/appwrite/rfc/blob/cli-2.0/018-cli-2.0/018-cli-2.0.md