-
Notifications
You must be signed in to change notification settings - Fork 470
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
Restore ability to put generated files in a directory relative to source #470
Conversation
Please note that the format changes are the result of a fixed |
It appears that the precommit script was incorrectly defined in the packages/apollo-cli/package.json file, which was making it impossible to commit without a --no-verify flag. I fixed the configuration, and applied the format changes to the to-be-changed files in this commit.
Before the change from `apollo-codegen` to `apollo`, flow type definitions were output into a `__generated__` directory, next to their respective source files. The new `localDirectory` flag restores support for this kind of workflow by accepting a custom directory name: ```sh apollo codegen:generate --target=flow --localDirectory=__generated__ ``` This flag is ignored if `--output` is specified.
Please also note that something in your test on travis fails nondeterministically. I force-pushed the exact same code a couple times with amended commits (separating out the formatting changes from the meaningful ones) and sometimes it would fail (with messages about using a custom engine key), other times it would succeed. This (obviously) has nothing to do with my PR, but I figured you should be aware. |
I definitely think this behavior is worth supporting, maybe even as a default. But if we want to keep it under an option, I'm wondering if we can find a more descriptive alternative to |
Hmm, personally my preference would be to reuse the Would that be a workable solution, and default to |
@mike-marcacci That makes sense to me, but curious to hear what @shadaj and @jbaxleyiii think. |
Placing Flow and TypeScript files in directories relative to their source files is now the default behavior. By default, the directory name used is To use the To continue placing generated files immediately adjacent their source files (which is the current behavior, albiet only for a couple days and arguably undesireable) Side note: for consistency with the other flags, I used |
Placing Flow and TypeScript files in directories relative to their source files is now the default behavior. By default, the directory name used is `__generated__`, which can be overridden by setting the `output` (first) cli arg. To use the `output` to specify a single locaation the new `--outputRelativeToCWD` flag can be set. To continue placing generated files immediately adjacent their source files (which is the current behavior, albiet only for a couple days and arguably undesireable) `output` can be set to an empty string. While available, I suspect this feature will never be used, due to the problems outlined in #468 and #469.
Hi @mike-marcacci this looks great! |
@shadaj good idea. The PR's been updated with your suggestion. |
localDirectory
flag to TypeScript/Flow generators.
Fixes #469. Before the change from
apollo-codegen
toapollo
cli, flow type definitions were output into a__generated__
directory, next to their respective source files.This adds a
localDirectory
flag that accepts a name to use locally for generated types. For example:This flag is ignored if
--output
is specified.