Skip to content

Commit 00ac0a9

Browse files
committed
fix(deps): bulk add missing dependencies - 2023-11-02
1. Added missing dependencies everywhere to all the packages 2. The exception to the above is test runners and related dependencies. You can see the detailed exclusion list in the source code of the script itself [1]. We should make these configurable later on as well. For reference, this is what the exclusions were declared as when I ran the tool in order to then proceed to update the package.json files: ```typescript ignorePatterns: [ // files matching these patterns will be ignored "sandbox", "dist", "bower_components", "node_modules" ], ignoreMatches: [ // ignore dependencies that matches these globs "grunt-*", "jest-extended", "tape-promise", "tape", "tap", "@ionic-native/*" ], ``` 3. There were instances of missing dependency usages where we did NOT have to add the dependencies to package.json files because what we could do instead is just import types at development time by using the `import type { .. } from "...";` syntax of Typescript which means that the import is disappeared during transpilation completely. So this is why some source code files were also modified and not strictly just package.json files. 4. One exception to the above is the google-sm-keychain plugin's mock code where minimal code alternations were necessary to satisfy the compiler. With that said, no behavioral code change was done here either, just the elimination of some redundant assignments. 5. Added a script in the ./tools/custom-check directory to audit the entire mono-repo for missing NodeJS dependencies. We've had at least a dozen packages that were missing production dependency declarations from their package.json files. The usual suspects here are packages that are contained by the root node_modules folder which masks the problem at development time (e.g. the compiler won't let you know about the missing dependencies). For a future-proof solution we should add a commit hook or other validation that runs the custom check that I added [2] here to verify that there are no missing dependencies in the project [1] `./tools/custom-checks/check-missing-node-deps.ts` [2] `$ yarn tools:check-missing-node-deps` Fixes hyperledger-cacti#2857 Signed-off-by: Peter Somogyvari <[email protected]>
1 parent 27334af commit 00ac0a9

File tree

78 files changed

+1281
-186
lines changed

Some content is hidden

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

78 files changed

+1281
-186
lines changed

examples/cactus-check-connection-ethereum-validator/BusinessLogicCheckEthereumValidator.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Request } from "express";
1+
import type { Request } from "express";
22
import { getLogger } from "log4js";
33
import { RequestInfo } from "./RequestInfo";
44

examples/cactus-check-connection-ethereum-validator/package.json

+9-1
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,18 @@
1616
},
1717
"dependencies": {
1818
"escape-html": "1.0.3",
19+
"express": "4.18.2",
20+
"js-yaml": "4.1.0",
21+
"log4js": "6.9.1",
22+
"shelljs": "0.8.5",
1923
"socket.io": "4.5.4"
2024
},
2125
"devDependencies": {
26+
"@hyperledger/cactus-common": "2.0.0-alpha.2",
2227
"@types/escape-html": "1.0.1",
23-
"@types/node": "15.14.9"
28+
"@types/express": "4.17.20",
29+
"@types/js-yaml": "4.0.8",
30+
"@types/node": "15.14.9",
31+
"@types/shelljs": "0.8.14"
2432
}
2533
}

examples/cactus-example-carbon-accounting-frontend/src/app/app.module.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
BESU_DEMO_LEDGER_ID,
1515
CACTUS_API_URL,
1616
FABRIC_DEMO_LEDGER_ID,
17-
} from "src/constants";
17+
} from "../constants";
1818
import { ApiClient } from "@hyperledger/cactus-api-client";
1919

2020
LoggerProvider.setLogLevel("TRACE");

examples/cactus-example-discounted-asset-trade/package.json

+6-1
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,25 @@
3636
"fabric-ca-client": "2.2.19",
3737
"fabric-network": "2.2.19",
3838
"http-errors": "1.6.3",
39+
"indy-sdk": "1.16.0-dev-1655",
3940
"jsonwebtoken": "9.0.0",
4041
"jsrsasign": "10.5.25",
4142
"log4js": "6.4.0",
4243
"morgan": "1.9.1",
44+
"run-time-error-cjs": "1.4.0",
4345
"shelljs": "0.8.5",
4446
"socket.io": "4.5.4",
4547
"ts-node": "8.9.1",
48+
"uuid": "9.0.1",
4649
"xmlhttprequest": "1.8.0"
4750
},
4851
"devDependencies": {
4952
"@types/elliptic": "6.4.14",
5053
"@types/escape-html": "1.0.1",
5154
"@types/express": "4.17.19",
55+
"@types/indy-sdk": "1.16.29",
5256
"@types/jsonwebtoken": "9.0.2",
53-
"@types/jsrsasign": "10.5.8"
57+
"@types/jsrsasign": "10.5.8",
58+
"@types/uuid": "9.0.6"
5459
}
5560
}

examples/cactus-example-electricity-trade/package.json

+2
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,14 @@
4040
"shelljs": "0.8.5",
4141
"socket.io": "4.5.4",
4242
"ts-node": "8.9.1",
43+
"uuid": "9.0.1",
4344
"web3": "1.8.1",
4445
"xmlhttprequest": "1.8.0"
4546
},
4647
"devDependencies": {
4748
"@types/escape-html": "1.0.1",
4849
"@types/express": "4.17.19",
50+
"@types/uuid": "9.0.6",
4951
"@typescript-eslint/eslint-plugin": "4.33.0",
5052
"@typescript-eslint/parser": "4.33.0",
5153
"eslint": "7.32.0",

examples/cactus-example-supply-chain-business-logic-plugin/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
"axios": "1.5.1",
6969
"express": "4.18.2",
7070
"openapi-types": "9.1.0",
71+
"run-time-error-cjs": "1.4.0",
7172
"typescript-optional": "2.0.1",
7273
"uuid": "8.3.2"
7374
},

examples/cactus-example-supply-chain-frontend/package.json

+3
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,11 @@
6767
"@ionic-native/status-bar": "5.36.0",
6868
"@ionic/angular": "7.3.3",
6969
"net-browserify": "0.2.4",
70+
"run-time-error-cjs": "1.4.0",
7071
"rxjs": "7.8.1",
7172
"tls-browserify": "0.2.2",
7273
"tslib": "2.6.2",
74+
"uuid": "9.0.1",
7375
"zone.js": "0.13.1"
7476
},
7577
"devDependencies": {
@@ -80,6 +82,7 @@
8082
"@angular/compiler-cli": "16.2.4",
8183
"@angular/language-service": "16.2.4",
8284
"@ionic/angular-toolkit": "10.0.0",
85+
"@types/uuid": "9.0.6",
8386
"browserify-fs": "1.0.0",
8487
"https-browserify": "1.0.0",
8588
"net-browserify": "0.2.4",

examples/cactus-example-supply-chain-frontend/src/app/app.module.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
CACTUS_API_URL,
1616
QUORUM_DEMO_LEDGER_ID,
1717
FABRIC_DEMO_LEDGER_ID,
18-
} from "src/constants";
18+
} from "../constants";
1919
import { ApiClient } from "@hyperledger/cactus-api-client";
2020
import { AuthConfig } from "./common/auth-config";
2121

examples/cactus-example-supply-chain-frontend/src/app/bookshelf/bookshelf-detail/bookshelf-detail.page.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
} from "@hyperledger/cactus-example-supply-chain-business-logic-plugin";
1818

1919
import { Logger, LoggerProvider } from "@hyperledger/cactus-common";
20-
import { QUORUM_DEMO_LEDGER_ID } from "src/constants";
20+
import { QUORUM_DEMO_LEDGER_ID } from "../../../constants";
2121

2222
import { AuthConfig } from "../../common/auth-config";
2323

examples/cactus-example-supply-chain-frontend/src/app/shipment/shipment-detail/shipment-detail.page.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
} from "@hyperledger/cactus-example-supply-chain-business-logic-plugin";
1818

1919
import { Logger, LoggerProvider } from "@hyperledger/cactus-common";
20-
import { QUORUM_DEMO_LEDGER_ID } from "src/constants";
20+
import { QUORUM_DEMO_LEDGER_ID } from "../../../constants";
2121

2222
import { AuthConfig } from "../../common/auth-config";
2323

examples/cactus-example-tcs-huawei/package.json

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"@hyperledger/cactus-core-api": "2.0.0-alpha.2",
1717
"@hyperledger/cactus-verifier-client": "2.0.0-alpha.2",
1818
"@types/node": "14.18.54",
19+
"@types/uuid": "9.0.6",
1920
"body-parser": "1.20.2",
2021
"cookie-parser": "1.4.6",
2122
"debug": "2.6.9",
@@ -33,6 +34,7 @@
3334
"shelljs": "0.8.5",
3435
"socket.io": "4.5.4",
3536
"ts-node": "8.9.1",
37+
"uuid": "9.0.1",
3638
"web3": "1.7.0",
3739
"xmlhttprequest": "1.8.0"
3840
},

examples/cactus-workshop-examples-2022-11-14/package.json

+8-1
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,17 @@
5353
"webpack:dev:web": "webpack --env=dev --target=web --config ../../webpack.config.js"
5454
},
5555
"dependencies": {
56+
"@hyperledger/cactus-cmd-api-server": "2.0.0-alpha.2",
5657
"@hyperledger/cactus-common": "2.0.0-alpha.2",
5758
"@hyperledger/cactus-core": "2.0.0-alpha.2",
59+
"@hyperledger/cactus-core-api": "2.0.0-alpha.2",
5860
"@hyperledger/cactus-test-tooling": "2.0.0-alpha.2",
59-
"typescript-optional": "2.0.1"
61+
"kubo-rpc-client": "3.0.1",
62+
"typescript-optional": "2.0.1",
63+
"uuid": "9.0.1"
64+
},
65+
"devDependencies": {
66+
"@types/uuid": "9.0.6"
6067
},
6168
"engines": {
6269
"node": ">=10",

examples/cactus-workshop-examples-2022-11-14/src/main/typescript/hello-world.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import { ApiServer, ConfigService } from "@hyperledger/cactus-cmd-api-server";
33
import { Logger, LoggerProvider } from "@hyperledger/cactus-common";
44
import { GoIpfsTestContainer } from "@hyperledger/cactus-test-tooling";
5-
import { create } from "ipfs-http-client";
65
import { createServer } from "http";
76
import { v4 as uuidv4 } from "uuid";
87
import {
@@ -23,6 +22,7 @@ const main = async () => {
2322
// retrieve the url so that the IPFS connector plugin is
2423
// able to connect to the IPFS network. This will be used
2524
// as an argument for the plugin bellow
25+
const { create } = await import("kubo-rpc-client");
2626
const ipfsClientOrOptions = create({
2727
url: await ipfsNetwork.getApiUrl(),
2828
});

extensions/cactus-plugin-htlc-coordinator-besu/package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,14 @@
7272
"prom-client": "13.1.0",
7373
"run-time-error-cjs": "1.4.0",
7474
"socket.io-client-fixed-types": "4.5.4",
75-
"typescript-optional": "2.0.1"
75+
"typescript-optional": "2.0.1",
76+
"uuid": "9.0.1"
7677
},
7778
"devDependencies": {
7879
"@hyperledger/cactus-plugin-keychain-memory": "2.0.0-alpha.2",
7980
"@hyperledger/cactus-test-tooling": "2.0.0-alpha.2",
8081
"@types/express": "4.17.19",
82+
"@types/uuid": "9.0.6",
8183
"express": "4.18.2",
8284
"socket.io": "4.5.4",
8385
"web3-eth-abi": "4.0.3",

extensions/cactus-plugin-object-store-ipfs/package.json

+2
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@
6666
"devDependencies": {
6767
"@hyperledger/cactus-test-tooling": "2.0.0-alpha.2",
6868
"@multiformats/multiaddr": "11.6.1",
69+
"@types/body-parser": "1.19.4",
6970
"@types/express": "4.17.19",
71+
"body-parser": "1.20.2",
7072
"express": "4.18.2",
7173
"ipfs-core-types": "0.14.1",
7274
"ipfs-unixfs": "9.0.1",

package.json

+5
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"tools:generate-sbom": "TS_NODE_PROJECT=tools/tsconfig.json node --experimental-json-modules --trace-deprecation --experimental-modules --abort-on-uncaught-exception --loader ts-node/esm --experimental-specifier-resolution=node ./tools/generate-sbom.ts",
4040
"tools:fix-pkg-npm-scope": "TS_NODE_PROJECT=tools/tsconfig.json node --experimental-json-modules --trace-deprecation --experimental-modules --abort-on-uncaught-exception --loader ts-node/esm --experimental-specifier-resolution=node ./tools/custom-checks/check-pkg-npm-scope.ts",
4141
"tools:sort-package-json": "TS_NODE_PROJECT=tools/tsconfig.json node --experimental-json-modules --trace-deprecation --experimental-modules --abort-on-uncaught-exception --loader ts-node/esm --experimental-specifier-resolution=node ./tools/sort-package-json.ts",
42+
"tools:check-missing-node-deps": "TS_NODE_PROJECT=tools/tsconfig.json node --experimental-json-modules --trace-deprecation --experimental-modules --abort-on-uncaught-exception --loader ts-node/esm --experimental-specifier-resolution=node ./tools/custom-checks/check-missing-node-deps.ts",
4243
"generate-api-server-config": "node ./tools/generate-api-server-config.js",
4344
"sync-ts-config": "TS_NODE_PROJECT=tools/tsconfig.json node --experimental-json-modules --loader ts-node/esm ./tools/sync-npm-deps-to-tsc-projects.ts",
4445
"start:api-server": "node ./packages/cactus-cmd-api-server/dist/lib/main/typescript/cmd/cactus-api.js --config-file=.config.json",
@@ -128,6 +129,7 @@
128129
"cspell": "5.21.2",
129130
"del": "7.1.0",
130131
"del-cli": "4.0.1",
132+
"depcheck": "1.4.7",
131133
"es-main": "1.2.0",
132134
"eslint": "7.32.0",
133135
"eslint-config-prettier": "8.10.0",
@@ -223,6 +225,9 @@
223225
"esbuild": {
224226
"built": false
225227
},
228+
"indy-sdk": {
229+
"built": false
230+
},
226231
"iso-constants": {
227232
"built": false
228233
},

packages/cactus-common/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
"key-encoder": "2.0.3",
6161
"loglevel": "1.7.1",
6262
"loglevel-plugin-prefix": "0.8.4",
63+
"run-time-error-cjs": "1.4.0",
6364
"sanitize-html": "2.7.0",
6465
"secp256k1": "4.0.3",
6566
"sha3": "2.1.4"

packages/cactus-core-api/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
"@grpc/proto-loader": "0.7.8",
6868
"@types/express": "4.17.19",
6969
"@types/google-protobuf": "3.15.5",
70+
"google-protobuf": "3.21.2",
7071
"grpc-tools": "1.12.4",
7172
"grpc_tools_node_protoc_ts": "5.3.3",
7273
"make-dir-cli": "3.1.0",

packages/cactus-core-api/src/main/typescript/plugin/web-service/i-web-service-endpoint.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Express } from "express";
1+
import type { Express } from "express";
22
import { IAsyncProvider } from "@hyperledger/cactus-common";
33
import { IEndpointAuthzOptions } from "./i-endpoint-authz-options";
44
import { IExpressRequestHandler } from "./i-express-request-handler";

packages/cactus-core/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"express": "4.18.2",
5656
"express-jwt-authz": "2.4.1",
5757
"express-openapi-validator": "5.0.4",
58+
"run-time-error-cjs": "1.4.0",
5859
"safe-stable-stringify": "2.4.3",
5960
"typescript-optional": "2.0.1"
6061
},

packages/cactus-plugin-keychain-aws-sm/package.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,15 @@
6666
},
6767
"devDependencies": {
6868
"@hyperledger/cactus-test-tooling": "2.0.0-alpha.2",
69+
"@types/body-parser": "1.19.4",
6970
"@types/express": "4.17.19",
7071
"@types/request": "2.48.7",
72+
"@types/uuid": "9.0.6",
73+
"body-parser": "1.20.2",
7174
"express": "4.18.2",
7275
"internal-ip": "6.2.0",
73-
"openapi-types": "9.1.0"
76+
"openapi-types": "9.1.0",
77+
"uuid": "9.0.1"
7478
},
7579
"engines": {
7680
"node": ">=10",

packages/cactus-plugin-keychain-azure-kv/package.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,14 @@
7171
},
7272
"devDependencies": {
7373
"@hyperledger/cactus-test-tooling": "2.0.0-alpha.2",
74+
"@types/body-parser": "1.19.4",
7475
"@types/express": "4.17.19",
7576
"@types/request": "2.48.7",
77+
"body-parser": "1.20.2",
7678
"express": "4.18.2",
7779
"internal-ip": "6.2.0",
78-
"openapi-types": "9.1.0"
80+
"openapi-types": "9.1.0",
81+
"uuid": "9.0.1"
7982
},
8083
"engines": {
8184
"node": ">=10",

packages/cactus-plugin-keychain-google-sm/package.json

+6-1
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,18 @@
6161
"@hyperledger/cactus-core-api": "2.0.0-alpha.2",
6262
"axios": "1.5.1",
6363
"http-status-codes": "2.1.4",
64-
"typescript-optional": "2.0.1"
64+
"typescript-optional": "2.0.1",
65+
"uuid": "9.0.1"
6566
},
6667
"devDependencies": {
6768
"@hyperledger/cactus-test-tooling": "2.0.0-alpha.2",
69+
"@types/body-parser": "1.19.4",
6870
"@types/express": "4.17.19",
6971
"@types/request": "2.48.7",
72+
"@types/uuid": "9.0.6",
73+
"body-parser": "1.20.2",
7074
"express": "4.18.2",
75+
"google-gax": "4.0.5",
7176
"internal-ip": "6.2.0",
7277
"openapi-types": "9.1.0"
7378
},

packages/cactus-plugin-keychain-google-sm/src/test/typescript/mock/plugin-keychain-google-sm-mock.ts

+2-7
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ import {
44
protos,
55
} from "@google-cloud/secret-manager";
66

7-
import * as gax from "google-gax";
8-
import { Descriptors } from "google-gax";
7+
import type { GoogleAuth } from "google-gax";
98

109
import {
1110
Logger,
@@ -38,12 +37,8 @@ export class SecretManagerServiceClientMock extends SecretManagerServiceClient {
3837

3938
this.log = LoggerProvider.getOrCreate({ level, label });
4039

41-
this.auth = "" as unknown as gax.GoogleAuth;
42-
this.descriptors = "" as unknown as Descriptors;
40+
this.auth = "" as unknown as GoogleAuth;
4341
this.innerApiCalls = "" as unknown as { [name: string]: Function };
44-
this.pathTemplates = "" as unknown as {
45-
[name: string]: gax.PathTemplate;
46-
};
4742

4843
this.secrets = new Map<string, string>();
4944
this.log.info(`Created ${this.className}.`);

packages/cactus-plugin-keychain-memory-wasm/package.json

+2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@
6969
"uuid": "8.3.2"
7070
},
7171
"devDependencies": {
72+
"@types/body-parser": "1.19.4",
7273
"@types/express": "4.17.19",
74+
"body-parser": "1.20.2",
7375
"cpy-cli": "4.2.0",
7476
"del-cli": "4.0.1"
7577
},

packages/cactus-plugin-keychain-memory/package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@
6464
"uuid": "8.3.2"
6565
},
6666
"devDependencies": {
67-
"@types/express": "4.17.19"
67+
"@types/body-parser": "1.19.4",
68+
"@types/express": "4.17.19",
69+
"body-parser": "1.20.2"
6870
},
6971
"engines": {
7072
"node": ">=10",

packages/cactus-plugin-keychain-vault/package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,11 @@
7272
"@types/request": "2.48.7",
7373
"@types/tape-promise": "4.0.1",
7474
"@types/uuid": "8.3.4",
75+
"body-parser": "1.20.2",
7576
"express": "4.18.2",
7677
"internal-ip": "6.2.0",
77-
"openapi-types": "9.1.0"
78+
"openapi-types": "9.1.0",
79+
"uuid": "9.0.1"
7880
},
7981
"engines": {
8082
"node": ">=10",

packages/cactus-plugin-ledger-connector-besu/package.json

+5
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,20 @@
6969
"web3": "1.6.1",
7070
"web3-core": "1.6.1",
7171
"web3-eth": "1.6.1",
72+
"web3-eth-contract": "1.6.1",
7273
"web3-utils": "1.6.1",
7374
"web3js-quorum": "22.4.0"
7475
},
7576
"devDependencies": {
7677
"@hyperledger/cactus-plugin-keychain-memory": "2.0.0-alpha.2",
7778
"@hyperledger/cactus-test-tooling": "2.0.0-alpha.2",
79+
"@types/body-parser": "1.19.4",
7880
"@types/express": "4.17.19",
81+
"@types/uuid": "9.0.6",
82+
"body-parser": "1.20.2",
7983
"key-encoder": "2.0.3",
8084
"socket.io": "4.5.4",
85+
"uuid": "9.0.1",
8186
"web3-core": "1.6.1",
8287
"web3-eth": "1.6.1"
8388
},

0 commit comments

Comments
 (0)