Skip to content

Commit 4d1a7db

Browse files
authored
chore: add TypeScript project references and upgrade compiler (#140)
1 parent 5415479 commit 4d1a7db

10 files changed

Lines changed: 109 additions & 36 deletions

File tree

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ example/vendor/
5151
# node.js
5252
#
5353
node_modules/
54+
.tsbuild/
5455
npm-debug.log
5556
bun-debug.log
5657
bun-error.log

‎bun.lock‎

Lines changed: 47 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎eslint.config.mjs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ export default defineConfig([
2424
},
2525
},
2626
{
27-
ignores: ['node_modules/', 'lib/', 'package/lib/'],
27+
ignores: ['node_modules/', 'lib/', 'package/lib/', '.tsbuild/'],
2828
},
2929
]);

‎example/tsconfig.json‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
{
2-
"extends": "../tsconfig",
2+
"extends": "../tsconfig.base.json",
3+
"include": ["src"],
4+
"references": [{ "path": "../package" }],
35
"compilerOptions": {
4-
// Avoid expo-cli auto-generating a tsconfig
6+
"composite": true,
7+
"noEmit": true,
8+
"tsBuildInfoFile": "../.tsbuild/example/tsconfig.tsbuildinfo",
9+
"paths": {
10+
"react-native-graph": ["../package/src/index"]
11+
},
12+
"types": ["node"]
513
}
614
}

‎package.json‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"example": "bun --cwd example",
1313
"clean": "bun graph clean",
1414
"prepare": "bun graph prepare",
15-
"typecheck": "tsc",
15+
"typecheck": "tsc --build",
1616
"release": "bun graph release",
1717
"test": "bun graph test",
1818
"lint": "eslint \"**/*.{js,ts,tsx}\""
@@ -41,7 +41,8 @@
4141
"react-native-worklets": "^0.7.4",
4242
"release-it": "^19.0.4",
4343
"turbo": "^2.5.6",
44-
"typescript": "^5.9.2"
44+
"typescript": "npm:@typescript/typescript6@^6.0.2",
45+
"@typescript/native": "npm:typescript@^7.0.2"
4546
},
4647
"prettier": {
4748
"quoteProps": "consistent",

‎package/package.json‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@
109109
"preset": "react-native",
110110
"modulePathIgnorePatterns": [
111111
"<rootDir>/lib/"
112+
],
113+
"testPathIgnorePatterns": [
114+
"/node_modules/",
115+
"<rootDir>/../.tsbuild/"
112116
]
113117
},
114118
"create-react-native-library": {

‎package/tsconfig.build.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
2-
"extends": "../tsconfig",
2+
"extends": "../tsconfig.base.json",
33
"include": ["src"],
4+
"exclude": ["src/**/__tests__/**"],
45
"compilerOptions": {
56
"rootDir": "."
67
}

‎package/tsconfig.json‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"extends": "../tsconfig.base.json",
3+
"include": ["src"],
4+
"compilerOptions": {
5+
"composite": true,
6+
"rootDir": ".",
7+
"outDir": "../.tsbuild/package",
8+
"declaration": true,
9+
"emitDeclarationOnly": true,
10+
"tsBuildInfoFile": "../.tsbuild/package/tsconfig.tsbuildinfo",
11+
"types": ["jest", "node"]
12+
}
13+
}

‎tsconfig.base.json‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"compilerOptions": {
3+
"allowUnreachableCode": false,
4+
"allowUnusedLabels": false,
5+
"customConditions": ["react-native-strict-api"],
6+
"esModuleInterop": true,
7+
"forceConsistentCasingInFileNames": true,
8+
"jsx": "react-jsx",
9+
"lib": ["ESNext"],
10+
"module": "ESNext",
11+
"moduleResolution": "bundler",
12+
"noFallthroughCasesInSwitch": true,
13+
"noImplicitReturns": true,
14+
"noUncheckedIndexedAccess": true,
15+
"noUnusedLocals": true,
16+
"noUnusedParameters": true,
17+
"resolveJsonModule": true,
18+
"skipLibCheck": true,
19+
"strict": true,
20+
"target": "ESNext",
21+
"verbatimModuleSyntax": true
22+
}
23+
}

‎tsconfig.json‎

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,7 @@
11
{
2-
"compilerOptions": {
3-
"rootDir": ".",
4-
"paths": {
5-
"react-native-graph": ["./package/src/index"]
6-
},
7-
"allowUnreachableCode": false,
8-
"allowUnusedLabels": false,
9-
"customConditions": ["react-native-strict-api"],
10-
"esModuleInterop": true,
11-
"forceConsistentCasingInFileNames": true,
12-
"jsx": "react-jsx",
13-
"lib": ["ESNext"],
14-
"module": "ESNext",
15-
"moduleResolution": "bundler",
16-
"noEmit": true,
17-
"noFallthroughCasesInSwitch": true,
18-
"noImplicitReturns": true,
19-
"noImplicitUseStrict": false,
20-
"noStrictGenericChecks": false,
21-
"noUncheckedIndexedAccess": true,
22-
"noUnusedLocals": true,
23-
"noUnusedParameters": true,
24-
"resolveJsonModule": true,
25-
"skipLibCheck": true,
26-
"strict": true,
27-
"target": "ESNext",
28-
"verbatimModuleSyntax": true
29-
}
2+
"files": [],
3+
"references": [
4+
{ "path": "./package" },
5+
{ "path": "./example" }
6+
]
307
}

0 commit comments

Comments
 (0)