$npx -y skills add rstackjs/agent-skills --skill migrate-to-rslibMigrate tsc or tsup library projects to Rslib.
| 1 | # Migrate to Rslib |
| 2 | |
| 3 | ## Goal |
| 4 | |
| 5 | Migrate `tsc` and `tsup` projects to Rslib with minimal behavior changes and clear verification. |
| 6 | |
| 7 | ## Supported source frameworks |
| 8 | |
| 9 | - tsc |
| 10 | - tsup |
| 11 | |
| 12 | ## Migration principles (must follow) |
| 13 | |
| 14 | 1. **Official guide first**: treat Rslib migration docs as source of truth. |
| 15 | 2. **Smallest-change-first**: complete baseline migration first, then migrate advanced or custom behavior. |
| 16 | 3. **Do not change business logic**: avoid touching source or business logic unless user explicitly asks. |
| 17 | 4. **Validate before cleanup**: keep old tool dependencies/config temporarily if needed; remove only after Rslib is green. |
| 18 | |
| 19 | ## Workflow |
| 20 | |
| 21 | 1. **Detect source tool** |
| 22 | - `tsup` |
| 23 | - Config: `tsup.config.*` |
| 24 | - Dependency: `tsup` |
| 25 | - Build script: uses `tsup` to build projects |
| 26 | - `tsc` |
| 27 | - Config: `tsconfig.json` or `tsconfig.*.json` |
| 28 | - Dependency: `typescript` |
| 29 | - Build script: uses `tsc` to build projects. And it should be noted that `tsc` used only for type checking (e.g., `tsc --noEmit`) does not make it a `tsc` build project. |
| 30 | |
| 31 | 2. **Apply tool-specific migration deltas** |
| 32 | - tsc: `references/tsc.md` |
| 33 | - tsup: `references/tsup.md` |
| 34 | |
| 35 | 3. **Validate behavior** |
| 36 | - Run build command to verify the project builds successfully. |
| 37 | - If issues remain, compare the old project configuration with the migration guide and complete any missing mappings. |
| 38 | |
| 39 | 4. **Cleanup and summarize** |
| 40 | - Remove obsolete dependencies/config only after validation passes. |
| 41 | - Summarize changed files, mapped options, and any remaining manual follow-ups. |