@elliemae/ds-codemods 3.46.0-rc.9 → 3.46.0

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.
@@ -6,6 +6,8 @@ import {
6
6
  LEGACY_WITH_NEW_MEDIUM_MIGRATION_EFFORT,
7
7
  LEGACY_WITH_NEW_LARGE_MIGRATION_EFFORT,
8
8
  DISMISSED_WITH_EXAMPLE,
9
+ NEVER_INTENDED_FOR_EXTERNAL_USAGE,
10
+ DISMISSED_BEFORE_DEPRECATION_FLOWS_EXISTED,
9
11
  STORYPOINTS_TO_EFFORT,
10
12
  } from '../../../constants/index.mjs';
11
13
 
@@ -15,6 +17,8 @@ import {
15
17
  * | typeof LEGACY_WITH_NEW_LARGE_MIGRATION_EFFORT} deprecatedEffortMap
16
18
  * @typedef {deprecatedEffortMap[number]} deprecatedEffortMapEntry
17
19
  * @typedef {typeof DISMISSED_WITH_EXAMPLE[number]} dismissedWithExampleEntry
20
+ * @typedef {typeof NEVER_INTENDED_FOR_EXTERNAL_USAGE[number]} reportingUsageOfInternalOnlyEntry
21
+ * @typedef {typeof DISMISSED_BEFORE_DEPRECATION_FLOWS_EXISTED[number]} dismissedBeforeDeprecationFlowsExistedEntry
18
22
  *
19
23
  * @typedef { object } regexpInfo
20
24
  * @property { string } regexpInfo.fullMatch
@@ -30,10 +34,18 @@ import {
30
34
  * @typedef { object } matchDeprecatedEntryPropeties
31
35
  * @property { dismissedWithExampleEntry[] } matchDeprecatedEntryPropeties.matchingEffortsMetainfo
32
36
  *
37
+ * @typedef { object } matchInternalOnlyEntryPropeties
38
+ * @property { reportingUsageOfInternalOnlyEntry[] } matchInternalOnlyEntryPropeties.matchingEffortsMetainfo
39
+ *
40
+ * @typedef { object } matchDeprecatedBeforeDeprecationFlowsExistedEntryPropeties
41
+ * @property { dismissedBeforeDeprecationFlowsExistedEntry[] } matchDeprecatedBeforeDeprecationFlowsExistedEntryPropeties.matchingEffortsMetainfo
42
+ *
33
43
  * @typedef {matchSharedPropieties & matchWithEffortEntryPropeties} matchWithEffortMetaInfo
34
44
  * @typedef {matchSharedPropieties & matchDeprecatedEntryPropeties} matchDeprecatedWithExample
45
+ * @typedef {matchSharedPropieties & matchInternalOnlyEntryPropeties} matchInternalOnlyUsedExternally
46
+ * @typedef {matchSharedPropieties & matchDeprecatedBeforeDeprecationFlowsExistedEntryPropeties} matchDeprecatedBeforeDeprecationFlowsExisted
35
47
  *
36
- * @typedef {matchWithEffortMetaInfo | matchDeprecatedWithExample} matchedEffortMapValue
48
+ * @typedef {matchWithEffortMetaInfo | matchDeprecatedWithExample | matchInternalOnlyUsedExternally | matchDeprecatedBeforeDeprecationFlowsExisted} matchedEffortMapValue
37
49
  *
38
50
  * @typedef {Map<string, matchedEffortMapValue>} matchedEffortMap
39
51
  *
@@ -42,12 +54,14 @@ import {
42
54
  * @property {matchWithEffortMetaInfo} fileReport.deprecatedSmallEffort
43
55
  * @property {matchWithEffortMetaInfo} fileReport.deprecatedMediumEffort
44
56
  * @property {matchWithEffortMetaInfo} fileReport.deprecatedLargeEffort
45
- * @property {matchDeprecatedWithExample} fileReport.deprecatedDismissed
57
+ * @property {matchDeprecatedWithExample} fileReport.deprecatedWithExample
58
+ * @property {matchInternalOnlyUsedExternally} fileReport.reportingUsageOfInternalOnly
59
+ * @property {matchDeprecatedBeforeDeprecationFlowsExisted} fileReport.deprecatedBeforeDeprecationFlowsExisted
46
60
  *
47
61
  */
48
62
 
49
63
  const subStringAdhocDSMatcher = (str, substr) => {
50
- if (str === substr) return true;
64
+ if (str === substr || substr === '*') return true;
51
65
  const substrRegExp = substr.startsWith('@elliemae/ds-')
52
66
  ? new RegExp(`@\\belliemae\/ds-${substr.split('@elliemae/ds-')[1]}`, 'g')
53
67
  : new RegExp(`\\b${substr}\\b`, 'g');
@@ -189,11 +203,11 @@ export const checkDeprecatedLargeEffort = (importStatements) =>
189
203
  checkDeprecatedEffort(importStatements, LEGACY_WITH_NEW_LARGE_MIGRATION_EFFORT, 'large');
190
204
 
191
205
  /**
192
- * given a list of import statements, it checks if any of them is a large effort deprecation
206
+ * given a list of import statements, it checks if any of them is a deprecated with example effort
193
207
  * @param {string[][]} importStatements - list of import statements to check generated by the regex
194
208
  * @returns {Map<string, matchDeprecatedWithExample>} - a map of matched statements
195
209
  */
196
- export const checkDeprecatedDismissed = (importStatements) => {
210
+ export const checkDeprecatedWithExample = (importStatements) => {
197
211
  const matchedEfforts = new Map();
198
212
  importStatements.forEach((importStatement) => {
199
213
  const [fullMatch, importedComponent, packageName] = importStatement;
@@ -212,6 +226,54 @@ export const checkDeprecatedDismissed = (importStatements) => {
212
226
  return matchedEfforts;
213
227
  };
214
228
 
229
+ /**
230
+ * given a list of import statements, it checks if any of them is importing a component that was never intended for external usage
231
+ * @param {string[][]} importStatements - list of import statements to check generated by the regex
232
+ * @returns {Map<string, matchInternalOnlyUsedExternally>} - a map of matched statements
233
+ */
234
+ export const checkInternalUsageOnlyIntended = (importStatements) => {
235
+ const matchedEfforts = new Map();
236
+ importStatements.forEach((importStatement) => {
237
+ const [fullMatch, importedComponent, packageName] = importStatement;
238
+ const matchingDeprecations = NEVER_INTENDED_FOR_EXTERNAL_USAGE.filter(
239
+ (effortMetainfo) =>
240
+ subStringAdhocDSMatcher(importedComponent, effortMetainfo.component) &&
241
+ // {DSGroupBox} from 'ds-mobile' is not (yet) deprecated, DSGroupBox is a repeated component name, we need the extra package check
242
+ subStringAdhocDSMatcher(packageName, effortMetainfo.oldPackage),
243
+ );
244
+ if (matchingDeprecations.length < 1) return;
245
+ matchedEfforts.set(fullMatch, {
246
+ regexpInfo: { fullMatch, importedComponent, packageName },
247
+ matchingEffortsMetainfo: matchingDeprecations,
248
+ });
249
+ });
250
+ return matchedEfforts;
251
+ };
252
+
253
+ /**
254
+ * given a list of import statements, it checks if any of them is importing a component that was deprecated before the deprecation flows existed
255
+ * @param {string[][]} importStatements - list of import statements to check generated by the regex
256
+ * @returns {Map<string, matchDeprecatedBeforeDeprecationFlowsExisted>} - a map of matched statements
257
+ */
258
+ export const checkDeprecatedBeforeDeprecationFlowExisted = (importStatements) => {
259
+ const matchedEfforts = new Map();
260
+ importStatements.forEach((importStatement) => {
261
+ const [fullMatch, importedComponent, packageName] = importStatement;
262
+ const matchingDeprecations = DISMISSED_BEFORE_DEPRECATION_FLOWS_EXISTED.filter(
263
+ (effortMetainfo) =>
264
+ subStringAdhocDSMatcher(importedComponent, effortMetainfo.component) &&
265
+ // {DSGroupBox} from 'ds-mobile' is not (yet) deprecated, DSGroupBox is a repeated component name, we need the extra package check
266
+ subStringAdhocDSMatcher(packageName, effortMetainfo.oldPackage),
267
+ );
268
+ if (matchingDeprecations.length < 1) return;
269
+ matchedEfforts.set(fullMatch, {
270
+ regexpInfo: { fullMatch, importedComponent, packageName },
271
+ matchingEffortsMetainfo: matchingDeprecations,
272
+ });
273
+ });
274
+ return matchedEfforts;
275
+ };
276
+
215
277
  /**
216
278
  * given a file path, it checks if the file contains any deprecated components
217
279
  * @param {string} filePath - path to the file to check
@@ -224,20 +286,26 @@ export const checkFileForDeprecatedComponents = (filePath) => {
224
286
  const deprecatedSmallEffort = checkDeprecatedSmallEffort(importStatements);
225
287
  const deprecatedMediumEffort = checkDeprecatedMediumEffort(importStatements);
226
288
  const deprecatedLargeEffort = checkDeprecatedLargeEffort(importStatements);
227
- const deprecatedDismissed = checkDeprecatedDismissed(importStatements);
289
+ const deprecatedWithExample = checkDeprecatedWithExample(importStatements);
290
+ const reportingUsageOfInternalOnly = checkInternalUsageOnlyIntended(importStatements);
291
+ const deprecatedBeforeDeprecationFlowsExisted = checkDeprecatedBeforeDeprecationFlowExisted(importStatements);
228
292
 
229
293
  const isFileProblematic =
230
294
  deprecatedSmallEffort.size > 0 ||
231
295
  deprecatedMediumEffort.size > 0 ||
232
296
  deprecatedLargeEffort.size > 0 ||
233
- deprecatedDismissed.size > 0;
297
+ deprecatedWithExample.size > 0 ||
298
+ reportingUsageOfInternalOnly.size > 0 ||
299
+ deprecatedBeforeDeprecationFlowsExisted.size > 0;
234
300
 
235
301
  return {
236
302
  isFileProblematic,
237
303
  deprecatedSmallEffort,
238
304
  deprecatedMediumEffort,
239
305
  deprecatedLargeEffort,
240
- deprecatedDismissed,
306
+ deprecatedWithExample,
307
+ reportingUsageOfInternalOnly,
308
+ deprecatedBeforeDeprecationFlowsExisted,
241
309
  };
242
310
  };
243
311
 
@@ -276,7 +344,14 @@ const generateCsvRowFromMatchedEffort = (matchingEffortMetainfo, filePath, org,
276
344
  * @returns {string[]} - list of csv rows
277
345
  */
278
346
  export const generateCsvRows = (fileReport, filePath, org, repo) => {
279
- const { deprecatedSmallEffort, deprecatedMediumEffort, deprecatedLargeEffort, deprecatedDismissed } = fileReport;
347
+ const {
348
+ deprecatedSmallEffort,
349
+ deprecatedMediumEffort,
350
+ deprecatedLargeEffort,
351
+ deprecatedWithExample,
352
+ reportingUsageOfInternalOnly,
353
+ deprecatedBeforeDeprecationFlowsExisted,
354
+ } = fileReport;
280
355
  // csv structure = `Legacy Component,${options.org ? 'Org,' : ''}${options.repo ? 'Repository,' : ''}Legacy Package,Filename,File Path,Effort Size,Story Points`
281
356
  // Legacy Component -> matchingEffortMetainfo.component
282
357
  // Legacy Package -> matchingEffortMetainfo.oldPackage
@@ -304,7 +379,21 @@ export const generateCsvRows = (fileReport, filePath, org, repo) => {
304
379
  });
305
380
  });
306
381
 
307
- deprecatedDismissed.forEach((effort) => {
382
+ deprecatedWithExample.forEach((effort) => {
383
+ const { matchingEffortsMetainfo } = effort;
384
+ matchingEffortsMetainfo.forEach((effort) => {
385
+ csvRows.push(generateCsvRowFromMatchedEffort(effort, filePath, org, repo));
386
+ });
387
+ });
388
+
389
+ reportingUsageOfInternalOnly.forEach((effort) => {
390
+ const { matchingEffortsMetainfo } = effort;
391
+ matchingEffortsMetainfo.forEach((effort) => {
392
+ csvRows.push(generateCsvRowFromMatchedEffort(effort, filePath, org, repo));
393
+ });
394
+ });
395
+
396
+ deprecatedBeforeDeprecationFlowsExisted.forEach((effort) => {
308
397
  const { matchingEffortsMetainfo } = effort;
309
398
  matchingEffortsMetainfo.forEach((effort) => {
310
399
  csvRows.push(generateCsvRowFromMatchedEffort(effort, filePath, org, repo));
@@ -222,6 +222,11 @@ export const LEGACY_WITH_NEW_SMALL_MIGRATION_EFFORT = [
222
222
  tags:[ SEVERITY_TAGS.A11Y_LIMITATIONS ], storyPoints: "50",
223
223
  },
224
224
 
225
+ { component: 'comboboxfreesolo', oldPackage: '@elliemae/ds-form',
226
+ newComponent: 'DSComboBoxV3', newPackage: '@elliemae/ds-controlled-form',
227
+ tags:[ SEVERITY_TAGS.A11Y_LIMITATIONS ], storyPoints: "50",
228
+ },
229
+
225
230
  { component: 'DSPill', oldPackage: '@elliemae/ds-pills',
226
231
  newComponent: 'DSPillV2', newPackage: '@elliemae/ds-pills-v2',
227
232
  tags:[ SEVERITY_TAGS.A11Y_LIMITATIONS ], storyPoints: "50",
@@ -331,11 +336,6 @@ export const LEGACY_WITH_NEW_MEDIUM_MIGRATION_EFFORT = [
331
336
  newComponent: 'DSDropzone', newPackage: '@elliemae/ds-dropzone',
332
337
  tags:[ SEVERITY_TAGS.A11Y_LIMITATIONS ], storyPoints: "250",
333
338
  },
334
-
335
- { component: 'DSZipCodeSearch', oldPackage: '@elliemae/ds-zipcode-search',
336
- newComponent: 'DSAutocomplete', newPackage: '@elliemae/ds-form-layout-autocomplete',
337
- tags:[ SEVERITY_TAGS.A11Y_LIMITATIONS ], storyPoints: "250",
338
- },
339
339
  ]
340
340
 
341
341
  /* prettier-ignore */
@@ -349,13 +349,8 @@ export const LEGACY_WITH_NEW_LARGE_MIGRATION_EFFORT = [
349
349
  newComponent: 'DataTable', newPackage: '@elliemae/ds-data-table',
350
350
  tags:[ SEVERITY_TAGS.A11Y_LIMITATIONS ], storyPoints: "500",
351
351
  },
352
- { component: 'DSDataGrid', oldPackage: '@elliemae/ds-datagrids',
353
- newComponent: 'DataTable', newPackage: '@elliemae/ds-data-table',
354
- tags:[ SEVERITY_TAGS.A11Y_LIMITATIONS ], storyPoints: "500",
355
- },
356
352
  ];
357
353
 
358
- // all of those are considered LOW effort
359
354
  /**
360
355
  * @type {DeprecatedPackageMatch[]}
361
356
  */
@@ -412,6 +407,45 @@ export const DISMISSED_WITH_EXAMPLE = [
412
407
  { component: 'DSZoom', oldPackage: '@elliemae/ds-zoom',
413
408
  storyPoints: "300",
414
409
  },
410
+ { component: '*', oldPackage: '@elliemae/ds-popover',
411
+ storyPoints: "300",
412
+ },
413
+ { component: '*', oldPackage: '@elliemae/ds-popper',
414
+ storyPoints: "300",
415
+ },
416
+ ];
417
+ /**
418
+ * @type {DeprecatedPackageMatch[]}
419
+ */
420
+ /* prettier-ignore */
421
+ export const NEVER_INTENDED_FOR_EXTERNAL_USAGE = [
422
+ { component: '*', oldPackage: '@elliemae/ds-overlay',
423
+ storyPoints: "50",
424
+ },
425
+ { component: '*', oldPackage: '@elliemae/ds-shared',
426
+ storyPoints: "150",
427
+ },
428
+ { component: '*', oldPackage: '@elliemae/ds-classnames',
429
+ storyPoints: "500",
430
+ },
431
+ { component: '*', oldPackage: '@elliemae/ds-common',
432
+ storyPoints: "150",
433
+ },
434
+ { component: '*', oldPackage: '@elliemae/ds-portal',
435
+ storyPoints: "50",
436
+ },
437
+ { component: '*', oldPackage: '@elliemae/ds-scrollable-container',
438
+ storyPoints: "50",
439
+ },
440
+ ];
441
+ /**
442
+ * @type {DeprecatedPackageMatch[]}
443
+ */
444
+ /* prettier-ignore */
445
+ export const DISMISSED_BEFORE_DEPRECATION_FLOWS_EXISTED = [
446
+ { component: '*', oldPackage: '@elliemae/ds-imagelibrarymodal',
447
+ storyPoints: "300",
448
+ },
415
449
  ];
416
450
 
417
451
  /* prettier-ignore */
@@ -4,5 +4,7 @@ export {
4
4
  LEGACY_WITH_NEW_MEDIUM_MIGRATION_EFFORT,
5
5
  LEGACY_WITH_NEW_LARGE_MIGRATION_EFFORT,
6
6
  DISMISSED_WITH_EXAMPLE,
7
+ NEVER_INTENDED_FOR_EXTERNAL_USAGE,
8
+ DISMISSED_BEFORE_DEPRECATION_FLOWS_EXISTED,
7
9
  STORYPOINTS_TO_EFFORT,
8
10
  } from './deprecatedPackages.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/ds-codemods",
3
- "version": "3.46.0-rc.9",
3
+ "version": "3.46.0",
4
4
  "license": "MIT",
5
5
  "description": "ICE MT - Dimsum - Code Mods",
6
6
  "files": [