Skip to content

Commit

Permalink
feat: add node wrapper (#2)
Browse files Browse the repository at this point in the history
* 1.0.1

* feat: add node wrapper

* add test
  • Loading branch information
straker authored Jan 28, 2022
1 parent 7f9c9f7 commit 8a4f95e
Show file tree
Hide file tree
Showing 8 changed files with 1,962 additions and 22 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.DS_Store
tmp/*
!tmp/README.md
!tmp/README.md
node_modules/
28 changes: 12 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ npm install browser-driver-manager
## Usage

```terminal
browser-driver-manager install chrome chromedriver
npx browser-driver-manager install chrome chromedriver
```

Managing browsers and drivers for continuous integration, especially Chrome and ChromeDriver, can be extremely difficult, if not utterly frustrating.
Expand All @@ -29,7 +29,7 @@ So instead you decided to pin to the `@latest` tag. This works great as now both

This is why this package exists. It will help keep the versions of Chrome and ChromeDriver in-sync so that your continuous integration system tests don't fail due to ChromeDriver versions.

So now instead of relying on pinning, you can ask the system which version of Chrome is installed and always get the version of ChromeDriver that matches.
So now instead of relying on pinning, you can ask the system which version of Chrome is installed and always get the version of ChromeDriver that matches. This will even work for Chrome channels that are not just Stable (i.e. Beta, Dev, and Canary).

Here's an example of doing just that in an npm script.

Expand All @@ -41,18 +41,14 @@ Here's an example of doing just that in an npm script.
}
```

Here's an example of getting the installed Chrome version and installing the matching ChromeDriver version from npm.
If you wanted to install Chrome Beta and its associated driver:

```bash
#! /bin/bash

chromeVersion=$(browser-driver-manager version chrome)

# Extract the version number and major number
versionNumber="$(echo $chromeVersion | sed 's/^Google Chrome //' | sed 's/^Chromium //')"
majorVersion="${versionNumber%%.*}"

npm install --no-save "chromedriver@$majorVersion"
```json
{
"scripts": {
"install:chromedriver": "browser-driver-manager install chrome=beta chromedriver=beta"
}
}
```

## Supported Platforms and Browsers
Expand All @@ -63,14 +59,14 @@ Currently there are no plans to support Windows. If you need Windows support ple

## System Requirements

Using the `version` or `which` commands do not require any bash built in commands. The `install` command requires the following support:
Using the `version` or `which` commands do not require any bash built in commands. The `install` bash command requires the following support:

- `curl` or `wget` to download files
- `dpkg` or `rpm` to extract browser applications
- `apt` or `yum` to install browsers
- `unzip` to install ChromeDriver
- `unzip` to install ChromeDriver (if using the bash script directly)

Additionally, `sudo` permissions are needed in order to install browsers and drivers.
Additionally, `sudo` permissions are needed in order to install browsers.

## Commands and Options

Expand Down
Loading

0 comments on commit 8a4f95e

Please sign in to comment.