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:
Emma Dickson 2021-02-08 12:45:46 -05:00 committed by GitHub
parent 8af5e1487d
commit 7cfeefd19b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 5715 additions and 1062 deletions

1
.eslintignore Normal file
View file

@ -0,0 +1 @@
.*

View file

@ -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
View 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
View 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

View file

@ -71,7 +71,7 @@ class AutoFetcher
const resp = await fetch(url);
await resp.blob();
} catch (e) {
console.log(e)
}
this.numPending--;
}

View file

@ -628,7 +628,7 @@ class Crawler {
//console.log(`Direct capture: ${this.capturePrefix}${url}`);
const abort = new AbortController();
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();
}

4329
package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -15,6 +15,7 @@
"uuid": "8.3.2"
},
"devDependencies": {
"eslint": "^7.12.1"
"eslint": "^7.19.0",
"eslint-plugin-react": "^7.22.0"
}
}

2350
yarn.lock

File diff suppressed because it is too large Load diff