Skip to content

Commit

Permalink
refactor: re-arch (#279)
Browse files Browse the repository at this point in the history
* refactor: re-arch

* fix: update ci

* fix: fox

* fix: fix

* fix: test

* fix: test

* fix: tests

* fix: fix

* fix: dont run tests against dist

* fix: cov

* fix: fix

* fix: fix

* fix: sonar

* fix: fixes

* fix: fix

* fix: fox

* fix: fix

* fix: again

* fix: fix

* fix: fix

* fix: fix

* fix: fix

* fix: fix

* fix: fix

* fix: fix

* fix: test

* fix: test

* fix: test

* fix: test

* fix: fix

* fix: test

* fix: test

* fix: test

* fix: test

* fix: test

* fix: fix

* fix: fix
  • Loading branch information
cgilbe27 authored Jan 18, 2024
1 parent 113ca01 commit 323334e
Show file tree
Hide file tree
Showing 219 changed files with 1,478 additions and 99,578 deletions.
93 changes: 9 additions & 84 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,96 +1,21 @@
const common = {
module.exports = {
env: {
node: true,
es6: true,
browser: true,
es6: true,
node: true,
"jest/globals": true,
},
plugins: ["prettier", "jest"],
extends: ["airbnb-base", "prettier", "plugin:jest/recommended"],
rules: {
"@typescript-eslint/no-redeclare": ["error"],
"@typescript-eslint/no-useless-constructor": "error",
camelcase: "off",
"consistent-return": "off",
eqeqeq: "off",
"no-unreachable-loop": ["off"],
"import/extensions": "off",
"lines-between-class-members": "off",
"no-underscore-dangle": "off",
"import/no-extraneous-dependencies": ["error", { devDependencies: true }],
"import/no-named-as-default": "off",
"import/prefer-default-export": "off",
"jest/consistent-test-it": [
"error",
{ fn: "test", withinDescribe: "test" },
],
"jest/disallow-commented-out-tests": "off",
"jest/expect-expect": "off",
"jest/no-disabled-tests": "warn",
"jest/no-focused-tests": "error",
"jest/no-identical-title": "error",
"jest/no-conditional-expect": "off",
"jest/no-test-return-statement": "off",
"jest/prefer-expect-assertions": "off",
"jest/prefer-to-have-length": "warn",
"jest/require-hook": "off",
"jest/valid-expect": ["error", { maxArgs: 2 }],
"guard-for-in": "off",
"max-classes-per-file": ["off", {}],
"no-await-in-loop": "off",
"no-console": "off",
"no-iterator": "off",
"no-else-return": "off",
"no-param-reassign": "off",
"no-redeclare": "off",
"no-restricted-syntax": "off",
"no-shadow": "off",
"no-unused-vars": [
"off",
{ args: "none", argsIgnorePattern: "^_", vars: "local" },
],
"no-use-before-define": "off",
"no-useless-constructor": "off",
quotes: ["off"],
"quote-props": ["warn", "as-needed"],
radix: "off",
},
}

module.exports = {
root: true,
overrides: [
{
/*
eslint-plugin-markdown only finds javascript code block snippet.
For specific spec, refer to https://github.com/eslint/eslint-plugin-markdown
*/
files: ["**/*.js", "**/*.md"],
...common,
},
{
files: ["**/*.ts"],
parser: "@typescript-eslint/parser",
env: common.env,
plugins: [...common.plugins, "@typescript-eslint"],
extends: [
...common.extends,
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript",
],
rules: {
...common.rules,
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-unused-vars": "off",
},
settings: {
"import/resolver": {
// node: ['.js', '.ts'],
typescript: {},
},
},
},
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint", "jest", "prettier"],
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:prettier/recommended",
],
}
46 changes: 30 additions & 16 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Semantic Release 🚀
on:
push:
branches: ["main", "release/*"]
branches: ["main"]

permissions:
contents: read
Expand All @@ -16,27 +16,41 @@ jobs:
pull-requests: write
id-token: write
steps:
- uses: actions/checkout@v3
- name: Checkout ts-sdk Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Setup NodeJS and npm
uses: actions/setup-node@v3
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
path: "ts-sdk"

- name: Checkout nibiru Repository
uses: actions/checkout@v4
with:
node-version: "lts/hydrogen"
- name: Install yarn using npm
run: npm install -g yarn
- name: Setup NodeJS with yarn caching
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
repository: NibiruChain/nibiru
ref: releases/v0.21.x
path: "nibiru"
token: ${{ secrets.NIBIBOT_GIT_TOKEN }}

- name: Setup NodeJS and npm
uses: actions/setup-node@v3
with:
node-version: "lts/hydrogen"
cache: "yarn"
- name: Install dependencies
run: yarn --prefer-offline --check-files
- name: Packages Build
run: yarn build
- name: Semantic Release

- name: yarn install
uses: borales/actions-yarn@v4
with:
cmd: install

- name: yarn build
uses: borales/actions-yarn@v4
with:
cmd: build

- name: yarn semantic-release
uses: borales/actions-yarn@v4
env:
GITHUB_TOKEN: ${{ secrets.NIBIBOT_GIT_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: yarn semantic-release
with:
cmd: semantic-release
71 changes: 25 additions & 46 deletions .github/workflows/test-ts-sdk.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: ⛓️ Tests @nibiruchain/ts-sdk
name: ⛓️ Builds and Tests @nibiruchain/ts-sdk

on:
pull_request:
Expand All @@ -7,72 +7,49 @@ on:
branches: ["main"]

jobs:
checkout_cache_install:
checkout_cache_install_build_test:
runs-on: ubuntu-latest
env:
VALIDATOR_MNEMONIC: ${{ secrets.VALIDATOR_MNEMONIC }}
VALIDATOR_ADDRESS: ${{ secrets.VALIDATOR_ADDRESS }}
LCD_ENDPOINT: "http://127.0.0.1:1317"
GRPC_ENDPOINT: "127.0.0.1:9090"
TENDERMINT_RPC_ENDPOINT: "http://127.0.0.1:26657"
USE_LOCALNET: true
WEBSOCKET_ENDPOINT: "ws://127.0.0.1:26657/websocket"
CHAIN_ID: "nibiru-localnet-0"
steps:
- name: Checkout Repository
- name: Checkout ts-sdk Repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

- name: Checkout nibiru Repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
repository: NibiruChain/nibiru
ref: releases/v0.21.x
path: "nibiru"
token: ${{ secrets.NIBIBOT_GIT_TOKEN }}

- name: Setup NodeJS with yarn caching
uses: actions/setup-node@v3
with:
node-version: "lts/hydrogen"
cache: "yarn"
cache-dependency-path: "**/yarn.lock"

- name: yarn install
uses: borales/actions-yarn@v4
with:
cmd: install:packages

- name: "Tar files"
run: tar -cf preview_image.tar ./

- name: Upload preview_image
uses: actions/upload-artifact@v4
with:
name: preview_image
path: ./preview_image.tar

build:
runs-on: ubuntu-latest
needs: [checkout_cache_install]
steps:
- name: Download preview_image
uses: actions/download-artifact@v4
with:
name: preview_image

- name: Untar files
run: tar -xf preview_image.tar
cmd: install

- name: yarn build
uses: borales/actions-yarn@v4
with:
cmd: build

test:
runs-on: ubuntu-latest
needs: [checkout_cache_install]
env:
VALIDATOR_MNEMONIC: ${{ secrets.VALIDATOR_MNEMONIC }}
VALIDATOR_ADDRESS: ${{ secrets.VALIDATOR_ADDRESS }}
LCD_ENDPOINT: "http://127.0.0.1:1317"
GRPC_ENDPOINT: "127.0.0.1:9090"
TENDERMINT_RPC_ENDPOINT: "http://127.0.0.1:26657"
USE_LOCALNET: true
WEBSOCKET_ENDPOINT: "ws://127.0.0.1:26657/websocket"
CHAIN_ID: "nibiru-localnet-0"
steps:
- name: Download preview_image
uses: actions/download-artifact@v4
with:
name: preview_image

- name: Untar files
run: tar -xf preview_image.tar

- name: Run Nibiru network in the background (scripts/localnet.sh)
run: |
# Install nibid CLI
Expand All @@ -90,6 +67,8 @@ jobs:

- name: Jest Coverage Comment
uses: MishaKav/jest-coverage-comment@main
with:
coverage-summary-path: ./coverage/coverage-summary.json

- name: SonarQube Scan
uses: sonarsource/sonarqube-scan-action@master
Expand Down
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ temp
# Created by https://www.gitignore.io/api/node,intellij+all,visualstudiocode
# Edit at https://www.gitignore.io/?templates=node,intellij+all,visualstudiocode

examples/foo.ts

docs/
src/protojs/
proto/
src/indexer-nibi/gql/

### Intellij+all ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
Expand Down
1 change: 1 addition & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
module.exports = {
semi: false,
endOfLine: "lf",
}
Loading

0 comments on commit 323334e

Please sign in to comment.