Skip to content
This repository was archived by the owner on Oct 30, 2023. It is now read-only.

Commit dce88f4

Browse files
committed
feat: initial commit
0 parents  commit dce88f4

15 files changed

+843
-0
lines changed

.aegir.js

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import EchoServer from 'aegir/echo-server'
2+
import body from 'body-parser'
3+
4+
export default {
5+
test: {
6+
before: async () => {
7+
const providers = new Map()
8+
const echoServer = new EchoServer()
9+
echoServer.polka.use(body.text())
10+
echoServer.polka.post('/add-providers/:cid', (req, res) => {
11+
providers.set(req.params.cid, req.body)
12+
res.end()
13+
})
14+
15+
// https://github.com/ipfs/specs/blob/main/routing/ROUTING_V1_HTTP.md#api
16+
echoServer.polka.get('/routing/v1/providers/:cid', (req, res) => {
17+
const provs = providers.get(req.params.cid)
18+
providers.delete(req.params.cid)
19+
20+
// 404 means no matching records are found
21+
if (provs == null) {
22+
res.statusCode = 404
23+
return res.end()
24+
}
25+
26+
res.end(provs)
27+
})
28+
29+
await echoServer.start()
30+
31+
return {
32+
env: {
33+
ECHO_SERVER: `http://${echoServer.host}:${echoServer.port}`
34+
},
35+
echoServer
36+
}
37+
},
38+
after: async (options, beforeResult) => {
39+
await beforeResult.echoServer.stop()
40+
}
41+
}
42+
}

.github/dependabot.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: npm
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
time: "10:00"
8+
open-pull-requests-limit: 10
9+
commit-message:
10+
prefix: "deps"
11+
prefix-development: "deps(dev)"

.github/workflows/automerge.yml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
name: Automerge
2+
on: [ pull_request ]
3+
4+
jobs:
5+
automerge:
6+
uses: protocol/.github/.github/workflows/automerge.yml@master
7+
with:
8+
job: 'automerge'
+181
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
name: test & maybe release
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
8+
jobs:
9+
10+
check:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- uses: actions/setup-node@v3
15+
with:
16+
node-version: lts/*
17+
- uses: ipfs/aegir/actions/cache-node-modules@master
18+
- run: npm run --if-present lint
19+
- run: npm run --if-present dep-check
20+
21+
test-node:
22+
needs: check
23+
runs-on: ${{ matrix.os }}
24+
strategy:
25+
matrix:
26+
os: [windows-latest, ubuntu-latest, macos-latest]
27+
node: [lts/*]
28+
fail-fast: true
29+
steps:
30+
- uses: actions/checkout@v3
31+
- uses: actions/setup-node@v3
32+
with:
33+
node-version: ${{ matrix.node }}
34+
- uses: ipfs/aegir/actions/cache-node-modules@master
35+
- run: npm run --if-present test:node
36+
- uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # v3.1.1
37+
with:
38+
flags: node
39+
40+
test-chrome:
41+
needs: check
42+
runs-on: ubuntu-latest
43+
steps:
44+
- uses: actions/checkout@v3
45+
- uses: actions/setup-node@v3
46+
with:
47+
node-version: lts/*
48+
- uses: ipfs/aegir/actions/cache-node-modules@master
49+
- run: npm run --if-present test:chrome
50+
- uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # v3.1.1
51+
with:
52+
flags: chrome
53+
54+
test-chrome-webworker:
55+
needs: check
56+
runs-on: ubuntu-latest
57+
steps:
58+
- uses: actions/checkout@v3
59+
- uses: actions/setup-node@v3
60+
with:
61+
node-version: lts/*
62+
- uses: ipfs/aegir/actions/cache-node-modules@master
63+
- run: npm run --if-present test:chrome-webworker
64+
- uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # v3.1.1
65+
with:
66+
flags: chrome-webworker
67+
68+
test-firefox:
69+
needs: check
70+
runs-on: ubuntu-latest
71+
steps:
72+
- uses: actions/checkout@v3
73+
- uses: actions/setup-node@v3
74+
with:
75+
node-version: lts/*
76+
- uses: ipfs/aegir/actions/cache-node-modules@master
77+
- run: npm run --if-present test:firefox
78+
- uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # v3.1.1
79+
with:
80+
flags: firefox
81+
82+
test-firefox-webworker:
83+
needs: check
84+
runs-on: ubuntu-latest
85+
steps:
86+
- uses: actions/checkout@v3
87+
- uses: actions/setup-node@v3
88+
with:
89+
node-version: lts/*
90+
- uses: ipfs/aegir/actions/cache-node-modules@master
91+
- run: npm run --if-present test:firefox-webworker
92+
- uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # v3.1.1
93+
with:
94+
flags: firefox-webworker
95+
96+
test-webkit:
97+
needs: check
98+
runs-on: ${{ matrix.os }}
99+
strategy:
100+
matrix:
101+
os: [ubuntu-latest, macos-latest]
102+
node: [lts/*]
103+
fail-fast: true
104+
steps:
105+
- uses: actions/checkout@v3
106+
- uses: actions/setup-node@v3
107+
with:
108+
node-version: lts/*
109+
- uses: ipfs/aegir/actions/cache-node-modules@master
110+
- run: npm run --if-present test:webkit
111+
- uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # v3.1.1
112+
with:
113+
flags: webkit
114+
115+
test-webkit-webworker:
116+
needs: check
117+
runs-on: ${{ matrix.os }}
118+
strategy:
119+
matrix:
120+
os: [ubuntu-latest, macos-latest]
121+
node: [lts/*]
122+
fail-fast: true
123+
steps:
124+
- uses: actions/checkout@v3
125+
- uses: actions/setup-node@v3
126+
with:
127+
node-version: lts/*
128+
- uses: ipfs/aegir/actions/cache-node-modules@master
129+
- run: npm run --if-present test:webkit-webworker
130+
- uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # v3.1.1
131+
with:
132+
flags: webkit-webworker
133+
134+
test-electron-main:
135+
needs: check
136+
runs-on: ubuntu-latest
137+
steps:
138+
- uses: actions/checkout@v3
139+
- uses: actions/setup-node@v3
140+
with:
141+
node-version: lts/*
142+
- uses: ipfs/aegir/actions/cache-node-modules@master
143+
- run: npx xvfb-maybe npm run --if-present test:electron-main
144+
- uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # v3.1.1
145+
with:
146+
flags: electron-main
147+
148+
test-electron-renderer:
149+
needs: check
150+
runs-on: ubuntu-latest
151+
steps:
152+
- uses: actions/checkout@v3
153+
- uses: actions/setup-node@v3
154+
with:
155+
node-version: lts/*
156+
- uses: ipfs/aegir/actions/cache-node-modules@master
157+
- run: npx xvfb-maybe npm run --if-present test:electron-renderer
158+
- uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # v3.1.1
159+
with:
160+
flags: electron-renderer
161+
162+
release:
163+
needs: [test-node, test-chrome, test-chrome-webworker, test-firefox, test-firefox-webworker, test-webkit, test-webkit-webworker, test-electron-main, test-electron-renderer]
164+
runs-on: ubuntu-latest
165+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
166+
steps:
167+
- uses: actions/checkout@v3
168+
with:
169+
fetch-depth: 0
170+
- uses: actions/setup-node@v3
171+
with:
172+
node-version: lts/*
173+
- uses: ipfs/aegir/actions/cache-node-modules@master
174+
- uses: ipfs/aegir/actions/docker-login@master
175+
with:
176+
docker-token: ${{ secrets.DOCKER_TOKEN }}
177+
docker-username: ${{ secrets.DOCKER_USERNAME }}
178+
- run: npm run --if-present release
179+
env:
180+
GITHUB_TOKEN: ${{ secrets.UCI_GITHUB_TOKEN || github.token }}
181+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: "Semantic PR"
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- opened
7+
- edited
8+
- synchronize
9+
10+
jobs:
11+
main:
12+
name: Validate PR title
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: amannn/action-semantic-pull-request@b6bca70dcd3e56e896605356ce09b76f7e1e0d39 # v5.1.0
16+
env:
17+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18+
with:
19+
# Configure which types are allowed (newline delimited).
20+
types: |
21+
feat
22+
fix
23+
chore
24+
docs
25+
deps
26+
test
27+
refactor
28+
ci
29+
requireScope: false
30+
31+
- name: Check PR title length
32+
env:
33+
TITLE: ${{ github.event.pull_request.title }}
34+
run: |
35+
title_length=${#TITLE}
36+
if [ $title_length -gt 72 ]
37+
then
38+
echo "PR title is too long (greater than 72 characters)"
39+
exit 1
40+
fi

.github/workflows/stale.yml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Close and mark stale issue
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 * * *'
6+
7+
jobs:
8+
stale:
9+
10+
runs-on: ubuntu-latest
11+
permissions:
12+
issues: write
13+
pull-requests: write
14+
15+
steps:
16+
- uses: actions/stale@v3
17+
with:
18+
repo-token: ${{ secrets.GITHUB_TOKEN }}
19+
stale-issue-message: 'Oops, seems like we needed more information for this issue, please comment with more details or this issue will be closed in 7 days.'
20+
close-issue-message: 'This issue was closed because it is missing author input.'
21+
stale-issue-label: 'kind/stale'
22+
any-of-labels: 'need/author-input'
23+
exempt-issue-labels: 'need/triage,need/community-input,need/maintainer-input,need/maintainers-input,need/analysis,status/blocked,status/in-progress,status/ready,status/deferred,status/inactive'
24+
days-before-issue-stale: 6
25+
days-before-issue-close: 7
26+
enable-statistics: true

.gitignore

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
node_modules
2+
build
3+
dist
4+
.docs
5+
.coverage
6+
node_modules
7+
package-lock.json
8+
yarn.lock
9+
.vscode

LICENSE

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
This project is dual licensed under MIT and Apache-2.0.
2+
3+
MIT: https://www.opensource.org/licenses/mit
4+
Apache-2.0: https://www.apache.org/licenses/license-2.0

LICENSE-APACHE

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
2+
3+
http://www.apache.org/licenses/LICENSE-2.0
4+
5+
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

LICENSE-MIT

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
The MIT License (MIT)
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in
11+
all copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
THE SOFTWARE.

0 commit comments

Comments
 (0)