Skip to content

Commit 225772a

Browse files
chore(examples): update RNOneSignalTS demo to match Android design + functionality (#1911)
Co-authored-by: Fadi George <fadii925@gmail.com>
1 parent 86f909b commit 225772a

File tree

161 files changed

+10522
-4223
lines changed

Some content is hidden

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

161 files changed

+10522
-4223
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../CLAUDE.md

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ jobs:
8787
- name: Install
8888
run: |
8989
bun install --frozen-lockfile
90-
cd examples/RNOneSignalTS
90+
cd examples/demo
9191
bun run setup
9292
9393
- name: Get current native SDK versions from target branch

.gitignore

Lines changed: 13 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -23,38 +23,23 @@ examples/.DS_Store
2323

2424
# examples node_modules
2525
#
26-
examples/CocoapodsDemo/node_modules
27-
examples/RNOneSignal/node_modules
26+
examples/*/node_modules
2827
*.iml
2928
local.properties
3029

31-
# examples android device Data
30+
# examples android data
3231
#
33-
examples/CocoapodsDemo/android/app/build
34-
examples/CocoapodsDemo/android/.gradle
35-
examples/CocoapodsDemo/android/.idea
36-
examples/CocoapodsDemo/android/build
37-
examples/RNOneSignalTS/android/app/build
38-
examples/RNOneSignalTS/android/app/debug.keystore
39-
examples/RNOneSignalTS/android/.gradle
40-
examples/RNOneSignalTS/android/.idea
41-
examples/RNOneSignalTS/android/build
32+
examples/*/android/app/build
33+
examples/*/android/app/debug.keystore
34+
examples/*/android/.gradle
35+
examples/*/android/.idea
36+
examples/*/android/build
4237

4338
# examples iOS data
4439
#
45-
examples/CocoapodsDemo/ios/CocoapodsDemo.xcodeproj/project.xcworkspace/xcshareddata
46-
examples/CocoapodsDemo/ios/CocoapodsDemo.xcodeproj/project.xcworkspace/xcuserdata
47-
examples/CocoapodsDemo/ios/CocoapodsDemo.xcodeproj/xcuserdata
48-
examples/CocoapodsDemo/ios/CocoapodsDemo.xcworkspace/xcshareddata
49-
examples/CocoapodsDemo/ios/CocoapodsDemo.xcworkspace/xcuserdata
50-
examples/CocoapodsDemo/ios/Pods/Pods.xcodeproj/xcuserdata
51-
examples/RNOneSignalTS/ios/RNOneSignal.xcodeproj/project.xcworkspace/xcshareddata
52-
examples/RNOneSignalTS/ios/RNOneSignal.xcodeproj/project.xcworkspace/xcuserdata
53-
examples/RNOneSignalTS/ios/RNOneSignal.xcodeproj/xcuserdata
54-
examples/RNOneSignalTS/ios/RNOneSignal.xcworkspace/xcshareddata
55-
examples/RNOneSignalTS/ios/RNOneSignal.xcworkspace/xcuserdata
56-
examples/RNOneSignal/ios/Pods/Pods.xcodeproj/xcuserdata
57-
58-
59-
60-
40+
examples/*/ios/*.xcodeproj/project.xcworkspace/xcshareddata
41+
examples/*/ios/*.xcodeproj/project.xcworkspace/xcuserdata
42+
examples/*/ios/*.xcodeproj/xcuserdata
43+
examples/*/ios/*.xcworkspace/xcshareddata
44+
examples/*/ios/*.xcworkspace/xcuserdata
45+
examples/*/ios/Pods/Pods.xcodeproj/xcuserdata

.prettierignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
examples/RNOneSignalTS/vendor
2-
examples/RNOneSignalTS/ios
3-
examples/RNOneSignalTS/android
1+
examples/*/vendor
2+
examples/*/ios
3+
examples/*/android

CLAUDE.md

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
---
2+
description: Use Bun instead of Node.js, npm, pnpm, or vite.
3+
globs: "*.ts, *.tsx, *.html, *.css, *.js, *.jsx, package.json"
4+
alwaysApply: false
5+
---
6+
7+
Default to using Bun instead of Node.js.
8+
9+
- Use `bun <file>` instead of `node <file>` or `ts-node <file>`
10+
- Use `bun test` instead of `jest` or `vitest`
11+
- Use `bun build <file.html|file.ts|file.css>` instead of `webpack` or `esbuild`
12+
- Use `bun install` instead of `npm install` or `yarn install` or `pnpm install`
13+
- Use `bun run <script>` instead of `npm run <script>` or `yarn run <script>` or `pnpm run <script>`
14+
- Use `bunx <package> <command>` instead of `npx <package> <command>`
15+
- Bun automatically loads .env, so don't use dotenv.
16+
17+
## APIs
18+
19+
- `Bun.serve()` supports WebSockets, HTTPS, and routes. Don't use `express`.
20+
- `bun:sqlite` for SQLite. Don't use `better-sqlite3`.
21+
- `Bun.redis` for Redis. Don't use `ioredis`.
22+
- `Bun.sql` for Postgres. Don't use `pg` or `postgres.js`.
23+
- `WebSocket` is built-in. Don't use `ws`.
24+
- Prefer `Bun.file` over `node:fs`'s readFile/writeFile
25+
- Bun.$`ls` instead of execa.
26+
27+
## Testing
28+
29+
Use `bun test` to run tests.
30+
31+
```ts#index.test.ts
32+
import { test, expect } from "bun:test";
33+
34+
test("hello world", () => {
35+
expect(1).toBe(1);
36+
});
37+
```
38+
39+
## Frontend
40+
41+
Use HTML imports with `Bun.serve()`. Don't use `vite`. HTML imports fully support React, CSS, Tailwind.
42+
43+
Server:
44+
45+
```ts#index.ts
46+
import index from "./index.html"
47+
48+
Bun.serve({
49+
routes: {
50+
"/": index,
51+
"/api/users/:id": {
52+
GET: (req) => {
53+
return new Response(JSON.stringify({ id: req.params.id }));
54+
},
55+
},
56+
},
57+
// optional websocket support
58+
websocket: {
59+
open: (ws) => {
60+
ws.send("Hello, world!");
61+
},
62+
message: (ws, message) => {
63+
ws.send(message);
64+
},
65+
close: (ws) => {
66+
// handle close
67+
}
68+
},
69+
development: {
70+
hmr: true,
71+
console: true,
72+
}
73+
})
74+
```
75+
76+
HTML files can import .tsx, .jsx or .js files directly and Bun's bundler will transpile & bundle automatically. `<link>` tags can point to stylesheets and Bun's CSS bundler will bundle.
77+
78+
```html#index.html
79+
<html>
80+
<body>
81+
<h1>Hello, world!</h1>
82+
<script type="module" src="./frontend.tsx"></script>
83+
</body>
84+
</html>
85+
```
86+
87+
With the following `frontend.tsx`:
88+
89+
```tsx#frontend.tsx
90+
import React from "react";
91+
import { createRoot } from "react-dom/client";
92+
93+
// import .css files directly and it works
94+
import './index.css';
95+
96+
const root = createRoot(document.body);
97+
98+
export default function Frontend() {
99+
return <h1>Hello, world!</h1>;
100+
}
101+
102+
root.render(<Frontend />);
103+
```
104+
105+
Then, run index.ts
106+
107+
```sh
108+
bun --hot ./index.ts
109+
```
110+
111+
For more information, read the Bun API docs in `node_modules/bun-types/docs/**.mdx`.

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ apply plugin: 'com.diffplug.spotless'
1717

1818
spotless {
1919
java {
20-
target 'android/**/*.java', 'examples/RNOneSignalTS/android/app/src/**/*.java'
20+
target 'android/**/*.java', 'examples/demo/android/app/src/**/*.java'
2121
targetExclude '**/build/**'
2222
palantirJavaFormat('2.85.0')
2323
removeUnusedImports()

bun.lockb

188 KB
Binary file not shown.

examples/RNOneSignalTS/App.tsx

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

examples/RNOneSignalTS/DetailsScreen.tsx

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

examples/RNOneSignalTS/Helpers.tsx

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

0 commit comments

Comments
 (0)