Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: printreport Sort by item.num #77

Merged
merged 9 commits into from
Dec 28, 2021
Merged

Conversation

chinanf-boy
Copy link
Contributor

add sort feat to reportList inside printReport

function printReport (dir: string, beginTime: number) {
  cliInstance.update(cliInstance.total, { doSomething: 'All done!' });
  cliInstance.stop()
  console.log('conversion items successful converted:')
  // sort feat
  _sortByNum(reportList)

  reportList.forEach(item => {
    tabDt.push([item.num, item.feat, item.times?.toString()])
  })
  1. sort by item.num first char;
  2. then, if first char Equal, sory by item.num after first char

Test to vue-manage-system

  • conversion.log
--------------------------------------------------
conversion items successful conversion: 

╔════════╤═══════════════════════════╤══════════════════╗
║ Number │ Conversion item           │ Conversion count ║
╟────────┼───────────────────────────┼──────────────────╢
║  B01   │ add package.json          │        1         ║
║  B02   │ add index.html            │        1         ║
║  B03   │ add vite.config.js        │        1         ║
║  B04   │ required plugins          │        1         ║
║  V01   │ base public path          │        1         ║
║  V02   │ css options               │        1         ║
║  V03   │ build options             │        1         ║
║  V05   │ resolve.alias options     │        1         ║
║  V06   │ client-side env variables │        1         ║
╚════════╧═══════════════════════════╧══════════════════╝

Copy link
Collaborator

@Chieffo2021 Chieffo2021 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done for a better user experience 🥳️

src/utils/report.ts Outdated Show resolved Hide resolved
src/utils/report.ts Outdated Show resolved Hide resolved
Comment on lines +29 to +33
interface ConverObj {
num: string;// 'Number'
feat: string;// 'Conversion item'
times?: number;// 'Conversion times'
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it an interface that can be imported from report.ts?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

50% / 50%,

just like the Vue3 composition thought, keep it tight
But, it can imported from report.ts for the long journey.

tests/render.test.ts Outdated Show resolved Hide resolved
Comment on lines 51 to 56
test2_nums.forEach((num) =>{
reportList2.push({
num,
feat: ''
})
})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can also use the map function.

tests/render.test.ts Outdated Show resolved Hide resolved
src/utils/report.ts Outdated Show resolved Hide resolved
src/utils/report.ts Outdated Show resolved Hide resolved
chinanf-boy and others added 8 commits December 28, 2021 17:01
Co-authored-by: Chieffo2021 <85914490+Chieffo2021@users.noreply.github.com>
Co-authored-by: Joe Zhang <flyfish.zy@gmail.com>
Co-authored-by: Joe Zhang <flyfish.zy@gmail.com>
Co-authored-by: Chieffo2021 <85914490+Chieffo2021@users.noreply.github.com>
Co-authored-by: Chieffo2021 <85914490+Chieffo2021@users.noreply.github.com>
Co-authored-by: Chieffo2021 <85914490+Chieffo2021@users.noreply.github.com>
@Chieffo2021 Chieffo2021 merged commit e51260d into originjs:main Dec 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants