Skip to content
This repository has been archived by the owner on Feb 16, 2024. It is now read-only.

Commit

Permalink
fix: yaml formatting (#557)
Browse files Browse the repository at this point in the history
  • Loading branch information
r4zendev authored Jan 10, 2024
1 parent 4d9d193 commit 897011b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
11 changes: 6 additions & 5 deletions readme-parser/parse.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const DATA = `
## Description
This is an amazing codemod which does \`the thing\`
This is an amazing codemod which does \`the thing\`. Changes:
### WARNING
Expand Down Expand Up @@ -98,7 +98,7 @@ describe('parse/yaml', function () {
deepEqual(parseResult, {
name: 'Do the thing',
description:
'This is an amazing codemod which does `the thing`\n\n### WARNING\n\nThis codemod does the thing\n' +
'This is an amazing codemod which does `the thing`. Changes:\n\n\n### WARNING\n\nThis codemod does the thing\n' +
'Following the original msw [upgrade guide](https://mswjs.io/docs/migrations/1.x-to-2.x/#imports), ' +
'there are certain imports that changed their location and/or naming. This codemod will adjust your imports to the new location and naming.\n' +
' - `setupWorker` is now imported from `msw/browser`\n' +
Expand Down Expand Up @@ -171,7 +171,8 @@ f_long-description: >-
## Description
This is an amazing codemod which does \`the thing\`
This is an amazing codemod which does \`the thing\`. Changes:
### WARNING
Expand Down Expand Up @@ -249,8 +250,8 @@ seo:
title: Msw V2 - Do the thing | Codemod.com Automations
og:title: Msw V2 - Do the thing | Codemod.com Automations
twitter:title: Msw V2 - Do the thing | Codemod.com Automations
description: This is an amazing codemod which does \`the thing\`
twitter:card: This is an amazing codemod which does \`the thing\`
description: This is an amazing codemod which does the thing
twitter:card: This is an amazing codemod which does the thing
`.trim(),
);
});
Expand Down
8 changes: 7 additions & 1 deletion readme-parser/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,13 @@ export const convertToYaml = (
}
titleWithVersion = capitalize(titleWithVersion);

const shortDescription = description.split('\n').at(0);
const shortDescription = description
.split('\n')
.at(0)
?.split('.')
.at(0)
?.replace('`', '')
.replace(/\W$/g, '');

const res = `
created-on: ${new Date().toISOString()}
Expand Down

0 comments on commit 897011b

Please sign in to comment.