Skip to content

Commit 098d08a

Browse files
committed
Initial commit
1 parent bac8753 commit 098d08a

File tree

10 files changed

+150
-1
lines changed

10 files changed

+150
-1
lines changed

generator

Lines changed: 0 additions & 1 deletion
This file was deleted.

generator/App.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/**
2+
* Do not modify this file - it is a proxy to your `App.re` file
3+
* located in the `src/` folder.
4+
*/
5+
export { app as default } from "./src/App.bs.js";

generator/README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# HelloWorld
2+
3+
> This is a React Native application developed in Reason.
4+
5+
## Installation
6+
7+
To get started, add the following scripts to your `package.json`:
8+
9+
```json
10+
"scripts": {
11+
"start": "node node_modules/react-native/local-cli/cli.js start",
12+
"build": "bsb -make-world -clean-world",
13+
"watch": "bsb -make-world -clean-world -w"
14+
}
15+
```
16+
17+
Next, run `watch` and `start` scripts from the command line so that both processes are running at the same time. This can be done with `yarn` (e.g. `yarn watch`) or `npm` (e.g. `npm run watch`).
18+
19+
The first script compiles you Reason code in a watch mode, meaning that every change is instantly recompiled.
20+
21+
Second one is a React Native packager that serves the compiled Reason code to the React Native client.
22+
23+
## Hiding `.bs.js` files
24+
25+
Bucklescript compiles your Reason files to Javascript `in source`, meaning that `App.re` will result in `App.bs.js` file generated next to it.
26+
27+
These are build files and are by default ignored from the git repository.
28+
29+
If you are using VSCode, you can add the following to your workspace settings to hide them automatically:
30+
31+
```json
32+
{
33+
"files.exclude": {
34+
"**/*.bs.js": true
35+
}
36+
}
37+
```
38+
39+
## Breakdown of existing files
40+
41+
The `react-native init` command generates a lot of boilerplate with files that might be not needed for your particular use case. Below is a breakdown of all top-level files to help you decide:
42+
43+
- `.babelrc` - required, for transpiling Javascript files to supported by the mobile engine Javascript version
44+
- `.buckconfig` - optional, configuration files for `Buck`. Can be safely removed in most cases unless you are planning on using it
45+
- `.flowconfig` - optional, used to configure `Flow`, which is a type checker for Javascript. Can be removed as we are writing our code in Reason now
46+
- `.watchmanconfig` - optional, configuration for `Watchman`, which is a Facebook tool for listening to file system changes. This file is not needed, unless you plan on extending its configuration right now
47+
- `app.json` - optional, usually generated when you `eject` from an `Expo` or `create-react-native-app` project. Can be removed without any issues

generator/_babelrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"presets": ["react-native"]
3+
}

generator/_gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.pbxproj -text

generator/_gitignore

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# OSX
2+
#
3+
.DS_Store
4+
5+
# Xcode
6+
#
7+
build/
8+
*.pbxuser
9+
!default.pbxuser
10+
*.mode1v3
11+
!default.mode1v3
12+
*.mode2v3
13+
!default.mode2v3
14+
*.perspectivev3
15+
!default.perspectivev3
16+
xcuserdata
17+
*.xccheckout
18+
*.moved-aside
19+
DerivedData
20+
*.hmap
21+
*.ipa
22+
*.xcuserstate
23+
project.xcworkspace
24+
25+
# Android/IntelliJ
26+
#
27+
build/
28+
.idea
29+
.gradle
30+
local.properties
31+
*.iml
32+
33+
# node.js
34+
#
35+
node_modules/
36+
npm-debug.log
37+
yarn-error.log
38+
39+
# BUCK
40+
buck-out/
41+
\.buckd/
42+
*.keystore
43+
44+
# fastlane
45+
#
46+
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
47+
# screenshots whenever they are needed.
48+
# For more information about the recommended setup visit:
49+
# https://docs.fastlane.tools/best-practices/source-control/
50+
51+
*/fastlane/report.xml
52+
*/fastlane/Preview.html
53+
*/fastlane/screenshots
54+
55+
# Bundle artifact
56+
*.jsbundle
57+
58+
# Reason
59+
*.bs.js

generator/bsconfig.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "my-reason-react-native-app",
3+
"reason": {
4+
"react-jsx": 2
5+
},
6+
"package-specs": {
7+
"module": "commonjs",
8+
"in-source": true
9+
},
10+
"bsc-flags": ["-bs-super-errors"],
11+
"bs-dependencies": ["bs-react-native", "reason-react"],
12+
"sources": [
13+
{
14+
"dir": "src",
15+
"subdirs": true
16+
}
17+
],
18+
"suffix": ".bs.js",
19+
"refmt": 3
20+
}

generator/dependencies.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"bs-platform": "^4.0.0",
3+
"reason-react": "^0.4.2",
4+
"bs-react-native": "0.10.0-rc.0"
5+
}

generator/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name": "react-native-template-reason",
3+
"version": "0.0.4"
4+
}

generator/src/App.re

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
open BsReactNative;
2+
3+
let app = () =>
4+
<View>
5+
<Text> (ReasonReact.string("Let's get this party started!")) </Text>
6+
</View>;

0 commit comments

Comments
 (0)