Skip to content

Commit a750bac

Browse files
Build and dependency updates (#471)
This change updates many build and development dependencies since they were out of date and (in some cases) out of sync. It also updates TypeScript configurations to use suitable Node version templates, and uses the latest Fabric release images and binaries instead of outdated versions from the old Hyperledger Artifactory. Signed-off-by: Mark S. Lewis <Mark.S.Lewis@outlook.com>
1 parent c2857aa commit a750bac

Some content is hidden

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

46 files changed

+8394
-5411
lines changed

.eslintignore

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

.eslintrc

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

.github/workflows/test.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ jobs:
9494
PIPELINE_WORKSPACE: workspace
9595
run: |
9696
set -xev
97-
./tools/getEdgeDocker.sh # essential to get main docker images of peer etc.
9897
docker image load --input build/fabric-nodeenv.tar.gz # gets the build image of nodeenv
9998
docker tag hyperledger/fabric-nodeenv:latest hyperledger/fabric-nodeenv:2.5
10099
docker images
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
1-
test
2-
fabric-contract-api*.tgz
1+
# Exclude everything except specific inclusions below
2+
**/*
3+
4+
!lib/**/*
5+
!schema/**/*
6+
!types/**/*

apis/fabric-contract-api/package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"buildt": "tsc --project test/typescript",
1313
"test": "nyc mocha --recursive 'test/unit/**/*.js'",
1414
"build": "npm run lint && npm run test:unit && npm run test:schema",
15-
"lint": "eslint ./lib ./types ./test/typescript/*.ts --ext .js --ext .ts",
15+
"lint": "eslint ./lib ./types ./test/typescript/*.ts",
1616
"test:unit": "npm run test",
1717
"test:schema": "ajv compile -s ./schema/contract-schema.json && ajv validate -s ./schema/contract-schema.json -d ./schema/example-full.json"
1818
},
@@ -46,7 +46,7 @@
4646
},
4747
"dependencies": {
4848
"fabric-shim-api": "2.5.9",
49-
"class-transformer": "^0.4.0",
49+
"class-transformer": "^0.5.1",
5050
"fast-safe-stringify": "^2.1.1",
5151
"get-params": "^0.1.2",
5252
"reflect-metadata": "^0.1.13",
@@ -59,14 +59,17 @@
5959
"chai": "^4.3.4",
6060
"chai-as-promised": "^7.1.1",
6161
"chai-things": "^0.2.0",
62-
"eslint": "^6.6.0",
62+
"eslint": "^9.37.0",
6363
"gulp": "^4.0.2",
6464
"gulp-debug": "~4.0.0",
6565
"gulp-eslint": "~6.0.0",
6666
"mocha": "9.1.3",
6767
"nyc": "15.1.0",
6868
"rewire": "6.0.0",
6969
"sinon": "13.0.1",
70-
"typescript": "4.4.4"
70+
"typescript": "~5.8.3",
71+
"typescript-eslint": "^8.46.0",
72+
"@eslint/js": "^9.37.0",
73+
"@tsconfig/node18": "~18.2.4"
7174
}
7275
}

apis/fabric-contract-api/test/typescript/smartcontract.ts

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,19 @@
55
66
*/
77

8-
import {Contract, Context} from 'fabric-contract-api';
9-
import {ChaincodeStub, ClientIdentity} from 'fabric-shim-api';
8+
import { Contract, Context } from 'fabric-contract-api';
9+
import { ChaincodeStub, ClientIdentity } from 'fabric-shim-api';
1010

1111
export class ScenarioContext extends Context {
12-
customFunction(): void {
13-
14-
}
12+
customFunction(): void {}
1513
}
1614

1715
export default class TestContractOne extends Contract {
1816
constructor() {
1917
super('org.papernet.commercialpaper');
2018
}
2119

22-
beforeTransaction(ctx: ScenarioContext) {
20+
beforeTransaction(ctx: ScenarioContext): Promise<void> {
2321
// test that the context super class properties are available
2422
const stubApi: ChaincodeStub = ctx.stub;
2523
const clientIdentity: ClientIdentity = ctx.clientIdentity;
@@ -32,29 +30,33 @@ export default class TestContractOne extends Contract {
3230
return Promise.resolve();
3331
}
3432

35-
afterTransaction(ctx: ScenarioContext, result: any) {
33+
afterTransaction(ctx: ScenarioContext, result: any): Promise<void> {
3634
// This proves that typescript is enforcing the
3735
// return type of Promise<void>
3836
return Promise.resolve();
3937
}
4038

41-
aroundTransaction(ctx: ScenarioContext, fn: Function, parameters: any) {
39+
aroundTransaction(
40+
ctx: ScenarioContext,
41+
fn: Function,
42+
parameters: any
43+
): Promise<void> {
4244
// This proves that typescript is enforcing the
4345
// return type of Promise<void>
4446
return super.aroundTransaction(ctx, fn, parameters);
4547
}
4648

47-
unknownTransaction(ctx: ScenarioContext) {
49+
unknownTransaction(ctx: ScenarioContext): Promise<void> {
4850
// This proves that typescript is enforcing the
4951
// return type of Promise<void>
5052
return Promise.resolve();
5153
}
5254

53-
createContext() {
55+
createContext(): ScenarioContext {
5456
return new ScenarioContext();
5557
}
5658

57-
async Transaction(ctx: ScenarioContext) {
59+
async Transaction(ctx: ScenarioContext): Promise<void> {
5860
// test that the context super class properties are available
5961
const stubApi: ChaincodeStub = ctx.stub;
6062
const clientIdentity: ClientIdentity = ctx.clientIdentity;
@@ -69,7 +71,7 @@ export class TestContractTwo extends Contract {
6971
super();
7072
}
7173

72-
async Transaction(ctx: Context) {
74+
async Transaction(ctx: Context): Promise<void> {
7375
const stubApi: ChaincodeStub = ctx.stub;
7476
const clientIdentity: ClientIdentity = ctx.clientIdentity;
7577
}

apis/fabric-contract-api/tsconfig.json

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,17 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66
{
7-
"compilerOptions": {
8-
"types": ["./types/"],
9-
"alwaysStrict": true,
10-
"module": "commonjs",
11-
"declaration": true,
12-
"sourceMap": true,
13-
"strict": true,
14-
"target": "es2017",
15-
"lib": [
16-
"esnext",
17-
]
18-
},
19-
"include": [
20-
"lib/**/*",
21-
"test/**/*"
22-
],
23-
"exclude": [
24-
"node_modules/**/*"
25-
]
7+
"$schema": "https://json.schemastore.org/tsconfig",
8+
"extends": "@tsconfig/node18/tsconfig.json",
9+
"compilerOptions": {
10+
"types": ["./types/"],
11+
"declaration": true,
12+
"declarationMap": true,
13+
"erasableSyntaxOnly": true,
14+
"isolatedModules": true,
15+
"sourceMap": true,
16+
"strict": true
17+
},
18+
"include": ["lib/**/*", "test/**/*"],
19+
"exclude": ["node_modules/**/*"]
2620
}

apis/fabric-shim-api/.npmignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Exclude everything except specific inclusions below
2+
**/*
3+
4+
!lib/**/*
5+
!types/**/*

apis/fabric-shim-api/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"url": "https://github.com/hyperledger/fabric-chaincode-node"
1010
},
1111
"scripts": {
12-
"lint": "eslint ./types/ --ext .ts",
12+
"lint": "eslint ./types/",
1313
"build": "echo No Build needed"
1414
},
1515
"keywords": [
@@ -18,13 +18,13 @@
1818
"Fabric Shim"
1919
],
2020
"engines": {
21-
"node": ">=18",
22-
"eslint": "^6.6.0"
21+
"node": ">=18"
2322
},
2423
"types": "./types/index.d.ts",
2524
"license": "Apache-2.0",
2625
"devDependencies": {
2726
"@types/long": "^4.0.1",
28-
"eslint": "^6.6.0"
27+
"eslint": "^9.37.0",
28+
"@eslint/js": "^9.37.0"
2929
}
3030
}

common/config/rush/command-line.json

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"description": "Runs the Scenario e2e tests.",
2626
"enableParallelism": true,
2727
"ignoreMissingScript": true
28-
},
28+
},
2929
{
3030
"commandKind": "global",
3131
"name": "update-protos",
@@ -75,13 +75,6 @@
7575
"summary": "Lists build log files created",
7676
"description": "Run this command to list the build logs created after rush rebuild",
7777
"shellCommand": "./tools/logfiles.sh"
78-
},
79-
{
80-
"commandKind": "global",
81-
"name": "edge-docker",
82-
"summary": "Gets the latest main docker images for Fabric ",
83-
"description": "Run this command before doing anything to get the main branch Fabric docker images",
84-
"shellCommand": "./tools/getEdgeDocker.sh"
8578
}
8679
]
8780
}

0 commit comments

Comments
 (0)