-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
CLI: Fix copyTemplate failures on init
#22375
Conversation
@@ -10,7 +10,9 @@ const generator: Generator = async (packageManager, npmOptions, options) => { | |||
}); | |||
|
|||
const templateDir = join(getCliDir(), 'templates', 'server'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can just get rid of this block of code entirely. I just tested it out on a sample project and will be adding a telescoping PR to do it.
init
by guarding against copyTemplate failuresinit
Server: Add json indexer to preset Co-authored-by: Donnie Flood <[email protected]>
…okjs/storybook into shilman/20627-fix-server-indexer
…ndexer Server: Add json indexer
CLI: Fix server init
…into norbert/fix-22348
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I'll let @yannbf follow up as needed but merging now since I want to get the server changes released.
CLI: Fix copyTemplate failures on `init`
Closes #22348
What I did
Add guards against projectType being an unknown value
Add guards against templateDir being a location that doesn't exist
How to test
I'm not exactly sure how to reproduce the error, but 1 way that would work for sure would be to set a
projectType
to a odd value in an angular project. I don't think there are any other proper values other thenapplication
andlibrary
but if there are, then that would have caused issues in the past. After this PR that should default back toapplication
. I assume this is the correct default.If the templateDir cannot be found at all, we'll just skip it, this MIGHT cause those storybook to fail to start or build, but that's hard to tell without a full reproduction I can follow.
...either way that would become a follow-up issue then.