Skip to content

test(create-rslib): split parseTemplateName into separate module#1514

Merged
Timeless0911 merged 2 commits intomainfrom
fix/create-rslib-parse-template-flake
Mar 5, 2026
Merged

test(create-rslib): split parseTemplateName into separate module#1514
Timeless0911 merged 2 commits intomainfrom
fix/create-rslib-parse-template-flake

Conversation

@Timeless0911
Copy link
Copy Markdown
Contributor

@Timeless0911 Timeless0911 commented Mar 5, 2026

Summary

This PR removes parseTemplateName from the CLI entry module so unit tests no longer import runtime CLI side effects.

  • extracted parseTemplateName from packages/create-rslib/src/index.ts into packages/create-rslib/src/parseTemplateName.ts
  • re-exported parseTemplateName from index.ts to keep external API usage unchanged
  • updated packages/create-rslib/test/index.test.ts to import parseTemplateName from the standalone module
  • avoids importing CLI entry behavior during tests, which was linked to intermittent unit-create worker crashes/hangs

Related Links

  • N/A

Checklist

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

Validation

  • pnpm test:unit passed
  • stress run: 20 consecutive pnpm test:unit runs passed

Copilot AI review requested due to automatic review settings March 5, 2026 07:20
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 refactors create-rslib by extracting parseTemplateName into a standalone module while preserving the existing public API via a re-export from src/index.ts. This avoids importing the CLI entry module at runtime in unit tests, reducing intermittent test hangs/failures.

Changes:

  • Moved parseTemplateName from packages/create-rslib/src/index.ts into packages/create-rslib/src/parseTemplateName.ts.
  • Re-exported parseTemplateName from src/index.ts to keep existing imports working.
  • Updated unit tests to import parseTemplateName from the new standalone module and keep Lang as a type-only import.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
packages/create-rslib/test/index.test.ts Switches to importing parseTemplateName from the new module to avoid CLI side effects during tests.
packages/create-rslib/src/parseTemplateName.ts New dedicated module containing parseTemplateName logic.
packages/create-rslib/src/index.ts Imports and re-exports parseTemplateName, removing the inline implementation.

@Timeless0911 Timeless0911 merged commit 7dafd37 into main Mar 5, 2026
7 checks passed
@Timeless0911 Timeless0911 deleted the fix/create-rslib-parse-template-flake branch March 5, 2026 07:33
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.

3 participants