Skip to content

Commit b2845ec

Browse files
committed
build: Initial commit
0 parents  commit b2845ec

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+11564
-0
lines changed

.commitlintrc.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"extends": ["@commitlint/config-conventional"],
3+
"rules": {
4+
"subject-case": [2, "always", "sentence-case"],
5+
"type-enum": [
6+
2,
7+
"always",
8+
["build", "ci", "chore", "docs", "feat", "fix", "perf", "refactor", "revert", "style", "test"]
9+
]
10+
}
11+
}

.eslintignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
build/
2+
generated/
3+
node_modules/

.eslintrc

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"parser": "@typescript-eslint/parser",
3+
"plugins": ["@typescript-eslint"],
4+
"extends": ["plugin:@typescript-eslint/recommended", "prettier"]
5+
}

.github/dependabot.yml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: 2
2+
3+
updates:
4+
- package-ecosystem: "github-actions"
5+
directory: "/"
6+
schedule:
7+
interval: "weekly"

.github/workflows/build.yml

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Build
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
branches:
8+
- main
9+
10+
jobs:
11+
build:
12+
13+
name: Build
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v2
19+
20+
- name: Setup Node
21+
uses: actions/setup-node@v2
22+
with:
23+
node-version: 14.x
24+
25+
- name: Get yarn cache directory path
26+
id: yarn-cache-dir-path
27+
run: echo "::set-output name=dir::$(yarn cache dir)"
28+
29+
- uses: actions/cache@v2
30+
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
31+
with:
32+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
33+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
34+
restore-keys: |
35+
${{ runner.os }}-yarn-
36+
37+
- name: Install dependencies
38+
run: yarn install --frozen-lockfile
39+
40+
- name: Run codegen
41+
run: yarn codegen
42+
43+
- name: Run build
44+
run: yarn build

.github/workflows/eslint.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: ESLint
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
branches:
8+
- main
9+
10+
jobs:
11+
lint:
12+
13+
name: ESLint
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v2
19+
20+
- name: Setup Node
21+
uses: actions/setup-node@v2
22+
with:
23+
node-version: 14.x
24+
25+
- name: Get yarn cache directory path
26+
id: yarn-cache-dir-path
27+
run: echo "::set-output name=dir::$(yarn cache dir)"
28+
29+
- uses: actions/cache@v2
30+
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
31+
with:
32+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
33+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
34+
restore-keys: |
35+
${{ runner.os }}-yarn-
36+
37+
- name: Install dependencies
38+
run: yarn install --frozen-lockfile
39+
40+
- name: Run ESLint
41+
run: yarn lint

.github/workflows/prettier.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Prettier
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
branches:
8+
- main
9+
10+
jobs:
11+
format:
12+
13+
name: Prettier
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v2
19+
20+
- name: Setup Node
21+
uses: actions/setup-node@v2
22+
with:
23+
node-version: 14.x
24+
25+
- name: Get yarn cache directory path
26+
id: yarn-cache-dir-path
27+
run: echo "::set-output name=dir::$(yarn cache dir)"
28+
29+
- uses: actions/cache@v2
30+
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
31+
with:
32+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
33+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
34+
restore-keys: |
35+
${{ runner.os }}-yarn-
36+
37+
- name: Install dependencies
38+
run: yarn install --frozen-lockfile
39+
40+
- name: Run Prettier
41+
run: yarn format:check

.gitignore

+120
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
lerna-debug.log*
8+
9+
# Diagnostic reports (https://nodejs.org/api/report.html)
10+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
11+
12+
# Runtime data
13+
pids
14+
*.pid
15+
*.seed
16+
*.pid.lock
17+
18+
# Directory for instrumented libs generated by jscoverage/JSCover
19+
lib-cov
20+
21+
# Coverage directory used by tools like istanbul
22+
coverage
23+
*.lcov
24+
25+
# nyc test coverage
26+
.nyc_output
27+
28+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
29+
.grunt
30+
31+
# Bower dependency directory (https://bower.io/)
32+
bower_components
33+
34+
# node-waf configuration
35+
.lock-wscript
36+
37+
# Compiled binary addons (https://nodejs.org/api/addons.html)
38+
build/Release
39+
40+
# Dependency directories
41+
node_modules/
42+
jspm_packages/
43+
44+
# TypeScript v1 declaration files
45+
typings/
46+
47+
# TypeScript cache
48+
*.tsbuildinfo
49+
50+
# Optional npm cache directory
51+
.npm
52+
53+
# Optional eslint cache
54+
.eslintcache
55+
56+
# Microbundle cache
57+
.rpt2_cache/
58+
.rts2_cache_cjs/
59+
.rts2_cache_es/
60+
.rts2_cache_umd/
61+
62+
# Optional REPL history
63+
.node_repl_history
64+
65+
# Output of 'npm pack'
66+
*.tgz
67+
68+
# Yarn Integrity file
69+
.yarn-integrity
70+
71+
# dotenv environment variables file
72+
.env
73+
.env.test
74+
75+
# parcel-bundler cache (https://parceljs.org/)
76+
.cache
77+
78+
# Vercel build output
79+
.vercel
80+
81+
# Next.js build output
82+
.next
83+
84+
# Nuxt.js build / generate output
85+
.nuxt
86+
dist
87+
88+
# Gatsby files
89+
.cache/
90+
# Comment in the public line in if your project uses Gatsby and *not* Next.js
91+
# https://nextjs.org/blog/next-9-1#public-directory-support
92+
# public
93+
94+
# vuepress build output
95+
.vuepress/dist
96+
97+
# Serverless directories
98+
.serverless/
99+
100+
# FuseBox cache
101+
.fusebox/
102+
103+
# DynamoDB Local files
104+
.dynamodb/
105+
106+
# TernJS port file
107+
.tern-port
108+
109+
# MacOS
110+
.DS_Store
111+
112+
# IDE's
113+
.vscode/
114+
.idea/
115+
116+
# GraphQL directories
117+
build/
118+
generated/
119+
120+
.turbo

.husky/commit-msg

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
pnpm commitlint --edit $1

.husky/pre-commit

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
pnpm format:check

.prettierignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
build/
2+
generated/
3+
node_modules/

.prettierrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"printWidth": 120
3+
}

LICENSE

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

README.md

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Subgraph-template
2+
3+
<div align=center style="background:lightgrey">
4+
<img src="./logo.png" width=100" height="100" />
5+
</div>
6+
<div align=center>
7+
<img src="https://img.shields.io/badge/nodejs^14-blue"/>
8+
<img src="https://img.shields.io/badge/graph^0.30.0-blue"/>
9+
<img src="https://img.shields.io/badge/subgraph^0.0.5-blue"/>
10+
</div>
11+
12+
English | [简体中文](./README_zh.md)
13+
14+
15+
TheGraph exposes a GraphQL endpoint to query the events and entities within the xxx chain and xxx ecosystem.
16+
17+
Currently, there are multiple subgraphs, but additional subgraphs can be added to this repository, following the current architecture.
18+
19+
20+
## Subgraphs
21+
01. **[Demo](https://thegraph.com/hosted-service/subgraph/lingcoder/xxx)**: Tracks data for Demo.
22+
23+
24+
## Dependencies
25+
26+
- [Graph CLI](https://github.com/graphprotocol/graph-cli)
27+
- Required to generate and build local GraphQL dependencies.
28+
29+
```shell
30+
yarn global add @graphprotocol/graph-cli
31+
```
32+
33+
## Deployment
34+
35+
For any of the subgraph: `blocks` as `[subgraph]`
36+
37+
1. Run the `cd subgraphs/[subgraph]` command to move to the subgraph directory.
38+
39+
2. Run the `yarn codegen` command to prepare the TypeScript sources for the GraphQL (generated/*).
40+
41+
3. Run the `yarn build` command to build the subgraph, and check compilation errors before deploying.
42+
43+
4. Run `graph auth --product hosted-service '<ACCESS_TOKEN>'`
44+
45+
5. Deploy via `yarn deploy`.

0 commit comments

Comments
 (0)