Skip to content
This repository has been archived by the owner on Sep 9, 2024. It is now read-only.

Commit

Permalink
Initial forklift
Browse files Browse the repository at this point in the history
  • Loading branch information
Paulo Köch committed Aug 23, 2022
1 parent 28f393e commit cc31c1c
Show file tree
Hide file tree
Showing 67 changed files with 16,275 additions and 1 deletion.
125 changes: 125 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
{
"env": {
"browser": true,
"node": true,
"es6": true,
"es2020": true
},
"globals": {
"jsdom": true,
"jsSDK": true
},
"parser": "@babel/eslint-parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
}
},
"plugins": ["react", "babel"],
"extends": ["eslint:recommended", "plugin:react/recommended", "prettier"],
"settings": {
"react": {
"version": "16.14"
}
},
"rules": {
// Possible Errors
"no-misleading-character-class": "error",
"no-template-curly-in-string": "error",
"no-console": "warn",
// Best practices
"array-callback-return": "error",
"consistent-return": "error",
"default-case": "error",
"eqeqeq": "error",
"no-eq-null": "error",
"no-param-reassign": "error",
"no-return-assign": "error",
"no-return-await": "error",
"babel/no-unused-expressions": "error",
"require-await": "error",
"radix": "error",
// Variables
"no-unused-vars": [
"error",
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_"
}
],
"no-shadow-restricted-names": "error",
// Stylistic issues
"no-nested-ternary": "error",
"spaced-comment": [
"error",
"always",
{
"exceptions": ["-"]
}
],
// ECMAScript 6
"arrow-body-style": ["error", "as-needed"],
"no-duplicate-imports": "error",
"no-var": "error",
"prefer-const": [
"error",
{
"destructuring": "all"
}
],
"prefer-template": "error",
"template-curly-spacing": "off",
// React
"react/prop-types": "off",
"react/no-unescaped-entities": "off",
"no-import-assign": "warn"
},
"overrides": [
{
// https://typescript-eslint.io/docs/linting/troubleshooting/#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors
"files": ["*.ts", "*.mts", "*.cts", "*.tsx"],
"rules": {
"no-undef": "off"
}
},
{
"files": ["src/**/*.ts", "src/**/*.tsx"],
"excludedFiles": [
"src/components/ui/**/*.ts",
"src/components/ui/**/*.tsx"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true,
"modules": true
},
"sourceType": "module",
"project": "./tsconfig.json",
"createDefaultProgram": true
},
"plugins": ["@typescript-eslint", "react", "babel"],
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking"
],
"rules": {
"@typescript-eslint/no-floating-promises": "warn",
"@typescript-eslint/no-unsafe-assignment": "warn",
"@typescript-eslint/no-unsafe-member-access": "warn",
"@typescript-eslint/no-unsafe-call": "warn",
"@typescript-eslint/no-misused-promises": "warn",
"@typescript-eslint/no-unused-vars": [
"error",
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_"
}
]
}
}
]
}
68 changes: 68 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Pull request

on:
pull_request:
push:
branches: master

# This will cancel previous jobs in case of new push.
concurrency:
group: ${{ github.head_ref || github.ref }}
cancel-in-progress: true

jobs:
audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.13.1

- name: Find yarn cache location
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: JS package cache
uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install packages
run: yarn install --pure-lockfile

- name: Run audit
run: yarn audit-ci

eslint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.13.1

- name: Find yarn cache location
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: JS package cache
uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install packages
run: yarn install --pure-lockfile

- name: Run linters
run: yarn lint:js
63 changes: 63 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
### Gatsby default
node_modules/
.cache/
public
src/gatsby-types.d.ts

### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### macOS Patch ###
# iCloud generated files
*.icloud

### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets

# Local History for Visual Studio Code
.history/

# Built Visual Studio Code Extensions
*.vsix

### VisualStudioCode Patch ###
# Ignore all local history of files
.history
.ionide

# Support for Project snippet scope
.vscode/*.code-snippets

# Ignore code-workspaces
*.code-workspace
6 changes: 6 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# From https://www.gatsbyjs.com/plugins/gatsby-plugin-prettier-eslint/
**/node_modules/**/*
**/.git/**/*
**/dist/**/*
.cache/**/*
public/**/*
1 change: 1 addition & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"cSpell.words": ["Typegen", "unconfigured"],
"[typescript]": {
"editor.formatOnSave": false,
"editor.tabSize": 2
}
}
28 changes: 27 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,27 @@
# did-registry-demo-dapp
# Credentials API demo

A simple demo of our Credentials API.

## Stack

- Gatsby v4
- Styled components (using web3.fractal.id's theme)
- [web3-react v6](https://github.com/Uniswap/web3-react/tree/v6)

## Setup

### Run development mode

```bash
yarn install

yarn start
```

### Local build

```
yarn clean && yarn build
yarn serve
```
15 changes: 15 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module.exports = {
presets: [
[
"@babel/env",
{
modules: false,
useBuiltIns: "entry",
forceAllTransforms: true,
corejs: "3",
},
],
"@babel/react",
"@babel/typescript",
],
};
7 changes: 7 additions & 0 deletions gatsby-browser.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import React from "react";

import Web3Provider from "./src/components/common/Web3Provider";

export const wrapRootElement = ({ element }: { element: React.ReactNode }) => {
return <Web3Provider>{element}</Web3Provider>;
};
51 changes: 51 additions & 0 deletions gatsby-config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import type { GatsbyConfig } from "gatsby";

const config: GatsbyConfig = {
siteMetadata: {
title: `DID registry API demo`,
siteUrl: `https://did-registry.demo.fractal.id/`,
author: "@trustfractal",
image: "/static/icons/favicon-32x32.png",
},
// More easily incorporate content into your pages through automatic TypeScript type generation and better GraphQL IntelliSense.
// If you use VSCode you can also use the GraphQL plugin
// Learn more at: https://gatsby.dev/graphql-typegen
graphqlTypegen: true,
plugins: [
"gatsby-plugin-image",
"gatsby-plugin-react-helmet",
"gatsby-plugin-sharp",
"gatsby-plugin-styled-components",
"gatsby-transformer-sharp",
{
resolve: "gatsby-source-filesystem",
options: {
name: "images",
path: `${__dirname}/src/assets/images/`,
},
__key: "images",
},
{
resolve: "gatsby-plugin-react-svg",
options: {
rule: {
include: /assets/,
},
},
},
{
resolve: `gatsby-plugin-manifest`,
options: {
name: `Credentials API demo`,
short_name: `creditentials-api`,
start_url: `/`,
background_color: `#FFFFFF`,
theme_color: `#FFFFFF`,
display: `minimal-ui`,
icon: `src/assets/images/logo.png`, // This path is relative to the root of the site.
},
},
],
};

export default config;
7 changes: 7 additions & 0 deletions gatsby-ssr.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import React from "react";

import Web3Provider from "./src/components/common/Web3Provider";

export const wrapRootElement = ({ element }: { element: React.ReactNode }) => {
return <Web3Provider>{element}</Web3Provider>;
};
Loading

0 comments on commit cc31c1c

Please sign in to comment.