-
Notifications
You must be signed in to change notification settings - Fork 171
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: CLI Local development #862
Conversation
templates/cli/lib/questions.js.twig
Outdated
type: "input", | ||
name: "port", | ||
message: 'Which port would you like function to listen on?', | ||
default: async () => { | ||
let port = 3000; |
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.
we should only show this prompt when the port 3000 is not available right?
you can use the when
condition of inquirer to check this
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.
Well we could automatically also pick 3001 because its available. Should we not ask this question at all, and just tell them to use --port
if they want to change it?
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.
Yeap agreed 👍
.alias("functions") | ||
.description("Run functions in the current directory.") | ||
.option(`--functionId <functionId>`, `Function ID`) | ||
.option(`--port <port>`, `Local port`) |
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.
lets fix a default port so user doesnt need to enter it
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.
It's optional param. If not provided ,question is asked (with default 3000 as placeholder)
if(!port) { | ||
let portFound = fale; | ||
port = 3000; | ||
while(port < 3100) { |
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.
while very rare, why limit the search to 100 ports? Why not set it to something higher like 6000 ?
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.
No idea how long that might take. And as you said, very rare. I wouldn' worry too much until we get some complains.
What does this PR do?
Implements local development in
appwrite run function
.Test Plan
Related PRs and Issues
x
Have you read the Contributing Guidelines on issues?
Yes