Skip to content

Commit 4f02ac0

Browse files
committed
Package setup
0 parents  commit 4f02ac0

19 files changed

+691
-0
lines changed

.aegir.cjs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/** @type {import('aegir').PartialOptions} */
2+
module.exports = {
3+
tsRepo: true,
4+
build: {
5+
config: {
6+
platform: 'node'
7+
},
8+
bundlesizeMax: '44KB'
9+
}
10+
}

.envrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
use asdf
2+
3+
export PATH=$(npm bin):${PATH}
4+
export MOCK_PINNING_SERVER_PORT=3000
5+
export MOCK_PINNING_SERVER_SECRET=secret

.github/dependabot.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
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

.github/workflows/automerge.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Automatically merge pull requests opened by web3-bot, as soon as (and only if) all tests pass.
2+
# This reduces the friction associated with updating with our workflows.
3+
4+
on: [ pull_request ]
5+
name: Automerge
6+
7+
jobs:
8+
automerge-check:
9+
if: github.event.pull_request.user.login == 'web3-bot'
10+
runs-on: ubuntu-latest
11+
outputs:
12+
status: ${{ steps.should-automerge.outputs.status }}
13+
steps:
14+
- uses: actions/checkout@v2
15+
with:
16+
fetch-depth: 0
17+
- name: Check if we should automerge
18+
id: should-automerge
19+
run: |
20+
for commit in $(git rev-list --first-parent origin/${{ github.event.pull_request.base.ref }}..${{ github.event.pull_request.head.sha }}); do
21+
committer=$(git show --format=$'%ce' -s $commit)
22+
echo "Committer: $committer"
23+
if [[ "$committer" != "[email protected]" ]]; then
24+
echo "Commit $commit wasn't committed by web3-bot, but by $committer."
25+
echo "::set-output name=status::false"
26+
exit
27+
fi
28+
done
29+
echo "::set-output name=status::true"
30+
automerge:
31+
needs: automerge-check
32+
runs-on: ubuntu-latest
33+
# The check for the user is redundant here, as this job depends on the automerge-check job,
34+
# but it prevents this job from spinning up, just to be skipped shortly after.
35+
if: github.event.pull_request.user.login == 'web3-bot' && needs.automerge-check.outputs.status == 'true'
36+
steps:
37+
- name: Wait on tests
38+
uses: lewagon/wait-on-check-action@bafe56a6863672c681c3cf671f5e10b20abf2eaa # v0.2
39+
with:
40+
ref: ${{ github.event.pull_request.head.sha }}
41+
repo-token: ${{ secrets.GITHUB_TOKEN }}
42+
wait-interval: 10
43+
running-workflow-name: 'automerge' # the name of this job
44+
- name: Merge PR
45+
uses: pascalgn/automerge-action@741c311a47881be9625932b0a0de1b0937aab1ae # v0.13.1
46+
env:
47+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
48+
MERGE_LABELS: ""
49+
MERGE_METHOD: "squash"
50+
MERGE_DELETE_BRANCH: true
Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
name: test & maybe release
2+
on:
3+
push:
4+
branches:
5+
- main # with #262 - ${{{ github.default_branch }}}
6+
pull_request:
7+
branches:
8+
- main # with #262 - ${{{ github.default_branch }}}
9+
10+
jobs:
11+
12+
check:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
- uses: actions/setup-node@v2
17+
with:
18+
node-version: lts/*
19+
- uses: ipfs/aegir/actions/cache-node-modules@master
20+
- run: npm run --if-present lint
21+
- run: npm run --if-present dep-check
22+
23+
test-node:
24+
needs: check
25+
runs-on: ${{ matrix.os }}
26+
strategy:
27+
matrix:
28+
os: [windows-latest, ubuntu-latest, macos-latest]
29+
node: [16]
30+
fail-fast: true
31+
steps:
32+
- uses: actions/checkout@v2
33+
- uses: actions/setup-node@v2
34+
with:
35+
node-version: ${{ matrix.node }}
36+
- uses: ipfs/aegir/actions/cache-node-modules@master
37+
- run: npm run --if-present test:node
38+
- uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0
39+
with:
40+
directory: ./.nyc_output
41+
flags: node
42+
43+
test-chrome:
44+
needs: check
45+
runs-on: ubuntu-latest
46+
steps:
47+
- uses: actions/checkout@v2
48+
- uses: actions/setup-node@v2
49+
with:
50+
node-version: lts/*
51+
- uses: ipfs/aegir/actions/cache-node-modules@master
52+
- run: npm run --if-present test:chrome
53+
- uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0
54+
with:
55+
directory: ./.nyc_output
56+
flags: chrome
57+
58+
test-chrome-webworker:
59+
needs: check
60+
runs-on: ubuntu-latest
61+
steps:
62+
- uses: actions/checkout@v2
63+
- uses: actions/setup-node@v2
64+
with:
65+
node-version: lts/*
66+
- uses: ipfs/aegir/actions/cache-node-modules@master
67+
- run: npm run --if-present test:chrome-webworker
68+
- uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0
69+
with:
70+
directory: ./.nyc_output
71+
flags: chrome-webworker
72+
73+
test-firefox:
74+
needs: check
75+
runs-on: ubuntu-latest
76+
steps:
77+
- uses: actions/checkout@v2
78+
- uses: actions/setup-node@v2
79+
with:
80+
node-version: lts/*
81+
- uses: ipfs/aegir/actions/cache-node-modules@master
82+
- run: npm run --if-present test:firefox
83+
- uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0
84+
with:
85+
directory: ./.nyc_output
86+
flags: firefox
87+
88+
test-firefox-webworker:
89+
needs: check
90+
runs-on: ubuntu-latest
91+
steps:
92+
- uses: actions/checkout@v2
93+
- uses: actions/setup-node@v2
94+
with:
95+
node-version: lts/*
96+
- uses: ipfs/aegir/actions/cache-node-modules@master
97+
- run: npm run --if-present test:firefox-webworker
98+
- uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0
99+
with:
100+
directory: ./.nyc_output
101+
flags: firefox-webworker
102+
103+
test-electron-main:
104+
needs: check
105+
runs-on: ubuntu-latest
106+
steps:
107+
- uses: actions/checkout@v2
108+
- uses: actions/setup-node@v2
109+
with:
110+
node-version: lts/*
111+
- uses: ipfs/aegir/actions/cache-node-modules@master
112+
- run: npx xvfb-maybe npm run --if-present test:electron-main
113+
- uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0
114+
with:
115+
directory: ./.nyc_output
116+
flags: electron-main
117+
118+
test-electron-renderer:
119+
needs: check
120+
runs-on: ubuntu-latest
121+
steps:
122+
- uses: actions/checkout@v2
123+
- uses: actions/setup-node@v2
124+
with:
125+
node-version: lts/*
126+
- uses: ipfs/aegir/actions/cache-node-modules@master
127+
- run: npx xvfb-maybe npm run --if-present test:electron-renderer
128+
- uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0
129+
with:
130+
directory: ./.nyc_output
131+
flags: electron-renderer
132+
133+
release:
134+
needs: [test-node, test-chrome, test-chrome-webworker, test-firefox, test-firefox-webworker, test-electron-main, test-electron-renderer]
135+
runs-on: ubuntu-latest
136+
if: github.event_name == 'push' && github.ref == 'refs/heads/main' # with #262 - 'refs/heads/${{{ github.default_branch }}}'
137+
steps:
138+
- uses: actions/checkout@v2
139+
with:
140+
fetch-depth: 0
141+
- uses: actions/setup-node@v2
142+
with:
143+
node-version: lts/*
144+
- uses: ipfs/aegir/actions/cache-node-modules@master
145+
- uses: ipfs/aegir/actions/docker-login@master
146+
with:
147+
docker-token: ${{ secrets.DOCKER_TOKEN }}
148+
docker-username: ${{ secrets.DOCKER_USERNAME }}
149+
- run: npm run --if-present release
150+
env:
151+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
152+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Test & Maybe Release
2+
on: [push, pull_request]
3+
jobs:
4+
test:
5+
strategy:
6+
fail-fast: false
7+
matrix:
8+
node: [14.x, 16.x]
9+
os: [macos-latest, ubuntu-latest, windows-latest]
10+
runs-on: ${{ matrix.os }}
11+
steps:
12+
- name: Checkout Repository
13+
uses: actions/[email protected]
14+
- name: Use Node.js ${{ matrix.node }}
15+
uses: actions/[email protected]
16+
with:
17+
node-version: ${{ matrix.node }}
18+
- name: Install Dependencies
19+
run: |
20+
npm install --no-progress
21+
- name: Run tests
22+
run: |
23+
npm config set script-shell bash
24+
npm run test:ci
25+
release:
26+
name: Release
27+
needs: test
28+
runs-on: ubuntu-latest
29+
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
30+
steps:
31+
- name: Checkout
32+
uses: actions/[email protected]
33+
with:
34+
fetch-depth: 0
35+
- name: Setup Node.js
36+
uses: actions/[email protected]
37+
with:
38+
node-version: 14
39+
- name: Install dependencies
40+
run: |
41+
npm install --no-progress --no-package-lock --no-save
42+
- name: Build
43+
run: |
44+
npm run build
45+
- name: Install plugins
46+
run: |
47+
npm install \
48+
@semantic-release/commit-analyzer \
49+
conventional-changelog-conventionalcommits \
50+
@semantic-release/release-notes-generator \
51+
@semantic-release/npm \
52+
@semantic-release/github \
53+
@semantic-release/git \
54+
@semantic-release/changelog \
55+
--no-progress --no-package-lock --no-save
56+
- name: Release
57+
env:
58+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
60+
run: npx semantic-release

.github/workflows/typecheck.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
on:
2+
push:
3+
branches:
4+
- master
5+
- main
6+
- default
7+
pull_request:
8+
branches:
9+
- "**"
10+
11+
name: Typecheck
12+
jobs:
13+
check:
14+
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
node-version: [12.x]
18+
steps:
19+
- uses: actions/[email protected]
20+
- name: Use Node.js ${{ matrix.node-version }}
21+
uses: actions/[email protected]
22+
with:
23+
node-version: ${{ matrix.node-version }}
24+
- name: Install dependencies
25+
run: npm install
26+
- name: Typecheck
27+
uses: gozala/[email protected]
28+
with:
29+
project: test/tsconfig.json

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
node_modules
2+
typings
3+
dist
4+
build
5+
coverage
6+
node_modules
7+
.DS_Store
8+
yarn.lock
9+
test/ts-use/tsconfig.tsbuildinfo
10+
test/tsconfig.tsbuildinfo
11+
package-lock.json

.openapi-generator-ignore

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# OpenAPI Generator Ignore
2+
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
3+
4+
# Use this file to prevent files from being overwritten by the generator.
5+
# The patterns follow closely to .gitignore or .dockerignore.
6+
7+
# As an example, the C# client generator defines ApiClient.cs.
8+
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
9+
#ApiClient.cs
10+
11+
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
12+
#foo/*/qux
13+
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
14+
15+
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
16+
#foo/**/qux
17+
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
18+
19+
# You can also negate patterns with an exclamation (!).
20+
# For example, you can ignore all files in a docs folder with the file extension .md:
21+
#docs/*.md
22+
# Then explicitly reverse the ignore rule for a single file:
23+
#!docs/README.md
24+
25+
.gitignore
26+
package.json
27+
package-lock.json
28+
README.md
29+
tsconfig.json

.vscode/settings.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"editor.tabSize": 2,
3+
"typescript.format.semicolons": "remove",
4+
"javascript.format.semicolons": "remove",
5+
"typescript.suggest.includeAutomaticOptionalChainCompletions": true,
6+
}

0 commit comments

Comments
 (0)