Skip to content

Commit 61b6a62

Browse files
committed
Add esm support
1 parent 9a1913e commit 61b6a62

3 files changed

Lines changed: 39 additions & 2 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,3 +195,6 @@ Examples/testapp_rn
195195

196196
# Android debug build files (conflict ignoring #Visual Studio files)
197197
!android/app/src/debug/
198+
199+
# generated by bob
200+
lib/

package.json

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,21 @@
88
"bugs": {
99
"email": "support@appzung.com"
1010
},
11-
"main": "src/CodePush.js",
11+
"main": "./lib/commonjs/index.js",
12+
"source": "./src/index.js",
13+
"module": "./lib/module/index.js",
1214
"typings": "typings/react-native-code-push.d.ts",
15+
"exports": {
16+
".": {
17+
"import": {
18+
"default": "./lib/module/index.js"
19+
},
20+
"require": {
21+
"default": "./lib/commonjs/index.js"
22+
}
23+
},
24+
"./package.json": "./package.json"
25+
},
1326
"scripts": {
1427
"clean": "shx rm -rf bin",
1528
"setup": "npm install --quiet --no-progress",
@@ -26,7 +39,8 @@
2639
"test:fast:ios": "mocha --recursive bin/test --ios",
2740
"test:debugger:android": "mocha --recursive --inspect-brk=0.0.0.0 bin/test --android",
2841
"test:debugger:ios": "mocha --recursive --inspect-brk=0.0.0.0 bin/test --ios",
29-
"tslint": "tslint -c tslint.json test/**/*.ts"
42+
"tslint": "tslint -c tslint.json test/**/*.ts",
43+
"prepare": "bob build"
3044
},
3145
"repository": {
3246
"type": "git",
@@ -50,12 +64,31 @@
5064
"mkdirp": "latest",
5165
"mocha": "^9.2.0",
5266
"q": "^1.5.1",
67+
"react-native-builder-bob": "^0.36.0",
5368
"run-sequence": "latest",
5469
"shx": "^0.3.4",
5570
"slash": "^3.0.0",
5671
"tslint": "^6.1.3",
5772
"typescript": "^4.4.3"
5873
},
74+
"react-native-builder-bob": {
75+
"source": "src",
76+
"output": "lib",
77+
"targets": [
78+
[
79+
"commonjs",
80+
{
81+
"esm": true
82+
}
83+
],
84+
[
85+
"module",
86+
{
87+
"esm": true
88+
}
89+
]
90+
]
91+
},
5992
"keywords": [
6093
"appzung",
6194
"codepush",

src/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './CodePush';

0 commit comments

Comments
 (0)