Skip to content

Commit 284a845

Browse files
authored
Merge pull request #17 from Zondax/dev
refactoring + standard practices
2 parents 1d2ebeb + 19b97fa commit 284a845

19 files changed

+715
-353
lines changed

.eslintignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

.eslintrc.json

Lines changed: 0 additions & 14 deletions
This file was deleted.

.github/workflows/main.yaml

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
name: "Main"
1+
name: 'Main'
22
on:
33
- push
44

55
jobs:
66
configure:
7-
runs-on: ubuntu-latest
7+
runs-on: zondax-runners
88
outputs:
99
uid_gid: ${{ steps.get-user.outputs.uid_gid }}
1010
datetime: ${{ steps.get-datetime.outputs.datetime }}
@@ -16,17 +16,30 @@ jobs:
1616

1717
build:
1818
needs: [configure]
19-
runs-on: ubuntu-latest
19+
runs-on: zondax-runners
20+
container:
21+
image: node:20-bookworm
22+
env:
23+
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
24+
HEAD_BRANCH_NAME: ${{ github.head_ref }}
2025
steps:
2126
- name: Checkout
2227
uses: actions/checkout@v3
2328
with:
2429
submodules: true
30+
2531
- name: Install node
2632
uses: actions/setup-node@v3
27-
- name: Install dependencies
28-
run: yarn install
29-
- name: Run linter
30-
run: yarn linter
31-
- name: Run formatter
32-
run: yarn format
33+
with:
34+
registry-url: 'https://registry.npmjs.org'
35+
scope: '@zondax'
36+
37+
- uses: oven-sh/setup-bun@v1
38+
39+
- run: bun install
40+
41+
- run: bun run format:check
42+
43+
- run: bun lint
44+
45+
- run: bun test

.github/workflows/publish.yaml

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: "Publish packages"
1+
name: 'Publish packages'
22

33
on:
44
release:
@@ -10,34 +10,40 @@ on:
1010

1111
jobs:
1212
configure:
13-
runs-on: ubuntu-latest
13+
runs-on: zondax-runners
1414
outputs:
1515
datetime: ${{ steps.get-datetime.outputs.datetime }}
1616
steps:
1717
- id: get-datetime
1818
run: echo "datetime=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT
1919

2020
publish_npm_package:
21-
runs-on: ubuntu-latest
21+
runs-on: zondax-runners
2222
steps:
2323
- name: Checkout
2424
uses: actions/checkout@v3
25+
2526
- name: Install node
2627
uses: actions/setup-node@v3
2728
with:
28-
registry-url: "https://registry.npmjs.org"
29-
scope: "@zondax"
30-
- name: Install yarn
31-
run: npm install -g yarn
32-
- run: yarn install
33-
- run: yarn build
29+
registry-url: 'https://registry.npmjs.org'
30+
scope: '@zondax'
31+
32+
- uses: oven-sh/setup-bun@v1
33+
34+
- run: bun install
35+
36+
- run: bun run build
37+
3438
- name: Get latest release version number
3539
id: get_version
3640
uses: battila7/get-version-action@v2
41+
3742
- name: Update tag
3843
run: |
3944
echo Publishing as ${{ steps.get_version.outputs.version }}
4045
npm --allow-same-version --no-git-tag-version version ${{ steps.get_version.outputs.version }}
46+
4147
- name: Publish package
4248
env:
4349
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN_PUBLISH_AUTO }}

.prettierrc

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
11
{
2-
"printWidth": 120
2+
"singleQuote": true,
3+
"arrowParens": "avoid",
4+
"semi": false,
5+
"useTabs": false,
6+
"printWidth": 140,
7+
"tabWidth": 2,
8+
"importOrder": ["^@(.*)/(.*)$", "^[./]"],
9+
"trailingComma": "es5",
10+
"plugins": ["@trivago/prettier-plugin-sort-imports"],
11+
"importOrderSeparation": true,
12+
"importOrderSortSpecifiers": true
313
}

.vscode/extensions.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"recommendations": [
3+
"dbaeumer.vscode-eslint",
4+
"esbenp.prettier-vscode",
5+
"github.vscode-github-actions",
6+
"hbenl.vscode-test-explorer",
7+
"orta.vscode-jest",
8+
"aaron-bond.better-comments"
9+
]
10+
}

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"workbench.activityBar.orientation": "vertical"
3+
}

bun.lockb

204 KB
Binary file not shown.

eslint.config.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
module.exports = {
2+
languageOptions: {
3+
ecmaVersion: 'latest',
4+
sourceType: 'module',
5+
globals: {
6+
window: 'readonly',
7+
document: 'readonly',
8+
process: 'readonly',
9+
require: 'readonly',
10+
},
11+
parserOptions: {
12+
project: 'tsconfig.json',
13+
},
14+
},
15+
ignores: ['dist/*', 'node_modules/*'],
16+
plugins: {
17+
'unused-imports': require('eslint-plugin-unused-imports'),
18+
'@typescript-eslint': require('@typescript-eslint/eslint-plugin'),
19+
'eslint-plugin-tsdoc': require('eslint-plugin-tsdoc'),
20+
promise: require('eslint-plugin-promise'),
21+
},
22+
rules: {
23+
curly: 'warn',
24+
'prefer-const': 'warn',
25+
'no-else-return': 'warn',
26+
complexity: ['warn', 1000],
27+
'no-unneeded-ternary': 'warn',
28+
'no-alert': 'warn',
29+
'no-empty': 'warn',
30+
'no-useless-catch': 'error',
31+
'require-await': 'warn',
32+
'no-continue': 'warn',
33+
'promise/prefer-await-to-then': 'warn',
34+
'no-console': 'warn',
35+
'unused-imports/no-unused-imports': 'warn',
36+
'no-magic-numbers': 'off',
37+
},
38+
}

jest.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
preset: 'ts-jest',
3+
testEnvironment: 'node',
4+
}

0 commit comments

Comments
 (0)