@public-ui/kolibri-cli 4.0.0-alpha.0 → 4.0.0-alpha.10

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.
Files changed (59) hide show
  1. package/README.md +277 -64
  2. package/dist/generate-scss/index.js +18 -0
  3. package/dist/index.js +5 -5
  4. package/dist/info/index.js +19 -6
  5. package/dist/migrate/index.js +18 -3
  6. package/dist/migrate/runner/abstract-task.js +8 -2
  7. package/dist/migrate/runner/task-runner.js +18 -19
  8. package/dist/migrate/runner/tasks/common/ExecTask.js +1 -0
  9. package/dist/migrate/runner/tasks/common/GenericRenamePropertyTask.js +4 -0
  10. package/dist/migrate/runner/tasks/common/GenericRenameSlotNameTask.js +5 -0
  11. package/dist/migrate/runner/tasks/common/GenericRenameTagNameTask.js +5 -2
  12. package/dist/migrate/runner/tasks/common/GenericUpdatePropertyValueTask.js +62 -0
  13. package/dist/migrate/runner/tasks/common/GitIgnoreAddRuleTask.js +1 -0
  14. package/dist/migrate/runner/tasks/common/HandleDependencyTask.js +10 -8
  15. package/dist/migrate/runner/tasks/common/JsonTask.js +2 -1
  16. package/dist/migrate/runner/tasks/common/LabelExpertSlot.js +7 -0
  17. package/dist/migrate/runner/tasks/common/MergeHtmlTask.js +3 -0
  18. package/dist/migrate/runner/tasks/common/NpmRcAddRuleTask.js +1 -0
  19. package/dist/migrate/runner/tasks/common/RefactorPropertyErrorToMsg.js +59 -0
  20. package/dist/migrate/runner/tasks/common/RefactorPropertyIconAlign.js +4 -3
  21. package/dist/migrate/runner/tasks/common/RefactorPropertyLabelReplaceFalse.js +2 -2
  22. package/dist/migrate/runner/tasks/common/RemoveMsgPropsTask.js +54 -0
  23. package/dist/migrate/runner/tasks/common/RemovePropertyNameTask.js +6 -0
  24. package/dist/migrate/runner/tasks/common/RenamePropertyNameTask.js +1 -2
  25. package/dist/migrate/runner/tasks/common/RenameTagNameTask.js +1 -2
  26. package/dist/migrate/runner/tasks/common/ScssAddSelectorTask.js +203 -0
  27. package/dist/migrate/runner/tasks/common/ScssRemoveSelectorTask.js +275 -0
  28. package/dist/migrate/runner/tasks/common/ScssRenameBlockTask.js +43 -0
  29. package/dist/migrate/runner/tasks/common/ScssRenameElementTask.js +48 -0
  30. package/dist/migrate/runner/tasks/common/ScssRenameModifierTask.js +48 -0
  31. package/dist/migrate/runner/tasks/common/ScssUpdateTokenTask.js +51 -0
  32. package/dist/migrate/runner/tasks/common/TsConfigReconfigureTask.js +3 -1
  33. package/dist/migrate/runner/tasks/common/UpdatePropertyValueTask.js +14 -0
  34. package/dist/migrate/runner/tasks/common/VsCodeSettingsReconfigureTask.js +3 -1
  35. package/dist/migrate/runner/tasks/v1/button.js +1 -1
  36. package/dist/migrate/runner/tasks/v1/index.js +2 -2
  37. package/dist/migrate/runner/tasks/v1/input-email.js +1 -1
  38. package/dist/migrate/runner/tasks/v1/input-number.js +1 -1
  39. package/dist/migrate/runner/tasks/v1/input-password.js +1 -1
  40. package/dist/migrate/runner/tasks/v1/input-text.js +1 -1
  41. package/dist/migrate/runner/tasks/v1/link.js +1 -1
  42. package/dist/migrate/runner/tasks/v1/select.js +1 -1
  43. package/dist/migrate/runner/tasks/v3/abbr.js +5 -0
  44. package/dist/migrate/runner/tasks/v3/all-input.js +27 -0
  45. package/dist/migrate/runner/tasks/v3/index.js +17 -0
  46. package/dist/migrate/runner/tasks/v3/input-file.js +5 -0
  47. package/dist/migrate/runner/tasks/v3/modal.js +5 -0
  48. package/dist/migrate/runner/tasks/v3/textarea.js +6 -0
  49. package/dist/migrate/runner/tasks/v3/toaster.js +34 -0
  50. package/dist/migrate/runner/tasks/v4/id.js +26 -0
  51. package/dist/migrate/runner/tasks/v4/index.js +16 -0
  52. package/dist/migrate/runner/tasks/v4/link.js +66 -0
  53. package/dist/migrate/runner/tasks/v4/loader.js +36 -0
  54. package/dist/migrate/runner/tasks/v4/msg.js +5 -0
  55. package/dist/migrate/runner/tasks/v4/toast.js +56 -0
  56. package/dist/migrate/runner/tasks/v4/toaster.js +68 -0
  57. package/dist/migrate/shares/reuse.js +44 -1
  58. package/dist/types.js +5 -2
  59. package/package.json +27 -20
package/README.md CHANGED
@@ -1,8 +1,19 @@
1
1
  # KoliBri - CLI-Tools
2
2
 
3
+ Command line utilities to help maintain and migrate KoliBri projects.
4
+
5
+ [![npm](https://img.shields.io/npm/v/@public-ui/kolibri-cli)](https://www.npmjs.com/package/@public-ui/components)
6
+ [![license](https://img.shields.io/npm/l/@public-ui/kolibri-cli)](https://github.com/public-ui/kolibri/blob/main/LICENSE)
7
+ [![downloads](https://img.shields.io/npm/dt/@public-ui/kolibri-cli)](https://www.npmjs.com/package/@public-ui/kolibri-cli)
8
+ [![issues](https://img.shields.io/github/issues/public-ui/kolibri)](https://github.com/public-ui/kolibri/issues)
9
+ [![pull requests](https://img.shields.io/github/issues-pr/public-ui/kolibri)](https://github.com/public-ui/kolibri/pulls)
10
+ [![size](https://img.shields.io/bundlephobia/min/@public-ui/kolibri-cli)](https://bundlephobia.com/result?p=@public-ui/kolibri-cli)
11
+ ![contributors](https://img.shields.io/github/contributors/public-ui/kolibri)
12
+
3
13
  ## Motivation
4
14
 
5
15
  The `KoliBri` CLI-Tools are a collection of tools to support the development with `KoliBri` components.
16
+ They also help migrating projects when new components or design tokens are introduced.
6
17
 
7
18
  ## Installation
8
19
 
@@ -14,6 +25,16 @@ pnpm i -g @public-ui/kolibri-cli
14
25
  yarn add -g @public-ui/kolibri-cli
15
26
  ```
16
27
 
28
+ > **Important:** Install exactly the CLI version you want to upgrade to. The migration tool compares your locally installed `@public-ui/components` version with the CLI version to decide which migration tasks must run and in which order.
29
+
30
+ ## Quickstart (Happy Path)
31
+
32
+ 1. Install the CLI version that matches your target `@public-ui/components` release (see above).
33
+ 2. Run the migration in your project root: `kolibri migrate .`.
34
+ 3. Review the changes: `git status` and `git diff`.
35
+ 4. Format updated files: `pnpm format`.
36
+ 5. Commit the result and continue development.
37
+
17
38
  ## Usage
18
39
 
19
40
  The `KoliBri` CLI is intended to be executed in your project root directory. Use the `kolibri` command to start the CLI.
@@ -45,6 +66,7 @@ Commands:
45
66
  ```
46
67
 
47
68
  ### Info
69
+
48
70
  With the `info` command you can show the current system and KoliBri package information.
49
71
 
50
72
  This command is mainly needed for our bug issue templates.
@@ -55,27 +77,141 @@ If errors occur in our packages, we would like to ask you to create an issue und
55
77
 
56
78
  With the `migrate` command you can migrate your project to the latest version of `KoliBri`.
57
79
 
58
- Actually the following migration tasks from version 1 to version 2 are available:
59
-
60
- - Component renaming
61
- - Component removal (no one yet)
62
- - Property renaming
63
- - Property removal
64
- - Slots renaming (`content`)
65
- - Slots removal (`footer`, `header`) ✓
66
- - Logic refactoring (no one yet)
67
- - Expert-Slot refactoring
68
- - Move `innerText` to property ✓
69
- - Property type change (remove `_label={false}`) ✓
70
- - Set `_label=""` to activate the expert slot ([#5396](https://github.com/public-ui/kolibri/issues/5396)) ✓
71
- - `.vscode/settings.json` add IntelliSense for HTML ✓
72
- - `.gitignore` exclude `.kolibri.migrate.json`
73
- - `.tsconfig` add `@public-ui/components` to `types` array
74
- - Format modified files (`prettier@^3`)
75
- - Copy and integrate new assets ✓
76
- - Handles `_icon-align` with a refactoring tasks ([#5397](https://github.com/public-ui/kolibri/issues/5397))
77
- - Detection of `_iconOnly` in TSX is not stable ([#5404](https://github.com/public-ui/kolibri/issues/5404)) ⏰
78
- - Handle the remove `@public-ui/core` package ([#???](https://github.com/public-ui/kolibri/issues/????))
80
+ > **Hint:** The migration tool currently supports React projects (JSX/TSX), Vue single-file components, and HTML/XHTML template-based projects such as Angular applications or vanilla custom elements. Support for additional project types is planned.
81
+
82
+ The migration runner registers tasks in the following order and executes only those whose semantic version ranges match your
83
+ project: common tasks (`*`), v1 tasks (`^1`), v2 tasks (`^2` / `>=2.1.7 <3`), v3 tasks (`>=2 <4`), v4 tasks (`^4`) and
84
+ asset-related tasks (`^1`). All tasks are enabled by default. If you need to disable a noisy task or explicitly re-enable a
85
+ previously deactivated one for better migratability, set the corresponding flag in `.kolibri.config.json` under
86
+ `migrate.tasks` to `false` or `true`.
87
+
88
+ #### Migration tasks and version ranges
89
+
90
+ - **Common tasks (`*`)**
91
+ - Add `.kolibri.migrate.json` to `.gitignore`.
92
+ - Add `save-exact=true` to `.npmrc`.
93
+ - Configure `html.customData` in `.vscode/settings.json` to point to `@public-ui/components/vscode-custom-data.json`.
94
+ - **Version 1 tasks (`^1`, unless noted)**
95
+ - `kol-abbr`: rename `_align` `_tooltip-align`; rename `_title` `_label`.
96
+ - `kol-accordion`: rename `_heading` `_label`; mark removed slot `header`; rename slot `content` to the default slot.
97
+ - `kol-alert`: rename `_heading` `_label`.
98
+ - `kol-badge`: remove `_icon-only`; rename `_icon-only` `_hide-label`; remove `_hide-label`; rename `_icon` → `_icons`.
99
+ - `kol-breadcrumb`: rename `_aria-label` `_label`.
100
+ - `kol-button`: remove `_aria-current`; remove `_aria-label`; rename `_icon-only` `_hide-label`; rename `_icon` → `_icons`;
101
+ refactor `_icon-align` into `_icons` (**`^2`**).
102
+ - `kol-button-link`: remove `_aria-current`; remove `_aria-label`; rename `_icon-only` → `_hide-label`; rename `_icon` →
103
+ `_icons`.
104
+ - `kol-card`: rename `_heading` → `_label`; rename `_headline` → `_label`; mark removed slots `footer` and `header`; rename
105
+ slot `content` to the default slot.
106
+ - `kol-details`: rename `_summary` → `_label`.
107
+ - `kol-icon`: rename `_aria-label` → `_label`; remove `_part`; rename `_icon` → `_icons`.
108
+ - `kol-input`: rename `_icon` → `_icons`.
109
+ - `kol-input-checkbox`: rename `_type` → `_variant`; rename `_icon` → `_icons`.
110
+ - `kol-input-color`: rename `_list` → `_suggestions`; rename `_icon` → `_icons`.
111
+ - `kol-input-date` / `kol-date`: rename `_list` → `_suggestions`; rename `_icon` → `_icons`.
112
+ - `kol-input-email`: rename `_list` → `_suggestions`; rename `_icon` → `_icons`; remove `_size`.
113
+ - `kol-input-file`: rename `_icon` → `_icons`.
114
+ - `kol-input-number`: rename `_list` → `_suggestions`; rename `_icon` → `_icons`; remove `_type`.
115
+ - `kol-input-password`: rename `_icon` → `_icons`; remove `_size`.
116
+ - `kol-input-radio`: rename `_list` → `_options`.
117
+ - `kol-input-range`: rename `_list` → `_suggestions`; rename `_icon` → `_icons`.
118
+ - `kol-input-text`: rename `_list` → `_suggestions`; rename `_icon` → `_icons`; remove `_size`.
119
+ - `kol-link`: remove `_aria-controls`, `_aria-expanded`, `_aria-label`, `_aria-selected`, `_disabled`, `_selector`, `_stealth`,
120
+ `_use-case`; rename `_aria-current` → `_listen-aria-current`; rename `_icon-only` → `_hide-label`; rename `_icon` → `_icons`;
121
+ refactor `_icon-align` (**`^2`**).
122
+ - `kol-link-button`: remove `_aria-controls`, `_aria-expanded`, `_aria-label`, `_aria-selected`, `_disabled`; rename
123
+ `_aria-current` → `_listen-aria-current`; rename `_icon-only` → `_hide-label`; rename `_icon` → `_icons`.
124
+ - `kol-link-group`: rename `_aria-label` → `_label`; rename `_heading` → `_label`; remove `_heading`; remove `_ordered`.
125
+ - `kol-logo`: rename `_abbr` → `_org`.
126
+ - `kol-modal`: rename `_aria-label` → `_label`.
127
+ - `kol-nav`: rename `_aria-label` → `_label`; rename `_compact` → `_hide-label`; remove `_variant`.
128
+ - `kol-pagination`: rename `_count` → `_total`; rename `_total` → `_max`.
129
+ - `kol-progress`: rename `_type` → `_variant`.
130
+ - `kol-quote`: rename `_caption` → `_label`.
131
+ - `kol-select`: rename `_height` → `_rows`; rename `_list` → `_options`; rename `_icon` → `_icons`; remove `_size`.
132
+ - `kol-skip-nav`: rename `_aria-label` → `_label`.
133
+ - `kol-span`: rename `_icon-only` → `_hide-label`; rename `_icon` → `_icons`.
134
+ - `kol-split-button`: remove `_aria-label`, `_access-key`, `_show-dropdown`; remove `_show`.
135
+ - `kol-symbol`: rename `_aria-label` → `_label`.
136
+ - `kol-table`: rename `_caption` → `_label`.
137
+ - `kol-tabs`: rename `_aria-label` → `_label`; rename `_tab-align` → `_align`; rename `_icon` → `_icons`; rename `_icon-only`
138
+ → `_hide-label`.
139
+ - `kol-toast`: remove `_show-duration`; rename `_heading` → `_label`.
140
+ - `kol-version`: rename `_version` → `_label`.
141
+ - Expert slot migrations: move `innerText` to `_label` for `kol-heading`, `kol-input-*`, `kol-link`, `kol-select`,
142
+ `kol-textarea` (**`^1`**).
143
+ - Slot removals: mark removed `kol-accordion` `header`, `kol-card` `footer`/`header` (**`^1`**).
144
+ - Slot renames: `kol-accordion` / `kol-card` slot `content` → default slot (**`^1`**).
145
+ - Refactor `_label={false}` to empty string (**`>=1.6 <=1.7`**).
146
+ - **Version 2 tasks**
147
+ - `kol-card`: remove `_has-footer` (**`^2`**).
148
+ - `kol-link-group`: remove `_level` (**`^2`**).
149
+ - `kol-table`: rename tag `kol-table` → `kol-table-stateful` (**`>=2.1.7 <3`**).
150
+ - **Version 3 tasks (`>=2 <4`)**
151
+ - `kol-abbr`: remove `_tooltip-align`.
152
+ - `kol-input-file`: remove `_value`.
153
+ - `kol-modal`: remove `_active-element`.
154
+ - `kol-textarea`: `_resize="both"` → `_resize="vertical"`; `_resize="horizontal"` → `_resize="none"`.
155
+ - `kol-toaster`: rename `alertVariant` → `variant`; rename `defaultAlertType` → `defaultVariant`.
156
+ - All inputs (`kol-combobox`, `kol-input-*`, `kol-select`, `kol-single-select`, `kol-textarea`): remove `_alert`; rename
157
+ `_hide-error` → `_hide-msg`; refactor `_error` → `_msg`.
158
+ - **Version 4 tasks (`^4`)**
159
+ - Remove `_id` from `kol-button`, `kol-button-link`, `kol-combobox`, `kol-input-*`, `kol-popover-button`, `kol-select`,
160
+ `kol-single-select`, `kol-split-button`, `kol-textarea`, `kol-tooltip`.
161
+ - Remove `_label` and `_variant` keys from `_msg` objects.
162
+ - `kol-toast`: remove `variant` from `enqueue()` calls.
163
+ - `kol-toaster`: remove `defaultVariant` option from `getInstance()` calls.
164
+ - **Asset tasks (`^1`)**
165
+ - Remove old `cpy-cli`/`rimraf` versions and reinstall pinned ones.
166
+ - Add `scripts.prepare` to copy component assets into the project and remove `public/assets/codicons` before copying.
167
+ - Inject the Codicon stylesheet link into `index.html` (or warn if the file is missing).
168
+
169
+ #### Theme Migration
170
+
171
+ The CLI also supports migrating KoliBri themes alongside component updates to ensure theme packages remain synchronized with breaking changes in the component library.
172
+
173
+ ##### Goal
174
+
175
+ Synchronies breaking changes in components with the styling of each theme package so that upgrades require minimal manual work.
176
+
177
+ ##### Requirements
178
+
179
+ - Components and themes follow the BEM naming convention via `typed-bem`.
180
+ - Each theme lives under `packages/themes` and keeps its SCSS sources in `src/`.
181
+ - The CLI migration tool can read and modify `.scss` files.
182
+
183
+ ##### Concept
184
+
185
+ 1. **Central BEM schemas**
186
+ - Every component exports its BEM schema. These schemas are used by the CLI to generate SCSS files and by themes to reference selectors.
187
+ - When a selector changes, the same schema information allows the migration to update all theme packages consistently.
188
+
189
+ 2. **SCSS migration tasks**
190
+ The CLI runner is extended with task types operating on SCSS. They behave like the existing property tasks and are idempotent.
191
+ - `RenameBlockTask` – rename a block selector everywhere in a theme.
192
+ - `RenameElementTask` – rename an element within a block.
193
+ - `RenameModifierTask` – rename or replace a modifier.
194
+ - `AddSelectorTask` and `RemoveSelectorTask` – insert or remove entire rule sets.
195
+ - `UpdateTokenTask` – adjust variable names or values when tokens change.
196
+ - `MoveRulesTask` – move declarations from one selector to another if the DOM structure changes.
197
+
198
+ Tasks scan the SCSS with regular expressions or an AST parser. If a pattern is missing the task logs a warning instead of failing.
199
+
200
+ 3. **Safe execution**
201
+ - Migrations abort when uncommitted changes are detected unless `--ignore-uncommitted-changes` is specified.
202
+ - Each task logs the files it touched. After completion Prettier can format them automatically.
203
+ - Because tasks are idempotent, rerunning the migration produces no new changes. To undo a run, reset the Git state.
204
+
205
+ ##### Theme Migration Workflow Example
206
+
207
+ ```bash
208
+ pnpm i -g @public-ui/kolibri-cli@2 # install the CLI matching the next version
209
+ kolibri migrate path/to/project # run all tasks for the upgrade
210
+ pnpm format # format changed files
211
+ git diff # review results and commit
212
+ ```
213
+
214
+ Using these tasks, theme packages remain aligned with component updates. Future breaking changes can be scripted and applied via the CLI so that projects can upgrade in a controlled and reproducible way.
79
215
 
80
216
  #### How does it work?
81
217
 
@@ -122,53 +258,124 @@ You can configure the migration with the `.kolibri.config.json` file in your pro
122
258
  "tasks": {
123
259
  ".gitignore-add-rule-.kolibri.migrate.json": true,
124
260
  ".npmrc-add-rule-save-exact=true": true,
125
- "vscode-settings-reconfigure-html.customData": true,
261
+ "add--cpy-cli,rimraf": true,
262
+ "exec-npx cpy \"node_modules/@public-ui/components/assets/**/*\" \"public/assets\" --dot": true,
263
+ "kol-abbr-remove-property-_tooltip-align": true,
126
264
  "kol-abbr-rename-property-_align-to-_tooltip-align": true,
127
265
  "kol-abbr-rename-property-_title-to-_label": true,
266
+ "kol-accordion-mark-removed-slot-header": true,
128
267
  "kol-accordion-rename-property-_heading-to-_label": true,
268
+ "kol-accordion-rename-slot-content-to-": true,
129
269
  "kol-alert-rename-property-_heading-to-_label": true,
130
- "kol-badge-rename-property-_icon-only-to-_hide-label": true,
131
270
  "kol-badge-remove-property-_hide-label": true,
132
271
  "kol-badge-remove-property-_icon-only": true,
272
+ "kol-badge-rename-property-_icon-only-to-_hide-label": true,
133
273
  "kol-badge-rename-property-_icon-to-_icons": true,
134
274
  "kol-breadcrumb-rename-property-_aria-label-to-_label": true,
275
+ "kol-button-link-remove-property-_access-key": true,
135
276
  "kol-button-link-remove-property-_aria-current": true,
136
277
  "kol-button-link-remove-property-_aria-label": true,
278
+ "kol-button-link-remove-property-_id": true,
279
+ "kol-button-link-rename-property-_aria-current-to-_listen-aria-current": true,
137
280
  "kol-button-link-rename-property-_icon-only-to-_hide-label": true,
138
281
  "kol-button-link-rename-property-_icon-to-_icons": true,
282
+ "kol-button-remove-property-_access-key": true,
139
283
  "kol-button-remove-property-_aria-current": true,
140
284
  "kol-button-remove-property-_aria-label": true,
141
285
  "kol-button-remove-property-_icon-align": true,
286
+ "kol-button-remove-property-_id": true,
142
287
  "kol-button-rename-property-_icon-only-to-_hide-label": true,
288
+ "refactor-property-icon-align": true,
143
289
  "kol-button-rename-property-_icon-to-_icons": true,
290
+ "kol-card-mark-removed-slot-footer": true,
291
+ "kol-card-mark-removed-slot-header": true,
292
+ "kol-card-remove-property-_has-footer": true,
144
293
  "kol-card-rename-property-_heading-to-_label": true,
145
294
  "kol-card-rename-property-_headline-to-_label": true,
295
+ "kol-card-rename-slot-content-to-": true,
296
+ "kol-checkbox-rename-property-_type-to-_variant": true,
297
+ "kol-color-rename-property-_icon-to-_icons": true,
298
+ "kol-color-rename-property-_list-to-_suggestions": true,
299
+ "kol-combobox-refactor-property-error-to-msg": true,
300
+ "kol-combobox-remove-property-_alert": true,
301
+ "kol-combobox-remove-property-_id": true,
302
+ "kol-combobox-rename-property-_hide-error-to-_hide-msg": true,
303
+ "kol-date-rename-property-_list-to-_suggestions": true,
146
304
  "kol-details-rename-property-_summary-to-_label": true,
305
+ "kol-heading-move-innerText-to-property-_label": true,
147
306
  "kol-icon-remove-property-_part": true,
148
307
  "kol-icon-rename-property-_aria-label-to-_label": true,
149
308
  "kol-icon-rename-property-_icon-to-_icons": true,
309
+ "kol-input-checkbox-move-innerText-to-property-_label": true,
310
+ "kol-input-checkbox-refactor-property-error-to-msg": true,
311
+ "kol-input-checkbox-remove-property-_alert": true,
312
+ "kol-input-checkbox-remove-property-_id": true,
313
+ "kol-input-checkbox-rename-property-_hide-error-to-_hide-msg": true,
150
314
  "kol-input-checkbox-rename-property-_icon-to-_icons": true,
151
- "kol-checkbox-rename-property-_type-to-_variant": true,
152
- "kol-color-rename-property-_icon-to-_icons": true,
153
- "kol-color-rename-property-_list-to-_suggestions": true,
315
+ "kol-input-checkbox-rename-property-_type-to-_variant": true,
316
+ "kol-input-color-move-innerText-to-property-_label": true,
317
+ "kol-input-color-refactor-property-error-to-msg": true,
318
+ "kol-input-color-remove-property-_alert": true,
319
+ "kol-input-color-remove-property-_id": true,
320
+ "kol-input-color-rename-property-_hide-error-to-_hide-msg": true,
321
+ "kol-input-date-move-innerText-to-property-_label": true,
322
+ "kol-input-date-refactor-property-error-to-msg": true,
323
+ "kol-input-date-remove-property-_alert": true,
324
+ "kol-input-date-remove-property-_id": true,
325
+ "kol-input-date-rename-property-_hide-error-to-_hide-msg": true,
154
326
  "kol-input-date-rename-property-_icon-to-_icons": true,
155
- "kol-date-rename-property-_list-to-_suggestions": true,
327
+ "kol-input-email-move-innerText-to-property-_label": true,
328
+ "kol-input-email-refactor-property-error-to-msg": true,
329
+ "kol-input-email-remove-property-_alert": true,
330
+ "kol-input-email-remove-property-_id": true,
331
+ "kol-input-email-remove-property-_size": true,
332
+ "kol-input-email-rename-property-_hide-error-to-_hide-msg": true,
156
333
  "kol-input-email-rename-property-_icon-to-_icons": true,
157
334
  "kol-input-email-rename-property-_list-to-_suggestions": true,
158
- "kol-input-email-remove-property-_size": true,
335
+ "kol-input-file-move-innerText-to-property-_label": true,
336
+ "kol-input-file-refactor-property-error-to-msg": true,
337
+ "kol-input-file-remove-property-_alert": true,
338
+ "kol-input-file-remove-property-_id": true,
339
+ "kol-input-file-remove-property-_value": true,
340
+ "kol-input-file-rename-property-_hide-error-to-_hide-msg": true,
159
341
  "kol-input-file-rename-property-_icon-to-_icons": true,
342
+ "kol-input-number-move-innerText-to-property-_label": true,
343
+ "kol-input-number-refactor-property-error-to-msg": true,
344
+ "kol-input-number-remove-property-_alert": true,
345
+ "kol-input-number-remove-property-_id": true,
346
+ "kol-input-number-remove-property-_type": true,
347
+ "kol-input-number-rename-property-_hide-error-to-_hide-msg": true,
160
348
  "kol-input-number-rename-property-_icon-to-_icons": true,
161
349
  "kol-input-number-rename-property-_list-to-_suggestions": true,
162
- "kol-input-number-remove-property-_type": true,
163
- "kol-input-password-rename-property-_icon-to-_icons": true,
350
+ "kol-input-password-move-innerText-to-property-_label": true,
351
+ "kol-input-password-refactor-property-error-to-msg": true,
352
+ "kol-input-password-remove-property-_alert": true,
353
+ "kol-input-password-remove-property-_id": true,
164
354
  "kol-input-password-remove-property-_size": true,
355
+ "kol-input-password-rename-property-_hide-error-to-_hide-msg": true,
356
+ "kol-input-password-rename-property-_icon-to-_icons": true,
357
+ "kol-input-radio-move-innerText-to-property-_label": true,
358
+ "kol-input-radio-refactor-property-error-to-msg": true,
359
+ "kol-input-radio-remove-property-_alert": true,
360
+ "kol-input-radio-remove-property-_id": true,
361
+ "kol-input-radio-rename-property-_hide-error-to-_hide-msg": true,
165
362
  "kol-input-radio-rename-property-_list-to-_options": true,
363
+ "kol-input-range-move-innerText-to-property-_label": true,
364
+ "kol-input-range-refactor-property-error-to-msg": true,
365
+ "kol-input-range-remove-property-_alert": true,
366
+ "kol-input-range-remove-property-_id": true,
367
+ "kol-input-range-rename-property-_hide-error-to-_hide-msg": true,
166
368
  "kol-input-range-rename-property-_icon-to-_icons": true,
167
369
  "kol-input-range-rename-property-_list-to-_suggestions": true,
168
370
  "kol-input-rename-property-_icon-to-_icons": true,
371
+ "kol-input-text-move-innerText-to-property-_label": true,
372
+ "kol-input-text-refactor-property-error-to-msg": true,
373
+ "kol-input-text-remove-property-_alert": true,
374
+ "kol-input-text-remove-property-_id": true,
375
+ "kol-input-text-remove-property-_size": true,
376
+ "kol-input-text-rename-property-_hide-error-to-_hide-msg": true,
169
377
  "kol-input-text-rename-property-_icon-to-_icons": true,
170
378
  "kol-input-text-rename-property-_list-to-_suggestions": true,
171
- "kol-input-text-remove-property-_size": true,
172
379
  "kol-link-button-remove-property-_aria-controls": true,
173
380
  "kol-link-button-remove-property-_aria-expanded": true,
174
381
  "kol-link-button-remove-property-_aria-label": true,
@@ -177,16 +384,17 @@ You can configure the migration with the `.kolibri.config.json` file in your pro
177
384
  "kol-link-button-rename-property-_aria-current-to-_listen-aria-current": true,
178
385
  "kol-link-button-rename-property-_icon-only-to-_hide-label": true,
179
386
  "kol-link-button-rename-property-_icon-to-_icons": true,
180
- "kol-link-group-rename-property-_heading-to-_label": true,
181
387
  "kol-link-group-remove-property-_heading": true,
388
+ "kol-link-group-remove-property-_level": true,
182
389
  "kol-link-group-remove-property-_ordered": true,
183
390
  "kol-link-group-rename-property-_aria-label-to-_label": true,
391
+ "kol-link-group-rename-property-_heading-to-_label": true,
392
+ "kol-link-move-innerText-to-property-_label": true,
184
393
  "kol-link-remove-property-_aria-controls": true,
185
394
  "kol-link-remove-property-_aria-expanded": true,
186
395
  "kol-link-remove-property-_aria-label": true,
187
396
  "kol-link-remove-property-_aria-selected": true,
188
397
  "kol-link-remove-property-_disabled": true,
189
- "kol-link-remove-property-_icon-align": true,
190
398
  "kol-link-remove-property-_selector": true,
191
399
  "kol-link-remove-property-_stealth": true,
192
400
  "kol-link-remove-property-_use-case": true,
@@ -194,69 +402,74 @@ You can configure the migration with the `.kolibri.config.json` file in your pro
194
402
  "kol-link-rename-property-_icon-only-to-_hide-label": true,
195
403
  "kol-link-rename-property-_icon-to-_icons": true,
196
404
  "kol-logo-rename-property-_abbr-to-_org": true,
405
+ "kol-modal-remove-property-_active-element": true,
197
406
  "kol-modal-rename-property-_aria-label-to-_label": true,
407
+ "kol-nav-remove-property-_has-compact-button": true,
198
408
  "kol-nav-remove-property-_variant": true,
199
409
  "kol-nav-rename-property-_aria-label-to-_label": true,
200
410
  "kol-nav-rename-property-_compact-to-_hide-label": true,
201
411
  "kol-pagination-rename-property-_count-to-_total": true,
202
412
  "kol-pagination-rename-property-_total-to-_max": true,
413
+ "kol-popover-button-remove-property-_id": true,
203
414
  "kol-progress-rename-property-_type-to-_variant": true,
204
415
  "kol-quote-rename-property-_caption-to-_label": true,
416
+ "kol-select-move-innerText-to-property-_label": true,
417
+ "kol-select-refactor-property-error-to-msg": true,
418
+ "kol-select-remove-property-_alert": true,
419
+ "kol-select-remove-property-_id": true,
420
+ "kol-select-remove-property-_size": true,
205
421
  "kol-select-rename-property-_height-to-_rows": true,
422
+ "kol-select-rename-property-_hide-error-to-_hide-msg": true,
206
423
  "kol-select-rename-property-_icon-to-_icons": true,
207
424
  "kol-select-rename-property-_list-to-_options": true,
208
- "kol-select-remove-property-_size": true,
425
+ "kol-single-select-refactor-property-error-to-msg": true,
426
+ "kol-single-select-remove-property-_alert": true,
427
+ "kol-single-select-remove-property-_id": true,
428
+ "kol-single-select-rename-property-_hide-error-to-_hide-msg": true,
209
429
  "kol-skip-nav-rename-property-_aria-label-to-_label": true,
210
430
  "kol-span-rename-property-_icon-only-to-_hide-label": true,
211
431
  "kol-span-rename-property-_icon-to-_icons": true,
212
- "kol-split-button-remove-property-_aria-label": true,
213
432
  "kol-split-button-remove-property-_access-key": true,
214
- "kol-split-button-remove-property-_show-dropdown": true,
433
+ "kol-split-button-remove-property-_aria-label": true,
434
+ "kol-split-button-remove-property-_id": true,
215
435
  "kol-split-button-remove-property-_show": true,
436
+ "kol-split-button-remove-property-_show-dropdown": true,
216
437
  "kol-symbol-rename-property-_aria-label-to-_label": true,
217
438
  "kol-table-rename-property-_caption-to-_label": true,
218
439
  "kol-tabs-rename-property-_aria-label-to-_label": true,
440
+ "kol-tabs-rename-property-_icon-only-to-_hide-label": true,
219
441
  "kol-tabs-rename-property-_icon-to-_icons": true,
220
442
  "kol-tabs-rename-property-_tab-align-to-_align": true,
221
- "kol-tabs-rename-property-_icon-only-to-_hide-label": true,
443
+ "kol-textarea-move-innerText-to-property-_label": true,
444
+ "kol-textarea-refactor-property-error-to-msg": true,
445
+ "kol-textarea-remove-property-_alert": true,
446
+ "kol-textarea-remove-property-_id": true,
447
+ "kol-textarea-rename-property-_hide-error-to-_hide-msg": true,
448
+ "kol-textarea-update-property-_resize-value-both-to-vertical": true,
449
+ "kol-textarea-update-property-_resize-value-horizontal-to-none": true,
222
450
  "kol-toast-remove-property-_show-duration": true,
223
451
  "kol-toast-rename-property-_heading-to-_label": true,
452
+ "kol-tooltip-remove-property-_id": true,
224
453
  "kol-version-rename-property-_version-to-_label": true,
225
- "kol-heading-move-innerText-to-property-_label": true,
226
- "kol-input-checkbox-move-innerText-to-property-_label": true,
227
- "kol-input-color-move-innerText-to-property-_label": true,
228
- "kol-input-date-move-innerText-to-property-_label": true,
229
- "kol-input-email-move-innerText-to-property-_label": true,
230
- "kol-input-file-move-innerText-to-property-_label": true,
231
- "kol-input-number-move-innerText-to-property-_label": true,
232
- "kol-input-password-move-innerText-to-property-_label": true,
233
- "kol-input-radio-move-innerText-to-property-_label": true,
234
- "kol-input-range-move-innerText-to-property-_label": true,
235
- "kol-input-text-move-innerText-to-property-_label": true,
236
- "kol-link-move-innerText-to-property-_label": true,
237
- "kol-select-move-innerText-to-property-_label": true,
238
- "kol-textarea-move-innerText-to-property-_label": true,
239
- "kol-accordion-mark-removed-slot-header": true,
240
- "kol-card-mark-removed-slot-footer": true,
241
- "kol-card-mark-removed-slot-header": true,
242
- "kol-accordion-rename-slot-content-to-": true,
243
- "kol-card-rename-slot-content-to-": true,
454
+ "merge-html-codicon-in-index.html": true,
455
+ "package.json-reconfigure-scripts.prepare": true,
456
+ "refactor-property-icon-align": true,
244
457
  "refactor-property-label-replace-false": true,
245
- "kol-card-remove-property-_has-footer": true,
246
- "kol-link-group-remove-property-_level": true,
247
458
  "remove--cpy-cli,rimraf": true,
248
- "add--cpy-cli,rimraf": true,
249
- "package.json-reconfigure-scripts.prepare": true,
459
+ "remove-msg-props": true,
250
460
  "remove-public/assets/codicons": true,
251
- "exec-npx cpy \"node_modules/@public-ui/components/assets/**/*\" \"undefined/assets\" --dot": true,
252
- "kol-button-link-remove-property-_access-key": true,
253
- "kol-button-remove-property-_access-key": true,
254
- "kol-nav-remove-property-_has-compact-button": true
461
+ "remove-toast-variant-^4": true,
462
+ "remove-toaster-get-instance-options-^4": true,
463
+ "rename-tag-name-kol-table-to-kol-table-stateful": true,
464
+ "toaster-rename-properties": true,
465
+ "vscode-settings-reconfigure-html.customData": true
255
466
  }
256
467
  }
257
468
  }
258
469
  ```
259
470
 
471
+ > The `exec-npx cpy` task copies the packaged component assets into your project's `public/assets` folder; leave it enabled unless your build already handles asset copying in a different location.
472
+
260
473
  ## Troubleshooting
261
474
 
262
475
  If the migration failed, you can reset the migration with `git reset --hard HEAD~1`.
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = default_1;
4
+ const components_1 = require("@public-ui/components");
5
+ const scss_1 = require("typed-bem/scss");
6
+ /**
7
+ * This function is used to register the scss generator command.
8
+ * @param {Command} program The program object to register the command
9
+ */
10
+ function default_1(program) {
11
+ program
12
+ .command('generate-scss')
13
+ .description('Generate SCSS files with BEM selectors for KoliBri components (experimental).')
14
+ .action(() => {
15
+ (0, scss_1.generateBemScssFile)(components_1.BEM_ALERT, 'alert');
16
+ (0, scss_1.generateBemScssFile)(components_1.BEM_ICON, 'icon');
17
+ });
18
+ }
package/dist/index.js CHANGED
@@ -6,24 +6,24 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  const commander_1 = require("commander");
8
8
  const gradient_string_1 = __importDefault(require("gradient-string"));
9
+ const generate_scss_1 = __importDefault(require("./generate-scss"));
9
10
  const info_1 = __importDefault(require("./info"));
10
11
  const migrate_1 = __importDefault(require("./migrate"));
11
12
  const reuse_1 = require("./migrate/shares/reuse");
12
13
  const versionOfPublicUiKoliBriCli = (0, reuse_1.getVersionOfPublicUiKoliBriCli)();
13
- const banner = gradient_string_1.default.atlas.multiline(`
14
+ const banner = (0, gradient_string_1.default)(['red', 'green'], { interpolation: 'hsv', hsvSpin: 'long' }).multiline(`
14
15
  ,--. ,--. ,--. ,--. ,-----. ,--.
15
16
  | .' / ,---. | | \`--' | |) /_ ,--.--. \`--'
16
17
  | . ' | .-. | | | ,--. | .-. \\ | .--' ,--.
17
18
  | |\\ \\ | '-' | | | | | | '--' / | | | |
18
19
  \`--' \`--´ \`---´ \`--' \`--' \`------´ \`--' \`--'
19
20
  🚹 The accessible HTML-Standard | 👉 https://public-ui.github.io | ${versionOfPublicUiKoliBriCli}
20
- `, {
21
- interpolation: 'hsv',
22
- });
21
+ `);
23
22
  console.log(banner);
24
23
  const program = new commander_1.Command();
25
24
  program.name('kolibri').description('CLI for executing some helpful commands for KoliBri projects.').version(versionOfPublicUiKoliBriCli);
26
25
  // Add commands
26
+ (0, generate_scss_1.default)(program);
27
27
  (0, info_1.default)(program);
28
28
  (0, migrate_1.default)(program);
29
- program.parse();
29
+ void program.parseAsync();
@@ -4,16 +4,29 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.default = default_1;
7
- const os_1 = __importDefault(require("os"));
8
7
  const child_process_1 = require("child_process");
9
- const path_1 = __importDefault(require("path"));
10
8
  const fs_1 = __importDefault(require("fs"));
9
+ const os_1 = __importDefault(require("os"));
10
+ const path_1 = __importDefault(require("path"));
11
11
  // Function to get the binary version
12
12
  const getBinaryVersion = (command) => {
13
13
  try {
14
+ // For yarn, use a temporary directory to prevent package.json modification
15
+ // Yarn with Corepack automatically adds packageManager field when executed
16
+ if (command === 'yarn') {
17
+ const originalCwd = process.cwd();
18
+ const tmpDir = os_1.default.tmpdir();
19
+ process.chdir(tmpDir);
20
+ try {
21
+ return (0, child_process_1.execSync)(`${command} --version`, { encoding: 'utf8' }).trim();
22
+ }
23
+ finally {
24
+ process.chdir(originalCwd);
25
+ }
26
+ }
14
27
  return (0, child_process_1.execSync)(`${command} --version`, { encoding: 'utf8' }).trim();
15
28
  }
16
- catch (_a) {
29
+ catch {
17
30
  return 'N/A';
18
31
  }
19
32
  };
@@ -36,16 +49,16 @@ const getRelevantPackagesInfo = () => {
36
49
  const packageJson = JSON.parse(fs_1.default.readFileSync(packageJsonPath, 'utf8'));
37
50
  const packagePattern = /^@public-ui\//;
38
51
  const packagesInfo = {};
39
- const allDependencies = Object.assign(Object.assign({}, packageJson === null || packageJson === void 0 ? void 0 : packageJson.dependencies), packageJson === null || packageJson === void 0 ? void 0 : packageJson.devDependencies);
52
+ const allDependencies = { ...packageJson?.dependencies, ...packageJson?.devDependencies };
40
53
  Object.keys(allDependencies).forEach((pkg) => {
41
54
  if (packagePattern.test(pkg)) {
42
- packagesInfo[pkg] = allDependencies === null || allDependencies === void 0 ? void 0 : allDependencies[pkg];
55
+ packagesInfo[pkg] = allDependencies?.[pkg];
43
56
  }
44
57
  });
45
58
  // Add specific packages not matching the pattern
46
59
  const additionalPackages = ['react', 'react-dom', 'typescript'];
47
60
  additionalPackages.forEach((pkg) => {
48
- packagesInfo[pkg] = (allDependencies === null || allDependencies === void 0 ? void 0 : allDependencies[pkg]) || 'N/A';
61
+ packagesInfo[pkg] = allDependencies?.[pkg] || 'N/A';
49
62
  });
50
63
  return packagesInfo;
51
64
  };
@@ -15,8 +15,10 @@ const task_runner_1 = require("./runner/task-runner");
15
15
  const tasks_1 = require("./runner/tasks");
16
16
  const test_1 = require("./runner/tasks/test");
17
17
  const v1_1 = require("./runner/tasks/v1");
18
- const v2_1 = require("./runner/tasks/v2");
19
18
  const assets_1 = require("./runner/tasks/v1/assets");
19
+ const v2_1 = require("./runner/tasks/v2");
20
+ const v3_1 = require("./runner/tasks/v3");
21
+ const v4_1 = require("./runner/tasks/v4");
20
22
  const reuse_1 = require("./shares/reuse");
21
23
  const types_1 = require("./types");
22
24
  const currentVersionOfPublicUi = (0, reuse_1.getVersionOfPublicUiComponents)();
@@ -61,6 +63,12 @@ Current version of @public-ui/*: ${options.overwriteCurrentVersion}
61
63
  Target version of @public-ui/*: ${options.overwriteTargetVersion}
62
64
  Source folder to migrate: ${baseDir}
63
65
  `);
66
+ if (!fs_1.default.existsSync(baseDir)) {
67
+ throw (0, reuse_1.logAndCreateError)(`The specified source folder "${baseDir}" does not exist or is inaccessible. Please check the path and try again.`);
68
+ }
69
+ if (!(0, reuse_1.hasKoliBriTags)(baseDir)) {
70
+ console.log(chalk_1.default.yellow(`No KoliBri components (web or React) found under "${baseDir}". Check the path or your task configuration.`));
71
+ }
64
72
  if (!options.ignoreGreaterVersion && semver_1.default.lt(options.overwriteTargetVersion, options.overwriteCurrentVersion)) {
65
73
  throw (0, reuse_1.logAndCreateError)('Your current version of @public-ui/components is greater than the version of @public-ui/kolibri-cli. Please update @public-ui/kolibri-cli or force the migration with --ignore-greater-version.');
66
74
  }
@@ -78,6 +86,8 @@ Source folder to migrate: ${baseDir}
78
86
  runner.registerTasks(tasks_1.commonTasks);
79
87
  runner.registerTasks(v1_1.v1Tasks);
80
88
  runner.registerTasks(v2_1.v2Tasks);
89
+ runner.registerTasks(v3_1.v3Tasks);
90
+ runner.registerTasks(v4_1.v4Tasks);
81
91
  runner.registerTasks((0, assets_1.getAssetTasks)(baseDir));
82
92
  if (options.testTasks) {
83
93
  runner.registerTasks(test_1.testTasks);
@@ -143,14 +153,16 @@ Source folder to migrate: ${baseDir}
143
153
  * Prints the status of the task runner and the modified files.
144
154
  */
145
155
  function finish() {
146
- var _a, _b;
147
156
  console.log(`
148
157
  Status of all executed Tasks:`);
149
158
  const status = runner.getStatus(true);
150
159
  // Merge config with current config of Runner
151
160
  config = {
152
161
  migrate: {
153
- tasks: Object.assign(Object.assign({}, (_a = status.config.migrate) === null || _a === void 0 ? void 0 : _a.tasks), (_b = config.migrate) === null || _b === void 0 ? void 0 : _b.tasks),
162
+ tasks: {
163
+ ...status.config.migrate?.tasks,
164
+ ...config.migrate?.tasks,
165
+ },
154
166
  },
155
167
  };
156
168
  fs_1.default.writeFileSync(configFile, JSON.stringify(config, null, 2));
@@ -159,6 +171,9 @@ Modified files: ${reuse_1.MODIFIED_FILES.size}`);
159
171
  reuse_1.MODIFIED_FILES.forEach((file) => {
160
172
  console.log(`- ${file}`);
161
173
  });
174
+ if (reuse_1.MODIFIED_FILES.size === 0) {
175
+ console.log(chalk_1.default.yellow(`No files were modified. Verify the folder "${baseDir}" or check your .kolibri.config.json tasks.`));
176
+ }
162
177
  if (reuse_1.MODIFIED_FILES.size > 0 && options.format) {
163
178
  console.log(`
164
179
  We try to format the modified files with prettier...`);