Skip to content

Commit 2a04d51

Browse files
authored
Re-structure project and use Bun (#63)
1 parent a550bf7 commit 2a04d51

File tree

95 files changed

+1326
-15959
lines changed

Some content is hidden

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

95 files changed

+1326
-15959
lines changed

.bundle/config

Lines changed: 0 additions & 2 deletions
This file was deleted.

.eslintrc.js

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
module.exports = {
2+
root: true,
3+
extends: [
4+
'@react-native',
5+
'plugin:@typescript-eslint/recommended-type-checked',
6+
'plugin:@typescript-eslint/stylistic-type-checked',
7+
'plugin:prettier/recommended',
8+
],
9+
plugins: ['@typescript-eslint', 'prettier'],
10+
parser: '@typescript-eslint/parser',
11+
parserOptions: {
12+
project: true,
13+
tsconfigRootDir: __dirname,
14+
ecmaFeatures: {
15+
jsx: true,
16+
},
17+
ecmaVersion: 2018,
18+
sourceType: 'module',
19+
},
20+
rules: {
21+
'prettier/prettier': [
22+
'warn',
23+
{
24+
quoteProps: 'consistent',
25+
singleQuote: true,
26+
tabWidth: 2,
27+
trailingComma: 'es5',
28+
useTabs: false,
29+
},
30+
],
31+
// eslint
32+
'semi': 'off',
33+
'curly': ['warn', 'multi-or-nest', 'consistent'],
34+
'no-mixed-spaces-and-tabs': ['warn', 'smart-tabs'],
35+
'no-async-promise-executor': 'warn',
36+
'require-await': 'warn',
37+
'no-return-await': 'warn',
38+
'no-await-in-loop': 'warn',
39+
'comma-dangle': 'off', // prettier already detects this
40+
'no-restricted-syntax': [
41+
'error',
42+
{
43+
selector: 'TSEnumDeclaration',
44+
message:
45+
"Enums have various disadvantages, use TypeScript's union types instead.",
46+
},
47+
],
48+
// prettier
49+
'prettier/prettier': ['warn'],
50+
// typescript
51+
'@typescript-eslint/no-use-before-define': 'off',
52+
'@typescript-eslint/no-unused-vars': [
53+
'error',
54+
{
55+
vars: 'all',
56+
args: 'after-used',
57+
ignoreRestSiblings: false,
58+
varsIgnorePattern: '^_',
59+
argsIgnorePattern: '^_',
60+
},
61+
],
62+
'@typescript-eslint/no-namespace': 'off',
63+
'@typescript-eslint/ban-ts-comment': 'off',
64+
'@typescript-eslint/no-unsafe-assignment': 'error',
65+
'@typescript-eslint/no-floating-promises': 'off',
66+
// react plugin
67+
'react/no-unescaped-entities': 'off',
68+
// react native plugin
69+
'react-native/no-unused-styles': 'warn',
70+
'react-native/split-platform-components': 'off',
71+
'react-native/no-inline-styles': 'warn',
72+
'react-native/no-color-literals': 'off',
73+
'react-native/no-raw-text': 'off',
74+
'react-native/no-single-element-style-arrays': 'warn',
75+
'@typescript-eslint/strict-boolean-expressions': [
76+
'error',
77+
{
78+
allowString: false,
79+
allowNullableObject: false,
80+
allowNumber: false,
81+
allowNullableBoolean: true,
82+
},
83+
],
84+
'@typescript-eslint/no-non-null-assertion': 'error',
85+
'@typescript-eslint/no-unnecessary-condition': 'error',
86+
'@typescript-eslint/consistent-type-imports': 'warn',
87+
88+
// react hooks
89+
'react-hooks/exhaustive-deps': [
90+
'error',
91+
{
92+
additionalHooks:
93+
'(useDerivedValue|useAnimatedStyle|useAnimatedProps|useWorkletCallback|useFrameProcessor|useSkiaFrameProcessor)',
94+
},
95+
],
96+
},
97+
}

.gitattributes

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

.gitignore

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,20 @@ example/vendor/bundle
5858
#
5959
node_modules/
6060
npm-debug.log
61-
yarn-debug.log
62-
yarn-error.log
6361

6462
# BUCK
6563
buck-out/
6664
\.buckd/
65+
66+
#Android
6767
android/app/libs
6868
android/keystores/debug.keystore
6969
android/.cxx
70+
**/android/bin
71+
**/android/build
72+
73+
**/android/.project
74+
**/.settings
7075

7176
# Expo
7277
.expo/*
@@ -75,8 +80,11 @@ android/.cxx
7580
lib/
7681
# Gradle
7782
android/gradle/
78-
android/gradle*
83+
android/.gradle
7984

8085
# Yalc
8186
.yalc
8287
yalc.lock
88+
89+
# Typescript
90+
**/tsconfig.tsbuildinfo

.prettierrc.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module.exports = {
2+
quoteProps: "consistent",
3+
singleQuote: true,
4+
tabWidth: 2,
5+
trailingComma: "es5",
6+
useTabs: false,
7+
semi: false,
8+
};

.ruby-version

Lines changed: 0 additions & 1 deletion
This file was deleted.

.tool-versions

Lines changed: 0 additions & 3 deletions
This file was deleted.

.yarnrc

Lines changed: 0 additions & 3 deletions
This file was deleted.

CONTRIBUTING.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,54 +4,54 @@ We want this community to be friendly and respectful to each other. Please follo
44

55
## Development workflow
66

7-
To get started with the project, run `yarn` in the root directory to install the required dependencies for each package:
7+
To get started with the project, run `bun` in the root directory to install the required dependencies for each package:
88

99
```sh
10-
yarn
10+
bun
1111
```
1212

1313
While developing, you can run the [example app](/example/) to test your changes.
1414

1515
To start the packager:
1616

1717
```sh
18-
yarn example start
18+
bun example start
1919
```
2020

2121
To run the example app on Android:
2222

2323
```sh
24-
yarn example android
24+
bun example android
2525
```
2626

2727
To run the example app on iOS:
2828

2929
```sh
30-
yarn example ios
30+
bun example ios
3131
```
3232

3333
Make sure your code passes TypeScript and ESLint. Run the following to verify:
3434

3535
```sh
36-
yarn typescript
37-
yarn lint
36+
bun typescript
37+
bun lint
3838
```
3939

4040
To fix formatting errors, run the following:
4141

4242
```sh
43-
yarn lint --fix
43+
bun lint --fix
4444
```
4545

4646
Remember to add tests for your change if possible. Run the unit tests by:
4747

4848
```sh
49-
yarn test
49+
bun test
5050
```
5151

5252
To edit the Objective-C files, open `example/ios/SequelExample.xcworkspace` in XCode and find the source files at `Pods > Development Pods > react-native-quick-sqlite`.
5353

54-
To edit the Kotlin files, open `example/android` in Android studio and find the source files at `reactnativequicksqlite` under `Android`.
54+
To edit the Kotlin files, open `example/android` in Android studio and find the source files at `rnquicksqlite` under `Android`.
5555

5656
### Commit message convention
5757

@@ -78,13 +78,13 @@ Our pre-commit hooks verify that the linter and tests pass when committing.
7878

7979
The `package.json` file contains various scripts for common tasks:
8080

81-
- `yarn bootstrap`: setup project by installing all dependencies and pods.
82-
- `yarn typescript`: type-check files with TypeScript.
83-
- `yarn lint`: lint files with ESLint.
84-
- `yarn test`: run unit tests with Jest.
85-
- `yarn example start`: start the Metro server for the example app.
86-
- `yarn example android`: run the example app on Android.
87-
- `yarn example ios`: run the example app on iOS.
81+
- `bun bootstrap`: setup project by installing all dependencies and pods.
82+
- `bun typescript`: type-check files with TypeScript.
83+
- `bun lint`: lint files with ESLint.
84+
- `bun test`: run unit tests with Jest.
85+
- `bun example start`: start the Metro server for the example app.
86+
- `bun example android`: run the example app on Android.
87+
- `bun example ios`: run the example app on iOS.
8888

8989
### Sending a pull request
9090

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<div align="center">
44
<pre align="center">
5-
yarn add react-native-quick-sqlite
5+
bun add react-native-quick-sqlite
66
npx pod-install</pre>
77
<a align="center" href="https://github.com/mrousavy?tab=followers">
88
<img src="https://img.shields.io/github/followers/mrousavy?label=Follow%20%40mrousavy&style=social" />
@@ -235,7 +235,7 @@ Starting on Node14 all files that need to be accessed by third-party modules nee
235235
After you have applied that change, do:
236236

237237
```sh
238-
yarn patch-package --exclude 'nothing' typeorm
238+
bun patch-package --exclude 'nothing' typeorm
239239
```
240240

241241
Now every time you install your node_modules that line will be added.
@@ -260,7 +260,7 @@ plugins: [
260260
You will need to install the babel `module-resolver` plugin:
261261

262262
```sh
263-
yarn add babel-plugin-module-resolver
263+
bun add babel-plugin-module-resolver
264264
```
265265

266266
Finally, you will now be able to start the app without any metro/babel errors (you will also need to follow the instructions on how to setup TypeORM), now we can feed the driver into TypeORM:
@@ -280,7 +280,7 @@ datasource = new DataSource({
280280

281281
# Loading existing DBs
282282

283-
The library creates/opens databases by appending the passed name plus, the [documents directory on iOS](https://github.com/margelo/react-native-quick-sqlite/blob/733e876d98896f5efc80f989ae38120f16533a66/ios/QuickSQLite.mm#L34-L35) and the [files directory on Android](https://github.com/margelo/react-native-quick-sqlite/blob/main/android/src/main/java/com/reactnativequicksqlite/QuickSQLiteBridge.java#L16), this differs from other SQL libraries (some place it in a `www` folder, some in androids `databases` folder, etc.).
283+
The library creates/opens databases by appending the passed name plus, the [documents directory on iOS](https://github.com/margelo/react-native-quick-sqlite/blob/733e876d98896f5efc80f989ae38120f16533a66/ios/QuickSQLite.mm#L34-L35) and the [files directory on Android](https://github.com/margelo/react-native-quick-sqlite/blob/main/android/src/main/java/com/margelo/rnquicksqlite/QuickSQLiteBridge.java#L16), this differs from other SQL libraries (some place it in a `www` folder, some in androids `databases` folder, etc.).
284284

285285
If you have an existing database file you want to load you can navigate from these directories using dot notation. e.g. `../www/myDb.sqlite`. Note that on iOS the file system is sand-boxed, so you cannot access files/directories outside your app bundle directories.
286286

@@ -323,7 +323,7 @@ quickSqliteFlags="<SQLITE_FLAGS>"
323323

324324
On iOS, the SQLite database can be placed in an app group, in order to make it accessible from other apps in that app group. E.g. for sharing capabilities.
325325

326-
To use an app group, add the app group ID as the value for the `ReactNativeQuickSQLite_AppGroup` key in your project's `Info.plist` file. You'll also need to configure the app group in your project settings. (Xcode -> Project Settings -> Signing & Capabilities -> Add Capability -> App Groups)
326+
To use an app group, add the app group ID as the value for the `RNQuickSQLite_AppGroup` key in your project's `Info.plist` file. You'll also need to configure the app group in your project settings. (Xcode -> Project Settings -> Signing & Capabilities -> Add Capability -> App Groups)
327327

328328
## Community Discord
329329

0 commit comments

Comments
 (0)