safaridriver 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,5 +1,64 @@
1
1
  # Safaridriver for Node.js
2
2
 
3
- An NPM wrapper for handling the Safaridriver binary.
3
+ > A Node.js untility to manage Safaridriver sessions.
4
4
 
5
- __Note:__ 🚧 this package is currently in development, come back later!
5
+ The Safaridriver utility is used to launch an HTTP server that implements the [WebDriver](https://w3c.github.io/webdriver/) REST API. When launched, Safaridriver allows for automated testing of web content using the version of Safari that is installed with macOS.
6
+
7
+ ## Install
8
+
9
+ To install the package, run:
10
+
11
+ ```sh
12
+ npm install --save-dev safaridriver
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ To start a Safaridriver server, import the package and run:
18
+
19
+ ```js
20
+ import safaridriver from 'safaridriver'
21
+
22
+ safaridriver.start()
23
+
24
+ // run some automation...
25
+
26
+ // then kill instance via:
27
+ safaridriver.stop()
28
+ ```
29
+
30
+ ## Options
31
+
32
+ ### `port`
33
+
34
+ Specifies the port on which the HTTP server should listen for incoming connections. If the port is already in use or otherwise unavailable, Safaridriver will exit immediately with a non-zero return code.
35
+
36
+ __Type:__ `number`<br />
37
+ __Default:__ `4444`
38
+
39
+ ### `path`
40
+
41
+ Path to Safaridriver binary.
42
+
43
+ __Type:__ `string`<br />
44
+ __Default:__ `/usr/bin/safaridriver`
45
+
46
+ ### `enable`
47
+
48
+ Applies configuration changes so that subsequent WebDriver sessions will run without further authentication. This includes checking "Enable Remote Automation" in Safari's `Develop` menu. The user must authenticate via password for the changes to be applied.
49
+
50
+ When this option is specified, safaridriver exits immediately without starting up the REST API service. If the changes were successful or already applied, safaridriver exits 0; otherwise, safaridriver exits >0 and prints an error message to stderr.
51
+
52
+ __Type:__ `boolean`<br />
53
+ __Default:__ `false`
54
+
55
+ ### `diagnose`
56
+
57
+ Enables diagnostic logging for all sessions hosted by this safaridriver instance.
58
+
59
+ __Type:__ `boolean`<br />
60
+ __Default:__ `false`
61
+
62
+ ----
63
+
64
+ For more information on WebdriverIO see the [homepage](http://webdriver.io).
package/package.json CHANGED
@@ -1,10 +1,20 @@
1
1
  {
2
2
  "name": "safaridriver",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
+ "author": "Christian Bromann <mail@bromann.dev>",
5
+ "license": "MIT",
4
6
  "description": "An NPM wrapper for handling the Safaridriver binary.",
5
- "main": "index.js",
7
+ "homepage": "https://github.com/webdriverio-community/node-safaridriver#readme",
6
8
  "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1"
9
+ "build": "tsc -b .",
10
+ "ci": "run-s lint build test",
11
+ "clean": "rimraf ./node_modules package-lock.yaml ./dist",
12
+ "prepare": "husky install",
13
+ "test": "run-s test:*",
14
+ "test:lint": "eslint src tests",
15
+ "test:unit": "vitest",
16
+ "test:interop": "node ./tests/interop/cjs.test.js",
17
+ "watch": "npm run build -- --watch"
8
18
  },
9
19
  "repository": {
10
20
  "type": "git",
@@ -17,13 +27,35 @@
17
27
  "webdriverio",
18
28
  "selenium"
19
29
  ],
20
- "author": "Christian Bromann <mail@bromann.dev>",
21
- "license": "MIT",
22
30
  "bugs": {
23
31
  "url": "https://github.com/webdriverio-community/node-safaridriver/issues"
24
32
  },
25
- "homepage": "https://github.com/webdriverio-community/node-safaridriver#readme",
33
+ "main": "./dist/cjs/index.js",
34
+ "type": "module",
35
+ "module": "./dist/index.js",
36
+ "exports": {
37
+ ".": [
38
+ {
39
+ "types": "./dist/index.d.ts",
40
+ "import": "./dist/index.js",
41
+ "require": "./dist/cjs/index.js"
42
+ },
43
+ "./dist/cjs/index.js"
44
+ ]
45
+ },
46
+ "types": "./build/index.d.ts",
47
+ "typeScriptVersion": "3.8.3",
26
48
  "devDependencies": {
27
- "release-it": "^15.6.0"
49
+ "@typescript-eslint/eslint-plugin": "^5.48.0",
50
+ "@typescript-eslint/parser": "^5.48.0",
51
+ "@vitest/coverage-c8": "^0.26.3",
52
+ "eslint": "^8.31.0",
53
+ "eslint-plugin-import": "^2.26.0",
54
+ "eslint-plugin-unicorn": "^45.0.2",
55
+ "husky": "^8.0.3",
56
+ "npm-run-all": "^4.1.5",
57
+ "release-it": "^15.6.0",
58
+ "typescript": "^4.9.4",
59
+ "vitest": "^0.26.3"
28
60
  }
29
61
  }
@@ -1,62 +0,0 @@
1
- name: Manual NPM Publish
2
-
3
- on:
4
- workflow_dispatch:
5
- inputs:
6
- releaseType:
7
- description: "Release type - major, minor or patch"
8
- required: true
9
- type: choice
10
- default: "patch"
11
- options:
12
- - patch
13
- - minor
14
- - major
15
- distTag:
16
- description: 'NPM tag (e.g. use "next" to release a test version)'
17
- required: true
18
- default: 'latest'
19
- preRelease:
20
- description: If latest release was a pre-release (e.g. X.X.X-alpha.0) and you want to push another one, pick "yes"
21
- required: true
22
- type: choice
23
- default: "no"
24
- options:
25
- - "yes"
26
- - "no"
27
-
28
- env:
29
- NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
30
-
31
- jobs:
32
- release:
33
- runs-on: ubuntu-latest
34
- steps:
35
- - uses: actions/checkout@v2
36
- with:
37
- ref: 'main'
38
- fetch-depth: 0
39
- - uses: actions/setup-node@v1
40
- with:
41
- node-version: 18.x
42
- - name: NPM Setup
43
- run: |
44
- npm set registry "https://registry.npmjs.org/"
45
- npm set //registry.npmjs.org/:_authToken $NPM_TOKEN
46
- npm whoami
47
- - name: Git Setup
48
- run: |
49
- git config --global user.email "bot@webdriver.io"
50
- git config --global user.name "WebdriverIO Release Bot"
51
- - name: Release
52
- run: npx release-it ${{github.event.inputs.releaseType}} --github.release --ci --npm.skipChecks --no-git.requireCleanWorkingDir --npm.tag=${{github.event.inputs.distTag}}
53
- env:
54
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
55
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56
- if: ${{ github.event.inputs.preRelease == 'no' }}
57
- - name: Pre-Release
58
- run: npx release-it ${{github.event.inputs.releaseType}} --github.release --ci --npm.skipChecks --no-git.requireCleanWorkingDir --preRelease=alpha --github.preRelease --npm.tag=next
59
- env:
60
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
61
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62
- if: ${{ github.event.inputs.preRelease == 'yes' }}