Skip to content

Commit 4d5429f

Browse files
authored
Merge pull request #155 from callstack/chore/tooling-overhaul
chore: tooling overhaul - integrated lefthook & commitlint, upgraded dependencies, formatted files, extracted tooling config from package.json
2 parents d10a0d8 + ff6f76d commit 4d5429f

19 files changed

Lines changed: 2445 additions & 2236 deletions

‎.eslintrc.json‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"root": true,
3+
"extends": ["@react-native", "prettier"],
4+
"plugins": ["prettier"],
5+
"ignorePatterns": ["node_modules/", "lib/"]
6+
}

‎.github/workflows/build.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
android:
1111
name: Build Android App
1212
runs-on: ubuntu-latest
13-
13+
1414
env:
1515
SKIP_YARN_COREPACK_CHECK: 0
1616

@@ -46,7 +46,7 @@ jobs:
4646
ios:
4747
name: Build iOS App
4848
runs-on: macos-latest
49-
49+
5050
env:
5151
SKIP_YARN_COREPACK_CHECK: 0
5252

@@ -85,4 +85,4 @@ jobs:
8585
- name: Build iOS App
8686
run: |
8787
cd example/swift
88-
xcodebuild -workspace SwiftExample.xcworkspace -scheme SwiftExample -configuration Debug -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 16' build CODE_SIGNING_ALLOWED=NO
88+
xcodebuild -workspace SwiftExample.xcworkspace -scheme SwiftExample -configuration Debug -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 16' build CODE_SIGNING_ALLOWED=NO

‎.github/workflows/ci.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: Lint & Type Check
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [main]
66
pull_request:
7-
branches: [ main ]
7+
branches: [main]
88

99
jobs:
1010
analyse:

‎.prettierignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
lib

‎.prettierrc.json‎

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

‎.release-it.json‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"$schema": "https://unpkg.com/release-it@19/schema/release-it.json",
3+
"git": {
4+
"commitMessage": "chore: release ${version}",
5+
"tagName": "v${version}"
6+
},
7+
"npm": {
8+
"publish": true
9+
},
10+
"github": {
11+
"release": true
12+
},
13+
"plugins": {
14+
"@release-it/conventional-changelog": {
15+
"preset": "angular"
16+
}
17+
}
18+
}

‎CODE_OF_CONDUCT.md‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,21 @@ orientation.
1414
Examples of behavior that contributes to creating a positive environment
1515
include:
1616

17-
* Using welcoming and inclusive language
18-
* Being respectful of differing viewpoints and experiences
19-
* Gracefully accepting constructive criticism
20-
* Focusing on what is best for the community
21-
* Showing empathy towards other community members
17+
- Using welcoming and inclusive language
18+
- Being respectful of differing viewpoints and experiences
19+
- Gracefully accepting constructive criticism
20+
- Focusing on what is best for the community
21+
- Showing empathy towards other community members
2222

2323
Examples of unacceptable behavior by participants include:
2424

25-
* The use of sexualized language or imagery and unwelcome sexual attention or
25+
- The use of sexualized language or imagery and unwelcome sexual attention or
2626
advances
27-
* Trolling, insulting/derogatory comments, and personal or political attacks
28-
* Public or private harassment
29-
* Publishing others' private information, such as a physical or electronic
27+
- Trolling, insulting/derogatory comments, and personal or political attacks
28+
- Public or private harassment
29+
- Publishing others' private information, such as a physical or electronic
3030
address, without explicit permission
31-
* Other conduct which could reasonably be considered inappropriate in a
31+
- Other conduct which could reasonably be considered inappropriate in a
3232
professional setting
3333

3434
## Our Responsibilities
@@ -70,4 +70,4 @@ members of the project's leadership.
7070
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
7171
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct/
7272

73-
[homepage]: https://www.contributor-covenant.org
73+
[homepage]: https://www.contributor-covenant.org

‎bob.config.js‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
module.exports = {
2+
source: 'src',
3+
output: 'lib',
4+
targets: [
5+
[
6+
'commonjs',
7+
{
8+
esm: true,
9+
configFile: true,
10+
},
11+
],
12+
[
13+
'module',
14+
{
15+
esm: true,
16+
configFile: true,
17+
},
18+
],
19+
[
20+
'typescript',
21+
{
22+
project: 'tsconfig.build.json',
23+
},
24+
],
25+
],
26+
};

‎commitlint.config.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default { extends: ['@commitlint/config-conventional'] };

‎docs/GUIDELINES.md‎

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,24 @@ Here you can find the guidelines for standard brownfield approach and advanced u
55
As a golden rule of standard brownfield with react-native, your native App should never have to interact directly
66
with react-native APIs. There are various reasons that doing the opposite is discouraged.
77

8-
- If you have different teams working on RN brownfield and the native App and you distribute your AAR/XCFramework to the native
9-
team. They can use the APIs from those artifacts and interact with them. However, if the native team have to import a react native
10-
API, say `PackageList` then the rule of brownfield is being violated. The native team have native developers and they should not need
11-
to worry about and interact with react-native directly. All of the abstraction should be handled within your artifacts.
8+
- If you have different teams working on RN brownfield and the native App and you distribute your AAR/XCFramework to the native
9+
team. They can use the APIs from those artifacts and interact with them. However, if the native team have to import a react native
10+
API, say `PackageList` then the rule of brownfield is being violated. The native team have native developers and they should not need
11+
to worry about and interact with react-native directly. All of the abstraction should be handled within your artifacts.
1212

1313
- If your native App interacts with react-native directly then you could imagine how complicated the codebase would be. The native App
14-
should follow and worry about their native APIs rather than interacting with react-native. If in future, some react-native APIs needs to
15-
be changed or refactored, then the effort would be cumbersome. On the contrast, if your native App was interacting with your artifact only
16-
then the native App need not to worry about what happens internally. This makes things simpler for the native App team.
14+
should follow and worry about their native APIs rather than interacting with react-native. If in future, some react-native APIs needs to
15+
be changed or refactored, then the effort would be cumbersome. On the contrast, if your native App was interacting with your artifact only
16+
then the native App need not to worry about what happens internally. This makes things simpler for the native App team.
1717

1818
- If the native App team is using your artifact and any build, compile time or run time issue arises the stack trace would lead to your artifact
19-
and making it simpler for the teams to focus on their area only. On the contrary, if the native App team would interact with react-native directly,
20-
then any related issues would be time consuming for that team to figure out the root cause and then delegate to the team managing RN flows.
19+
and making it simpler for the teams to focus on their area only. On the contrary, if the native App team would interact with react-native directly,
20+
then any related issues would be time consuming for that team to figure out the root cause and then delegate to the team managing RN flows.
2121

2222
Building upon the above points, below is how your brownfield implementation should look like if you're using `react-native-brownfield`:
2323

2424
- In your brownfield android library or iOS xcframework, create a class following the facade pattern. The role of this class would be to encapsulate the
25-
initialization of `react-native-brownfield` by not asking the native App to interact with `react-native` directly. Below is how it would look like:
25+
initialization of `react-native-brownfield` by not asking the native App to interact with `react-native` directly. Below is how it would look like:
2626

2727
```kt
2828
// Your artifact
@@ -64,7 +64,6 @@ ReactNativeHostManager.initialize(application)
6464
As you can see the issue here is that now we are mixing the native App with react-native APIs, which is discouraged. If we stick to
6565
the above approach then the native App is free of interacting with react-native directly.
6666

67-
6867
### Advanced Use Cases:
6968

7069
If you built on top of the above approach, then you can rather easily scale it to incorporate advanced use cases. We will discuss here only one
@@ -130,4 +129,4 @@ fun sendEvent(event: String, handlerId: String) {
130129
fun sendEvent(event: String, handlerId: String) {
131130
eventHandlers[handlerId].invoke(event)
132131
}
133-
```
132+
```

0 commit comments

Comments
 (0)