Skip to content

fix(create-rslib): support dynamic package name in rspress template#1465

Merged
Timeless0911 merged 3 commits intomainfrom
fix/create-rslib-rspress-template-name
Jan 30, 2026
Merged

fix(create-rslib): support dynamic package name in rspress template#1465
Timeless0911 merged 3 commits intomainfrom
fix/create-rslib-rspress-template-name

Conversation

@Timeless0911
Copy link
Copy Markdown
Contributor

Summary

This PR adds support for dynamic package name replacement in the Rspress React TS template.

  • Replaces hardcoded rslib-react-ts with {{ packageName }} placeholder in docs/Button.mdx and tsconfig.json.
  • Updates create-rslib to replace the placeholder with the actual package name during project creation.

Related Links

N/A

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copilot AI review requested due to automatic review settings January 30, 2026 10:34
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR makes the Rspress React TS template use a dynamic package name placeholder and wires create-rslib to replace that placeholder with the actual package name when generating a project.

Changes:

  • Replaced hardcoded rslib-react-ts references in the Rspress React TS tsconfig.json and docs/Button.mdx with a {{ packageName }} placeholder.
  • Added getPackageName and replacePackageNamePlaceholder helpers in create-rslib/src/index.ts to read the generated project’s package.json and replace the placeholder in copied Rspress template files.
  • Hooked the placeholder replacement into the rspress extra tool action for react-ts templates so the generated docs and TS path mapping use the actual package name.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
packages/create-rslib/template-rspress/react-ts/tsconfig.json Uses {{ packageName }} in the paths key so the alias matches the generated package name once replaced.
packages/create-rslib/template-rspress/react-ts/docs/Button.mdx Imports Button from {{ packageName }} to align docs imports with the generated package name after replacement.
packages/create-rslib/src/index.ts Adds helpers to read the project’s package name and replace {{ packageName }} in Rspress template files during project creation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Timeless0911 Timeless0911 merged commit e6dcc79 into main Jan 30, 2026
11 checks passed
@Timeless0911 Timeless0911 deleted the fix/create-rslib-rspress-template-name branch January 30, 2026 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants