SuperAPI AI Directory

migrate-v1-to-v2

Frontend & websites

View repository

Updated 11-03 17:04

About this skill

Migrate from v1 to v2 skill

This skill helps the user migrate the project from Wot UI v1 (wot-design-uni) to Wot UI v2 (@wot-ui/ui)。

Full migration guide:Chinese / English。


Scope of responsibility

  • Scan v1 usage, replace package names/paths, migrate component APIs, migrate the form validation system and built-in icon names, and fix incompatible changes.
  • Not responsible forcreating new business pages or refactoring business logic; only make the minimum necessary compatibility replacements.
  • Not responsible forinstalling dependencies; the user performs this in the terminal.

First interaction confirmation

Before starting any operation, first confirm the following three points with the user (skip the corresponding question if it can already be inferred from context):

  1. Installation method: npm or uni_modules? (affects import paths and easycom configuration)
  2. Target:
    • A. Full migration(project not yet upgraded) → execute according to phases 1–7
    • B. Fix errors after upgrade(already upgraded but encountering compilation/runtime errors) → first read errors.md to locate the problem
  3. Target platform: H5 / WeChat Mini Program / Alipay Mini Program? (affects style isolation and easycom verification methods)

Quick path

Based on the problem described by the user, load the corresponding sub-file directly:

Keyword Sub-file
Error message / compilation error / module not found / is not defined / abnormal after upgrade errors.md
Form / Form / schema / zodAdapter / FormRules / validation / required asterisk form.md
Package name / easycom / Volar / vite plugin / internationalization / path replacement / uni_modules infra.md
Sass / theme / Design Token / CSS variables / style overrides / dark mode / ConfigProvider styles.md
Dialog / MessageBox / Empty / StatusTip / Cascader / ColPicker / Keyboard / NumberKeyboard / Button / Tag / Radio / Checkbox / Search / Grid / Fab / Badge / Slider / Tabs / Steps / Swiper / Tooltip / Popover / Collapse / Cell / Input / Textarea / PickerView / ImgCropper / CountTo / Segmented components.md
Icon / icon / wd-icon / icon / iconClass / activeIcon / inactiveIcon / prefixIcon / suffixIcon / empty icon components.md 's "Icon migration" and icons.json

Core changes quick reference table

Type v1 v2
npm package name wot-design-uni @wot-ui/ui
uni_modules directory wot-design-uni wot-ui
Dialog component wd-message-box wd-dialog
Dialog Hook useMessage useDialog
Empty prompt wd-status-tip wd-empty
Multi-column picker wd-col-picker wd-cascader
Number keyboard wd-number-keyboard wd-keyboard
Form validation rules / FormRules schema / FormSchema
Button variant plain / type="text" / type="icon" variant / icon button
Button danger color type="error" type="danger"
Tag variant plain variant="plain"
Radio/checkbox form shape / inline / cell type / direction / manual combination wd-cell
Search box light style light variant="light"
GridItem click @itemclick @click
Utility function path components/common/util common/util
Built-in icon names v1 icon set According to icons.json manual review results

Migration process

Recommended order: dependency upgrade → path replacement → Form pages → high-impact components → medium/low-impact components → icons and low-impact properties → styles and themes → regression testing.

After completing each stage, confirm with the user before proceeding to the next stage.

Stage 1: Scan and Diagnose

  1. Determine the user's installation method (npm or uni_modules)。

  2. Confirm project configuration:pages.json easycom、tsconfig.json type declarations, Vite plugin auto-import.

  3. Search for old v1 usages:

    rg "wot-design-uni|wd-message-box|useMessage|wd-status-tip|wd-col-picker|wd-number-keyboard|wd-icon|icon-class|iconClass|active-icon|activeIcon|inactive-icon|inactiveIcon|prefix-icon|prefixIcon|suffix-icon|suffixIcon|@itemclick|shape=|inline|\scell\b|\slight\b|type=\"error\"|type=\"icon\"|type=\"text\"|\splain\b|classPrefix|components/common/util|hide-label|hide-min-max|autoLineWidth|disabled-color|setRoate|useContentSlot|useMoreSlot|\bshow="
    
  4. If the project has forms, additionally search for:

    rg "wd-form|FormRules|:rules=|rules=|errorType|resetOnChange"
    
  5. Report the list of findings to the user, sorted by impact level:

    • High impact: Form (structure + validation system), Dialog (formerly MessageBox), ColPicker, NumberKeyboard
    • Medium impact: Button, Tag, Radio/Checkbox, Search, Grid, Fab, built-in icon names
    • Low impact: camelCase prop names, minor prop adjustments for Badge/Slider/Tabs/Steps/Swiper, etc.

Stage 2: Dependency and Path Replacement

See infra.md(package name, easycom, Volar, Vite plugin, i18n) and styles.md(Sass upgrade). After reading, return toStage 3to continue.

Stage 3: High-Impact Component Migration

See components.md(MessageBox→Dialog、StatusTip→Empty、ColPicker→Cascader、NumberKeyboard→Keyboard)。

For the Form form system, see form.md. After reading, return toStage 4to continue.

Stage 4: Medium-Impact Component Migration

See components.md(Button, Tag, Radio/Checkbox, Search, Grid, Fab). After reading, return toStage 5to continue.

Stage 5: Low-Impact Prop and Icon Migration

See components.md(Badge, Slider, Tabs, Steps, Swiper, Tooltip, Popover, Collapse, DatetimePickerView, ImgCropper, CountTo, Segmented, PickerView, icon migration, camelCase prop names). When migrating icons, you must read icons.json, and only replace confirmed mappings; "no counterpart" and dynamically bound items are left for manual decision. After reading, return toStage 6to continue.

Stage 6: Style and Theme Migration

See styles.md(theme file imports, global variable overrides, ConfigProvider, style override priority, dark mode). After reading, proceed toStage 7regression verification.

Stage 7: Regression Verification

  • Whether H5 and the target mini-program platform compile normally
  • easycom Whether all wd-* components resolve correctly
  • Toast、Dialog、Notify Whether functional calls such as those have instances declared in the page
  • Whether form submission, single-field validation, reset, hidden fields, and async validation work properly
  • Whether the display text and submitted values of selector-type form items are correct
  • Button Whether the type、variant、round and height are as expected
  • Tag Whether the variant has been migrated from plain migration
  • Radio/Checkbox Whether the shape、inline、cell has been migrated
  • Search Whether the light has been migrated to variant="light"
  • GridItem Whether the click event has been migrated from itemclick to click
  • Cell、Input、Textarea Whether the form-related props have been migrated to wd-form-item
  • PickerView、ImgCropper、CountTo Whether instance methods such as those can still be called normally
  • Badge、Slider、Tabs、Steps、Swiper Whether old props such as those have been migrated
  • Dialog Whether click-mask-to-close, the Prompt return value, and the button configuration meet expectations
  • Whether dark mode, theme variables, and brand color overrides take effect
  • Does the popup layer have style isolation issues on the mini program side?
  • Do custom override styles still take effect?
  • Are all static built-in icon names handled according to icons.json , and has no global replacement been performed on business strings?
  • "No corresponding", dynamic binding, and iconClass / activeIcon / inactiveIcon / prefixIcon / suffixIcon have been listed separately and manually confirmed?
  • Are the business semantics and visual results of the icons correct, and is the name casing kept accurate?
  • Does the change in icon button height affect the page layout?