-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
[WIP] export default configuration on moduleAPI #5229
Conversation
The goal of this PR is to help extract the default server config into a separate package that can be consumed and published standalone. If it is required that we move this out of the repo, I'm fine with that to. The goal of the PR is to show a potential solution for cypress-io#5217
sorry I'm not understanding, what exactly is the end goal to the user? Could you mention some use cases this supports? possibly a simpler solution is just moving it to another file/exporting it so users can use |
@bkucera The use case (for me, and hopefully others) is if I want to import the default ruleset, I can. In our case, we provide a default ruleset which we do two things with via our tooling:
The goal here being that I can properly provide a default without having to manually amend the config every time there is a Cypress update in the event that the config gets a new key added or a key is removed. |
@bkucera That's part of it, but we already are doing this internally since we feed the NodeJS API parameters instead of using the CLI directly and having it find a config. |
@Aghassi alright, so it looks like if we export the defaults as part of the module api like so: Is that correct? |
@bkucera That is correct 😄 |
@Aghassi sounds like a manageable PR, shouldn't require making a new package.json, if you want to get the ball rolling on this you could implement that in this PR |
@bkucera Sounds good. Something that was confusing to me was how the current package compiles into the final |
@Aghassi this should be it: https://github.com/cypress-io/cypress/blob/develop/cli/lib/cypress.js However we don't export a default member, so probably just add it to the moduleApi obj |
Hey @Aghassi, I've added |
Thanks. So if I follow the structure of this repo @bkucera, all
Do any of these sound better than the others to you? I like 3 because it is simple and doesn't really disrupt much of the build flow you currently have. |
@Aghassi now that I thought more about this, we try to keep the cli as thin and dumb as possible, and copying a default config file into both the binary and cli breaks that goal. Currently, the cli has no knowledge of valid config/cli args, it just passes them along. We could however, yield you the defaults in the plugins api, e.g.: // plugins/index.js
module.exports = (on, config) => {
config.defaults.defaultCommandTimeout
} I know you said you want access through the moduleApi, but would this work for you? that would also make this PR go in much faster |
@bkucera Not really as we would like to validate the config before Cypress starts :/. Kind of like how webpack is able to validate their config before webpack starts. Same with Jest. Once Cypress is running, we don't have much control on config validation. |
@Aghassi good point, maybe a shared subpackage that's copied into both cli/binary is the best solution here. I know it will take some work to get that right however. Here's where we build the final binary, that could possible copy over a https://github.com/cypress-io/cypress/blob/develop/scripts/binary/build.coffee |
@Aghassi Will you have time to finish this PR? If not, we will close this PR due to inactivity. |
@jennifer-shehane I will, I have been a little busy with work and have not had a chance to. I will try and get some of it done this weekend. Have to brush up on this repo's build cycle again to see where I can accomplish the copy over. |
@Aghassi Will you have time to finish this PR? If not, we will close this PR due to inactivity. |
I've since moved on to another team. @krohrsb can take point on this in the future if that team still requires it. |
The goal of this PR is to help extract the default server
config into a separate package that can be consumed and published
standalone. If it is required that we move this out of the repo,
I'm fine with that to. The goal of the PR is to show a potential
solution for #5217
Pre-merge Tasks
cypress-documentation
been submitted to document any user-facing changes?