-
Notifications
You must be signed in to change notification settings - Fork 11
refactor(api): extract file system logic from API layer #8
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
refactor(api): extract file system logic from API layer #8
Conversation
@dkundel I'd be up for an opinion here. 🙈 It may be that i'm not seeing the whole picture. :) |
Issues I ran into: https://github.com/twilio-labs/serverless-api/blob/master/src/api/functions.ts#L92-L94 This part only works when you're dealing with the file system. With configurations that are passed into https://github.com/twilio-labs/serverless-api/blob/master/src/api/functions.ts#L178-L185 IMO upload functions shouldn't deal with this. :) Additional logic in the API layer makes the functionality very hard to grasp when you're dealing with the methods programmatically. The same things apply for the asset part. :) Overall, the proposed change is that the API layer only deals with API calls – not much additional logic. |
src/types/generic.ts
Outdated
/** | ||
* Path for the serverless function | ||
*/ | ||
path?: string; |
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 should be mandatory. Every Function or Asset should have a path.
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.
path
was a the filesystem one before and name
was the actual path. Why would you have name
now? See comment above
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 move the example into the comment here of how those paths would look like. I.e. starting with a /
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.
Made path
mandatory and answered your comments below. 👇
@dkundel Thanks for looking into this. I addressed your comments and pushed some updates. :) |
* fix: update code for new version of severless-api re twilio-labs/serverless-api#8 * chore(npm): upgrade @twilio-labs/serverless-api * fix(tests): fix integration tests Remove the reliance on stacktraces in the error integration tests
* feat: introduce config file functionality (#15) With this change we are starting to allow .twilio-functions for more than just storing some build outcomes. It supports grouping configs by environment, command or project or nested combinations of these. Very extended config: ```json { "startConfig": { "ngrok": "dom", "inspect": "" }, "environments": { "dev": { "deployConfig": { "env": ".env" } }, "prod": { "deployConfig": { "env": ".env.prod" } } }, "projects": { "ACc2bdaa19578061b45a518axxxxxxxxxx": { "serviceSid": "ZSd6e3037c5710c8e8c979f5xxxxxxxxxx", "latestBuild": "ZBdf824389570e3ee2ebcec7xxxxxxxxxx", "deployConfig": { "environment": "prod" } } }, "serviceSid": "ZSd6e3037c5710c8e8c979fxxxxxxxxxx", "latestBuild": "ZBdf824389570e3ee2ebcec7xxxxxxxxxx" } ``` fix: #15 * feat: add config support for list,activate,deploy (#15) This commit adds config file support for the list, activate and deploy command. It also deprecates the --functions-env flag BREAKING CHANGE: Deprecating --functions-env as an option fix: #15, fix: #27 * refactor(config): factor out common code for testability * fix(config): write serviceSid to config This creates compatibility of config files for twilio-run * test(config): add basic test for list config * feat(runtime): handle invalid account sid & new error page This change will check for valid Account SIDs in local development mode and create an appropriate error message. It also introduces a new Error response page BREAKING CHANGE: Error page layout changed fix #45 * chore(release): 2.0.0-beta.13 * fix: update code for new version of severless-api (#46) * fix: update code for new version of severless-api re twilio-labs/serverless-api#8 * chore(npm): upgrade @twilio-labs/serverless-api * fix(tests): fix integration tests Remove the reliance on stacktraces in the error integration tests * chore(release): 2.0.0-rc.0 * chore(npm): upgrade serverless-api library * chore(release): 2.0.0-rc.1 * feat(new): change from prompts to inquirer (#36) Prompts has a bug for screens that are smaller than the content. This fix hasn't been launched yet so we are switching to inquirer. fixes #36 * fix(templates): switch template list endpoint to next branch The templates are currently pulled from the next branch but the list was from master, causing some templates to crash * feat: introduce config file functionality (#15) With this change we are starting to allow .twilio-functions for more than just storing some build outcomes. It supprts grouping configs by environment, command or project or nested combinations of these fix: #15 * feat: add config support for list,activate,deploy (#15) This commit adds config file support for the list, activate and deploy command. It also deprecates the --functions-env flag BREAKING CHANGE: Deprecating --functions-env as an option fix: #15, fix: #27 * refactor(config): factor out common code for testability * fix(config): write serviceSid to config This creates compatibility of config files for twilio-run * test(config): add basic test for list config * feat(config): accept external config options * test(config): add more tests for configs * fix(config): store under accountSid not API key
Extract file system logic from APi layer. :)
fix #7
Contributing to Twilio