Skip to content

Commit

Permalink
Type check with Typescript compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
giggio committed Oct 31, 2022
1 parent 33411c3 commit dafc01e
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ jobs:
- run: npm run lint .
name: Lint
if: matrix.runner == 'ubuntu-latest'
- run: npm run typecheck
name: Type check
if: matrix.runner == 'ubuntu-latest'
- run: |
set -euo pipefail
sudo apt-get update
Expand Down
2 changes: 2 additions & 0 deletions install.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ function getRequestOptions(downloadPath) {
*/
async function getChromeDriverVersion(requestOptions) {
console.log('Finding Chromedriver version.');
// @ts-expect-error
const response = await axios.request(requestOptions);
chromedriver_version = response.data.trim();
console.log(`Chromedriver version is ${chromedriver_version}.`);
Expand All @@ -261,6 +262,7 @@ async function requestBinary(requestOptions, filePath) {
const outFile = fs.createWriteStream(filePath);
let response;
try {
// @ts-expect-error
response = await axios.request({ responseType: 'stream', ...requestOptions });
} catch (error) {
if (error && error.response) {
Expand Down
22 changes: 21 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"scripts": {
"install": "node install.js",
"update-chromedriver": "node update.js",
"typecheck": "tsc",
"lint": "eslint"
},
"dependencies": {
Expand All @@ -36,7 +37,8 @@
"tcp-port-used": "^1.0.1"
},
"devDependencies": {
"eslint": "^8.26.0"
"eslint": "^8.26.0",
"typescript": "^4.8.4"
},
"engines": {
"node": ">=10"
Expand Down
17 changes: 17 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "ES2020",
"sourceMap": false,
"allowJs": true,
"checkJs": true,
"skipLibCheck": true,
"noEmit": true
},
"include": [
"**/*.js"
],
"exclude": [
"node_modules"
]
}
1 change: 1 addition & 0 deletions update.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const CURRENT_VERSION = require('./lib/chromedriver').version;
async function getLatest() {
const requestOptions = { url: 'https://chromedriver.storage.googleapis.com/LATEST_RELEASE', method: "GET" };
try {
// @ts-expect-error
const response = await axios(requestOptions);
return response.data.trim();
} catch (err) {
Expand Down

0 comments on commit dafc01e

Please sign in to comment.