• Stars
    star
    405
  • Rank 103,172 (Top 3 %)
  • Language
    CoffeeScript
  • License
    MIT License
  • Created over 8 years ago
  • Updated over 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

📲 Bootstrap ClojureScript React Native apps

Natal

Bootstrap ClojureScript-based React Native apps

Dan Motzenbecker, MIT License @dcmotz


Natal is a simple command-line utility that automates most of the process of setting up a React Native app running on ClojureScript.

It stands firmly on the shoulders of giants, specifically those of Mike Fikes who created Ambly and the documentation on setting up a ClojureScript React Native app.

Usage

Before getting started, make sure you have the required dependencies installed.

Then, install the CLI using npm:

$ npm install -g natal

To bootstrap a new app, run natal init with your app's name as an argument:

$ natal init FutureApp

If your app's name is more than a single word, be sure to type it in CamelCase. A corresponding hyphenated Clojure namespace will be created.

By default Natal will create a simple skeleton based on the current stable version of Om (aka Om Now). If you'd like to base your app upon Om Next, you can specify a React interface template during init:

$ natal init FutureApp --interface om-next

Keep in mind your app isn't limited to the React interfaces Natal provides templates for; these are just for convenience.

If all goes well your app should compile and boot in the simulator.

From there you can begin an interactive workflow by starting the REPL.

$ cd future-app
$ rlwrap natal repl

(If you don't have rlwrap installed, you can simply run natal repl, but using rlwrap allows the use of arrow keys).

If there are no issues, the REPL should connect to the simulator automatically. To manually choose which device it connects to, you can run rlwrap natal repl --choose.

At the prompt, try loading your app's namespace:

(in-ns 'future-app.core)

Changes you make via the REPL or by changing your .cljs files should appear live in the simulator.

Try this command as an example:

(swap! app-state assoc :text "Hello Native World")

When the REPL connects to the simulator it will begin to automatically log success messages, warnings, and errors whenever you update your .cljs files.

Tips

  • Having rlwrap installed is optional but highly recommended since it makes the REPL a much nicer experience with arrow keys.

  • Don't press ⌘-R in the simulator; code changes should be reflected automatically. See this issue in Ambly for details.

  • Running multiple React Native apps at once can cause problems with the React Packager so try to avoid doing so.

  • You can launch your app on the simulator without opening Xcode by running natal launch in your app's root directory.

  • By default new Natal projects will launch on the iPhone 6 simulator. To change which device natal launch uses, you can run natal listdevices to see a list of available simulators, then select one by running natal setdevice with the index of the device on the list.

  • To change advanced settings run natal xcode to quickly open the Xcode project.

  • The Xcode-free workflow is for convenience. If you're encountering app crashes, you should open the Xcode project and run it from there to view errors.

  • You can run any command with --verbose or -v to see output that may be helpful in diagnosing errors.

Dependencies

As Natal is the orchestration of many individual tools, there are quite a few dependencies. If you've previously done React Native or Clojure development, you should hopefully have most installed already. Platform dependencies are listed under their respective tools.

Updating Natal

You can get the latest version of Natal by running npm install -g natal again.

Aspirations

  • Xcode-free workflow with CLI tools
  • Templates for other ClojureScript React wrappers
  • Automatic wrapping of all React Native component functions for ClojureScript
  • Automatically tail compilation log and report errors to REPL
  • Automatically run React packager in background
  • Working dev tools
  • Automatic bundling for offline device usage and App Store distribution
  • Android support
  • Automatic setup of JS modules

Example apps bootstrapped with Natal

Coda

Contributions are welcome.

For more ClojureScript React Native resources visit cljsrn.org.

If you're looking for a simple ClojureScript wrapper around the React Native API, check out the companion library Natal Shell. It is included by default in projects generated by Natal.

More Repositories

1

oriDomi

🪭 Fold up DOM elements like paper
CoffeeScript
2,406
star
2

thing-translator

📷 🗣 Point your camera at things to hear how to say them in a different language
JavaScript
1,315
star
3

trystero

🤝 Build instant multiplayer webapps, no server required — Magic WebRTC matchmaking over BitTorrent, Nostr, MQTT, IPFS, and Firebase
JavaScript
810
star
4

TuringType

⌨️ Simple human typing effect
CoffeeScript
144
star
5

hexaflip

🧊 Visualizes arrays as cube interfaces
CoffeeScript
137
star
6

maskew

▰ Add some diagonal rhythm to your elements
CoffeeScript
117
star
7

jade-html5-boilerplate

HTML5 Boilerplate ported to Jade. Great as a drop and go markup skeleton for Express apps.
Shell
112
star
8

emdash

📚🧙‍♂️ Wisdom indexer — use AI to organize text snippets so you can actually remember & learn from what you read
Elm
110
star
9

natal-shell

A thin ClojureScript wrapper around the React Native API
Clojure
38
star
10

soundscrape

SoundCloud command line downloader in Node.js
CoffeeScript
28
star
11

GildedGauge

💸 An experiment in visualizing relative wealth
Clojure
19
star
12

stream-snitch

👀 Event emitter for watching text streams with regex patterns
JavaScript
19
star
13

commune.js

Web workers lose their chains: Easy threads without separate function files.
CoffeeScript
18
star
14

ear-pipe

Pipe audio streams to your ears
JavaScript
16
star
15

ExifExodus

🕶 Remove GPS data from your photos before you upload them.
CoffeeScript
14
star
16

bashcoin

Bitcoin ticker tape for your terminal
JavaScript
10
star
17

express-spa-router

Express middleware for single page app routing
JavaScript
9
star
18

cellf

👁 Experiment / small game that reflects you and your surroundings
Clojure
9
star
19

statmap

Output recursive directory stats as JSON for visualization and analysis.
JavaScript
8
star
20

taxa

📐 A tiny language inside JavaScript to enforce type signatures.
CoffeeScript
8
star
21

dotfiles

$> (C)onfig (R)ules (E)verything (A)round (M)e
Shell
7
star
22

gimme

Simple command line utility that takes a name and shows domain and twitter availability.
JavaScript
7
star
23

cupboard-calc

🥦 Plan your pantry
Svelte
6
star
24

yearcal

📅 My loose grasp on time
JavaScript
5
star
25

monocat

Automated asset inlining
CoffeeScript
5
star
26

distilla

Distill a derived branch build with no mess. Designed for gh-pages.
JavaScript
4
star
27

oxen

DEPRECATED Create Github pull requests from the command line
JavaScript
4
star
28

ether-tontine

⚰️💰 On-chain mortality lottery
Solidity
3
star
29

holdTheLine

Tiny jQuery HTML5 placeholder polyfill for old browsers.
JavaScript
2
star
30

ptolemy

Serendipitous tome extractions
Haskell
1
star
31

dmotz.github.com

$HOME
JavaScript
1
star
32

tasseographer

Divine auspices from Git log hashes
Clojure
1
star