electron-chromedriver 22.0.0 → 24.0.0

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.
@@ -1,71 +1,157 @@
1
- # Javascript Node CircleCI 2.0 configuration file
2
- #
3
- # Check https://circleci.com/docs/2.0/language-javascript/ for more details
4
- #
5
- version: 2
6
- jobs:
7
- install-test-linux:
8
- docker:
9
- # specify the version you desire here
10
- - image: circleci/node:14-browsers
1
+ version: 2.1
11
2
 
12
- # Specify service dependencies here if necessary
13
- # CircleCI maintains a library of pre-built images
14
- # documented at https://circleci.com/docs/2.0/circleci-images/
15
- # - image: circleci/mongo:3.4.4
16
-
17
- working_directory: ~/repo
3
+ orbs:
4
+ node: circleci/node@5.1.0
5
+ win: circleci/windows@5.0.0
18
6
 
7
+ commands:
8
+ install:
9
+ parameters:
10
+ node-version:
11
+ description: Node.js version to install
12
+ type: string
19
13
  steps:
14
+ - node/install:
15
+ node-version: << parameters.node-version >>
16
+ - run: nvm use << parameters.node-version >>
20
17
  - checkout
21
-
22
- # Download and cache dependencies
23
18
  - restore_cache:
24
19
  keys:
25
- - v1-dependencies-{{ checksum "package.json" }}
26
- # fallback to using the latest cache if no exact match is found
27
- - v1-dependencies-
28
-
29
- - run: npm install
30
-
20
+ - v1-dependencies-{{ arch }}-{{ checksum "package-lock.json" }}
21
+ - v1-dependencies-{{ arch }}
22
+ - when:
23
+ condition: << pipeline.git.tag >>
24
+ steps:
25
+ - run:
26
+ name: Update Version
27
+ command: node script/update-version.js << pipeline.git.tag >>
28
+ - run: npm install
29
+ - unless:
30
+ condition: << pipeline.git.tag >>
31
+ steps:
32
+ - run:
33
+ command: npm install
34
+ environment:
35
+ ELECTRON_CHROMEDRIVER_STABLE_FALLBACK: 1
31
36
  - save_cache:
32
37
  paths:
33
38
  - node_modules
34
- key: v1-dependencies-{{ checksum "package.json" }}
35
-
36
- # run tests!
39
+ key: v1-dependencies-{{ arch }}-{{ checksum "package-lock.json" }}
40
+ test:
41
+ steps:
37
42
  - run: node --version
38
43
  - run: npm --version
39
44
  - run: npm test
40
45
 
41
- install-test-osx:
46
+ jobs:
47
+ test-linux:
48
+ docker:
49
+ - image: cimg/base:stable
50
+ parameters:
51
+ node-version:
52
+ description: Node.js version to install
53
+ type: string
54
+ steps:
55
+ - install:
56
+ node-version: << parameters.node-version >>
57
+ - test
58
+ test-mac:
42
59
  macos:
43
60
  xcode: "13.3.0"
61
+ parameters:
62
+ node-version:
63
+ description: Node.js version to install
64
+ type: string
65
+ steps:
66
+ - install:
67
+ node-version: << parameters.node-version >>
68
+ - test
69
+ test-windows:
70
+ executor:
71
+ name: win/default
72
+ shell: bash.exe
73
+ parameters:
74
+ node-version:
75
+ description: Node.js version to install
76
+ type: string
77
+ steps:
78
+ - install:
79
+ node-version: << parameters.node-version >>
80
+ - test
81
+ release:
82
+ docker:
83
+ - image: cimg/node:18.14
44
84
  steps:
45
85
  - checkout
46
- # Download and cache dependencies
47
- - restore_cache:
48
- keys:
49
- - v1-mac-dependencies-{{ checksum "package.json" }}
50
- # fallback to using the latest cache if no exact match is found
51
- - v1-mac-dependencies-
52
- - run: node --version
53
- - run: npm --version
54
- - run: npm install
55
-
56
- - save_cache:
57
- paths:
58
- - node_modules
59
- key: v1-mac-dependencies-{{ checksum "package.json" }}
60
-
61
- # run tests!
62
- - run: npm test
86
+ - run:
87
+ name: Update Version
88
+ command: node script/update-version.js << pipeline.git.tag >>
89
+ - run:
90
+ name: Install Dependencies
91
+ command: npm ci
92
+ - run:
93
+ name: Obtain Publishing Credentials
94
+ command: npx @continuous-auth/circleci-oidc-github-auth@1.0.4
95
+ - run:
96
+ name: Confirm Version Updated
97
+ command: node -e "if (require('./package.json').version === '0.0.0-development') process.exit(1)"
98
+ - run:
99
+ name: Set NPM Credentials
100
+ command: echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} > ~/.npmrc
101
+ - run:
102
+ name: Check NPM Credentials
103
+ command: npm whoami
104
+ - run:
105
+ name: CFA Publish
106
+ command: node script/publish.js
63
107
 
64
108
  workflows:
65
- version: 2
66
- test-linux:
67
- jobs:
68
- - install-test-linux
69
- test-osx:
109
+ test_and_release:
70
110
  jobs:
71
- - install-test-osx
111
+ - test-linux:
112
+ matrix:
113
+ parameters:
114
+ node-version:
115
+ - 18.14.0
116
+ - 16.19.0
117
+ - 14.19.0
118
+ filters:
119
+ tags:
120
+ only: /.*/
121
+ - test-mac:
122
+ matrix:
123
+ parameters:
124
+ node-version:
125
+ - 18.14.0
126
+ - 16.19.0
127
+ - 14.19.0
128
+ filters:
129
+ tags:
130
+ only: /.*/
131
+ - test-windows:
132
+ matrix:
133
+ parameters:
134
+ node-version:
135
+ - 18.14.0
136
+ - 16.19.0
137
+ - 14.19.0
138
+ filters:
139
+ tags:
140
+ only: /.*/
141
+ - release:
142
+ requires:
143
+ - test-linux-18.14.0
144
+ - test-linux-16.19.0
145
+ - test-linux-14.19.0
146
+ - test-mac-18.14.0
147
+ - test-mac-16.19.0
148
+ - test-mac-14.19.0
149
+ - test-windows-18.14.0
150
+ - test-windows-16.19.0
151
+ - test-windows-14.19.0
152
+ filters:
153
+ tags:
154
+ only: /^v.*/
155
+ branches:
156
+ ignore: /.*/
157
+ context: cfa-release
@@ -11,13 +11,14 @@ env:
11
11
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
12
12
 
13
13
  jobs:
14
- run_tests:
15
- strategy:
16
- matrix:
17
- os: [ubuntu-latest, macos-latest]
18
- runs-on: ${{ matrix.os }}
14
+ smoke_test:
15
+ runs-on: ubuntu-latest
19
16
  steps:
20
- - uses: actions/checkout@v3
17
+ - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # tag: v3.3.0
18
+ - name: Setup Node.js
19
+ uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # tag: v3.6.0
20
+ with:
21
+ node-version: "16.19.0"
21
22
  - name: Update Version
22
23
  run: node script/update-version.js ${{ github.event.inputs.version }}
23
24
  - name: Install Dependencies
@@ -26,29 +27,10 @@ jobs:
26
27
  run: npm test
27
28
  create_new_version:
28
29
  runs-on: ubuntu-latest
29
- needs: run_tests
30
+ needs: smoke_test
30
31
  steps:
31
- - uses: actions/checkout@v3
32
- - name: Use Node.js v16
33
- uses: actions/setup-node@v3
34
- with:
35
- node-version: 16.x
36
- registry-url: 'https://registry.npmjs.org'
37
- - name: Check npm credentials
38
- run: npm whoami
39
- env:
40
- NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
41
- - name: Set Git Credentials
42
- run: |
43
- git config user.name electron-bot
44
- git config user.email electron@github.com
45
- - name: Update Version
46
- run: node script/update-version.js ${{ github.event.inputs.version }}
47
- - name: Push Update Commit
48
- run: |
49
- git add .
50
- git commit -m "chore: update version to ${{ github.event.inputs.version }}"
51
- git push origin main
32
+ - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # tag: v3.3.0
33
+ # Tag here, the CircleCI workflow will trigger on the new tag and do the CFA publish
52
34
  - name: Push New Tag
53
35
  run: |
54
36
  git tag ${{ github.event.inputs.version }}
@@ -56,7 +38,3 @@ jobs:
56
38
  - name: Create Release
57
39
  run: |
58
40
  gh release create ${{ github.event.inputs.version }} -t ${{ github.event.inputs.version }}
59
- - name: Publish to npm
60
- run: npm publish
61
- env:
62
- NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
@@ -7,14 +7,20 @@ on:
7
7
  - edited
8
8
  - synchronize
9
9
 
10
+ permissions:
11
+ contents: read
12
+
10
13
  jobs:
11
14
  main:
15
+ permissions:
16
+ pull-requests: read # for amannn/action-semantic-pull-request to analyze PRs
17
+ statuses: write # for amannn/action-semantic-pull-request to mark status of analyzed PR
12
18
  name: Validate PR Title
13
19
  runs-on: ubuntu-latest
14
20
  steps:
15
21
  - name: semantic-pull-request
16
- uses: amannn/action-semantic-pull-request@v4
22
+ uses: amannn/action-semantic-pull-request@01d5fd8a8ebb9aafe902c40c53f0f4744f7381eb # tag: v5
17
23
  env:
18
24
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19
25
  with:
20
- validateSingleCommit: true
26
+ validateSingleCommit: false
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) Contributors to the Electron project
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,12 +1,11 @@
1
1
  # Electron ChromeDriver
2
2
 
3
- [![Linux and Mac Build Status](https://circleci.com/gh/electron/chromedriver/tree/main.svg?style=shield)](https://circleci.com/gh/electron/chromedriver/tree/main)
4
- [![Windows Build status](https://ci.appveyor.com/api/projects/status/43safb37jdlaeviw/branch/main?svg=true)](https://ci.appveyor.com/project/electron-bot/chromedriver/branch/main)
3
+ [![CircleCI Status](https://circleci.com/gh/electron/chromedriver/tree/main.svg?style=shield)](https://circleci.com/gh/electron/chromedriver/tree/main)
4
+ [![npm:](https://img.shields.io/npm/v/electron-chromedriver.svg)](https://www.npmjs.com/package/electron-chromedriver)
5
5
  <br>
6
6
  [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://standardjs.com/)
7
7
  [![license:mit](https://img.shields.io/badge/license-mit-blue.svg)](https://opensource.org/licenses/MIT)
8
8
  <br>
9
- [![npm:](https://img.shields.io/npm/v/electron-chromedriver.svg)](https://www.npmjs.com/package/electron-chromedriver)
10
9
  [![dependencies:?](https://img.shields.io/npm/dm/electron-chromedriver.svg)](https://www.npmjs.com/package/electron-chromedriver)
11
10
 
12
11
  Simple node module to download the [ChromeDriver](https://sites.google.com/corp/chromium.org/driver/)
@@ -4,6 +4,33 @@ const { downloadArtifact } = require('@electron/get')
4
4
  const extractZip = require('extract-zip')
5
5
  const versionToDownload = require('./package').version
6
6
 
7
+ // Refs https://github.com/electron/fiddle-core/blob/1ee2d2737f23fd1012917a249a9444b6db89f1d8/src/versions.ts#L47-L57
8
+ function compareVersions (a, b) {
9
+ const l = a.compareMain(b)
10
+ if (l) return l
11
+ // Electron's approach is nightly -> other prerelease tags -> stable,
12
+ // so force `nightly` to sort before other prerelease tags.
13
+ const [prea] = a.prerelease
14
+ const [preb] = b.prerelease
15
+ if (prea === 'nightly' && preb !== 'nightly') return -1
16
+ if (prea !== 'nightly' && preb === 'nightly') return 1
17
+ return a.comparePre(b)
18
+ }
19
+
20
+ // Refs https://github.com/electron/fiddle-core/blob/1ee2d2737f23fd1012917a249a9444b6db89f1d8/src/versions.ts#L152-L160
21
+ function getLatestStable (releases) {
22
+ const { parse: semverParse } = require('semver')
23
+ const semvers = releases.map(({ version }) => semverParse(version)).filter((sem) => Boolean(sem))
24
+ semvers.sort((a, b) => compareVersions(a, b))
25
+ let stable
26
+ for (const ver of semvers.values()) {
27
+ if (ver.prerelease.length === 0) {
28
+ stable = ver
29
+ }
30
+ }
31
+ return stable
32
+ }
33
+
7
34
  function download (version) {
8
35
  return downloadArtifact({
9
36
  version,
@@ -18,6 +45,18 @@ function download (version) {
18
45
  }
19
46
 
20
47
  async function attemptDownload (version) {
48
+ // Fall back to latest stable if there is not a stamped version, for tests
49
+ if (version === '0.0.0-development') {
50
+ if (!process.env.ELECTRON_CHROMEDRIVER_STABLE_FALLBACK) {
51
+ console.log('WARNING: chromedriver in development needs the environment variable ELECTRON_CHROMEDRIVER_STABLE_FALLBACK set')
52
+ process.exit(1)
53
+ }
54
+
55
+ const fetch = require('node-fetch')
56
+ const releases = await fetch('https://releases.electronjs.org/releases.json').then(response => response.json())
57
+ version = getLatestStable(releases).version
58
+ }
59
+
21
60
  try {
22
61
  const targetFolder = path.join(__dirname, 'bin')
23
62
  const zipPath = await download(version)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "electron-chromedriver",
3
- "version": "22.0.0",
3
+ "version": "24.0.0",
4
4
  "description": "Electron ChromeDriver",
5
5
  "repository": "https://github.com/electron/chromedriver",
6
6
  "bin": {
@@ -21,7 +21,10 @@
21
21
  "extract-zip": "^2.0.0"
22
22
  },
23
23
  "devDependencies": {
24
+ "@continuous-auth/client": "^2.2.2",
24
25
  "mocha": "^10.1.0",
26
+ "node-fetch": "^2.6.9",
27
+ "semver": "^7.3.8",
25
28
  "standard": "^13.1.0"
26
29
  }
27
- }
30
+ }
@@ -0,0 +1,10 @@
1
+ // Publish the package in the CWD with an OTP code from CFA
2
+ const { getOtp } = require('@continuous-auth/client')
3
+ const { spawnSync } = require('child_process')
4
+
5
+ async function publish () {
6
+ const { status } = spawnSync('npm', ['publish', '--otp', await getOtp()])
7
+ process.exit(status)
8
+ }
9
+
10
+ publish()
@@ -10,8 +10,8 @@ const normalizeVersion = (version = '') => {
10
10
  async function updateVersion () {
11
11
  const version = normalizeVersion(process.argv[2])
12
12
  if (!versionFormat.test(version)) {
13
- console.error(`Invalid version ${version}`)
14
- process.exit(1)
13
+ console.error(`Unsupported version ${version} - only major, minor, and patch releases are currently supported`)
14
+ return
15
15
  }
16
16
 
17
17
  const PJ_PATH = path.join(__dirname, '..', 'package.json')