Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
flexsurfer committed Jun 5, 2020
0 parents commit cee4428
Show file tree
Hide file tree
Showing 33 changed files with 9,014 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .buckconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

[android]
target = Google Inc.:Google APIs:23

[maven_repositories]
central = https://repo1.maven.org/maven2
4 changes: 4 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
root: true,
extends: '@react-native-community',
};
74 changes: 74 additions & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
[ignore]
; We fork some components by platform
.*/*[.]android.js

; Ignore "BUCK" generated dirs
<PROJECT_ROOT>/\.buckd/

; Ignore polyfills
node_modules/react-native/Libraries/polyfills/.*

; These should not be required directly
; require from fbjs/lib instead: require('fbjs/lib/warning')
node_modules/warning/.*

; Flow doesn't support platforms
.*/Libraries/Utilities/LoadingView.js

[untyped]
.*/node_modules/@react-native-community/cli/.*/.*

[include]

[libs]
node_modules/react-native/interface.js
node_modules/react-native/flow/

[options]
emoji=true

esproposal.optional_chaining=enable
esproposal.nullish_coalescing=enable

module.file_ext=.js
module.file_ext=.json
module.file_ext=.ios.js

munge_underscores=true

module.name_mapper='^react-native/\(.*\)$' -> '<PROJECT_ROOT>/node_modules/react-native/\1'
module.name_mapper='^@?[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '<PROJECT_ROOT>/node_modules/react-native/Libraries/Image/RelativeImageStub'

suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FlowFixMeProps
suppress_type=$FlowFixMeState

suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError

[lints]
sketchy-null-number=warn
sketchy-null-mixed=warn
sketchy-number=warn
untyped-type-import=warn
nonstrict-import=warn
deprecated-type=warn
unsafe-getters-setters=warn
inexact-spread=warn
unnecessary-invariant=warn
signature-verification-failure=warn
deprecated-utility=error

[strict]
deprecated-type
nonstrict-import
sketchy-null
unclear-type
unsafe-getters-setters
untyped-import
untyped-type-import

[version]
^0.113.0
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.pbxproj -text
64 changes: 64 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# OSX
#
.DS_Store

# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate

# Android/IntelliJ
#
build/
.idea
.gradle
local.properties
*.iml

# node.js
#
node_modules/
npm-debug.log
yarn-error.log

# BUCK
buck-out/
\.buckd/
*.keystore
!debug.keystore

# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/

*/fastlane/report.xml
*/fastlane/Preview.html
*/fastlane/screenshots

# Bundle artifact
*.jsbundle

# CocoaPods
/ios/Pods/

# Project exclude paths
/android/
/app/
/ios/
6 changes: 6 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
bracketSpacing: false,
jsxBracketSameLine: true,
singleQuote: true,
trailingComma: 'all',
};
1 change: 1 addition & 0 deletions .watchmanconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
55 changes: 55 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# ![RealWorld Example App](logo.png)

> #### This application is a port of [web version](https://github.com/jacekschae/conduit) for react native
> ### [ClojureScript](https://clojurescript.org/) and [re-frame](https://github.com/Day8/re-frame) codebase containing real world examples (CRUD, auth, advanced patterns, etc) that adheres to the [RealWorld](https://github.com/gothinkster/realworld-example-apps) spec and API.
### [App creation process and demo (youtube)]() &nbsp;&nbsp;&nbsp;&nbsp; [Demo APK]() &nbsp;&nbsp;&nbsp;&nbsp; [RealWorld](https://github.com/gothinkster/realworld)

This codebase was created to demonstrate a fully fledged react native application built with
[ClojureScript](https://clojurescript.org/) and [re-frame](https://github.com/Day8/re-frame) including CRUD operations,
authentication, routing, pagination, and more.

For more information on how this works with other frontends/backends, head over to the
[RealWorld](https://github.com/gothinkster/realworld) repo.

Learn how to build similar project with [Learn re-frame](https://www.learnreframe.com/)


## Setup And Run

#### Copy repository
```shell
git clone https://github.com/flexsurfer/conduitrn.git && cd conduitrn
```

#### Install dependencies
```shell
yarn install || npm install
```

#### Install pods for ios
```shell
cd ios; pod install; cd ../
```

#### Run dev server
```shell
yarn dev || npm run dev
```

#### Run metro bundler

```shell
yarn start || npm run start
```

#### Run the app

```shell
yarn ios || npm run ios
```
OR
```shell
yarn android || npm run android
```
4 changes: 4 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "conduitrn",
"displayName": "conduitrn"
}
3 changes: 3 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
};
8 changes: 8 additions & 0 deletions deps.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{:deps {org.clojure/clojure {:mvn/version "1.10.0"}
org.clojure/clojurescript {:mvn/version "1.10.520"}
reagent {:mvn/version "0.10.0"}
re-frame {:mvn/version "0.10.7"}
superstructor/re-frame-fetch-fx {:mvn/version "0.0.2"}
rn-shadow-steroid {:mvn/version "0.2.5"}
re-frame-steroid {:mvn/version "0.1.1"}
cljs-bean {:mvn/version "1.3.0"}}}
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import "./app/index.js";
Binary file added logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions metro.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* Metro configuration for React Native
* https://github.com/facebook/react-native
*
* @format
*/

module.exports = {
transformer: {
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: false,
},
}),
},
};
43 changes: 43 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"name": "conduitrn",
"version": "0.0.1",
"private": true,
"scripts": {
"dev": "shadow-cljs watch app",
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint .",
"re-frisk": "shadow-cljs run re-frisk-remote.core/start"
},
"dependencies": {
"@react-native-community/async-storage": "^1.11.0",
"@react-native-community/masked-view": "^0.1.10",
"@react-navigation/bottom-tabs": "^5.5.1",
"@react-navigation/native": "^5.5.0",
"@react-navigation/stack": "^5.4.1",
"react": "16.11.0",
"react-dom": "16.13.0",
"react-native": "0.62.2",
"react-native-gesture-handler": "^1.6.1",
"react-native-reanimated": "^1.9.0",
"react-native-safe-area-context": "^3.0.2",
"react-native-screens": "^2.8.0",
"react-native-splash-screen": "^3.2.0",
"react-native-vector-icons": "^6.6.0"
},
"devDependencies": {
"@babel/core": "^7.9.6",
"@babel/runtime": "^7.9.6",
"@react-native-community/eslint-config": "^1.1.0",
"babel-jest": "^26.0.1",
"eslint": "^7.1.0",
"jest": "^26.0.1",
"metro-react-native-babel-preset": "^0.59.0",
"react-test-renderer": "16.11.0"
},
"jest": {
"preset": "react-native"
}
}
20 changes: 20 additions & 0 deletions shadow-cljs.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{:source-paths ["src"]

:dependencies [[reagent "0.10.0"]
[re-frame "0.12.0"]
[superstructor/re-frame-fetch-fx "0.0.2"]
[re-frisk-remote "1.3.3"]
[rn-shadow-steroid "0.2.5"]
[re-frame-steroid "0.1.1"]
[cljs-bean "1.3.0"]]

:builds {:app {:target :react-native
:output-dir "app"
:init-fn conduit.core/init

:compiler-options {:closure-defines
{re-frame.trace/trace-enabled? true}}

:devtools {:after-load steroid.rn.core/reload
:build-notify steroid.rn.core/build-notify
:preloads [re-frisk-remote.preload]}}}}
15 changes: 15 additions & 0 deletions src/conduit/api.cljs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
(ns conduit.api
(:require [clojure.string :as string]))

(def api-url "https://conduit.productionready.io/api")

(defn endpoint
"Concat any params to api-url separated by /"
[& params]
(string/join "/" (concat [api-url] params)))

(defn auth-header
"Get user token and format for API authorization"
[db]
(when-let [token (get-in db [:user :token])]
{"Authorization" (str "Token " token)}))
12 changes: 12 additions & 0 deletions src/conduit/core.cljs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
(ns conduit.core
(:require [steroid.rn.core :as rn]
[conduit.ui.views :as views]
conduit.events
conduit.subs
conduit.fx))

;; -- Entry Point -------------------------------------------------------------
;; shadow-cljs.edn :init-fn conduit.core/init

(defn init []
(rn/register-comp "conduitrn" views/root-stack))
8 changes: 8 additions & 0 deletions src/conduit/db.cljs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
(ns conduit.db)

;; -- Default app-db Value ---------------------------------------------------
;;
;; When the application first starts, this will be the value put in app-db
;; Look in: `events.cljs` for the registration of :initialise-app handler
;;
(def default-db {:active-page :home}) ;; what gets put into app-db by default.
Loading

0 comments on commit cee4428

Please sign in to comment.