Skip to content

Commit

Permalink
feat: use typescript (#194)
Browse files Browse the repository at this point in the history
* migrate classes to separate typescript files

* fixed all typescript errors

* add aegir

* compile new app.js: npx tsc

* add vscode config

* move app.js to dist/

* chore: improve dev setup

* chore: fix with aegir lint -f

* chore: replace all tab characters

* chore: fix majority of lint errors

* chore: clean up comments & fix docs

* run check-aegir-project

* remove docker publish action

* use dist folder

* publish github pages on push to master branch

* deploy to gh-pages on merge to master

* remove release job

* temporarily disable running test scripts

* clock icon no longer blocks flag icon

* create npm start script

* minor refactor, misc improvements; dep updates

* fix a few UI issues

* Bump typescript from 4.5.5 to 4.6.2

Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.5.5 to 4.6.2.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](microsoft/TypeScript@v4.5.5...v4.6.2)

---
updated-dependencies:
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* feat: use jsipfs to publish to ipfs

* chore: fix package.json 'main' and 'files'

* fix: correct aegir settings & type failures

* use gh-pages

* fix: Cors onerror clears Tag

* revert ipfs client and ipfs-geoip versions

* CORS results update correctly

* All checks are async

* Online icon displays globe on success

* minor touchup

* commit serialized version of site before changes

The json was generated by rendering the public-gateway-checker locally, and then running the following snippet in the console:

```javascript
console.log(JSON.stringify(Array.from(document.querySelectorAll('.Node')).map((el) => Array.from(el.querySelectorAll('div')).reduce((acc, item) => {

    let content = item.textContent

    if (item.className.includes('Flag')) {
        content = item.style.getPropertyValue('background-image')
    }
    if (item.className.includes('Took')) {
        // Do not serialized the time it took because it may always change
        return acc
    }
    acc[item.className] = content
    return acc
}, {})).sort((a, b) => {
    if (a.Link > b.Link) return 1
    if (a.Link < b.Link) return -1
    return 0
}), null, 2))
```

* serialize changes after update

* fix origin checks

* #/# tested correctly updates

Also fixed online checks. All gateways show online. Verified manually by clicking each link

* runaway fixes...

* Update package.json

Co-authored-by: Marcin Rataj <[email protected]>

* Update .github/workflows/js-test-and-release.yml

Co-authored-by: Marcin Rataj <[email protected]>

* Update .github/workflows/build-and-publish-github-pages.yml

Co-authored-by: Marcin Rataj <[email protected]>

* use versioned rate-limter pkg

* comment out test github actions

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Marcin Rataj <[email protected]>
  • Loading branch information
3 people authored Mar 8, 2022
1 parent 7e65373 commit 10958e6
Show file tree
Hide file tree
Showing 41 changed files with 50,872 additions and 454 deletions.
10 changes: 10 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": [
"ipfs",
"plugin:compat/recommended"
],
"env": {
"browser": true,
"node": false
}
}
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2
updates:
- package-ecosystem: npm
directory: "/"
schedule:
interval: daily
time: "10:00"
open-pull-requests-limit: 10
50 changes: 50 additions & 0 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Automatically merge pull requests opened by web3-bot, as soon as (and only if) all tests pass.
# This reduces the friction associated with updating with our workflows.

on: [ pull_request ]
name: Automerge

jobs:
automerge-check:
if: github.event.pull_request.user.login == 'web3-bot'
runs-on: ubuntu-latest
outputs:
status: ${{ steps.should-automerge.outputs.status }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Check if we should automerge
id: should-automerge
run: |
for commit in $(git rev-list --first-parent origin/${{ github.event.pull_request.base.ref }}..${{ github.event.pull_request.head.sha }}); do
committer=$(git show --format=$'%ce' -s $commit)
echo "Committer: $committer"
if [[ "$committer" != "[email protected]" ]]; then
echo "Commit $commit wasn't committed by web3-bot, but by $committer."
echo "::set-output name=status::false"
exit
fi
done
echo "::set-output name=status::true"
automerge:
needs: automerge-check
runs-on: ubuntu-latest
# The check for the user is redundant here, as this job depends on the automerge-check job,
# but it prevents this job from spinning up, just to be skipped shortly after.
if: github.event.pull_request.user.login == 'web3-bot' && needs.automerge-check.outputs.status == 'true'
steps:
- name: Wait on tests
uses: lewagon/wait-on-check-action@bafe56a6863672c681c3cf671f5e10b20abf2eaa # v0.2
with:
ref: ${{ github.event.pull_request.head.sha }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 10
running-workflow-name: 'automerge' # the name of this job
- name: Merge PR
uses: pascalgn/automerge-action@741c311a47881be9625932b0a0de1b0937aab1ae # v0.13.1
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
MERGE_LABELS: ""
MERGE_METHOD: "squash"
MERGE_DELETE_BRANCH: true
26 changes: 26 additions & 0 deletions .github/workflows/build-and-publish-github-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Build and Publish github pages
on:
push:
branches:
- master
jobs:
build-and-publish:
concurrency: ci-${{ github.ref }} # Recommended if you intend to make multiple deployments in quick succession.
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v2

- name: Install and Build 🔧 # This example project is built using npm and outputs the result to the 'build' folder. Replace with the commands required to build your project, or remove this step entirely if your site is pre-built.
run: |
npm install
npm run build
# Deploy to gh pages branch
- name: Deploy
uses: s0/git-publish-subdir-action@399aab378450f99b7de6767f62b0d1dbfcb58b53
env:
REPO: self
BRANCH: gh-pages
FOLDER: dist
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
131 changes: 131 additions & 0 deletions .github/workflows/js-test-and-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
name: test & maybe release
on:
push:
branches:
- master # with #262 - ${{{ github.default_branch }}}
pull_request:
branches:
- master # with #262 - ${{{ github.default_branch }}}

jobs:

check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: lts/*
- uses: ipfs/aegir/actions/cache-node-modules@master
- run: npm run --if-present lint
- run: npm run --if-present dep-check

# test-node:
# needs: check
# runs-on: ${{ matrix.os }}
# strategy:
# matrix:
# os: [windows-latest, ubuntu-latest, macos-latest]
# node: ['lts/*']
# fail-fast: true
# steps:
# - uses: actions/checkout@v2
# - uses: actions/setup-node@v2
# with:
# node-version: ${{ matrix.node }}
# - uses: ipfs/aegir/actions/cache-node-modules@master
# - run: npm run --if-present test:node
# - uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0
# with:
# directory: ./.nyc_output
# flags: node

# test-chrome:
# needs: check
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - uses: actions/setup-node@v2
# with:
# node-version: lts/*
# - uses: ipfs/aegir/actions/cache-node-modules@master
# - run: npm run --if-present test:chrome
# - uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0
# with:
# directory: ./.nyc_output
# flags: chrome

# test-chrome-webworker:
# needs: check
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - uses: actions/setup-node@v2
# with:
# node-version: lts/*
# - uses: ipfs/aegir/actions/cache-node-modules@master
# - run: npm run --if-present test:chrome-webworker
# - uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0
# with:
# directory: ./.nyc_output
# flags: chrome-webworker

# test-firefox:
# needs: check
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - uses: actions/setup-node@v2
# with:
# node-version: lts/*
# - uses: ipfs/aegir/actions/cache-node-modules@master
# - run: npm run --if-present test:firefox
# - uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0
# with:
# directory: ./.nyc_output
# flags: firefox

# test-firefox-webworker:
# needs: check
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - uses: actions/setup-node@v2
# with:
# node-version: lts/*
# - uses: ipfs/aegir/actions/cache-node-modules@master
# - run: npm run --if-present test:firefox-webworker
# - uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0
# with:
# directory: ./.nyc_output
# flags: firefox-webworker

# test-electron-main:
# needs: check
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - uses: actions/setup-node@v2
# with:
# node-version: lts/*
# - uses: ipfs/aegir/actions/cache-node-modules@master
# - run: npx xvfb-maybe npm run --if-present test:electron-main
# - uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0
# with:
# directory: ./.nyc_output
# flags: electron-main

# test-electron-renderer:
# needs: check
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - uses: actions/setup-node@v2
# with:
# node-version: lts/*
# - uses: ipfs/aegir/actions/cache-node-modules@master
# - run: npx xvfb-maybe npm run --if-present test:electron-renderer
# - uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0
# with:
# directory: ./.nyc_output
# flags: electron-renderer
Loading

0 comments on commit 10958e6

Please sign in to comment.