Skip to content

Commit

Permalink
get driver latest major version
Browse files Browse the repository at this point in the history
  • Loading branch information
dmlemeshko committed Apr 1, 2020
1 parent e2792e7 commit cb9f6a5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,6 @@ node_modules

# driver archive
msedgedriver.*

# paths store
paths.json
9 changes: 3 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,10 @@ const getBrowser = async () => {
};

const downloadDriver = async (version: string) => {
if (version === 'LATEST') {
process.stdout.write(`Getting the latest driver version\n`);
const response = await got.get(`${cdnUrl}/LATEST_STABLE`);

version = response.body.replace(/[^\d.]/g, '');
}
const versionMatcher = version === 'LATEST' ? 'LATEST_STABLE' : `LATEST_RELEASE_${version.split('.')[0]}`;
const response = await got.get(`${cdnUrl}/${versionMatcher}`);

version = response.body.replace(/[^\d.]/g, '');
process.stdout.write(`Downloading MS Edge Driver ${version}...\n`);

const downloadUrl = `${cdnUrl}/${version}/edgedriver_${osName}.zip`;
Expand Down

0 comments on commit cb9f6a5

Please sign in to comment.