Skip to content

Commit

Permalink
Replace dash to slash for asdf lts syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
doong-jo committed Mar 26, 2023
1 parent a4fcaaf commit ed77a6b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions __tests__/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ describe('main tests', () => {
${'lts/erbium'} | ${'lts/erbium'}
${'lts/*'} | ${'lts/*'}
${'nodejs 12.3.4'} | ${'12.3.4'}
${'nodejs lts-erbium'} | ${'lts/erbium'}
${'ruby 2.3.4\nnodejs 12.3.4\npython 3.4.5'} | ${'12.3.4'}
${''} | ${''}
${'unknown format'} | ${'unknown format'}
Expand Down
8 changes: 7 additions & 1 deletion src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ export function parseNodeVersionFile(contents: string): string {

if (!nodeVersion) {
const found = contents.match(/^(?:nodejs\s+)?v?(?<version>[^\s]+)$/m);
nodeVersion = found?.groups?.version;


if (found?.groups?.version?.includes('lts-')) {
nodeVersion = found?.groups?.version.replace(/-/g, '/');
} else {
nodeVersion = found?.groups?.version;
}
}

// In the case of an unknown format,
Expand Down

0 comments on commit ed77a6b

Please sign in to comment.