Skip to content

Commit

Permalink
Merge branch 'dev/dep-injection' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
aussedatlo committed Nov 2, 2023
2 parents 53f7d30 + 46d0da4 commit 0aaf4e7
Show file tree
Hide file tree
Showing 60 changed files with 5,472 additions and 9,485 deletions.
30 changes: 30 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
module.exports = {
env: {
browser: true,
es2021: true,
},
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
overrides: [
{
env: {
node: true,
},
files: ['.eslintrc.{js,cjs}'],
parserOptions: {
sourceType: 'script',
},
},
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
plugins: ['@typescript-eslint'],
rules: {
indent: ['error', 2],
'linebreak-style': ['error', 'unix'],
quotes: ['error', 'single'],
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
},
};
32 changes: 19 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,30 @@
name: Build CI

on:
push:
branches: ['master']
pull_request:
branches: ['master']
on: push

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x, 18.x, 19.x]
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v3
- name: Build with Node.js ${{ matrix.node-version }} on ${{ matrix.os }}
uses: actions/setup-node@v3
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm install
- run: npm run build

- name: Install pnpm
run: |
npm install -g pnpm
shell: bash

- name: Install dependencies
run: pnpm install

- name: Build
run: pnpm build
33 changes: 22 additions & 11 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
name: Lint CI

on:
push:
branches: ['master']
pull_request:
branches: ['master']
on: push

jobs:
run-linters:
name: Run linters
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x, 18.x, 19.x]

steps:
- name: Check out Git repository
uses: actions/checkout@v3
- name: Checkout code
uses: actions/checkout@v2

- run: npm install
- run: npm run prettier
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}

- name: Install pnpm
run: |
npm install -g pnpm
shell: bash

- name: Install dependencies
run: pnpm install

- name: Run prettier
run: pnpm prettier
35 changes: 23 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
name: Lint CI
name: Test CI

on:
push:
branches: ['master']
pull_request:
branches: ['master']
on: push

jobs:
run-test:
name: Run Jest
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x, 18.x, 19.x]

steps:
- name: Check out Git repository
uses: actions/checkout@v3
- name: Checkout code
uses: actions/checkout@v2

- run: npm install
- run: npm run test
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}

- name: Install pnpm
run: |
npm install -g pnpm
shell: bash

- name: Install dependencies
run: pnpm install

- name: Run tests
run: pnpm test
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

pnpm lint-staged
4 changes: 4 additions & 0 deletions .lintstagedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"src/**.{ts,tsx}": "eslint --max-warnings=0",
"*.{js,jsx,ts,tsx,md,html,css}": "prettier --write"
}
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ providing a smooth and efficient experience for managing their crypto investment
## Install

```shell
npm install
npm run build
npm install -g
pnpm i -g dcanod
```

## Setup command
Expand Down Expand Up @@ -58,7 +56,7 @@ dcanod-cli setup -c /tmp/dcanod/newconfig.json

## Buy command

Buy a specific ammount of crypto.
Buy a specific amount of crypto.

```shell
dcanod-cli buy BTC/USDT 15
Expand All @@ -81,8 +79,15 @@ To run DCANod every Monday at 8 AM, add the following line to the crontab:
0 8 * * 1 dcanod-cli BTC/USDT 20
```

## Build locally

```shell
pnpm build
```

## Tests

```shell
npm run test
pnpm test
pnpm prettier
```
3 changes: 3 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@ module.exports = {
moduleNameMapper: {
'^@app/(.*)$': '<rootDir>/src/$1',
},
collectCoverage: true,
collectCoverageFrom: ['src/**/*.ts'],
testRegex: '(src/__tests__/.*|(\\.|/)(test|spec))\\.ts$',
};
Loading

0 comments on commit 0aaf4e7

Please sign in to comment.