-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from subquery/milestone-1
Milestone 1 Support
- Loading branch information
Showing
148 changed files
with
23,561 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.github | ||
node_modules | ||
coverage | ||
deploy | ||
docs | ||
test/docker-compose.yaml | ||
test/Dockerfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/build/** | ||
/api_docs/** | ||
**/node_modules/** | ||
**/test/**/* | ||
/scripts/* | ||
packages/**/dist/** | ||
packages/**/lib/** | ||
.eslintrc.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
/* | ||
👋 Hi! This file was autogenerated by tslint-to-eslint-config. | ||
https://github.com/typescript-eslint/tslint-to-eslint-config | ||
It represents the closest reasonable ESLint configuration to this | ||
project's original TSLint configuration. | ||
We recommend eventually switching this configuration to extend from | ||
the recommended rulesets in typescript-eslint. | ||
https://github.com/typescript-eslint/tslint-to-eslint-config/blob/master/docs/FAQs.md | ||
Happy linting! 💖 | ||
*/ | ||
module.exports = { | ||
env: { | ||
node: true, | ||
jest: true, | ||
}, | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
tsconfigRootDir: __dirname, | ||
sourceType: 'module', | ||
project: ['./tsconfig.json', './packages/*/tsconfig.json'], | ||
warnOnUnsupportedTypeScriptVersion: false, | ||
EXPERIMENTAL_useSourceOfProjectReferenceRedirect: true, | ||
}, | ||
plugins: ['@typescript-eslint', 'header', 'import', 'sort-destructure-keys'], | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:@typescript-eslint/recommended-requiring-type-checking', | ||
], | ||
rules: { | ||
// rules turned off in upstream project (also required when recommended-requiring-type-checking is extended) | ||
'@typescript-eslint/explicit-function-return-type': 'off', | ||
'@typescript-eslint/no-unsafe-argument': 'off', | ||
'@typescript-eslint/no-unsafe-assignment': 'off', | ||
'@typescript-eslint/no-unsafe-call': 'off', | ||
'@typescript-eslint/no-unsafe-member-access': 'off', | ||
'@typescript-eslint/no-unsafe-return': 'off', | ||
'@typescript-eslint/no-unnecessary-type-assertion': 'off', | ||
'@typescript-eslint/restrict-plus-operands': 'off', | ||
'@typescript-eslint/restrict-template-expressions': 'off', | ||
// Support recommended-requiring-type-checking (specific to this project) set them as warning | ||
'@typescript-eslint/unbound-method': 'warn', | ||
'@typescript-eslint/no-floating-promises': 'warn', | ||
// Making affected recommended types as warning for now | ||
'@typescript-eslint/explicit-module-boundary-types': 'warn', | ||
'@typescript-eslint/no-explicit-any': 'warn', | ||
'@typescript-eslint/no-var-requires': 'warn', | ||
'@typescript-eslint/no-unused-vars': 'warn', | ||
'@typescript-eslint/ban-ts-comment': 'warn', | ||
'@typescript-eslint/ban-types': 'warn', | ||
'@typescript-eslint/no-inferrable-types': 'warn', | ||
'@typescript-eslint/await-thenable': 'error', | ||
'@typescript-eslint/dot-notation': 'error', | ||
'@typescript-eslint/explicit-member-accessibility': [ | ||
'error', | ||
{ | ||
accessibility: 'no-public', | ||
}, | ||
], | ||
'@typescript-eslint/no-namespace': ['error', {allowDeclarations: true}], | ||
// "@typescript-eslint/member-ordering": "error", | ||
// "@typescript-eslint/naming-convention": "error", | ||
// "@typescript-eslint/no-param-reassign": "error", | ||
'@typescript-eslint/promise-function-async': ['error', {checkArrowFunctions: false}], | ||
// "arrow-body-style": "error", | ||
complexity: ['error', 20], | ||
curly: ['error', 'multi-line'], | ||
'default-case': 'error', | ||
eqeqeq: ['error', 'always'], | ||
'import/no-extraneous-dependencies': 'off', | ||
'import/order': [ | ||
'error', | ||
{ | ||
alphabetize: { | ||
order: 'asc' /* sort in ascending order. Options: ['ignore', 'asc', 'desc'] */, | ||
caseInsensitive: true /* ignore case. Options: [true, false] */, | ||
}, | ||
}, | ||
], | ||
'header/header': [ | ||
2, | ||
'line', | ||
[ | ||
//Copyright 2020-2023 SubQuery Pte Ltd authors & contributors | ||
{pattern: ' Copyright \\d{4}(-\\d{4})? SubQuery Pte Ltd authors & contributors'}, | ||
' SPDX-License-Identifier: GPL-3.0', | ||
], | ||
2, | ||
], | ||
'sort-destructure-keys/sort-destructure-keys': [ | ||
2, | ||
{ | ||
caseSensitive: true, | ||
}, | ||
], | ||
'no-console': 'off', | ||
'no-duplicate-imports': 'error', | ||
// "no-magic-numbers": "error", | ||
'no-return-await': 'error', | ||
'no-undef-init': 'error', | ||
'prefer-template': 'error', | ||
'use-isnan': 'error', | ||
}, | ||
settings: { | ||
'import/extensions': ['.js', '.ts'], | ||
'import/parsers': { | ||
'@typescript-eslint/parser': ['.ts', '.tsx'], | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
### Prerequisites | ||
|
||
* [ ] Are you running the latest version(s)? | ||
* [ ] Have you searched the [documentation for your issue](https://academy.subquery.network/)? | ||
* [ ] Did you search for an existing issue or pull request? | ||
|
||
### Description | ||
|
||
[Description of the bug or feature] | ||
|
||
### Details | ||
|
||
These details can help to reproduce the environment the issue is occurring | ||
|
||
**Local Environment:** [You can get this information from executing `subql version`.] | ||
**Query Version:** [What is the version of the query service?] | ||
**Indexer Version:** [What is the version of the indexer service?] | ||
**Network Details:** | ||
* [Network] | ||
* [Block height, a block height where the issue is happening] | ||
* [Dictionary endpoint, if used] | ||
|
||
### Steps to Reproduce | ||
|
||
1. [First Step] | ||
2. [Second Step] | ||
3. [and so on...] | ||
|
||
**Example project:** [A link to a minimal example that can reproduce the issue] | ||
|
||
**Expected behavior:** [What you expected to happen] | ||
|
||
**Actual behavior:** [What actually happened] | ||
|
||
|
||
### Any other information | ||
|
||
Is there any other information you would like to add? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Description | ||
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change. | ||
|
||
Fixes # (issue) | ||
|
||
## Type of change | ||
|
||
Please delete options that are not relevant. | ||
|
||
- [ ] Bug fix (non-breaking change which fixes an issue) | ||
- [ ] New feature (non-breaking change which adds functionality) | ||
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) | ||
- [ ] This change requires a documentation update | ||
|
||
## Checklist | ||
|
||
- [ ] I have tested locally | ||
- [ ] I have performed a self review of my changes | ||
- [ ] Updated any relevant documentation | ||
- [ ] Linked to any relevant issues | ||
- [ ] I have added tests relevant to my changes | ||
- [ ] Any dependent changes have been merged and published in downstream modules | ||
- [ ] My code is up to date with the base branch | ||
- [ ] I have updated relevant changelogs. [We suggest using chan](https://github.com/geut/chan/tree/main/packages/chan) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Composite action needed to access github context | ||
|
||
# This is to compensate for yarn 3 issue https://github.com/yarnpkg/berry/issues/3868 | ||
name: 'Remove Stable Versions' | ||
description: 'This will remove stableVersion from packages for prerelease' | ||
inputs: | ||
package-path: | ||
description: 'package path to run action e.g. package/common' | ||
required: true | ||
npm-token: | ||
description: 'token to push to npm registry' | ||
required: true | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- working-directory: ${{ github.workspace }} | ||
run: node ${{ github.action_path }}/remove-stable-version.js ${{ github.workspace }}/${{ inputs.package-path }} | ||
shell: bash | ||
|
||
- working-directory: ${{ inputs.package-path }} | ||
run: echo "Changes exist in ${{ inputs.package-path }}" && yarn version prerelease && yarn npm publish --access public --tag dev | ||
env: | ||
NPM_TOKEN: ${{ inputs.npm-token }} | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
const fs = require('fs'); | ||
const myArgs = process.argv.slice(2); | ||
const pJson = require(`${myArgs[0]}/package.json`) | ||
|
||
if (pJson.stableVersion){ | ||
delete pJson.stableVersion | ||
fs.writeFileSync(`${myArgs[0]}/package.json`, JSON.stringify(pJson, null, 2)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Composite action needed to access github context | ||
|
||
name: 'Create Release' | ||
description: 'This will publish to NPM registry and create Github release' | ||
inputs: | ||
package-path: # id of input | ||
description: 'package path to run action e.g. package/common' | ||
required: true | ||
repo-token: | ||
description: 'token to create github release' | ||
required: true | ||
npm-token: | ||
description: 'token to push to npm registry' | ||
required: true | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- working-directory: ${{ inputs.package-path }} | ||
run: echo "Changes exist in ${{ inputs.package-path }}" && yarn npm publish --access public | ||
env: | ||
NPM_TOKEN: ${{ inputs.npm-token }} | ||
shell: bash | ||
|
||
- working-directory: ${{ github.workspace }} | ||
run: node ${{ github.action_path }}/gh-release-script.js ${{ github.workspace }}/${{ inputs.package-path }} | ||
env: | ||
REPO_TOKEN: ${{ inputs.repo-token }} | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
const fs = require('fs'); | ||
const { exit } = require('process'); | ||
const core = require('@actions/core'); | ||
const { request } = require('@octokit/request'); | ||
|
||
const myArgs = process.argv.slice(2); | ||
|
||
const pJson = require(`${myArgs[0]}/package.json`) | ||
|
||
const version = pJson.version; | ||
const repoName = pJson.name; | ||
|
||
const packageName = repoName.split('/'); | ||
|
||
function checkForBetaVersion(version) { | ||
if (version.includes('-')){ | ||
exit(0); //skip this package but continue trying to release others | ||
} | ||
} | ||
|
||
function gatherReleaseInfo(logPath) { | ||
const changeLogs = fs.readFileSync(logPath, 'utf8'); | ||
const regex = /## \[([0-9]+(\.[0-9]+)+)] - [0-9]{4}-[0-9]{2}-[0-9]{2}/i; | ||
|
||
let lines = changeLogs.split(/\n/); | ||
let foundChangelog = false; | ||
let releaseInfo = ''; | ||
let i = 0; | ||
|
||
for(let j = 0; j < lines.length; j++){ | ||
if(lines[j].includes(`[${version}]`)){ | ||
i = j; | ||
j = lines.length; | ||
foundChangelog = true; | ||
} | ||
} | ||
|
||
lines = lines.slice(i); | ||
|
||
if(foundChangelog){ | ||
for(let j = 0; j < lines.length; j++){ | ||
if(j == 0){ | ||
releaseInfo += `${lines[j]}`+ '\n'; | ||
continue; | ||
} | ||
|
||
if(!regex.test(lines[j])){ | ||
releaseInfo += `${lines[j]}`+ '\n'; | ||
} else { | ||
j = lines.length; | ||
} | ||
} | ||
} | ||
|
||
if(releaseInfo === ''){ | ||
core.setFailed("No release info found, either missing in changelog or changelog is formatted incorrectly") | ||
} | ||
|
||
console.log("Gathered release info...") | ||
return releaseInfo; | ||
} | ||
|
||
async function publishRelease(releaseInfo) { | ||
|
||
await request('POST /repos/{owner}/{repo}/releases', { | ||
headers: { | ||
authorization: `token ${process.env.REPO_TOKEN}`, | ||
}, | ||
owner: 'subquery', | ||
name: `[${version}] ${repoName}`, | ||
repo: 'subql-soroban', | ||
tag_name: `${packageName[1]}/${version}`, | ||
body: releaseInfo | ||
}).catch( err => { | ||
core.setFailed(err) | ||
}) | ||
|
||
console.log("Release Created...") | ||
} | ||
|
||
checkForBetaVersion(version); | ||
|
||
const releaseInfo = gatherReleaseInfo(`${myArgs[0]}/CHANGELOG.md`); | ||
|
||
publishRelease(releaseInfo); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: discord notification | ||
on: | ||
release: | ||
types: | ||
- published | ||
|
||
jobs: | ||
notify: | ||
name: Discord Notification | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Send release details to Discord | ||
uses: rjstone/discord-webhook-notify@v1 | ||
with: | ||
webhookUrl: ${{ secrets.DISCORD_RELEASE_NOTES_WEBHOOK }} | ||
color: '#6499ff' | ||
avatarUrl: https://github.githubassets.com/images/modules/logos_page/Octocat.png | ||
details: ${{ github.event.release.body }} | ||
description: "[Release] ${{ github.event.release.name }}" | ||
footer: ${{ github.event.release.html_url }} |
Oops, something went wrong.