@elliemae/ds-codemods 3.28.1-rc.2 → 3.29.0-next.2

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.
@@ -19,7 +19,8 @@ function parseArgumentsIntoOptions(rawArgs) {
19
19
  // for arg Boolean are either true or undefined.
20
20
  '--debug': Boolean,
21
21
  '--append': Boolean,
22
- '--codebaseName': String,
22
+ '--org': String,
23
+ '--repo': String,
23
24
  '--fileExtensions': String,
24
25
  },
25
26
  {
@@ -38,7 +39,8 @@ function parseArgumentsIntoOptions(rawArgs) {
38
39
  debug: args['--debug'], // CLI flag, not available as a question.
39
40
  fileExtensions: args['--fileExtensions'], // CLI flag, not available as a question.
40
41
  append: args['--append'], // CLI flag, not available as a question.
41
- codebaseName: args['--codebaseName'], // CLI flag, not available as a question.
42
+ org: args['--org'], // CLI flag, not available as a question.
43
+ repo: args['--repo'], // CLI flag, not available as a question.
42
44
  gitIgnorePath: args['--gitIgnorePath'],
43
45
  script: args._[0],
44
46
  };
@@ -22,13 +22,15 @@ export const getDeprecatedUsageReportQuestions = (originalOptions) => {
22
22
  type: 'input',
23
23
  name: 'gitIgnorePath',
24
24
  message:
25
- 'Please provide the path to the .gitignore file (if a non-matching path is provided, node_modules, dist and build will be ignored)',
25
+ 'Please provide the path to the .gitignore file' +
26
+ '(if a non-matching path is provided, node_modules, dist and build will be ignored)',
26
27
  default: './.gitignore',
27
28
  });
28
29
  }
29
30
  // --debug is a CLI flag, not available as a question.
30
31
  // --append is a CLI flag, not available as a question.
31
- // --codebaseName is a CLI flag, not available as a question.
32
+ // --org is a CLI flag, not available as a question.
33
+ // --repo is a CLI flag, not available as a question.
32
34
 
33
35
  return extraOptions;
34
36
  };
@@ -8,7 +8,8 @@ import { generateCsvRows, checkFileForDeprecatedComponents } from './utils.mjs';
8
8
  * @param {string} options.outputPath - path to the .csv file to write the report to
9
9
  * @param {string} options.startingDirPath - path to the project root directory (where node_modules folder lives)
10
10
  * @param {string} options.gitIgnorePath - path to the .gitignore file
11
- * @param {string} options.codebaseName - optional codebaseName, if present an extra column will be added to the report
11
+ * @param {string} options.org - optional org, if present an extra column will be added to the report
12
+ * @param {string} options.repo - optional repo, if present an extra column will be added to the report
12
13
  * @param {boolean} options.debug - debug flag
13
14
  * @param {boolean} options.append - whether to append to the file or override it
14
15
  *
@@ -22,10 +23,14 @@ export const deprecatedComponentsUsageReport = (options) => {
22
23
  // in case we want to expand it in the future we can store it in the map...
23
24
  // const problematicFiles = new Map();
24
25
 
26
+ // "Org(?),Legacy Component,Repository(?),Legacy Package,Filename,File Path,Effort Size,Story Points"
25
27
  let csvRows = [
26
- `${
27
- options.codebaseName ? 'Codebase Name,' : ''
28
- }Legacy Component,Legacy Package,Filename,File Path,Effort Size,Story Points`,
28
+ // eslint-disable-next-line prettier/prettier
29
+ `Legacy Component,${
30
+ options.org ? 'Org,' : ''
31
+ }${
32
+ options.repo ? 'Repository,' : ''
33
+ }Legacy Package,Filename,File Path,Effort Size,Story Points`,
29
34
  ];
30
35
  filesToParse.forEach((filePath) => {
31
36
  const fileReport = checkFileForDeprecatedComponents(filePath);
@@ -33,7 +38,7 @@ export const deprecatedComponentsUsageReport = (options) => {
33
38
  // we have a lot more info than the one we use in the csv,
34
39
  // in case we want to expand it in the future we can store it in the map...
35
40
  // problematicFiles.set(filePath, fileReport);
36
- csvRows.push(...generateCsvRows(fileReport, filePath, options.codebaseName));
41
+ csvRows.push(...generateCsvRows(fileReport, filePath, options.org, options.repo));
37
42
  }
38
43
  });
39
44
  if (!append) {
@@ -1,6 +1,4 @@
1
- /* eslint-disable max-lines */
2
- /* eslint-disable max-statements */
3
- /* eslint-disable max-len */
1
+ /* eslint-disable max-params, max-lines, max-statements, max-len */
4
2
  import fs from 'fs';
5
3
  import { dimsumImportStatementsRegExp } from './regexp.mjs';
6
4
  import {
@@ -207,11 +205,12 @@ export const checkFileForDeprecatedComponents = (filePath) => {
207
205
  * Helper function to generate a csv row from a "matched effort" object
208
206
  * @param {matchedEffortMapValue} matchedEffort
209
207
  * @param {string} filePath
210
- * @param {string} codebaseName - optional, if present an extra column will be added to the report
208
+ * @param {string} org - optional, if present an extra column will be added to the report
209
+ * @param {string} repo - optional, if present an extra column will be added to the report
211
210
  * @returns {string} - csv row
212
211
  */
213
- const generateCsvRowFromMatchedEffort = (matchedEffort, filePath, codebaseName) => {
214
- // `${options.codebaseName ? 'Codebase Name,' : ''}Legacy Component,Legacy Package,Filename,File Path,Effort Size,Story Points`
212
+ const generateCsvRowFromMatchedEffort = (matchedEffort, filePath, org, repo) => {
213
+ // "Legacy Component,Org(?),Repository(?),Legacy Package,Filename,File Path,Effort Size,Story Points"
215
214
  const { matchingEffortMetainfo } = matchedEffort;
216
215
  // matchingEffortMetainfo type is deprecatedEffortMapEntry | dismissedWithExampleEntry
217
216
  // they share 'component' and 'oldPackage' properties and for the current use case we only care about those
@@ -224,20 +223,21 @@ const generateCsvRowFromMatchedEffort = (matchedEffort, filePath, codebaseName)
224
223
  const latestMatchingFolderIndx = pathFolders.findIndex((folder, indx) => folder !== cwdFolders[indx]);
225
224
  const filePathFolders = pathFolders.slice(latestMatchingFolderIndx);
226
225
  const reducedFilePath = filePathFolders.join('/');
227
- return `${
228
- codebaseName ? `${codebaseName},` : ''
229
- }${component},${oldPackage},${filename},${reducedFilePath},${tshirt},${storyPoints}`;
226
+ return `${component},${org ? `${org},` : ''}${
227
+ repo ? `${repo},` : ''
228
+ }${oldPackage},${filename},${reducedFilePath},${tshirt},${storyPoints}`;
230
229
  };
231
230
  /**
232
231
  * Helper function to generate a list of csv rows from a given file report
233
232
  * @param {fileReport} fileReport
234
233
  * @param {string} filePath
235
- * @param {string} codebaseName - optional, if present an extra column will be added to the report
234
+ * @param {string} org - optional, if present an extra column will be added to the report
235
+ * @param {string} repo - optional, if present an extra column will be added to the report
236
236
  * @returns {string[]} - list of csv rows
237
237
  */
238
- export const generateCsvRows = (fileReport, filePath, codebaseName) => {
238
+ export const generateCsvRows = (fileReport, filePath, org, repo) => {
239
239
  const { deprecatedSmallEffort, deprecatedMediumEffort, deprecatedLargeEffort, deprecatedDismissed } = fileReport;
240
- // csv structure = 'Legacy Component,Legacy Package,Filename,File Path'
240
+ // csv structure = `Legacy Component,${options.org ? 'Org,' : ''}${options.repo ? 'Repository,' : ''}Legacy Package,Filename,File Path,Effort Size,Story Points`
241
241
  // Legacy Component -> matchingEffortMetainfo.component
242
242
  // Legacy Package -> matchingEffortMetainfo.oldPackage
243
243
  // Filename -> filePath last part
@@ -246,17 +246,17 @@ export const generateCsvRows = (fileReport, filePath, codebaseName) => {
246
246
  // this is not a perfect "detect the root" solution, but should work in our CI/CD pipeline
247
247
  const csvRows = [];
248
248
  deprecatedSmallEffort.forEach((effort) => {
249
- csvRows.push(generateCsvRowFromMatchedEffort(effort, filePath, codebaseName));
249
+ csvRows.push(generateCsvRowFromMatchedEffort(effort, filePath, org, repo));
250
250
  });
251
251
  deprecatedMediumEffort.forEach((effort) => {
252
- csvRows.push(generateCsvRowFromMatchedEffort(effort, filePath, codebaseName));
252
+ csvRows.push(generateCsvRowFromMatchedEffort(effort, filePath, org, repo));
253
253
  });
254
254
  deprecatedLargeEffort.forEach((effort) => {
255
- csvRows.push(generateCsvRowFromMatchedEffort(effort, filePath, codebaseName));
255
+ csvRows.push(generateCsvRowFromMatchedEffort(effort, filePath, org, repo));
256
256
  });
257
257
 
258
258
  deprecatedDismissed.forEach((effort) => {
259
- csvRows.push(generateCsvRowFromMatchedEffort(effort, filePath, codebaseName));
259
+ csvRows.push(generateCsvRowFromMatchedEffort(effort, filePath, org, repo));
260
260
  });
261
261
 
262
262
  return csvRows;
@@ -296,6 +296,11 @@ export const LEGACY_WITH_NEW_MEDIUM_MIGRATION_EFFORT = [
296
296
  newComponent: 'DSInputText', newPackage: '@elliemae/ds-controlled-form',
297
297
  tags:[ SEVERITY_TAGS.A11Y_LIMITATIONS ], storyPoints: "250",
298
298
  },
299
+
300
+ { component: 'DSSlider', oldPackage: '@elliemae/ds-slider',
301
+ newComponent: 'DSSliderV2', newPackage: '@elliemae/ds-slider-v2',
302
+ tags:[ SEVERITY_TAGS.A11Y_LIMITATIONS ], storyPoints: "250",
303
+ },
299
304
  ]
300
305
 
301
306
  /* prettier-ignore */
@@ -356,9 +361,9 @@ export const DISMISSED_WITH_EXAMPLE = [
356
361
  export const STORYPOINTS_TO_EFFORT = {
357
362
  50: { tshirt: 'SMALL' },
358
363
  100: { tshirt: 'SMALL' },
359
- 150: { tshirt: 'MEDIUM' },
364
+ 150: { tshirt: 'SMALL' },
360
365
  200: { tshirt: 'MEDIUM' },
361
- 250: { tshirt: 'LARGE' },
366
+ 250: { tshirt: 'MEDIUM' },
362
367
  300: { tshirt: 'LARGE' },
363
368
  500: { tshirt: 'EXTRA-LARGE' },
364
369
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/ds-codemods",
3
- "version": "3.28.1-rc.2",
3
+ "version": "3.29.0-next.2",
4
4
  "license": "MIT",
5
5
  "description": "ICE MT - Dimsum - Code Mods",
6
6
  "files": [