fix(create-rslib): improve template argument parsing and defaults#1467
Merged
Timeless0911 merged 2 commits intomainfrom Jan 30, 2026
Merged
fix(create-rslib): improve template argument parsing and defaults#1467Timeless0911 merged 2 commits intomainfrom
Timeless0911 merged 2 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves the parsing of the --template argument in create-rslib by extracting the template name parsing logic into a dedicated function and correcting the default language behavior. Previously, when a language suffix was omitted, the code would incorrectly treat the last segment of the template name as the language. Now it correctly defaults to TypeScript by appending -ts to the template name.
Changes:
- Extracted template parsing logic into a new exported
parseTemplateNamefunction - Fixed default language behavior to append
-tswhen no language suffix is provided - Added comprehensive unit tests for the new parsing function
- Removed unused
order: 'pre'property from rspress template configuration
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/create-rslib/src/index.ts | Extracted parseTemplateName function with improved logic for handling template names with and without language suffixes; removed order: 'pre' from rspress config |
| packages/create-rslib/test/index.test.ts | Added unit tests for parseTemplateName covering single-segment and multi-segment templates with and without language suffixes |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
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.
Summary
This PR improves the parsing of the
--templateargument increate-rslib.parseTemplateNamelogic to handle template names more robustly.-tsor-js) is omitted, it now correctly defaults to-ts(appending it to the template name) instead of treating the last part of the template name as the language.parseTemplateName.order: 'pre'fromrspresstemplate config.Related Links
N/A
Checklist