@cratis/components.migrator 4.13.1 → 4.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
The Components 4 Migrator updates a Components 3 codebase to the Components 4 public contracts. It moves root namespaces to explicit subpath imports, replaces deprecated Button appearance props, and changes legacy event-wrapper callbacks to semantic value callbacks. The CLI uses syntax-aware codemods internally, but each command is named for the migration it performs, can be run independently, and is idempotent. Components 4 keeps only package-wide provider setup at the root; every component is imported from its explicit subpath (`@cratis/components/Canvas`, for example). The companion `@cratis/eslint-plugin-components` package's `no-root-barrel-import` rule enforces this once a consumer has migrated.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
The package is published on npm and released at the same version as `@cratis/components`
|
|
6
|
+
(4.0.0 onward). Run it with `npx`, `pnpm dlx`, or `yarn dlx` as shown below; it is never an
|
|
7
|
+
application runtime dependency. Contributors to this repository can run the workspace scripts
|
|
8
|
+
directly instead.
|
|
9
9
|
|
|
10
10
|
The published package is a **CLI-only** tool. Its public surface is the documented `cratis-components-*` executable names (plus `./package.json` for tooling metadata); `lib/`, `scripts/`, and individual transforms are implementation details and are blocked by the package export map. Do not import them from application code or build custom migration APIs on them.
|
|
11
11
|
|
|
@@ -197,6 +197,12 @@ The transform never guesses through JSX spreads, dynamic legacy values, duplicat
|
|
|
197
197
|
|
|
198
198
|
The affected CommandForm fields cover legacy `target`/`currentTarget` `value`, `checked`, and `valueAsNumber` payloads, plus `DropdownField`/`MultiSelectField` `event.value`. Already-semantic callbacks and callback references such as `onChange={setValue}` are unchanged.
|
|
199
199
|
|
|
200
|
+
The transform changes a callback's shape, not where it lives. With Arc 22.16.0, `CommandForm` calls an
|
|
201
|
+
`onChange` placed on a field with the new value at runtime, but the Components 4 CommandForm field
|
|
202
|
+
types do not declare `onChange`, so type-checked TSX reports TS2322 on a field that keeps one. Move
|
|
203
|
+
those side effects to `CommandForm`'s `onFieldChange` callback. The standalone `Dropdown` declares
|
|
204
|
+
`onChange` and is not affected. The [Components 3 to 4 migration guide](https://cratis.io/components/migration/3-to-4/) covers this case.
|
|
205
|
+
|
|
200
206
|
Multi-statement, multi-use, wrong-payload, destructuring-with-default/rest, and native-event-dependent callbacks are refused, reported, and annotated once:
|
|
201
207
|
|
|
202
208
|
```tsx
|
|
@@ -254,7 +260,9 @@ node Migrator/scripts/change-handler.js --check Source
|
|
|
254
260
|
cd Migrator && yarn test
|
|
255
261
|
```
|
|
256
262
|
|
|
257
|
-
Repository fixtures for every supported and unsupported case live under
|
|
263
|
+
Repository fixtures for every supported and unsupported root-import case live under
|
|
258
264
|
`Migrator/test/fixtures`,
|
|
259
265
|
each as an `input.ts`/`expected.ts` pair (`input.ts` and `expected.ts` are identical for an
|
|
260
|
-
unsupported case, since nothing should change).
|
|
266
|
+
unsupported case, since nothing should change). The Button and change-handler transforms use
|
|
267
|
+
`input.tsx`/`expected.tsx` pairs under `Migrator/test/button-fixtures` and
|
|
268
|
+
`Migrator/test/change-handler-fixtures`.
|
package/package.json
CHANGED