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

Handle generated file extensions more robustly #687

Merged
merged 2 commits into from
Nov 6, 2023

Conversation

bakerkretzmar
Copy link
Collaborator

@bakerkretzmar bakerkretzmar commented Nov 2, 2023

This PR allows the ziggy:generate command to handle a wider range of path argument formats and still create the right files with the right extensions.

Before this PR, the path argument had to be a file name ending in .js. That makes sense if you're generating Ziggy's JavaScript config file, but not so much if you're generating its types too, and even less so if you're generating just its types on their own.

Now, the extension of the path argument is mostly ignored and we just use the argument to figure out the file path and name. Path arguments ending in .js, .d.ts, .ts, or even no extension, all generate the requested .js and/or .d.ts file at the base filename specified. As an added convenience, if the path argument happens to point to an existing directory, ziggy.js and/or ziggy.d.ts files will be generated inside that directory instead.

This all applies to output paths set via config instead of arguments too.

See #680.

@lmeysel thoughts?

@lmeysel
Copy link

lmeysel commented Nov 3, 2023

Looks good, nothing to add 🚀

@bakerkretzmar bakerkretzmar merged commit 125a990 into main Nov 6, 2023
48 checks passed
@bakerkretzmar bakerkretzmar deleted the jbk/file-path-improvements branch November 6, 2023 18:17
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.

2 participants