Skip to content

Commit 842a3eb

Browse files
authored
Merge pull request #481 from dappnode/3alpha/quality-fixes
Quality fixes for build, publish and GitHub actions
2 parents abda227 + 83900da commit 842a3eb

108 files changed

Lines changed: 5359 additions & 3679 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.eslintrc‎

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

‎.github/workflows/main.yml‎

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,38 @@ on:
77
branches:
88
- master
99

10+
permissions:
11+
contents: read
12+
1013
jobs:
1114
test:
1215
runs-on: ubuntu-latest
1316
strategy:
1417
fail-fast: false # don't cancel all jobs if some of them failed
1518
matrix:
16-
node: ["20"]
19+
node: ["22", "24", "26"]
1720
steps:
1821
- uses: actions/checkout@v4
1922
- name: Setup node
2023
uses: actions/setup-node@v4
2124
with:
2225
node-version: ${{ matrix.node }}
23-
- run: yarn install
26+
- run: yarn install --frozen-lockfile
2427
- run: yarn lint
28+
- run: yarn build
2529
- run: yarn test
30+
31+
# Live Docker / IPFS / Ethereum checks (previously part of `yarn test`).
32+
# Kept visible but non-blocking, since they depend on external services.
33+
integration:
34+
runs-on: ubuntu-latest
35+
continue-on-error: true
36+
steps:
37+
- uses: actions/checkout@v4
38+
- name: Setup node
39+
uses: actions/setup-node@v4
40+
with:
41+
node-version: "24"
42+
- run: yarn install --frozen-lockfile
43+
- run: yarn build
44+
- run: yarn test:integration

‎.github/workflows/release.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
registry-url: https://registry.npmjs.org/
2525

2626
- name: Install dependencies
27-
run: yarn
27+
run: yarn install --frozen-lockfile
2828

2929
- name: Compare versions
3030
run: |

‎.github/workflows/test-ga-build.yml‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,23 @@ on:
55
branches:
66
- master
77

8+
permissions:
9+
contents: read
10+
# The build bot creates/updates its comment through the issues API; on a pull
11+
# request GitHub requires pull-requests: write for that.
12+
issues: write
13+
pull-requests: write
14+
815
jobs:
916
test:
1017
runs-on: ubuntu-latest
1118
steps:
1219
- uses: actions/checkout@v4
13-
- name: Set up Node.js 20.x
20+
- name: Set up Node.js 24.x
1421
uses: actions/setup-node@v4
1522
with:
16-
node-version: 20.x
17-
- run: yarn install
23+
node-version: 24.x
24+
- run: yarn install --frozen-lockfile
1825
- run: yarn build
1926

2027
# Simulate Github Actions run on an actual DAppNode package

‎.github/workflows/test-ga-bump-upstream-template.yml‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,21 @@ env:
99
ENVIRONMENT: TEST
1010
INITIAL_VERSION: "0.1.0"
1111

12+
permissions:
13+
contents: write # bump branch
14+
pull-requests: write # bump PR
15+
issues: write # build bot comment
16+
1217
jobs:
1318
test:
1419
runs-on: ubuntu-latest
1520
steps:
1621
- uses: actions/checkout@v4
17-
- name: Set up Node.js 20.x
22+
- name: Set up Node.js 24.x
1823
uses: actions/setup-node@v4
1924
with:
20-
node-version: 20.x
21-
- run: yarn install
25+
node-version: 24.x
26+
- run: yarn install --frozen-lockfile
2227
- run: yarn build
2328

2429
# Simulate Github Actions run on an actual DAppNode package

‎.github/workflows/test-ga-bump-upstream.yml‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,21 @@ env:
99
ENVIRONMENT: TEST
1010
INITIAL_VERSION: "0.1.0"
1111

12+
permissions:
13+
contents: write # bump branch
14+
pull-requests: write # bump PR
15+
issues: write # build bot comment
16+
1217
jobs:
1318
test:
1419
runs-on: ubuntu-latest
1520
steps:
1621
- uses: actions/checkout@v4
17-
- name: Set up Node.js 20.x
22+
- name: Set up Node.js 24.x
1823
uses: actions/setup-node@v4
1924
with:
20-
node-version: 20.x
21-
- run: yarn install
25+
node-version: 24.x
26+
- run: yarn install --frozen-lockfile
2227
- run: yarn build
2328

2429
# Simulate Github Actions run on an actual DAppNode package

‎.mocharc.yml‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
colors: true
2-
exit: true
32
extension: [ts]
3+
import:
4+
- tsx
45
require:
56
- dotenv/config
6-
- ts-node/register
7-
node-option:
8-
- experimental-specifier-resolution=node
9-
- loader=ts-node/esm
7+
spec:
8+
- test/**/*.test.ts
9+
ignore:
10+
- test/commands/build.test.ts
11+
- test/tasks/generatePublishTx.test.ts
12+
- test/utils/versions/getNextPackageVersion.test.ts

‎README.md‎

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,17 @@ Only generates the IPFS Hash to be able to install it without needing to create
3030
$ dappnodesdk build
3131
```
3232

33+
### Root and variant files
34+
35+
In a multi-variant package (`--all_variants` or `--variants`), each release is assembled from the package root and the variant directory (`package_variants/<variant>` by default):
36+
37+
- `dappnode_package.json` and `docker-compose.yml` are deep-merged, with the variant overriding the root.
38+
- `setup-wizard.*` fields are merged by `id`, and `notifications.yaml` endpoints by `correlationId`. Within a matched entry, the variant's values override the root's, and an array from the variant (for example `enum`, `conditions` or `alerts`) replaces the root's array. The release contains exactly what was validated.
39+
- Single files (avatar, `prometheus-targets.*`, `disclaimer.md`, `getting-started.md`, `setup.schema.json`, `setup-target.json`, `setup-ui.json`, `signature.json`) are taken from the variant directory when it has one, and otherwise from the root.
40+
- Grafana dashboards (`*grafana-dashboard.json`) are collected from both the root and the variant.
41+
42+
Schema validation coerces some values (for example `isBanner: "false"` becomes `false`). The release ships the coerced value, and the build prints a warning in the "Validate files" step so the source file can be fixed.
43+
3344
## Publish
3445

3546
It does the build of the image and shows the necessary transaction to be able to publish the package. The first time will create the repository but the rest will be updates of it.
@@ -126,11 +137,21 @@ services:
126137
The dappnode SDK ueses the following internal dependencies to avoid code duplication across the `dappnodeSDK`, `DNP_DAPPMANAGER` and `sdk-publish` modules:
127138

128139
- `@dappnode/types`
129-
- `@dappnode/toolkit`
130140
- `@dappnode/schemas`
131141

132142
In order to have a better developing experience these modules lives inside the DNP_DAPPMANAGER repository
133143

144+
## Development
145+
146+
Use Node.js 22.13+ or Node.js 24+ (Node.js 20 reached end of life in April 2026), and install the exact locked dependencies with `yarn install --frozen-lockfile`.
147+
148+
- `yarn lint` checks source and tests without changing files; `yarn lint:fix` applies automatic fixes.
149+
- `yarn build` checks and compiles the SDK.
150+
- `yarn test` runs deterministic regressions using temporary files, mocked Docker commands, and localhost HTTP servers. It does not need external credentials.
151+
- `yarn test:integration` runs the live Docker/IPFS/Ethereum tests and requires those services to be available.
152+
153+
Terminal builds show numbered package/architecture stages and recent complete log lines; uploads display a separate waiting-for-pinning phase after transmission.
154+
134155
## License
135156

136157
This project is licensed under the GNU General Public License v3.0 - see the [LICENSE](LICENSE) file for details

‎eslint.config.js‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import js from "@eslint/js";
2+
import tseslint from "typescript-eslint";
3+
4+
export default tseslint.config(
5+
{ ignores: ["dist/**", "node_modules/**", "test_files/**"] },
6+
js.configs.recommended,
7+
...tseslint.configs.recommended,
8+
{
9+
files: ["**/*.ts"],
10+
rules: {
11+
"@typescript-eslint/no-unused-vars": ["error", { caughtErrors: "none" }]
12+
}
13+
}
14+
);

‎package.json‎

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@
88
"bin": "dist/dappnodesdk.js",
99
"scripts": {
1010
"tag-and-publish": "npm version patch && git push --follow-tags",
11-
"test": "mocha \"./{,!(node_modules)/**}/*.test.ts\"",
12-
"lint": "eslint . --ext .ts --fix",
13-
"build": "tsc",
11+
"test": "mocha",
12+
"lint": "eslint src test --max-warnings 0",
13+
"build": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\" && tsc",
1414
"prepublish": "npm run build",
15-
"pre-commit": "npm run lint && npm run test"
15+
"pre-commit": "npm run lint && npm run test",
16+
"test:integration": "mocha --no-config --import=tsx --require=dotenv/config --timeout 120000 \"test/commands/build.test.ts\" \"test/tasks/generatePublishTx.test.ts\" \"test/utils/versions/getNextPackageVersion.test.ts\"",
17+
"lint:fix": "npm run lint -- --fix"
1618
},
1719
"repository": {
1820
"type": "git",
@@ -35,63 +37,60 @@
3537
"homepage": "https://github.com/dappnode/DAppNodeSDK#readme",
3638
"dependencies": {
3739
"@dappnode/schemas": "^0.1.26",
38-
"@dappnode/toolkit": "^0.1.21",
3940
"@dappnode/types": "^0.1.41",
40-
"@octokit/rest": "^20.1.1",
41+
"@octokit/rest": "^22.0.1",
4142
"async-retry": "^1.2.3",
4243
"chalk": "^2.4.2",
4344
"cli-progress": "^3.8.2",
44-
"dockerode": "^3.3.5",
45-
"dotenv": "^8.2.0",
46-
"ethers": "6.3.0",
45+
"dotenv": "^16.6.1",
46+
"ethers": "^6.17.0",
4747
"figlet": "^1.2.3",
48-
"form-data": "^3.0.0",
49-
"got": "^12.6.1",
50-
"graphql": "^16.6.0",
51-
"image-size": "^0.8.1",
52-
"inquirer": "^6.2.1",
53-
"js-yaml": "^4.1.0",
48+
"form-data": "^4.0.6",
49+
"got": "^14.6.6",
50+
"image-size": "^2.0.4",
51+
"inquirer": "^12.11.1",
52+
"js-yaml": "^4.3.2",
5453
"listr": "^0.14.3",
55-
"lodash-es": "^4.17.21",
54+
"lodash-es": "^4.18.1",
55+
"log-update": "^6.1.0",
5656
"mime-types": "^2.1.24",
5757
"moment": "^2.27.0",
5858
"prettier": "^2.1.2",
59-
"request": "^2.88.2",
60-
"rimraf": "^3.0.2",
6159
"semver": "^7.6.0",
6260
"source-map-support": "^0.5.19",
63-
"tar-fs": "^2.0.0",
61+
"tar-fs": "^3.1.3",
6462
"timestring": "^5.0.1",
65-
"yargs": "^17.7.1"
63+
"yargs": "^17.7.1",
64+
"wrap-ansi": "^9.0.2"
6665
},
6766
"devDependencies": {
67+
"@eslint/js": "^10.0.1",
6868
"@types/async-retry": "^1.4.2",
6969
"@types/chai": "^4.3.4",
7070
"@types/cli-progress": "^3.7.0",
71-
"@types/dockerode": "^3.3.16",
7271
"@types/figlet": "^1.2.0",
73-
"@types/inquirer": "^6.5.0",
74-
"@types/js-yaml": "^3.12.5",
72+
"@types/js-yaml": "^4.0.9",
7573
"@types/listr": "^0.14.2",
7674
"@types/lodash-es": "^4.17.7",
7775
"@types/mime-types": "^2.1.0",
7876
"@types/mocha": "^10.0.1",
79-
"@types/node": "^22.7.5",
77+
"@types/node": "^20.19.0",
8078
"@types/prettier": "^2.1.5",
81-
"@types/request": "^2.48.5",
82-
"@types/rimraf": "^3.0.0",
8379
"@types/semver": "^7.3.1",
8480
"@types/tar-fs": "^2.0.0",
8581
"@types/yargs": "^17.0.24",
86-
"@typescript-eslint/eslint-plugin": "^3.5.0",
87-
"@typescript-eslint/parser": "^3.5.0",
8882
"chai": "^5.1.0",
89-
"eslint": "^7.3.1",
90-
"mocha": "^10.2.0",
91-
"ts-node": "^10.9.1",
92-
"typescript": "^5.6.3"
83+
"eslint": "^10.14.0",
84+
"mocha": "^12.0.3",
85+
"tsx": "^4.23.15",
86+
"typescript": "~5.9.3",
87+
"typescript-eslint": "^8.72.1"
9388
},
9489
"engines": {
95-
"node": ">=20.0.0"
90+
"node": ">=22.13.0"
91+
},
92+
"resolutions": {
93+
"minimatch": "^11.0.1",
94+
"mocha/glob": "^14.0.2"
9695
}
9796
}

0 commit comments

Comments
 (0)