-
-
Notifications
You must be signed in to change notification settings - Fork 49
Implement splitting types per file per namespace #105
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
Open
gvlasov
wants to merge
10
commits into
spatie:main
Choose a base branch
from
gvlasov:file-per-namespace
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…of TransformedType->getTypescriptName()
# Conflicts: # src/Structures/TransformedType.php # src/Transformers/DtoTransformer.php # src/Transformers/EnumTransformer.php # src/Transformers/MyclabsEnumTransformer.php # src/Transformers/SpatieEnumTransformer.php # tests/Fakes/FakeTransformedType.php # tests/Fakes/FakeTypeScriptCollector.php
Author
|
Had to integrate #104 here because locating module paths requires logic from there in order to work with compacted namespaces, these two are a single PR now. |
aa31690 to
b16ce5d
Compare
b16ce5d to
5dfc1b4
Compare
…hen they are used in multiple places
|
Dear contributor, because this pull request seems to be inactive for quite some time now, I've automatically closed it. If you feel this pull request deserves some attention from my human colleagues feel free to reopen it. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem: When you have to use
ModuleWriter(e.g. to get usable enums instead of only type definitions), you can't have types with the same base name but from different PHP namespaces.Solution: Group code per namespace and output it in a corresponding directory structure, where the last part of the namespace is used to name the output
.tsfile for the namespace.Example output structure:
Introduces new config option:
If it is set,
TypeScriptTransformerignoresoutput_fileconfig option and uses an alternative strategy for bundling the code that puts types from every namespace into their own file, with directory structure mimicking the namespace parts.Otherwise puts all code into
output_fileas usual.Notes