Skip to content

Commit 1b27c8f

Browse files
authored
refactor [NET-1646]: Clean-up tsconfigs for the cli-tools package (#3270)
This pull request updates TypeScript configuration for the `cli-tools` package to improve project references and build reliability. The changes primarily enhance how the package manages its dependencies and build process, ensuring better integration with related packages and more robust project setup. ### Changes **TypeScript project configuration improvements:** * Added additional project references in `tsconfig.node.json` and `tsconfig.jest.json` for `dht`, `trackerless-network`, and `test-utils` to ensure proper dependency tracking and type checking. * Included `tsconfig.node.json` as a reference in the main `tsconfig.json` for `cli-tools`, clarifying the build order and dependencies. * Added `package.json` to the `include` array in `tsconfig.jest.json` to ensure it is considered in type checking and builds. **Build process and compiler options:** * Simplified the `build` script in `package.json` to use the default TypeScript project references build (`tsc -b`), making the build process more consistent. * Enabled the `disableSourceOfProjectReferenceRedirect` compiler option in the root `tsconfig.node.json` to prevent issues with source file redirection in project references. **Other adjustments:** * Removed the `composite` option from `cli-tools/tsconfig.node.json`, as it is now managed at a higher level.
1 parent b90adea commit 1b27c8f

File tree

6 files changed

+21
-7
lines changed

6 files changed

+21
-7
lines changed

packages/cli-tools/bin/streamr-stream-subscribe.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env node
22
import '../src/logLevel'
33

4-
import { convertStreamMessageToBytes, MessageMetadata, StreamMessage, StreamrClient } from '@streamr/sdk'
4+
import { convertStreamMessageToBytes, MessageMetadata, type StreamMessage, StreamrClient } from '@streamr/sdk'
55
import { binaryToHex, toLengthPrefixedFrame } from '@streamr/utils'
66
import mapValues from 'lodash/mapValues'
77
import isString from 'lodash/isString'

packages/cli-tools/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"streamr": "dist/bin/streamr.js"
1818
},
1919
"scripts": {
20-
"build": "tsc -b tsconfig.node.json",
20+
"build": "tsc -b",
2121
"check": "tsc -p ./tsconfig.jest.json",
2222
"clean": "jest --clearCache || true; rm -rf dist *.tsbuildinfo node_modules/.cache || true",
2323
"eslint": "eslint --cache --cache-location=node_modules/.cache/.eslintcache/ '*/**/*.{js,ts}'",
Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,24 @@
11
{
22
"extends": "../../tsconfig.jest.json",
33
"compilerOptions": {
4-
"noEmit": true,
5-
"types": ["node", "jest", "@streamr/test-utils/customMatcherTypes"],
4+
"types": [
5+
"node",
6+
"jest",
7+
"@streamr/test-utils/customMatcherTypes"
8+
],
69
"noImplicitOverride": false
710
},
811
"include": [
12+
"package.json",
913
"src",
1014
"bin",
1115
"test"
16+
],
17+
"references": [
18+
{ "path": "../utils/tsconfig.node.json" },
19+
{ "path": "../sdk/tsconfig.node.json" },
20+
{ "path": "../dht/tsconfig.node.json" },
21+
{ "path": "../trackerless-network/tsconfig.node.json" },
22+
{ "path": "../test-utils/tsconfig.node.json" }
1223
]
1324
}

packages/cli-tools/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"composite": true
55
},
66
"references": [
7+
{ "path": "./tsconfig.node.json" },
78
{ "path": "./tsconfig.jest.json" }
89
]
910
}
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"extends": "../../tsconfig.node.json",
33
"compilerOptions": {
4-
"composite": true,
54
"outDir": "dist"
65
},
76
"include": [
@@ -11,6 +10,8 @@
1110
],
1211
"references": [
1312
{ "path": "../utils/tsconfig.node.json" },
14-
{ "path": "../sdk/tsconfig.node.json" }
13+
{ "path": "../sdk/tsconfig.node.json" },
14+
{ "path": "../dht/tsconfig.node.json" },
15+
{ "path": "../trackerless-network/tsconfig.node.json" }
1516
]
1617
}

tsconfig.node.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
"sourceMap": true,
1515
"stripInternal": true,
1616
"useUnknownInCatchVariables": false,
17-
"strictBindCallApply": true
17+
"strictBindCallApply": true,
18+
"disableSourceOfProjectReferenceRedirect": true
1819
},
1920
"lib": [
2021
"DOM"

0 commit comments

Comments
 (0)