Skip to content

Commit 912c522

Browse files
authored
Merge pull request #191 from Zondax/js-package
2 parents 385c047 + 8550989 commit 912c522

20 files changed

+323
-666
lines changed

.github/workflows/check_version.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
name: "Verify PRs to main"
1+
name: Verify PRs to main
22

33
on:
4+
workflow_dispatch:
45
pull_request:
6+
paths:
7+
- app/**
8+
- deps/**
59
branches:
610
- main
711
- develop
@@ -13,7 +17,7 @@ jobs:
1317
uid_gid: ${{ steps.get-user.outputs.uid_gid }}
1418
steps:
1519
- id: get-user
16-
run: echo "::set-output name=uid_gid::$(id -u):$(id -g)"
20+
run: echo "uid_gid=$(id -u):$(id -g)" >> $GITHUB_OUTPUT
1721

1822
get_version:
1923
needs: configure
@@ -28,7 +32,7 @@ jobs:
2832
version: ${{ steps.store-version.outputs.version }}
2933
steps:
3034
- name: Checkout
31-
uses: actions/checkout@v2
35+
uses: actions/checkout@v3
3236
with:
3337
submodules: true
3438

@@ -39,7 +43,7 @@ jobs:
3943
run: make version
4044

4145
- id: store-version
42-
run: echo ::set-output name=version::$(cat ./app/app.version)
46+
run: echo "version=$(cat ./app/app.version)" >> $GITHUB_OUTPUT
4347

4448
check_app_version:
4549
needs: get_version

.github/workflows/ledger.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest
2424

2525
steps:
26-
- uses: actions/checkout@v2
26+
- uses: actions/checkout@v3
2727
with:
2828
submodules: true
2929

.github/workflows/main.yml

Lines changed: 45 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
name: "Test/Build"
1+
name: Build
22
on:
33
workflow_dispatch:
44
push:
5-
branches: [ main, develop ]
65
pull_request:
7-
branches: [ main, develop ]
6+
branches:
7+
- main
8+
- develop
89

910
jobs:
1011
configure:
@@ -13,13 +14,13 @@ jobs:
1314
uid_gid: ${{ steps.get-user.outputs.uid_gid }}
1415
steps:
1516
- id: get-user
16-
run: echo "::set-output name=uid_gid::$(id -u):$(id -g)"
17+
run: echo "uid_gid=$(id -u):$(id -g)" >> $GITHUB_OUTPUT
1718

1819
build:
1920
runs-on: ubuntu-latest
2021
steps:
2122
- name: Checkout
22-
uses: actions/checkout@v2
23+
uses: actions/checkout@v3
2324
with:
2425
submodules: true
2526
- name: Install deps
@@ -39,16 +40,30 @@ jobs:
3940
BOLOS_SDK: ${{ github.workspace }}/deps/nanos-secure-sdk
4041
BOLOS_ENV: /opt/bolos
4142
HOME: /home/zondax_circle
43+
outputs:
44+
size: ${{steps.build.outputs.size}}
4245
steps:
4346
- name: Checkout
44-
uses: actions/checkout@v2
47+
uses: actions/checkout@v3
4548
with:
4649
submodules: true
4750
- name: Build Standard app
51+
id: build
4852
shell: bash -l {0}
4953
run: |
5054
source $HOME/.cargo/env
5155
make
56+
echo "size=$(python3 deps/ledger-zxlib/scripts/getSize.py s)" >> $GITHUB_OUTPUT
57+
58+
size_nano_s:
59+
needs: build_ledger_nano_S
60+
runs-on: ubuntu-latest
61+
env:
62+
NANOS_LIMIT_SIZE: 136
63+
steps:
64+
- run: |
65+
echo "LNS app size: ${{needs.build_ledger_nano_S.outputs.size}} KiB"
66+
[ ${{needs.build_ledger_nano_S.outputs.size}} -le $NANOS_LIMIT_SIZE ]
5267
5368
build_ledger_nano_X:
5469
needs: configure
@@ -96,7 +111,7 @@ jobs:
96111
runs-on: ubuntu-latest
97112
steps:
98113
- name: Checkout
99-
uses: actions/checkout@v2
114+
uses: actions/checkout@v3
100115
with:
101116
submodules: true
102117
- run: sudo apt-get update -y && sudo apt-get install -y libusb-1.0.0 libudev-dev
@@ -106,9 +121,7 @@ jobs:
106121
sudo apt-get install -y cmake binutils-dev libcurl4-openssl-dev libiberty-dev libelf-dev libdw-dev
107122
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --no-modify-path --default-toolchain none -y;
108123
- name: Install node
109-
uses: actions/setup-node@v2
110-
with:
111-
node-version: '14.17.0'
124+
uses: actions/setup-node@v3
112125
- name: Install yarn
113126
run: |
114127
npm install -g yarn
@@ -125,7 +138,15 @@ jobs:
125138
make zemu_test
126139
127140
build_package_nanos:
128-
needs: [ configure, build, build_ledger_nano_S, build_ledger_nano_X, build_ledger_nano_SP, test_zemu ]
141+
needs:
142+
[
143+
configure,
144+
build,
145+
build_ledger_nano_S,
146+
build_ledger_nano_X,
147+
build_ledger_nano_SP,
148+
test_zemu,
149+
]
129150
if: ${{ github.ref == 'refs/heads/main' }}
130151
runs-on: ubuntu-latest
131152
container:
@@ -137,7 +158,7 @@ jobs:
137158
HOME: /home/zondax_circle
138159
steps:
139160
- name: Checkout
140-
uses: actions/checkout@v2
161+
uses: actions/checkout@v3
141162
with:
142163
submodules: true
143164
- name: Install deps
@@ -154,7 +175,7 @@ jobs:
154175
id: nanos
155176
run: |
156177
pip install ledgerblue
157-
echo ::set-output name=tag_name::$(./app/pkg/installer_nanos.sh version)
178+
echo "tag_name=$(./app/pkg/installer_nanos.sh version)" >> $GITHUB_OUTPUT
158179
159180
- name: Create Release
160181
id: create_release
@@ -168,7 +189,15 @@ jobs:
168189
prerelease: false
169190

170191
build_package_nanos_plus:
171-
needs: [ configure, build, build_ledger_nano_S, build_ledger_nano_X, build_ledger_nano_SP, test_zemu ]
192+
needs:
193+
[
194+
configure,
195+
build,
196+
build_ledger_nano_S,
197+
build_ledger_nano_X,
198+
build_ledger_nano_SP,
199+
test_zemu,
200+
]
172201
if: ${{ github.ref == 'refs/heads/main' }}
173202
runs-on: ubuntu-latest
174203
container:
@@ -180,7 +209,7 @@ jobs:
180209
HOME: /home/zondax_circle
181210
steps:
182211
- name: Checkout
183-
uses: actions/checkout@v2
212+
uses: actions/checkout@v3
184213
with:
185214
submodules: true
186215
- name: Install deps
@@ -197,7 +226,7 @@ jobs:
197226
id: nanosp
198227
run: |
199228
pip install ledgerblue
200-
echo ::set-output name=tag_name::$(./app/pkg/installer_nanos_plus.sh version)
229+
echo "tag_name=$(./app/pkg/installer_nanos_plus.sh version)" >> $GITHUB_OUTPUT
201230
202231
- name: Update Release
203232
id: update_release

js/.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist

js/.eslintrc.js

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

js/.eslintrc.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"es2021": true,
5+
"node": true
6+
},
7+
"extends": ["standard-with-typescript", "prettier"],
8+
"parserOptions": {
9+
"project": "tsconfig.json",
10+
"ecmaVersion": "latest",
11+
"sourceType": "module"
12+
},
13+
"rules": {}
14+
}

js/.prettierrc

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
11
{
2-
"trailingComma": "all",
3-
"singleQuote": true,
4-
"arrowParens": "avoid",
5-
"semi": false,
6-
"useTabs": false,
7-
"printWidth": 140,
8-
"tabWidth": 2
2+
"printWidth": 120
93
}

js/package.json

Lines changed: 14 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -25,45 +25,22 @@
2525
"url": "https://github.com/zondax/ledger-icp/issues"
2626
},
2727
"dependencies": {
28-
"@ledgerhq/hw-transport": "^6.24.1"
28+
"@zondax/ledger-js": "^0.2.1"
2929
},
3030
"devDependencies": {
31-
"@types/ledgerhq__hw-transport": "^4.21.4",
32-
"@typescript-eslint/eslint-plugin": "^5.11.0",
33-
"@typescript-eslint/parser": "^5.11.0",
34-
"bip32": "^3.0.1",
35-
"bip39": "^3.0.4",
36-
"core-js": "^3.21.0",
37-
"crypto-js": "4.1.1",
38-
"eslint": "^8.9.0",
39-
"eslint-config-prettier": "^8.3.0",
40-
"eslint-plugin-import": "^2.25.4",
41-
"eslint-plugin-jest": "^26.1.0",
42-
"eslint-plugin-prettier": "^4.0.0",
43-
"jest": "^27.5.1",
44-
"prettier": "^2.5.1",
45-
"secp256k1": "^4.0.3",
46-
"typescript": "^4.5.5"
31+
"@types/node": "^18.11.18",
32+
"@typescript-eslint/eslint-plugin": "^5.47.1",
33+
"@typescript-eslint/parser": "^5.47.1",
34+
"eslint": "^8.31.0",
35+
"eslint-config-prettier": "^8.5.0",
36+
"eslint-config-standard-with-typescript": "^24.0.0",
37+
"eslint-plugin-import": "^2.26.0",
38+
"eslint-plugin-n": "^15.6.0",
39+
"eslint-plugin-promise": "^6.1.1",
40+
"prettier": "^2.8.1",
41+
"typescript": "^4.9.4"
4742
},
48-
"moduleDirectories": [
49-
"node_modules",
50-
"dist"
51-
],
52-
"postcss": {
53-
"plugins": {
54-
"autoprefixer": {}
55-
}
56-
},
57-
"browserslist": [
58-
"> 1%",
59-
"last 2 versions"
60-
],
6143
"files": [
62-
"dist/*",
63-
"LICENSE",
64-
"yarn.lock"
65-
],
66-
"publishConfig": {
67-
"access": "public"
68-
}
44+
"dist/**/*"
45+
]
6946
}

0 commit comments

Comments
 (0)