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

feat(twilio-run): restructure configuration #198

Merged
merged 5 commits into from
Apr 16, 2021
Merged

Conversation

dkundel
Copy link
Member

@dkundel dkundel commented Oct 30, 2020

This PR aims to restructure the way configuration is handled by dropping .twilio-functions files in
favor of a dedicated config file and a deploy info cache file.

BREAKING CHANGE: Drops support for .twilio-functions files and internally restructures activate
files to promote

fix #166

Contributing to Twilio

All third-party contributors acknowledge that any contributions they provide will be made under the same open-source license that the open-source project is provided under.

  • I acknowledge that all my contributions will be made under the project's license.

@dkundel dkundel force-pushed the dkundel/change-config branch 2 times, most recently from aa8884a to e44cbad Compare October 31, 2020 03:11
@philnash
Copy link
Contributor

philnash commented Nov 4, 2020

A lot of this seems to be the consolidation of flags, which is a nice refactor. Can you point out the parts where the .twilio-functions file format has changed to the .twilioserverlessrc version? Where is the impact of this change? Thanks!

@dkundel
Copy link
Member Author

dkundel commented Nov 4, 2020

The big changes are:

  1. The .twilioserverlessrc file supports various formats incl json5 (default), yml and JS
  2. I removed more complex nesting capabilities (previously you could for example specify config per environment per account). Now you can only do either. The previous was more flexible but both harder to parse and harder to explain.
  3. The .twilioserverlessrc file will never be modified by the Toolkit. Instead the build info gets written into a .twiliodeployinfo file on a per account basis. It's the first step on removing some of the pain points we've seen when working with multiple Twilio accounts on the same project. The .twilioserverlessrc file can be checked in but the .twiliodeployinfo file should be added to gitignore by default (will add that at a later point)

And yes I consolidated all flags. That should hopefully help us also use flags in a more consistent matter.

Comment on lines 37 to 44
return [
'{',
`\t"commands": {},`,
`\t"environments": {},`,
`\t"projects": {},`,
lines,
'}',
].join('\n');
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason to not use JSON.stringify here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Because I'm adding comments since it's JSON5

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, in templateFlagAsConfig, got you. Shame JSON5 doesn't make it easier to actually work with the comments it permits.

@philnash philnash marked this pull request as ready for review November 6, 2020 03:58
@philnash philnash marked this pull request as draft November 6, 2020 03:58
@philnash
Copy link
Contributor

philnash commented Nov 6, 2020

Splitting this to the two files, publicly shareable and local data, is definitely going to be a good thing.

You were right in your comment about this being a difficult part of the code base! I can't see anything wrong, but you know it better than me.

You have this as draft. Was there more work to be done?

@dkundel dkundel force-pushed the dkundel/change-config branch from e44cbad to 2298573 Compare November 12, 2020 19:57
@dkundel
Copy link
Member Author

dkundel commented Nov 12, 2020

I'm still adding tests and I want to have a graceful migration option as well.

@philnash philnash added this to the v3 milestone Feb 25, 2021
@dkundel dkundel marked this pull request as ready for review April 15, 2021 23:01
Copy link
Contributor

@philnash philnash left a comment

Choose a reason for hiding this comment

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

I have a couple of questions. I'm sure nothing is a blocker.

packages/twilio-run/bin/upgrade-config.js Show resolved Hide resolved
packages/twilio-run/src/checks/legacy-config.ts Outdated Show resolved Hide resolved
dkundel added 5 commits April 15, 2021 17:39
This PR aims to restructure the way configuration is handled by dropping .twilio-functions files in
favor of a dedicated config file and a deploy info cache file.

BREAKING CHANGE: Drops support for .twilio-functions files and internally restructures activate
files to promote

fix #166
@dkundel dkundel force-pushed the dkundel/change-config branch from 96a6c4d to 1e17858 Compare April 16, 2021 01:03
Copy link
Contributor

@philnash philnash left a comment

Choose a reason for hiding this comment

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

👍

@dkundel dkundel merged commit f88d490 into main Apr 16, 2021
@dkundel dkundel deleted the dkundel/change-config branch April 16, 2021 01:21
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.

Redesigning config file / .twilio-functions file
2 participants