diff --git a/.gitignore b/.gitignore index 7f3a25df..83c888c2 100644 --- a/.gitignore +++ b/.gitignore @@ -89,4 +89,5 @@ android/.gradle yalc.lock # Typescript +**/.tsbuild/ **/tsconfig.tsbuildinfo diff --git a/config/tsconfig.json b/config/tsconfig.json index 8f33adf8..199aaac7 100644 --- a/config/tsconfig.json +++ b/config/tsconfig.json @@ -1,17 +1,5 @@ { "extends": "@tsconfig/react-native/tsconfig.json", - "include": ["**/*.ts", "**/*.tsx"], - "exclude": [ - "**/node_modules", - "**/Pods", - "**/lib", - "**/.eslintrc.js", - "**/.prettierrc.js", - "**/jest.config.js", - "**/babel.config.js", - "**/metro.config.js", - "**/tsconfig.json" - ], "compilerOptions": { "composite": true, "allowUnreachableCode": false, diff --git a/example/babel.config.js b/example/babel.config.js index 91e4533a..4686b33c 100644 --- a/example/babel.config.js +++ b/example/babel.config.js @@ -18,6 +18,8 @@ module.exports = { 'stream': 'readable-stream', 'buffer': 'react-native-quick-crypto', 'react-native-sqlite-storage': 'react-native-nitro-sqlite', + '^@nitro-sqlite/(.+)': + '../packages/react-native-nitro-sqlite/src/\\1', '^@/(.+)': './src/\\1', '^@tests/(.+)': './tests/\\1', }, diff --git a/example/package.json b/example/package.json index 8bdaa535..0c709806 100644 --- a/example/package.json +++ b/example/package.json @@ -8,7 +8,7 @@ "ios": "react-native run-ios", "bundle-install": "bundle install", "pods": "cd ios && bundle exec pod install", - "typecheck": "tsc --noEmit", + "typecheck": "tsc --build", "lint": "eslint \"**/*.{js,ts,tsx}\" --fix", "codegen": "bun react-native codegen", "test:harness": "react-native-harness", diff --git a/example/tests/db.ts b/example/tests/db.ts index 6da35edb..fe3c12b2 100644 --- a/example/tests/db.ts +++ b/example/tests/db.ts @@ -7,7 +7,7 @@ import { open } from 'react-native-nitro-sqlite' import { getDatabaseQueue, type DatabaseQueue, -} from '../../packages/react-native-nitro-sqlite/src/DatabaseQueue' +} from '@nitro-sqlite/DatabaseQueue' const chance = new Chance() diff --git a/example/tests/unit/specs/operations/execute.spec.ts b/example/tests/unit/specs/operations/execute.spec.ts index f8fa7ce1..6f724b41 100644 --- a/example/tests/unit/specs/operations/execute.spec.ts +++ b/example/tests/unit/specs/operations/execute.spec.ts @@ -2,8 +2,8 @@ import { chance, expect, isNitroSQLiteError } from '@tests/unit/common' import { describe, it } from '@tests/TestApi' import { createArrayBufferTestDb, testDb } from '@tests/db' import { open } from 'react-native-nitro-sqlite' -import { buildJSQueryResult } from '../../../../../packages/react-native-nitro-sqlite/src/operations/execute' -import type { NitroSQLiteQueryResult } from '../../../../../packages/react-native-nitro-sqlite/src/specs/NitroSQLiteQueryResult.nitro' +import { buildJSQueryResult } from '@nitro-sqlite/operations/execute' +import type { NitroSQLiteQueryResult } from '@nitro-sqlite/specs/NitroSQLiteQueryResult.nitro' const QUERY_RESULT_SIZES = [60, 1_000, 10_000] diff --git a/example/tsconfig.json b/example/tsconfig.json index 6e335f84..91542814 100644 --- a/example/tsconfig.json +++ b/example/tsconfig.json @@ -1,18 +1,13 @@ { "extends": "../config/tsconfig.json", - "include": [ - "src", - "tests", - "index.js", - "../packages/react-native-nitro-sqlite/src", - "rn-harness.config.mjs" - ], + "include": ["src", "tests", "index.js", "rn-harness.config.mjs"], + "references": [{ "path": "../packages/react-native-nitro-sqlite" }], "compilerOptions": { "paths": { "react-native-nitro-sqlite": [ - "../packages/react-native-nitro-sqlite/src" + "../packages/react-native-nitro-sqlite/src/index.ts" ], - "*": ["./*"], + "@nitro-sqlite/*": ["../packages/react-native-nitro-sqlite/src/*"], "@/*": ["./src/*"], "@tests/*": ["./tests/*"] } diff --git a/package.json b/package.json index d15caee1..6fa736e5 100644 --- a/package.json +++ b/package.json @@ -19,11 +19,11 @@ "homepage": "https://github.com/margelo/react-native-nitro-sqlite#readme", "scripts": { "postinstall": "patch-package", - "typecheck": "bun --filter=\"**\" typecheck", + "typecheck": "tsc --build", "lint": "bun sqlite lint && bun example lint", "lint-cpp": "./scripts/clang-format.sh", "prettier": "prettier --write .", - "clean": "rm -rf **/tsconfig.tsbuildinfo node_modules packages/react-native-nitro-sqlite/node_module packages/react-native-nitro-sqlite/lib", + "clean": "rm -rf **/.tsbuild **/tsconfig.tsbuildinfo node_modules packages/react-native-nitro-sqlite/node_module packages/react-native-nitro-sqlite/lib", "release": "./scripts/release.sh", "sqlite": "bun --cwd packages/react-native-nitro-sqlite", "example": "bun --cwd example" diff --git a/packages/react-native-nitro-sqlite-vec/package.json b/packages/react-native-nitro-sqlite-vec/package.json index ef61a014..dd2a3614 100644 --- a/packages/react-native-nitro-sqlite-vec/package.json +++ b/packages/react-native-nitro-sqlite-vec/package.json @@ -14,7 +14,7 @@ "README.md" ], "scripts": { - "typecheck": "tsc --noEmit", + "typecheck": "tsc --build", "lint": "eslint \"**/*.{js,ts,tsx}\" --fix", "release": "release-it", "prepublishOnly": "bun typecheck" diff --git a/packages/react-native-nitro-sqlite-vec/tsconfig.json b/packages/react-native-nitro-sqlite-vec/tsconfig.json index b42cdafe..a3e0c454 100644 --- a/packages/react-native-nitro-sqlite-vec/tsconfig.json +++ b/packages/react-native-nitro-sqlite-vec/tsconfig.json @@ -1,9 +1,11 @@ { "extends": "../../config/tsconfig.json", - "include": ["src", "../react-native-nitro-sqlite/src"], + "include": ["src"], + "references": [{ "path": "../react-native-nitro-sqlite" }], "compilerOptions": { + "rootDir": "src", "paths": { - "react-native-nitro-sqlite": ["../react-native-nitro-sqlite/src"] + "react-native-nitro-sqlite": ["../react-native-nitro-sqlite/src/index.ts"] } } } diff --git a/packages/react-native-nitro-sqlite/tsconfig.json b/packages/react-native-nitro-sqlite/tsconfig.json index 810346ee..1f319653 100644 --- a/packages/react-native-nitro-sqlite/tsconfig.json +++ b/packages/react-native-nitro-sqlite/tsconfig.json @@ -3,6 +3,9 @@ "include": ["src"], "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": ".tsbuild", + "emitDeclarationOnly": true, + "noEmit": false, + "tsBuildInfoFile": ".tsbuild/tsconfig.tsbuildinfo" } } diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 00000000..ae8a25a4 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,8 @@ +{ + "files": [], + "references": [ + { "path": "./packages/react-native-nitro-sqlite" }, + { "path": "./packages/react-native-nitro-sqlite-vec" }, + { "path": "./example" } + ] +}