Skip to content

Commit a5e0d65

Browse files
authored
Configure GitHub Actions (#1)
1 parent b0d6284 commit a5e0d65

File tree

11 files changed

+117
-16
lines changed

11 files changed

+117
-16
lines changed

.eslintrc.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"parserOptions": {
3+
"ecmaVersion": 5
4+
},
5+
"extends": "eslint:recommended",
6+
"env": {
7+
"commonjs": true,
8+
"browser": true
9+
},
10+
"rules": {
11+
"strict": [2, "global"],
12+
"block-scoped-var": 2,
13+
"consistent-return": 2,
14+
"eqeqeq": [2, "smart"],
15+
"guard-for-in": 2,
16+
"no-caller": 2,
17+
"no-extend-native": 2,
18+
"no-loop-func": 2,
19+
"no-new": 2,
20+
"no-param-reassign": 2,
21+
"no-return-assign": 2,
22+
"no-unused-expressions": 2,
23+
"no-use-before-define": 2,
24+
"radix": [2, "always"],
25+
"indent": [2, 2],
26+
"quotes": [2, "double"],
27+
"semi": [2, "always", { "omitLastInOneLineBlock": true }]
28+
}
29+
}

.github/workflows/ci.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
15+
- uses: purescript-contrib/setup-purescript@main
16+
17+
- uses: actions/setup-node@v1
18+
with:
19+
node-version: "10"
20+
21+
- name: Install dependencies
22+
run: |
23+
npm install -g bower
24+
npm install
25+
bower install --production
26+
27+
- name: Build source
28+
run: npm run-script build
29+
30+
- name: Run tests
31+
run: |
32+
bower install
33+
npm run-script test --if-present

.gitignore

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
/.*
2+
!/.gitignore
3+
!/.eslintrc.json
4+
!/.github/
5+
package-lock.json
16
/bower_components/
27
/node_modules/
3-
/.pulp-cache/
48
/output/
59
/generated-docs/
6-
/.psc-package/
7-
/.psc*
8-
/.purs*
9-
/.psa*

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,17 @@
11
# purescript-web-fetch
2+
3+
[![Latest release](http://img.shields.io/github/release/purescript-web/purescript-web-fetch.svg)](https://github.com/purescript-web/purescript-web-fetch/releases)
4+
[![Build status](https://github.com/purescript/purescript-web-fetch/workflows/CI/badge.svg?branch=master)](https://github.com/purescript/purescript-web-fetch/actions?query=workflow%3ACI+branch%3Amaster)
5+
[![Pursuit](https://pursuit.purescript.org/packages/purescript-web-fetch/badge)](https://pursuit.purescript.org/packages/purescript-web-fetch)
6+
7+
Types and low-level implementations for the [WHATWG Fetch Living Standard](https://fetch.spec.whatwg.org/).
8+
9+
## Installation
10+
11+
```
12+
spago install web-fetch
13+
```
14+
15+
## Documentation
16+
17+
Module documentation is [published on Pursuit](http://pursuit.purescript.org/packages/purescript-web-fetch).

package.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"private": true,
3+
"scripts": {
4+
"clean": "rimraf output && rimraf .pulp-cache",
5+
"build": "eslint src && pulp build -- --censor-lib --strict"
6+
},
7+
"devDependencies": {
8+
"eslint": "^7.15.0",
9+
"pulp": "^15.0.0",
10+
"purescript-psa": "^0.8.0",
11+
"rimraf": "^3.0.2"
12+
}
13+
}

src/Web/Fetch.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"use strict";
2+
13
exports._fetch = function(a, b) {
24
return fetch(a, b);
35
};

src/Web/Fetch/AbortController.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"use strict";
2+
13
exports.new = function() {
24
return new AbortController();
35
};
@@ -10,4 +12,4 @@ exports.abort = function(controller) {
1012

1113
exports.signal = function(controller) {
1214
return controller.signal;
13-
};
15+
};

src/Web/Fetch/Headers.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"use strict";
2+
13
exports.unsafeNew = function() {
24
return new Headers();
35
};
@@ -11,13 +13,11 @@ exports.unsafeFromRecord = function(r) {
1113
};
1214

1315
exports._toArray = function(tuple, headers) {
14-
var arr = [];
15-
for (var pair of headers.entries()) {
16-
arr.push(tuple(pair[0])(pair[1]));
17-
}
18-
return arr;
19-
}
16+
return Array.from(headers.entries(), function (pair) {
17+
return tuple(pair[0])(pair[1]);
18+
});
19+
};
2020

2121
exports.fromObject = function(obj) {
2222
return new Headers(obj);
23-
};
23+
};

src/Web/Fetch/Request.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
"use strict";
2+
13
exports._unsafeNew = function(url, options) {
24
try {
35
return new Request(url, options);
46
} catch (e) {
57
console.error(e);
68
throw e;
79
}
8-
};
10+
};

src/Web/Fetch/RequestBody.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
"use strict";
2+
13
exports.fromArrayBuffer = function(a) { return a };
24
exports.fromArrayView = function(a) { return a };
35
exports.fromString = function(a) { return a };
46
exports.fromReadableStream = function(a) { return a };
5-
exports.empty = null;
7+
exports.empty = null;

src/Web/Fetch/Response.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"use strict";
2+
13
exports.headers = function (resp) {
24
return resp.headers;
35
};
@@ -44,4 +46,4 @@ exports.text = function (resp) {
4446
return function() {
4547
return resp.text();
4648
};
47-
};
49+
};

0 commit comments

Comments
 (0)