Skip to content

Commit 90da4b9

Browse files
tw15eganfrancineluccaandreancardona
authored
fix(upgrade): add size prop codemods to upgrade package (#14089)
Co-authored-by: Francine Lucca <40550942+francinelucca@users.noreply.github.com> Co-authored-by: Andrea N. Cardona <cardona.n.andrea@gmail.com>
1 parent 033ecc7 commit 90da4b9

1 file changed

Lines changed: 54 additions & 0 deletions

File tree

packages/upgrade/src/upgrades.js

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,60 @@ export const upgrades = [
175175
});
176176
},
177177
},
178+
{
179+
name: 'size-prop-update',
180+
description: 'Updates xl sized components to lg',
181+
migrate: async (options) => {
182+
const transform = path.join(TRANSFORM_DIR, 'size-prop-update.js');
183+
const paths =
184+
Array.isArray(options.paths) && options.paths.length > 0
185+
? options.paths
186+
: await glob(['**/*.js', '**/*.jsx'], {
187+
cwd: options.workspaceDir,
188+
ignore: [
189+
'**/es/**',
190+
'**/lib/**',
191+
'**/umd/**',
192+
'**/node_modules/**',
193+
'**/storybook-static/**',
194+
],
195+
});
196+
197+
await run({
198+
dry: !options.write,
199+
transform,
200+
paths,
201+
verbose: options.verbose,
202+
});
203+
},
204+
},
205+
{
206+
name: 'small-to-size-prop',
207+
description: 'Update usage of small prop to size="sm"',
208+
migrate: async (options) => {
209+
const transform = path.join(TRANSFORM_DIR, 'small-to-size-prop.js');
210+
const paths =
211+
Array.isArray(options.paths) && options.paths.length > 0
212+
? options.paths
213+
: await glob(['**/*.js', '**/*.jsx'], {
214+
cwd: options.workspaceDir,
215+
ignore: [
216+
'**/es/**',
217+
'**/lib/**',
218+
'**/umd/**',
219+
'**/node_modules/**',
220+
'**/storybook-static/**',
221+
],
222+
});
223+
224+
await run({
225+
dry: !options.write,
226+
transform,
227+
paths,
228+
verbose: options.verbose,
229+
});
230+
},
231+
},
178232
{
179233
name: 'update-carbon-components-react-import-to-scoped',
180234
description:

0 commit comments

Comments
 (0)