Skip to content

Commit b81c22c

Browse files
authored
chore: update build script (#1853)
1 parent b55d3c6 commit b81c22c

File tree

11 files changed

+1072
-140
lines changed

11 files changed

+1072
-140
lines changed

.github/workflows/create-release-pr.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,12 @@ jobs:
6060
bun-version: latest
6161

6262
- name: Install
63-
run: bun install --frozen-lockfile
63+
run: |
64+
bun install --frozen-lockfile
65+
bun link
66+
cd examples/RNOneSignalTS
67+
bun install --frozen-lockfile
68+
6469
6570
- name: Get current native SDK versions
6671
id: current_versions
@@ -115,14 +120,6 @@ jobs:
115120
sed -i '' "s/s\.dependency 'OneSignalXCFramework', '[^']*'/s.dependency 'OneSignalXCFramework', '$VERSION'/" react-native-onesignal.podspec
116121
echo "✓ Updated react-native-onesignal.podspec with iOS SDK ${VERSION}"
117122
118-
# Update example
119-
bun link
120-
cd examples/RNOneSignalTS
121-
bun install
122-
cd ios
123-
pod update OneSignalXCFramework
124-
git add .
125-
126123
- name: Update sdk version
127124
run: |
128125
NEW_VERSION="${{ inputs.rn_version }}"
@@ -132,6 +129,10 @@ jobs:
132129
# Update package.json version
133130
bun pm pkg set version="$NEW_VERSION"
134131
132+
# Update example
133+
cd examples/RNOneSignalTS/ios
134+
pod update OneSignalXCFramework
135+
135136
git add .
136137
git commit -m "Release $NEW_VERSION"
137138
git push

.vscode/extensions.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"recommendations": [
3+
"oxc.oxc-vscode",
4+
"esbenp.prettier-vscode",
5+
"redhat.vscode-yaml"
6+
]
7+
}

.vscode/settings.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"editor.formatOnSave": true,
3+
"editor.codeActionsOnSave": {
4+
"source.fixAll.eslint": "explicit",
5+
"source.organizeImports": "explicit"
6+
},
7+
"editor.defaultFormatter": "esbenp.prettier-vscode",
8+
"[yaml]": {
9+
"editor.defaultFormatter": "redhat.vscode-yaml"
10+
}
11+
}

bun.lock

Lines changed: 910 additions & 22 deletions
Large diffs are not rendered by default.

examples/RNOneSignalTS/ios/Podfile.lock

Lines changed: 57 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1794,7 +1794,7 @@ PODS:
17941794
- React-RCTFBReactNativeSpec
17951795
- ReactCommon/turbomodule/core
17961796
- SocketRocket
1797-
- react-native-onesignal (5.2.13):
1797+
- react-native-onesignal (5.2.14):
17981798
- OneSignalXCFramework (= 5.2.15)
17991799
- React (< 1.0.0, >= 0.13.0)
18001800
- react-native-safe-area-context (5.6.2):
@@ -2632,71 +2632,71 @@ SPEC CHECKSUMS:
26322632
glog: 5683914934d5b6e4240e497e0f4a3b42d1854183
26332633
hermes-engine: 35c763d57c9832d0eef764316ca1c4d043581394
26342634
OneSignalXCFramework: ea9e14a95b92ad48d9b35037cbae88a9542bdea3
2635-
RCT-Folly: 59ec0ac1f2f39672a0c6e6cecdd39383b764646f
2635+
RCT-Folly: 846fda9475e61ec7bcbf8a3fe81edfcaeb090669
26362636
RCTDeprecation: c0ed3249a97243002615517dff789bf4666cf585
26372637
RCTRequired: 58719f5124f9267b5f9649c08bf23d9aea845b23
26382638
RCTTypeSafety: 4aefa8328ab1f86da273f08517f1f6b343f6c2cc
26392639
React: 2073376f47c71b7e9a0af7535986a77522ce1049
26402640
React-callinvoker: 751b6f2c83347a0486391c3f266f291f0f53b27e
2641-
React-Core: 7195661f0b48e7ea46c3360ccb575288a20c932c
2642-
React-CoreModules: 14f0054ab46000dd3b816d6528af3bd600d82073
2643-
React-cxxreact: 7f602425c63096c398dac13cd7a300efd7c281ae
2641+
React-Core: dff5d29973349b11dd6631c9498456d75f846d5e
2642+
React-CoreModules: c0ae04452e4c5d30e06f8e94692a49107657f537
2643+
React-cxxreact: 376fd672c95dfb64ad5cc246e6a1e9edb78dec4c
26442644
React-debug: 7b56a0a7da432353287d2eedac727903e35278f5
2645-
React-defaultsnativemodule: 695d8a0b40f735edb3c4031e0f049e567fdac47a
2646-
React-domnativemodule: 6d66c1f61f277d008d98cae650ce2c025b89d3b9
2647-
React-Fabric: 997d4115d688f483cb409a1290171bff3c93dab4
2648-
React-FabricComponents: 8167e5e363ca3a3fe394d8afee355e4072bea1db
2649-
React-FabricImage: f8f9f2c97657116702acc670e3f4357bc842bed3
2650-
React-featureflags: dfb4d0d527d55dd968231370f6832b9197ee653d
2651-
React-featureflagsnativemodule: c63cfd8fe95cd98f12ebb37daa919c4544810a45
2652-
React-graphics: fd795f1c2a1133a08dde31725b20949edd545dca
2653-
React-hermes: 0a167bbb02c242664745e82154578c64e90a88e5
2654-
React-idlecallbacksnativemodule: 1798c6aa33ddc7c2e9fa3c3d67729728639889e9
2655-
React-ImageManager: c498ee6945dffacc82bfa175aa3264212f27c70b
2656-
React-jserrorhandler: 216951fea62fc26c600f4c96f0dc4fd53d1e7a9b
2657-
React-jsi: 9c27d27d3007b73c702ad3fd5a6166557c741020
2658-
React-jsiexecutor: 2b24f4ed4026344a27f717bf947a434cbbeeff7a
2659-
React-jsinspector: 02394b059c48805780f7d977366317a24168d00e
2660-
React-jsinspectorcdp: f4b6d5c5c9db05ef44d082716714f90cfeed96bb
2661-
React-jsinspectornetwork: e7c77d01b5f0664e24c0bec1aea27d5e3d7fb746
2662-
React-jsinspectortracing: aaa96a4e53abb88dc6d47da3b5744c710652fef9
2663-
React-jsitooling: 226e5f4147c7b6f1ae1954a8406ffa713f3da828
2664-
React-jsitracing: 8a2fbeaa9c53c3f0b23904ccffefc890eae48d71
2665-
React-logger: 1767babce2d28c3251039ce05556714a2c8c6ded
2666-
React-Mapbuffer: 33f678ee25b6c0ee2b01b1ecec08e3e02424cefe
2667-
React-microtasksnativemodule: 44b44a4d3cd6ffb85d928abf741acdc26722de2e
2668-
react-native-onesignal: 8d74531c46c03f48b9c597c1243767739eebcfc3
2669-
react-native-safe-area-context: 54d812805f3c4e08a4580ad086cbde1d8780c2e4
2670-
React-NativeModulesApple: b5d18bc109c45c9a1c6b71664991b5cc3adc4e48
2645+
React-defaultsnativemodule: 393b81aaa6211408f50a6ef00a277847256dd881
2646+
React-domnativemodule: 5fb5829baa7a7a0f217019cbad1eb226d94f7062
2647+
React-Fabric: a17c4ae35503673b57b91c2d1388429e7cbee452
2648+
React-FabricComponents: a76572ddeba78ebe4ec58615291e9db4a55cd46a
2649+
React-FabricImage: d806eb2695d7ef355ec28d1a21f5a14ac26b1cae
2650+
React-featureflags: 1690ec3c453920b6308e23a4e24eb9c3632f9c75
2651+
React-featureflagsnativemodule: 7b7e8483fc671c5a33aefd699b7c7a3c0bdfdfec
2652+
React-graphics: ea146ee799dc816524a3a0922fc7be0b5a52dcc1
2653+
React-hermes: fcbdc45ecf38259fe3b12642bd0757c52270a107
2654+
React-idlecallbacksnativemodule: a353f9162eaa7ad787e68aba9f52a1cfa8154098
2655+
React-ImageManager: ec5cf55ce9cc81719eb5f1f51d23d04db851c86c
2656+
React-jserrorhandler: 594c593f3d60f527be081e2cace7710c2bd9f524
2657+
React-jsi: 59ec3190dd364cca86a58869e7755477d2468948
2658+
React-jsiexecutor: b87d78a2e8dd7a6f56e9cdac038da45de98c944f
2659+
React-jsinspector: b9204adf1af622c98e78af96ec1bca615c2ce2bd
2660+
React-jsinspectorcdp: 4a356fa69e412d35d3a38c44d4a6cc555c5931e8
2661+
React-jsinspectornetwork: 7820056773178f321cbf18689e1ffcd38276a878
2662+
React-jsinspectortracing: b341c5ef6e031a33e0bd462d67fd397e8e9cd612
2663+
React-jsitooling: 401655e05cb966b0081225c5201d90734a567cb9
2664+
React-jsitracing: 67eff6dea0cb58a1e7bd8b49243012d88c0f511e
2665+
React-logger: a3cb5b29c32b8e447b5a96919340e89334062b48
2666+
React-Mapbuffer: 9d2434a42701d6144ca18f0ca1c4507808ca7696
2667+
React-microtasksnativemodule: 75b6604b667d297292345302cc5bfb6b6aeccc1b
2668+
react-native-onesignal: b68c981956150f288c1585889871affcef3c0b8b
2669+
react-native-safe-area-context: c00143b4823773bba23f2f19f85663ae89ceb460
2670+
React-NativeModulesApple: 879fbdc5dcff7136abceb7880fe8a2022a1bd7c3
26712671
React-oscompat: 93b5535ea7f7dff46aaee4f78309a70979bdde9d
2672-
React-perflogger: a03d913e3205b00aee4128082abe42fd45ce0c98
2673-
React-performancetimeline: 9b5986cc15afafb9bf246d7dd55bdd138df94451
2672+
React-perflogger: 5536d2df3d18fe0920263466f7b46a56351c0510
2673+
React-performancetimeline: 9041c53efa07f537164dcfe7670a36642352f4c2
26742674
React-RCTActionSheet: 42195ae666e6d79b4af2346770f765b7c29435b9
2675-
React-RCTAnimation: 5c10527683128c56ff2c09297fb080f7c35bd293
2676-
React-RCTAppDelegate: c616bd5b0d12f0b21dfacee9cd2d512c6df013aa
2677-
React-RCTBlob: 6e3757bdd7dce6fd9788c0dd675fd6b6c432db9d
2678-
React-RCTFabric: e8f3b9da97477710bf0904a62eb5b5209c964694
2679-
React-RCTFBReactNativeSpec: c042f8d60d44ad9e2c722da89323c0bdab7a37af
2680-
React-RCTImage: a3482fe1ae562d1bab08b42d4670a7c9a21813cd
2681-
React-RCTLinking: d82b9adb141aef9d2b38d446b837ae7017ab60aa
2682-
React-RCTNetwork: fa9350dd99354c5695964f589bd4790bdd4f6a85
2683-
React-RCTRuntime: be99a38cd23388c08921d8969c82a1997a11ec90
2684-
React-RCTSettings: b7f4a03f44dba1d3a4dc6770843547b203ca9129
2685-
React-RCTText: 91dc597a5f6b27fd1048bb287c41ea05eeca9333
2686-
React-RCTVibration: 27b09ddf74bddfa30a58d20e48f885ea6ed6c9d9
2675+
React-RCTAnimation: fa103ccc3503b1ed8dedca7e62e7823937748843
2676+
React-RCTAppDelegate: 665d4baf19424cef08276e9ac0d8771eec4519f9
2677+
React-RCTBlob: 0fa9530c255644db095f2c4fd8d89738d9d9ecc0
2678+
React-RCTFabric: 1fcd8af6e25f92532f56b4ba092e58662c14d156
2679+
React-RCTFBReactNativeSpec: db171247585774f9f0a30f75109cc51568686213
2680+
React-RCTImage: ba824e61ce2e920a239a65d130b83c3a1d426dff
2681+
React-RCTLinking: d2dc199c37e71e6f505d9eca3e5c33be930014d4
2682+
React-RCTNetwork: 87137d4b9bd77e5068f854dd5c1f30d4b072faf6
2683+
React-RCTRuntime: 137fafaa808a8b7e76a510e8be45f9f827899daa
2684+
React-RCTSettings: 71f5c7fd7b5f4e725a4e2114a4b4373d0e46048f
2685+
React-RCTText: b94d4699b49285bee22b8ebf768924d607eccee3
2686+
React-RCTVibration: 6e3993c4f6c36a3899059f9a9ead560ddaf5a7d7
26872687
React-rendererconsistency: b4785e5ed837dc7c242bbc5fdd464b33ef5bfae7
2688-
React-renderercss: cef3f26df2ddec558ce3c0790fc574b4fb62ce67
2689-
React-rendererdebug: e68433ae67738caeb672a6c8cc993e9276b298a9
2690-
React-RuntimeApple: dc1d4709bf847bc695dbe6e8aaf3e22ef25aef02
2691-
React-RuntimeCore: ca3473c8b6578693fa3bad4d44240098d49d6723
2692-
React-runtimeexecutor: 0db3ca0b09cd72489cef3a3729349b3c2cf13320
2693-
React-RuntimeHermes: f92cabaf97ef2546a74360eddfc1c74a34cb9ff8
2694-
React-runtimescheduler: 06aea75069e0d556a75d258bfc89eb0ebd5d557e
2695-
React-timing: 1a90df9a04d8e7fd165ff7fa0918b9595c776373
2696-
React-utils: 92115441fb55ce01ded4abfb5e9336a74cd93e9c
2697-
ReactAppDependencyProvider: b20fba6c3d091a393925890009999472c8f94d95
2698-
ReactCodegen: 58dc2eb138a27145826ad7d5568610159dfcadee
2699-
ReactCommon: 00df7b9f859c9d02181844255bb89a8bca544374
2688+
React-renderercss: e6fb0ba387b389c595ffa86b8b628716d31f58dc
2689+
React-rendererdebug: 60a03de5c7ea59bf2d39791eb43c4c0f5d8b24e3
2690+
React-RuntimeApple: 3df6788cd9b938bb8cb28298d80b5fbd98a4d852
2691+
React-RuntimeCore: fad8adb4172c414c00ff6980250caf35601a0f5d
2692+
React-runtimeexecutor: d2db7e72d97751855ea0bf5273d2ac84e5ea390c
2693+
React-RuntimeHermes: 04faa4cf9a285136a6d73738787fe36020170613
2694+
React-runtimescheduler: f6a1c9555e7131b4a8b64cce01489ad0405f6e8d
2695+
React-timing: 1e6a8acb66e2b7ac9d418956617fd1fdb19322fd
2696+
React-utils: 52bbb03f130319ef82e4c3bc7a85eaacdb1fec87
2697+
ReactAppDependencyProvider: 433ddfb4536948630aadd5bd925aff8a632d2fe3
2698+
ReactCodegen: 1d05923ad119796be9db37830d5e5dc76586aa00
2699+
ReactCommon: 394c6b92765cf6d211c2c3f7f6bc601dffb316a6
27002700
SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748
27012701
Yoga: a3ed390a19db0459bd6839823a6ac6d9c6db198d
27022702

package.json

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,21 @@
66
"types": "dist/index.d.ts",
77
"scripts": {
88
"prepare": "bun run build",
9-
"build": "tsc",
9+
"build": "tsc --noEmit && vite build",
1010
"lint": "oxlint src examples && prettier --check src examples",
1111
"lint:fix": "oxlint src examples --fix && prettier --write src examples"
1212
},
1313
"dependencies": {
14-
"invariant": "^2.2.2"
14+
"invariant": "^2.2.4"
1515
},
1616
"devDependencies": {
17-
"@types/invariant": "^2.2.2",
18-
"@types/react-native": "^0.66.8",
19-
"oxlint": "^1.24.0",
20-
"prettier": "^2.7.1",
21-
"typescript": "^3.8.3"
17+
"@types/invariant": "^2.2.37",
18+
"@types/react-native": "^0.73.0",
19+
"oxlint": "^1.26.0",
20+
"prettier": "^3.6.2",
21+
"typescript": "^5.9.3",
22+
"vite": "^7.2.0",
23+
"vite-plugin-dts": "^4.5.4"
2224
},
2325
"keywords": [
2426
"react-component",

src/events/EventManager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {
2-
EmitterSubscription,
2+
type EmitterSubscription,
33
NativeEventEmitter,
4-
NativeModule,
4+
type NativeModule,
55
} from 'react-native';
66
import OSNotification from '../OSNotification';
77
import NotificationWillDisplayEvent from './NotificationWillDisplayEvent';

src/helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import invariant from 'invariant';
2-
import { NativeModule } from 'react-native';
2+
import type { NativeModule } from 'react-native';
33

44
export function isValidCallback(handler: Function) {
55
invariant(typeof handler === 'function', 'Must provide a valid callback');

src/index.ts

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -14,30 +14,30 @@ import {
1414
SUBSCRIPTION_CHANGED,
1515
USER_STATE_CHANGED,
1616
} from './events/events';
17-
import {
18-
NotificationEventName,
19-
NotificationEventTypeMap,
20-
NotificationClickEvent,
21-
} from './models/NotificationEvents';
22-
import {
23-
PushSubscriptionState,
24-
OSNotificationPermission,
25-
PushSubscriptionChangedState,
26-
} from './models/Subscription';
27-
import { UserState, UserChangedState } from './models/User';
2817
import NotificationWillDisplayEvent from './events/NotificationWillDisplayEvent';
29-
import { LiveActivitySetupOptions } from './models/LiveActivities';
30-
import {
18+
import { isNativeModuleLoaded, isValidCallback } from './helpers';
19+
import type {
3120
InAppMessage,
32-
InAppMessageEventTypeMap,
33-
InAppMessageEventName,
3421
InAppMessageClickEvent,
35-
InAppMessageWillDisplayEvent,
22+
InAppMessageDidDismissEvent,
3623
InAppMessageDidDisplayEvent,
24+
InAppMessageEventName,
25+
InAppMessageEventTypeMap,
3726
InAppMessageWillDismissEvent,
38-
InAppMessageDidDismissEvent,
27+
InAppMessageWillDisplayEvent,
3928
} from './models/InAppMessage';
40-
import { isValidCallback, isNativeModuleLoaded } from './helpers';
29+
import type { LiveActivitySetupOptions } from './models/LiveActivities';
30+
import type {
31+
NotificationClickEvent,
32+
NotificationEventName,
33+
NotificationEventTypeMap,
34+
} from './models/NotificationEvents';
35+
import {
36+
OSNotificationPermission,
37+
type PushSubscriptionChangedState,
38+
type PushSubscriptionState,
39+
} from './models/Subscription';
40+
import type { UserChangedState, UserState } from './models/User';
4141

4242
const RNOneSignal = NativeModules.OneSignal;
4343
const eventManager = new EventManager(RNOneSignal);
@@ -288,7 +288,7 @@ export namespace OneSignal {
288288
export namespace pushSubscription {
289289
/** Add a callback that fires when the OneSignal subscription state changes. */
290290
export function addEventListener(
291-
event: 'change',
291+
_event: 'change',
292292
listener: (event: PushSubscriptionChangedState) => void,
293293
) {
294294
if (!isNativeModuleLoaded(RNOneSignal)) return;
@@ -303,7 +303,7 @@ export namespace OneSignal {
303303

304304
/** Clears current subscription observers. */
305305
export function removeEventListener(
306-
event: 'change',
306+
_event: 'change',
307307
listener: (event: PushSubscriptionChangedState) => void,
308308
) {
309309
if (!isNativeModuleLoaded(RNOneSignal)) return;
@@ -410,7 +410,7 @@ export namespace OneSignal {
410410
* Important: When using the observer to retrieve the onesignalId, check the externalId as well to confirm the values are associated with the expected user.
411411
*/
412412
export function addEventListener(
413-
event: 'change',
413+
_event: 'change',
414414
listener: (event: UserChangedState) => void,
415415
) {
416416
if (!isNativeModuleLoaded(RNOneSignal)) return;
@@ -425,7 +425,7 @@ export namespace OneSignal {
425425

426426
/** Clears current user state observers. */
427427
export function removeEventListener(
428-
event: 'change',
428+
_event: 'change',
429429
listener: (event: UserChangedState) => void,
430430
) {
431431
if (!isNativeModuleLoaded(RNOneSignal)) return;
@@ -1002,20 +1002,20 @@ export namespace OneSignal {
10021002

10031003
export {
10041004
NotificationWillDisplayEvent,
1005-
NotificationClickEvent,
1006-
InAppMessage,
1007-
InAppMessageClickEvent,
1008-
InAppMessageWillDisplayEvent,
1009-
InAppMessageDidDisplayEvent,
1010-
InAppMessageWillDismissEvent,
1011-
InAppMessageDidDismissEvent,
1012-
PushSubscriptionState,
1013-
PushSubscriptionChangedState,
1014-
UserState,
1015-
UserChangedState,
10161005
OSNotificationPermission,
1006+
type InAppMessage,
1007+
type InAppMessageClickEvent,
1008+
type InAppMessageDidDismissEvent,
1009+
type InAppMessageDidDisplayEvent,
1010+
type InAppMessageWillDismissEvent,
1011+
type InAppMessageWillDisplayEvent,
1012+
type NotificationClickEvent,
1013+
type PushSubscriptionChangedState,
1014+
type PushSubscriptionState,
1015+
type UserChangedState,
1016+
type UserState,
10171017
};
10181018

1019+
export type { InAppMessageClickResult } from './models/InAppMessage';
1020+
export type { NotificationClickResult } from './models/NotificationEvents';
10191021
export { default as OSNotification } from './OSNotification';
1020-
export { NotificationClickResult } from './models/NotificationEvents';
1021-
export { InAppMessageClickResult } from './models/InAppMessage';

tsconfig.json

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
11
{
22
"compilerOptions": {
33
"outDir": "dist",
4-
"target": "es5",
5-
"moduleResolution": "node",
4+
"target": "es2020",
5+
"module": "esnext",
6+
"moduleResolution": "bundler",
67
"noImplicitAny": true,
7-
"lib": ["es6"],
8-
"rootDir": "src",
9-
"declaration": true,
10-
"allowSyntheticDefaultImports": true,
8+
"lib": ["es2020"],
119
"skipLibCheck": true,
10+
"allowSyntheticDefaultImports": true,
1211
"esModuleInterop": true,
1312
"strict": true,
14-
"noUnusedLocals": true
13+
"noUnusedLocals": true,
14+
"noUnusedParameters": true,
15+
16+
/**
17+
* Should use import type syntax instead of regular import when getting types/interfaces from a module
18+
*/
19+
"verbatimModuleSyntax": true
1520
},
1621
"exclude": ["node_modules", "dist", "android", "examples", "ios"]
1722
}

0 commit comments

Comments
 (0)