Skip to content

Commit

Permalink
chore(restapi): adding rest api code from old sdk
Browse files Browse the repository at this point in the history
add code from the old sdk
  • Loading branch information
subhranshudas committed Oct 5, 2022
1 parent e03908f commit e2f2fa5
Show file tree
Hide file tree
Showing 53 changed files with 4,237 additions and 59 deletions.
35 changes: 35 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"root": true,
"ignorePatterns": ["**/*"],
"plugins": ["@nrwl/nx"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {
"@nrwl/nx/enforce-module-boundaries": [
"error",
{
"enforceBuildableLibDependency": true,
"allow": [],
"depConstraints": [
{
"sourceTag": "*",
"onlyDependOnLibsWithTags": ["*"]
}
]
}
]
}
},
{
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nrwl/nx/typescript"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"extends": ["plugin:@nrwl/nx/javascript"],
"rules": {}
}
]
}
48 changes: 48 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Publish Push SDK

on:
pull_request:
types: [closed]
branches:
- main
jobs:
publish:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest

steps:
- name: "Checkout"
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: "Setup NodeJS"
uses: actions/setup-node@v2
with:
node-version: '14'

- name: Ensure NPM access
run: |
npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Setup Git
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor}}@users.noreply.github.com"
- run: yarn install --frozen-lockfile

# The NX target "ci-version" has postTargets=[build, ci-publish]
- name: "Version, Build, Publish"
shell: bash
run: yarn nx affected --target ci-version --base= origin/main~1 --head= HEAD --parallel=1 --exclude=demoreact demonative

- name: "Push GIT Tags"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
git push origin main --follow-tags
17 changes: 17 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh

red=`tput setaf 1`
green=`tput setaf 2`
reset=`tput sgr0`

echo "\n\nRunning GIT 'commit-msg' hook..."
echo "\n This enforces Conventional Commits"

if ! head -1 "$1" | grep -qE "^(feat|fix|chore|docs|test|style|refactor|perf|build|ci|revert)(\(.+?\))?: .{1,}$"; then
echo "${red}Aborting commit. Your commit message is invalid!!!" >&2
exit 1
fi
if ! head -1 "$1" | grep -qE "^.{1,88}$"; then
echo "${red}Aborting commit. Your commit message is too long!!!" >&2
exit 1
fi
7 changes: 7 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

echo "\nRunning GIT hooks..."
yarn cleanbuild
yarn nx affected --target=lint
yarn nx affected --target=test
5 changes: 3 additions & 2 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"recommendations": [

"nrwl.angular-console",
"esbenp.prettier-vscode"
"esbenp.prettier-vscode",
"dbaeumer.vscode-eslint",
"firsttris.vscode-jest-runner"
]
}
5 changes: 5 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { getJestProjects } from '@nrwl/jest';

export default {
projects: getJestProjects(),
};
3 changes: 3 additions & 0 deletions jest.preset.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const nxPreset = require('@nrwl/jest/preset').default;

module.exports = { ...nxPreset };
33 changes: 31 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,44 @@
"name": "sdk",
"version": "0.0.0",
"license": "MIT",
"scripts": {},
"scripts": {
"prepare": "husky install",
"cleanbuild": "rimraf ./dist && rimraf ./tmp"
},
"config": {
"commitizen": {
"path": "cz-conventional-changelog"
}
},
"private": true,
"dependencies": {},
"dependencies": {
"axios": "^1.0.0",
"ethers": "^5.7.1",
"tslib": "^2.3.0",
"uuid": "^9.0.0"
},
"devDependencies": {
"@nrwl/cli": "14.1.7",
"@nrwl/eslint-plugin-nx": "14.1.7",
"@nrwl/jest": "14.1.7",
"@nrwl/js": "14.1.7",
"@nrwl/linter": "14.1.7",
"@nrwl/workspace": "14.1.7",
"@types/jest": "27.4.1",
"@types/node": "16.11.7",
"@types/uuid": "^8.3.4",
"@typescript-eslint/eslint-plugin": "~5.18.0",
"@typescript-eslint/parser": "~5.18.0",
"commitizen": "^4.2.5",
"cz-conventional-changelog": "^3.3.0",
"eslint": "~8.12.0",
"eslint-config-prettier": "8.1.0",
"husky": "^8.0.0",
"jest": "27.5.1",
"nx": "14.1.7",
"prettier": "^2.5.1",
"ts-jest": "27.1.4",
"ts-node": "9.1.1",
"typescript": "~4.6.2"
}
}
18 changes: 18 additions & 0 deletions packages/restapi/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}
Loading

0 comments on commit e2f2fa5

Please sign in to comment.