-
Notifications
You must be signed in to change notification settings - Fork 27
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
Flutter CLI #82
base: master
Are you sure you want to change the base?
Flutter CLI #82
Conversation
lib/commands/flutter.js
Outdated
const appwriteFile = 'aW1wb3J0ICdwYWNrYWdlOmFwcHdyaXRlL2FwcHdyaXRlLmRhcnQnOwoKZmluYWwgY2xpZW50ID0gQ2xpZW50KCkKICAuc2V0RW5kcG9pbnQoJ3tFTkRQT0lOVH0nKQogIC5zZXRQcm9qZWN0KCd7UFJPSkVDVH0nKTsKCmZpbmFsIGFjY291bnQgPSBBY2NvdW50KGNsaWVudCk7CmZpbmFsIGRhdGFiYXNlcyA9IERhdGFiYXNlcyhjbGllbnQpOwpmaW5hbCBzdG9yYWdlID0gU3RvcmFnZShjbGllbnQpOwoK'; | ||
|
||
const modelTemplate = 'JUlNUE9SVFMlCmNsYXNzICVOQU1FJSB7CiAgZmluYWwgU3RyaW5nICRpZDsKICBmaW5hbCBTdHJpbmcgJGNyZWF0ZWRBdDsKICBmaW5hbCBTdHJpbmcgJHVwZGF0ZWRBdDsKICBmaW5hbCBTdHJpbmcgJGNvbGxlY3Rpb25JZDsKICBmaW5hbCBTdHJpbmcgJGRhdGFiYXNlSWQ7CiAgZmluYWwgTGlzdDxTdHJpbmc+ICRwZXJtaXNzaW9uczsKCiAgJUFUVFJJQlVURVMlCgogICVOQU1FJSh7CiAgICByZXF1aXJlZCB0aGlzLiRpZCwKICAgIHJlcXVpcmVkIHRoaXMuJGNyZWF0ZWRBdCwKICAgIHJlcXVpcmVkIHRoaXMuJHVwZGF0ZWRBdCwKICAgIHJlcXVpcmVkIHRoaXMuJGNvbGxlY3Rpb25JZCwKICAgIHJlcXVpcmVkIHRoaXMuJHBlcm1pc3Npb25zLAogICAgcmVxdWlyZWQgdGhpcy4kZGF0YWJhc2VJZCwKICAgICVDT05TVFJVQ1RPUl9QQVJBTUVURVJTJQogIH0pOwoKICBmYWN0b3J5ICVOQU1FJS5mcm9tTWFwKE1hcDxTdHJpbmcsIGR5bmFtaWM+IG1hcCkgewogICAgcmV0dXJuICVOQU1FJSgKICAgICAgJGlkOiBtYXBbJ1wkaWQnXSwKICAgICAgJGNyZWF0ZWRBdDogbWFwWydcJGNyZWF0ZWRBdCddLAogICAgICAkdXBkYXRlZEF0OiBtYXBbJ1wkdXBkYXRlZEF0J10sCiAgICAgICRjb2xsZWN0aW9uSWQ6IG1hcFsnXCRjb2xsZWN0aW9uSWQnXSwKICAgICAgJHBlcm1pc3Npb25zOiBMaXN0PFN0cmluZz4uZnJvbShtYXBbJ1wkcGVybWlzc2lvbnMnXSksCiAgICAgICRkYXRhYmFzZUlkOiBtYXBbJ1wkZGF0YWJhc2VJZCddLAogICAgICAlQ09OU1RSVUNUT1JfQVJHVU1FTlRTJQogICAgKTsKICB9CgogIE1hcDxTdHJpbmcsIGR5bmFtaWM+IHRvTWFwKCkgewogICAgcmV0dXJuIHsKICAgICAgJ1wkaWQnOiAkaWQsCiAgICAgICdcJGNyZWF0ZWRBdCc6ICRjcmVhdGVkQXQsCiAgICAgICdcJHVwZGF0ZWRBdCc6ICR1cGRhdGVkQXQsCiAgICAgICdcJGNvbGxlY3Rpb25JZCc6ICRjb2xsZWN0aW9uSWQsCiAgICAgICdcJHBlcm1pc3Npb25zJzogJHBlcm1pc3Npb25zLAogICAgICAnXCRkYXRhYmFzZUlkJzogJGRhdGFiYXNlSWQsCiAgICAgICVNQVBfRklFTERTJQogICAgfTsKICB9CgogIEBvdmVycmlkZQogIFN0cmluZyB0b1N0cmluZygpIHsKICAgIHJldHVybiAnJU5BTUUlICcgKyB0b01hcCgpLnRvU3RyaW5nKCk7CiAgfQp9'; |
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 include the raw templates by themselves to be more transparent?
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 can do that, I felt this was better than managing multiple 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.
We can do that, I felt this was better than managing multiple files?
Updated to use files instead.
lib/commands/flutter.js
Outdated
.replaceAll('%NAME%', name) | ||
.replace('%IMPORTS%', imports) | ||
.replace('%ATTRIBUTES%', properties) | ||
.replace('%CONSTRUCTOR_PARAMETERS%', constructorParams) | ||
.replace('%CONSTRUCTOR_ARGUMENTS%', constructorArgs) | ||
.replace('%MAP_FIELDS%', mapFields); |
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 we do this with a map and a loop instead to make it more extensible?
lib/commands/flutter.js
Outdated
if (!answers.project) process.exit(1) | ||
|
||
let project = {}; | ||
if (answers.start == "new") { |
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.
Let's use ===
everywhere applicable
What does this PR do?
appwrite flutter configure
command is used to setup Flutter project, link with appwrite project, add platforms and add and initialize Appwrite SDKappwrite flutter generate
is used to generate Dart classes for all the database collections in the projectGiving it a try
As it is still under development, if you would like to give it a try please use the following command to install (You will need Node and NPM installed)
Test Plan
(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work.)
Related PRs and Issues
(If this PR is related to any other PR or resolves any issue or related to any issue link all related PR and issues here.)
Have you read the Contributing Guidelines on issues?
(Write your answer here.)