Skip to content

Commit 172ae69

Browse files
authored
fix: Minor build and configuration issues (#229)
* fix: `typeorm` missing in `bun.lockb` * chore: add npm `prepare` script * Update bun.lockb * Update bun.lockb * chore: build package on `prepublishOnly` * chore: add `typeorm` dependency top-level * fix: eslint jest error in CI * chore: use prettier in VS Code * fix: typescript-eslint setup * fix: add back prettier/recommended eslint config * chore: add `eslint-plugin-eslint-comments` * chore: add `eslint-plugin-react` * chore: add `eslint-plugin-react-hooks` * chore: add `eslint-plugin-react-native` * chore: add `@react-native/eslint-plugin` * revert package changes * Update bun.lockb * revert: eslint changes * Update lint-typescript.yml * chore: remove lint-ci script * update ci deps * chore: update jest * chore: add `eslint-plugin-jest` * Revert "chore: add `eslint-plugin-jest`" This reverts commit ba3a04b. * Update lint-typescript.yml * Revert "Update lint-typescript.yml" This reverts commit aba9508. * chore: update deps * chore: fix bun dependencies * fix: eslint errors * chore: set strict typeorm version * chore: rename typecheck script * fix: typescript errors * Update lint-typescript.yml * chore: update TS setup * Update .gitattributes * Create bunfig.toml * chore: split up tsc workflow check * revert: TS changes * chore: fix typeorm version * Update package.json * Update package.json * Update bunfig.toml
1 parent e6bf3cd commit 172ae69

File tree

12 files changed

+3404
-41
lines changed

12 files changed

+3404
-41
lines changed

.gitattributes

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
*.pbxproj -text
22
# specific for windows script files
33
*.bat text eol=crlf
4-
.lockb binary diff=lockb

.github/workflows/lint-typescript.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,38 +36,38 @@ jobs:
3636
name: Compile TypeScript (tsc)
3737
runs-on: ubuntu-latest
3838
steps:
39-
- uses: actions/checkout@v4
39+
- uses: actions/checkout@v5
4040
- uses: oven-sh/setup-bun@v2
4141
- uses: reviewdog/action-setup@v1
4242

4343
- name: Install npm dependencies (bun)
4444
run: bun install
4545

46-
- name: Run TypeScript (tsc)
46+
- name: Run TypeScript (tsc) in example
47+
working-directory: example
48+
run: |
49+
bun typecheck | reviewdog -name="tsc" -efm="%f(%l,%c): error TS%n: %m" -reporter="github-pr-review" -filter-mode="nofilter" -fail-level=any -tee
50+
env:
51+
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52+
53+
- name: Run TypeScript (tsc) in react-native-nitro-sqlite
54+
working-directory: package
4755
run: |
48-
bun typescript | reviewdog -name="tsc" -efm="%f(%l,%c): error TS%n: %m" -reporter="github-pr-review" -filter-mode="nofilter" -fail-on-error -tee
56+
bun typecheck | reviewdog -name="tsc" -efm="%f(%l,%c): error TS%n: %m" -reporter="github-pr-review" -filter-mode="nofilter" -fail-level=any -tee
4957
env:
5058
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5159

5260
lint:
5361
name: Lint TypeScript (eslint, prettier)
5462
runs-on: ubuntu-latest
5563
steps:
56-
- uses: actions/checkout@v4
64+
- uses: actions/checkout@v5
5765
- uses: oven-sh/setup-bun@v2
58-
- uses: reviewdog/action-setup@v1
5966

6067
- name: Install npm dependencies (bun)
6168
run: bun install
6269

63-
- name: Run ESLint CI in example/
64-
working-directory: example
65-
run: bun lint-ci
66-
- name: Run ESLint CI in react-native-nitro-sqlite
67-
working-directory: package
68-
run: bun lint-ci
69-
70-
- name: Run ESLint with auto-fix in example/
70+
- name: Run ESLint with auto-fix in example
7171
working-directory: example
7272
run: bun lint
7373
- name: Run ESLint with auto-fix in react-native-nitro-sqlite

.vscode/settings.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
22
"[javascript]": {
3-
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
3+
"editor.defaultFormatter": "esbenp.prettier-vscode"
44
},
55
"[javascriptreact]": {
6-
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
6+
"editor.defaultFormatter": "esbenp.prettier-vscode"
77
},
88
"[typescript]": {
9-
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
9+
"editor.defaultFormatter": "esbenp.prettier-vscode"
1010
},
1111
"[typescriptreact]": {
12-
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
12+
"editor.defaultFormatter": "esbenp.prettier-vscode"
1313
}
1414
}

bun.lock

Lines changed: 3362 additions & 0 deletions
Large diffs are not rendered by default.

bun.lockb

-527 KB
Binary file not shown.

bunfig.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[install]
2+
# Opt out from isolated installs
3+
linker = "hoisted"
4+
linkWorkspacePackages = true

example/package.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@
88
"ios": "react-native run-ios",
99
"bundle-install": "bundle install",
1010
"pods": "cd ios && bundle exec pod install",
11-
"typescript": "tsc --noEmit",
11+
"typecheck": "tsc --noEmit",
1212
"lint": "eslint \"**/*.{js,ts,tsx}\" --fix",
13-
"lint-ci": "eslint \"**/*.{js,ts,tsx}\" -f @jamesacarr/github-actions",
1413
"codegen": "bun react-native codegen"
1514
},
1615
"dependencies": {
@@ -24,24 +23,24 @@
2423
"react": "19.0.0",
2524
"react-native": "0.78.0",
2625
"react-native-nitro-modules": "0.27.2",
27-
"react-native-nitro-sqlite": "9.1.11",
26+
"react-native-nitro-sqlite": "workspace:*",
2827
"react-native-safe-area-context": "^5.2.0",
2928
"react-native-screens": "^4.9.1",
3029
"reflect-metadata": "^0.1.13",
3130
"stream-browserify": "^3.0.0",
32-
"typeorm": "^0.3.20",
31+
"typeorm": "0.3.20",
3332
"util": "^0.12.5"
3433
},
3534
"devDependencies": {
36-
"@babel/core": "^7.25.2",
35+
"@babel/core": "^7.28.5",
3736
"@babel/plugin-proposal-decorators": "^7.20.5",
3837
"@babel/preset-env": "^7.25.4",
3938
"@babel/runtime": "^7.25.4",
4039
"@react-native-community/cli": "15.0.1",
4140
"@react-native-community/cli-platform-android": "15.0.1",
4241
"@react-native-community/cli-platform-ios": "15.0.1",
4342
"@react-native/babel-preset": "0.78.0",
44-
"@react-native/eslint-config": "0.78.0",
43+
"@react-native/eslint-config": "0.82.1",
4544
"@react-native/metro-config": "0.78.0",
4645
"@react-native/typescript-config": "0.78.0",
4746
"@types/chai": "^4.3.4",

example/src/Database.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export async function executeFailingTypeORMQuery(): Promise<QueryResult | void>
5858
SELECT * From UnexistingTable
5959
`)) as QueryResult
6060
return manualQuery
61-
} catch (e) {
61+
} catch {
6262
console.warn('should have cached')
6363
}
6464
}

example/src/initGlobals.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ import { Buffer as CraftzdogBuffer } from '@craftzdog/react-native-buffer'
22

33
declare global {
44
var Buffer: typeof CraftzdogBuffer
5+
}
56

6-
var process: {
7-
cwd: () => string
8-
env: { NODE_ENV: string }
9-
}
7+
if (!globalThis.process) {
8+
// @ts-expect-error
9+
globalThis.process = {}
1010
}
1111

1212
globalThis.Buffer = CraftzdogBuffer

example/src/tests/unitTests.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ export function registerUnitTests() {
350350
'INSERT INTO "User" (id, name, age, networth) VALUES(?, ?, ?, ?)',
351351
[id, name, age, networth]
352352
)
353-
} catch (e) {
353+
} catch {
354354
tx.rollback()
355355
}
356356
})

0 commit comments

Comments
 (0)