Skip to content

Commit da5479c

Browse files
authored
feat: do not ship commonjs build (#876)
* feat: do not ship commonjs * Update versioning for picker and viewer to major * fix: follow builder bob config * chore: bundle in ci
1 parent cab6a51 commit da5479c

File tree

12 files changed

+192
-671
lines changed

12 files changed

+192
-671
lines changed

.changeset/large-doors-return.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@react-native-documents/picker": major
3+
"@react-native-documents/viewer": major
4+
---
5+
6+
feat: do not ship commonjs

.github/workflows/nodejs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ jobs:
3030
- run: yarn lint
3131
- run: yarn test
3232
- run: yarn build
33+
- run: yarn workspace react-native-documents-example run bundle:android
34+
- run: yarn workspace react-native-documents-example run bundle:ios
3335

3436
publish-npm:
3537
needs: build

docs/docs/install.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ yarn add @react-native-documents/viewer
2020
The packages are designed to support last 3 stable versions of RN. However, they very likely work with RN 0.73 and up.
2121

2222
:::warning
23-
The document picker package requires iOS 14 or later. If you use Expo, use Expo SDK >=52 or [Expo build properties](https://docs.expo.dev/versions/latest/sdk/build-properties/#example-appjson-with-config-plugin) to update the `deploymentTarget` to `14`.
23+
The document picker package requires iOS 14 or later. If you use Expo, use Expo SDK >= 52 or [Expo build properties](https://docs.expo.dev/versions/latest/sdk/build-properties/#example-appjson-with-config-plugin) to update the `deploymentTarget` to `14`.
2424

2525
In regular React Native projects, use RN >= 0.76 or update the [settings in Xcode](https://stackoverflow.com/a/66798215/2070942).
2626
:::

example/ios/Podfile.lock

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1282,7 +1282,7 @@ PODS:
12821282
- React-RCTFBReactNativeSpec
12831283
- ReactCommon/turbomodule/core
12841284
- ReactNativeDependencies
1285-
- react-native-document-picker (10.1.6):
1285+
- react-native-document-picker (10.1.7):
12861286
- hermes-engine
12871287
- RCTRequired
12881288
- RCTTypeSafety
@@ -1304,7 +1304,7 @@ PODS:
13041304
- ReactCommon/turbomodule/core
13051305
- ReactNativeDependencies
13061306
- Yoga
1307-
- react-native-document-viewer (1.0.2):
1307+
- react-native-document-viewer (1.0.3):
13081308
- hermes-engine
13091309
- RCTRequired
13101310
- RCTTypeSafety
@@ -1702,7 +1702,7 @@ PODS:
17021702
- ReactCommon/turbomodule/core
17031703
- ReactNativeDependencies
17041704
- Yoga
1705-
- ReactTestApp-DevSupport (4.4.10):
1705+
- ReactTestApp-DevSupport (4.4.12):
17061706
- React-Core
17071707
- React-jsi
17081708
- ReactTestApp-Resources (1.0.0-dev)
@@ -1994,8 +1994,8 @@ SPEC CHECKSUMS:
19941994
React-logger: 7b234de35acb469ce76d6bbb0457f664d6f32f62
19951995
React-Mapbuffer: fbe1da882a187e5898bdf125e1cc6e603d27ecae
19961996
React-microtasksnativemodule: 76905804171d8ccbe69329fc84c57eb7934add7f
1997-
react-native-document-picker: 10d97da5ab59c2430e122924a525380d498b5d43
1998-
react-native-document-viewer: 49cf47192ee7e15f4ad25f8fdaef6b4f1ab0cc9c
1997+
react-native-document-picker: a3c4ce6322b7aa9902fe8ffb8e03d5858b5d7beb
1998+
react-native-document-viewer: 6fc76b1f9f2773a39b155f10aae674cf731f21b2
19991999
react-native-segmented-control: bf6e0032726727498e18dd437ae88afcdbc18e99
20002000
React-NativeModulesApple: a9464983ccc0f66f45e93558671f60fc7536e438
20012001
React-oscompat: 73db7dbc80edef36a9d6ed3c6c4e1724ead4236d
@@ -2029,7 +2029,7 @@ SPEC CHECKSUMS:
20292029
ReactCommon: 149b6c05126f2e99f2ed0d3c63539369546f8cae
20302030
ReactNativeDependencies: ed6d1e64802b150399f04f1d5728ec16b437251e
20312031
ReactNativeHost: 7f059fda99bc0ba0187c19bfe91866c7692d90df
2032-
ReactTestApp-DevSupport: 9b7bbba5e8fed998e763809171d9906a1375f9d3
2032+
ReactTestApp-DevSupport: 963986104f003af978562535682fec417b4aadfa
20332033
ReactTestApp-Resources: 1bd9ff10e4c24f2ad87101a32023721ae923bccf
20342034
RNCAsyncStorage: 3a4f5e2777dae1688b781a487923a08569e27fe4
20352035
Yoga: 051f086b5ccf465ff2ed38a2cf5a558ae01aaaa1

example/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"appium": "^2.5.4",
4242
"appium-uiautomator2-driver": "^3.1.0",
4343
"pod-install": "1.0.7",
44-
"react-native-test-app": "^4.4.10",
44+
"react-native-test-app": "^4.4.12",
4545
"ts-node": "^10.9.2",
4646
"wdio-wait-for": "^3.0.11"
4747
},

packages/document-picker/android/src/main/java/com/reactnativedocumentpicker/RNDocumentPickerModule.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ class RNDocumentPickerModule(reactContext: ReactApplicationContext) :
7575
}
7676

7777
override fun invalidate() {
78+
fileCopyingCoroutine.cancel("module invalidated")
7879
reactApplicationContext.removeActivityEventListener(activityEventListener)
7980
// TODO verify this should be done (and order)
8081
// reactApplicationContext.removeLifecycleEventListener(this)
@@ -307,7 +308,7 @@ class RNDocumentPickerModule(reactContext: ReactApplicationContext) :
307308
else -> emptyList()
308309
}
309310

310-
CoroutineScope(Dispatchers.IO).launch {
311+
fileCopyingCoroutine.launch {
311312
try {
312313
val pickOptions = currentPickOptions
313314
require(pickOptions != null)

packages/document-picker/package.json

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,16 @@
22
"name": "@react-native-documents/picker",
33
"version": "10.1.7",
44
"description": "A react native interface to access documents from dropbox, google drive, iCloud...",
5-
"main": "lib/commonjs/index",
6-
"module": "lib/module/index",
7-
"types": "lib/typescript/index.d.ts",
8-
"react-native": "src/index",
9-
"source": "src/index",
5+
"main": "./lib/module/index.js",
6+
"types": "./lib/typescript/src/index.d.ts",
7+
"exports": {
8+
".": {
9+
"source": "./src/index.ts",
10+
"types": "./lib/typescript/src/index.d.ts",
11+
"default": "./lib/module/index.js"
12+
},
13+
"./package.json": "./package.json"
14+
},
1015
"files": [
1116
"src",
1217
"lib",
@@ -60,12 +65,12 @@
6065
},
6166
"devDependencies": {
6267
"@tsconfig/node18": "^18.2.4",
63-
"react-native-builder-bob": "^0.36.0",
68+
"react-native-builder-bob": "^0.40.13",
6469
"typescript": "^5.7.3"
6570
},
6671
"peerDependencies": {
6772
"react": "*",
68-
"react-native": "*"
73+
"react-native": ">=0.79.0"
6974
},
7075
"jest": {
7176
"preset": "react-native",
@@ -77,8 +82,12 @@
7782
"source": "src",
7883
"output": "lib",
7984
"targets": [
80-
"commonjs",
81-
"module",
85+
[
86+
"module",
87+
{
88+
"esm": true
89+
}
90+
],
8291
[
8392
"typescript",
8493
{

packages/document-picker/react-native-document-picker.podspec

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ Pod::Spec.new do |s|
1414
s.source = { :git => "https://github.com/react-native-documents/sponsors-only.git", :tag => "v#{s.version}" }
1515

1616
s.source_files = ["ios/**/*.{h,m,mm,swift}"]
17-
s.frameworks = 'MobileCoreServices'
1817

1918
# Swift/Objective-C compatibility
2019
s.pod_target_xcconfig = {
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
21
{
32
"extends": "../../tsconfig.build.json",
3+
"compilerOptions": {
4+
"rootDir": "."
5+
}
46
}

packages/document-viewer/package.json

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,16 @@
22
"name": "@react-native-documents/viewer",
33
"version": "1.0.3",
44
"description": "A react native interface to preview documents",
5-
"main": "lib/commonjs/index",
6-
"module": "lib/module/index",
7-
"types": "lib/typescript/index.d.ts",
8-
"react-native": "src/index",
9-
"source": "src/index",
5+
"main": "./lib/module/index.js",
6+
"types": "./lib/typescript/src/index.d.ts",
7+
"exports": {
8+
".": {
9+
"source": "./src/index.ts",
10+
"types": "./lib/typescript/src/index.d.ts",
11+
"default": "./lib/module/index.js"
12+
},
13+
"./package.json": "./package.json"
14+
},
1015
"files": [
1116
"src",
1217
"lib",
@@ -59,12 +64,12 @@
5964
},
6065
"devDependencies": {
6166
"@tsconfig/node18": "^18.2.4",
62-
"react-native-builder-bob": "^0.36.0",
67+
"react-native-builder-bob": "^0.40.13",
6368
"typescript": "^5.7.3"
6469
},
6570
"peerDependencies": {
6671
"react": "*",
67-
"react-native": "*"
72+
"react-native": ">=0.79.0"
6873
},
6974
"jest": {
7075
"preset": "react-native",
@@ -76,8 +81,12 @@
7681
"source": "src",
7782
"output": "lib",
7883
"targets": [
79-
"commonjs",
80-
"module",
84+
[
85+
"module",
86+
{
87+
"esm": true
88+
}
89+
],
8190
[
8291
"typescript",
8392
{

0 commit comments

Comments
 (0)