Skip to content

Commit

Permalink
chore: setup monorepo and linting (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
sairanjit authored Sep 27, 2023
1 parent e3b4c4e commit 949cfa8
Show file tree
Hide file tree
Showing 17 changed files with 4,936 additions and 1 deletion.
71 changes: 71 additions & 0 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
root: true

parser: '@typescript-eslint/parser'

plugins:
- '@typescript-eslint'
- prettier
- import

parserOptions:
tsconfigRootDir: .
project:
- './tsconfig.eslint.json'
- './packages/**/tsconfig.json'

extends:
- eslint:recommended
- plugin:@typescript-eslint/strict
- plugin:@typescript-eslint/stylistic
- plugin:prettier/recommended

ignorePatterns:
- '**/build/**'
- '**/node_modules/**'

rules:
'@typescript-eslint/consistent-type-definitions': off
'@typescript-eslint/no-extraneous-class': off
'@typescript-eslint/no-use-before-define':
- error
- functions: false
classes: false
variables: true
'@typescript-eslint/explicit-member-accessibility': error
no-console: error
'@typescript-eslint/consistent-type-imports': error
import/newline-after-import:
- error
- count: 1
import/order:
- error
- groups:
- type
- - builtin
- external
- parent
- sibling
- index
alphabetize:
order: asc
newlines-between: always
'@typescript-eslint/no-non-null-assertion': error
import/no-extraneous-dependencies:
- error
- devDependencies: false

overrides:
- files: '**/tests/**'
env:
jest: true
node: true

- files:
- '**/scripts/**'
- '**/*.config.js'
env:
node: true
rules:
no-undef: off
no-console: off
'@typescript-eslint/no-var-requires': off
32 changes: 32 additions & 0 deletions .github/workflows/pipeline.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: 'Pipeline'

on:
push:
branches: ['main']

pull_request:
types: [opened, synchronize]

jobs:
continous-integration:
name: 'Continuous Integration'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: pnpm/action-setup@v2
with:
version: 8.6.0

- name: Install dependencies
run: pnpm install

- name: Check formatting
run: pnpm check-format

- name: Check types
run: pnpm check-types

- name: Test
run: pnpm test
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
build/
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node-linker=hoisted
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"printWidth": 120,
"semi": false,
"singleQuote": true,
"trailingComma": "none"
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# adeya-sdk
# adeya-sdk
17 changes: 17 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import type { JestConfigWithTsJest } from 'ts-jest'

const config: JestConfigWithTsJest = {
preset: 'ts-jest',
testEnvironment: 'node',
transform: {
'^.+\\.ts$': [
'ts-jest',
{
tsconfig: 'tsconfig.test.json',
isolatedModules: true
}
]
}
}

module.exports = config
43 changes: 43 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"name": "adeya-sdk",
"private": true,
"license": "Apache-2.0",
"description": "",
"repository": {
"type": "git",
"url": "https://github.com/credebl/adeya-sdk"
},
"scripts": {
"lint": "eslint .",
"test": "jest",
"check-types": "pnpm -r check-types",
"check-format": "pnpm prettier --list-different",
"build": "pnpm -r build",
"clean": "pnpm -r clean",
"prettier": "prettier --ignore-path .gitignore '**/*.+(js|json|ts|md|yml|yaml)'",
"format": "pnpm prettier --write",
"validate": "pnpm lint && pnpm check-types && pnpm check-format"
},
"devDependencies": {
"@pnpm/eslint-config": "^1.1.0",
"@types/eslint": "^8.44.3",
"@types/jest": "^29.5.5",
"@types/node": "^20.7.0",
"@typescript-eslint/eslint-plugin": "^6.7.3",
"@typescript-eslint/parser": "^6.7.3",
"eslint": "^8.50.0",
"eslint-config-prettier": "^9.0.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-prettier": "^5.0.0",
"jest": "^29.7.0",
"prettier": "^3.0.3",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.1",
"tsconfig-paths": "^4.2.0",
"typescript": "~5.2.2"
},
"engines": {
"node": ">= 18"
}
}
29 changes: 29 additions & 0 deletions packages/ssi/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "@adeya/ssi",
"version": "0.0.0",
"license": "Apache-2.0",
"main": "build/index",
"source": "src/index",
"homepage": "https://github.com/hyperledger/anoncreds-rs/tree/main/wrappers/javascript/anoncreds-shared",
"repository": {
"url": "https://github.com/hyperledger/anoncreds-rs",
"type": "git",
"directory": "packages/ssi"
},
"publishConfig": {
"access": "public"
},
"files": [
"build"
],
"scripts": {
"check-types": "pnpm compile --noEmit",
"build": "pnpm clean && pnpm compile",
"clean": "rimraf -rf ./build",
"compile": "tsc"
},
"devDependencies": {
"rimraf": "3.0.2",
"typescript": "~5.2.2"
}
}
3 changes: 3 additions & 0 deletions packages/ssi/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const add = (a: number, b: number) => {
return a + b
}
9 changes: 9 additions & 0 deletions packages/ssi/tests/ssi.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { add } from '../src'

describe('add function', () => {
it('should return the sum of two numbers', () => {
expect(add(1, 2)).toBe(3)
expect(add(0, 0)).toBe(0)
expect(add(-1, 1)).toBe(0)
})
})
8 changes: 8 additions & 0 deletions packages/ssi/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"baseUrl": ".",
"outDir": "./build"
},
"include": ["src"]
}
Loading

0 comments on commit 949cfa8

Please sign in to comment.