use react-native lib directly and peg version, update to react-native 0.10

This commit is contained in:
Dan Motzenbecker 2015-08-30 11:04:57 -04:00
parent c09dbad3db
commit 5d0369cea4
2 changed files with 22 additions and 7 deletions

View File

@ -8,9 +8,10 @@ fs = require 'fs'
crypto = require 'crypto' crypto = require 'crypto'
{execSync} = require 'child_process' {execSync} = require 'child_process'
chalk = require 'chalk' chalk = require 'chalk'
reactInit = require 'react-native/local-cli/init'
rnVersion = require(__dirname + '/package.json').dependencies['react-native']
resources = __dirname + '/resources/' resources = __dirname + '/resources/'
binPath = __dirname + '/node_modules/.bin/'
camelRx = /([a-z])([A-Z])/g camelRx = /([a-z])([A-Z])/g
projNameRx = /\$PROJECT_NAME\$/g projNameRx = /\$PROJECT_NAME\$/g
projNameHyphRx = /\$PROJECT_NAME_HYPHENATED\$/g projNameHyphRx = /\$PROJECT_NAME_HYPHENATED\$/g
@ -63,8 +64,22 @@ init = (projName) ->
execSync 'lein cljsbuild once dev' execSync 'lein cljsbuild once dev'
log 'Creating React Native skeleton' log 'Creating React Native skeleton'
execSync "#{ binPath }react-native init #{ projName }", stdio: 'ignore' fs.mkdirSync 'iOS'
execSync "mv #{ projName } iOS" process.chdir 'iOS'
_log = console.log
global.console.log = ->
reactInit '.', projName
global.console.log = _log
fs.writeFileSync 'package.json', JSON.stringify
name: projName
version: '0.0.1'
private: true
scripts:
start: 'node_modules/react-native/packager/packager.sh'
dependencies:
'react-native': rnVersion
, null, 2
execSync 'npm i', stdio: 'ignore'
log 'Installing Pod dependencies' log 'Installing Pod dependencies'
process.chdir 'iOS' process.chdir 'iOS'
@ -73,7 +88,7 @@ init = (projName) ->
log 'Updating Xcode project' log 'Updating Xcode project'
for ext in ['m', 'h'] for ext in ['m', 'h']
path = "./iOS/AppDelegate.#{ ext }" path = "#{ projName }/AppDelegate.#{ ext }"
execSync "cp #{ resources }AppDelegate.#{ ext } #{ path }" execSync "cp #{ resources }AppDelegate.#{ ext } #{ path }"
editSync path, [[projNameRx, projName], [projNameHyphRx, projNameHyph]] editSync path, [[projNameRx, projName], [projNameHyphRx, projNameHyph]]
@ -103,7 +118,7 @@ init = (projName) ->
[ [
/\/\* End PBXFileReference section \*\// /\/\* End PBXFileReference section \*\//
"\t\t#{ uuid1 } /* out */ = {isa = PBXFileReference; lastKnownFileType "\t\t#{ uuid1 } /* out */ = {isa = PBXFileReference; lastKnownFileType
= folder; name = out; path = ../target/out; = folder; name = out; path = ../../../target/out;
sourceTree = \"<group>\"; };\n/* End PBXFileReference section */" sourceTree = \"<group>\"; };\n/* End PBXFileReference section */"
] ]
[ [

View File

@ -1,6 +1,6 @@
{ {
"name": "natal", "name": "natal",
"version": "0.0.0", "version": "0.0.1",
"description": "Bootstrap ClojureScript React Native apps", "description": "Bootstrap ClojureScript React Native apps",
"main": "index.js", "main": "index.js",
"author": { "author": {
@ -12,7 +12,7 @@
"dependencies": { "dependencies": {
"chalk": "^1.1.1", "chalk": "^1.1.1",
"coffee-script": "^1.9.3", "coffee-script": "^1.9.3",
"react-native-cli": "^0.1.4" "react-native": "^0.10.1"
}, },
"engines": { "engines": {
"node": ">=0.12.x", "node": ">=0.12.x",