mirror of
https://github.com/webrecorder/browsertrix-crawler.git
synced 2025-10-19 14:33:17 +00:00
add ci and linting (#21)
* linting with eslint * ci: validate linting and check basic single-page crawl with wacz creation Co-authored-by: Emma Dickson <emmadickson@Emmas-MacBook-Pro.local>
This commit is contained in:
parent
8af5e1487d
commit
7cfeefd19b
9 changed files with 5715 additions and 1062 deletions
1
.eslintignore
Normal file
1
.eslintignore
Normal file
|
@ -0,0 +1 @@
|
||||||
|
.*
|
30
.eslintrc.js
30
.eslintrc.js
|
@ -1,30 +0,0 @@
|
||||||
module.exports = {
|
|
||||||
"env": {
|
|
||||||
"es6": true,
|
|
||||||
"node": true
|
|
||||||
},
|
|
||||||
"extends": "eslint:recommended",
|
|
||||||
"parserOptions": {
|
|
||||||
"ecmaVersion": 2018
|
|
||||||
},
|
|
||||||
"rules": {
|
|
||||||
"indent": [
|
|
||||||
"error",
|
|
||||||
2
|
|
||||||
],
|
|
||||||
"linebreak-style": [
|
|
||||||
"error",
|
|
||||||
"unix"
|
|
||||||
],
|
|
||||||
"quotes": [
|
|
||||||
"error",
|
|
||||||
"double"
|
|
||||||
],
|
|
||||||
"semi": [
|
|
||||||
"error",
|
|
||||||
"always"
|
|
||||||
],
|
|
||||||
"no-console": "off",
|
|
||||||
"no-unused-vars": "off",
|
|
||||||
}
|
|
||||||
};
|
|
14
.eslintrc.yml
Normal file
14
.eslintrc.yml
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
env:
|
||||||
|
browser: true
|
||||||
|
node: true
|
||||||
|
es2021: true
|
||||||
|
extends:
|
||||||
|
- 'plugin:react/recommended'
|
||||||
|
parserOptions:
|
||||||
|
ecmaFeatures:
|
||||||
|
jsx: true
|
||||||
|
ecmaVersion: 12
|
||||||
|
sourceType: module
|
||||||
|
plugins:
|
||||||
|
- react
|
||||||
|
rules: {}
|
46
.github/workflows/ci.yaml
vendored
Normal file
46
.github/workflows/ci.yaml
vendored
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
name: Node.js CI
|
||||||
|
|
||||||
|
on: [push]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
lint:
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
node-version: [14.x]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Use Node.js ${{ matrix.node-version }}
|
||||||
|
uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: ${{ matrix.node-version }}
|
||||||
|
- name: install requirements
|
||||||
|
run: npm install
|
||||||
|
- name: run linter
|
||||||
|
run: yarn run eslint .
|
||||||
|
|
||||||
|
build:
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
node-version: [14.x]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Use Node.js ${{ matrix.node-version }}
|
||||||
|
uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: ${{ matrix.node-version }}
|
||||||
|
- name: build docker
|
||||||
|
run: docker-compose build
|
||||||
|
- name: run crawl
|
||||||
|
run: docker-compose run crawler crawl --url http://www.example.com/ --generateWACZ --collection wr-net --workers 2
|
||||||
|
- name: validate existing wacz
|
||||||
|
run: docker-compose run crawler wacz validate --file collections/wr-net/wr-net.wacz
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ class AutoFetcher
|
||||||
const resp = await fetch(url);
|
const resp = await fetch(url);
|
||||||
await resp.blob();
|
await resp.blob();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
console.log(e)
|
||||||
}
|
}
|
||||||
this.numPending--;
|
this.numPending--;
|
||||||
}
|
}
|
||||||
|
|
|
@ -628,7 +628,7 @@ class Crawler {
|
||||||
//console.log(`Direct capture: ${this.capturePrefix}${url}`);
|
//console.log(`Direct capture: ${this.capturePrefix}${url}`);
|
||||||
const abort = new AbortController();
|
const abort = new AbortController();
|
||||||
const signal = abort.signal;
|
const signal = abort.signal;
|
||||||
const resp2 = await fetch(this.capturePrefix + url, {signal, headers: this.headers});
|
await fetch(this.capturePrefix + url, {signal, headers: this.headers});
|
||||||
abort.abort();
|
abort.abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
4329
package-lock.json
generated
Normal file
4329
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
|
@ -15,6 +15,7 @@
|
||||||
"uuid": "8.3.2"
|
"uuid": "8.3.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"eslint": "^7.12.1"
|
"eslint": "^7.19.0",
|
||||||
|
"eslint-plugin-react": "^7.22.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue