Skip to content

Commit bfe353f

Browse files
jleniKVNLSchcmedeiros
authored
Refactoring + repo structure (#66)
* remove crypto from dependencies (#25) * clean up * unify package.json / linter * simplify dependencies * small rework * formatting * Custom errors (#68) * update deps * add custom errors --------- Co-authored-by: Kevin Le Seigle <[email protected]> Co-authored-by: Carlos Medeiros <[email protected]>
1 parent 97dfbb8 commit bfe353f

22 files changed

+5521
-551
lines changed

.github/workflows/main.yaml

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

@@ -10,27 +10,36 @@ jobs:
1010
datetime: ${{ steps.get-datetime.outputs.datetime }}
1111
steps:
1212
- id: get-user
13-
run: echo "::set-output name=uid_gid::$(id -u):$(id -g)"
13+
run: echo "uid_gid=$(id -u):$(id -g)" >> $GITHUB_OUTPUT
1414
- id: get-datetime
15-
run: echo "::set-output name=datetime::$(date +'%Y%m%d%H%M%S')"
15+
run: echo "datetime=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT
1616

1717
build:
1818
needs: [configure]
1919
runs-on: ubuntu-latest
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
22-
uses: actions/checkout@v2
27+
uses: actions/checkout@v4
2328
with:
2429
submodules: true
30+
2531
- name: Install node
26-
uses: actions/setup-node@v2
27-
- name: Install dependencies
28-
run: yarn install
29-
- name: Run linter
30-
run: yarn lint
31-
- name: Run formatter
32-
run: yarn format
33-
- name: Build
34-
run: yarn build
35-
- name: Unit tests
36-
run: yarn test
32+
uses: actions/setup-node@v4
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: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,32 +15,50 @@ jobs:
1515
datetime: ${{ steps.get-datetime.outputs.datetime }}
1616
steps:
1717
- id: get-datetime
18-
run: echo "::set-output name=datetime::$(date +'%Y%m%d%H%M%S')"
18+
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
22+
container:
23+
image: node:20-bookworm
24+
env:
25+
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
26+
HEAD_BRANCH_NAME: ${{ github.head_ref }}
2227
steps:
2328
- name: Checkout
24-
uses: actions/checkout@v2
29+
uses: actions/checkout@v4
30+
with:
31+
submodules: true
32+
2533
- name: Install node
26-
uses: actions/setup-node@v2
34+
uses: actions/setup-node@v4
2735
with:
2836
registry-url: 'https://registry.npmjs.org'
2937
scope: '@zondax'
38+
39+
- uses: oven-sh/setup-bun@v1
40+
41+
- run: bun install
42+
3043
- run: mv README-npm.md README.md
31-
- name: Install yarn
32-
run: npm install -g yarn
33-
- run: yarn install
34-
- run: yarn build
44+
- run: bun run build
45+
3546
- name: Get latest release version number
3647
id: get_version
3748
uses: battila7/get-version-action@v2
49+
50+
- name: Show version
51+
run: echo ${{ steps.get_version.outputs.version }}
52+
3853
- name: Update tag
3954
run: |
40-
echo Publishing as ${{ steps.get_version.outputs.version }}
4155
npm --allow-same-version --no-git-tag-version version ${{ steps.get_version.outputs.version }}
56+
4257
- name: Publish package
4358
env:
4459
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN_PUBLISH_AUTO }}
60+
NODE_REPO_SERVER: 'https://registry.npmjs.org'
4561
run: |
62+
npm config set registry $NODE_REPO_SERVER
63+
npm config set //registry.npmjs.org/:_authToken $NODE_AUTH_TOKEN
4664
npm publish

.gitignore

Lines changed: 4 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,9 @@
1-
# Logs
2-
logs
3-
*.log
4-
npm-debug.log*
5-
yarn-debug.log*
6-
yarn-error.log*
7-
8-
# Runtime data
9-
pids
10-
*.pid
11-
*.seed
12-
*.pid.lock
13-
14-
# Directory for instrumented libs generated by jscoverage/JSCover
15-
lib-cov
16-
17-
# Coverage directory used by tools like istanbul
18-
coverage
19-
20-
# nyc test coverage
21-
.nyc_output
22-
23-
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
24-
.grunt
25-
26-
# Bower dependency directory (https://bower.io/)
27-
bower_components
28-
29-
# node-waf configuration
30-
.lock-wscript
31-
32-
# Compiled binary addons (https://nodejs.org/api/addons.html)
33-
build/Release
34-
35-
# Dependency directories
36-
node_modules/
37-
jspm_packages/
38-
39-
# TypeScript v1 declaration files
40-
typings/
41-
42-
# Optional npm cache directory
43-
.npm
44-
45-
# Optional eslint cache
46-
.eslintcache
47-
48-
# Optional REPL history
49-
.node_repl_history
50-
51-
# Output of 'npm pack'
52-
*.tgz
53-
54-
# Yarn Integrity file
55-
.yarn-integrity
56-
57-
# dotenv environment variables file
58-
.env
59-
60-
# next.js build output
61-
.next
62-
63-
\.idea/
64-
65-
.vscode
66-
67-
TODO\.md
68-
69-
\dist
70-
/certs/cert.pem
71-
/certs/server.cert
72-
/certs/server.key
73-
741
/.idea
752
/node_modules/
763
/output/
774
/dist/
785

79-
/yarn.lock
6+
node_modules
7+
.yarn/*
8+
!.yarn/releases
9+
!.yarn/plugins

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.yarn
2+
node_modules
3+
dist

.prettierrc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
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
13+
}

.prettierrc.json

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

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright 2018 - 2023 Zondax AG
189+
Copyright Zondax AG
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

certs/.gitkeep

Whitespace-only changes.

certs/openssl.cnf

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

docs/example.png

-225 KB
Binary file not shown.

0 commit comments

Comments
 (0)