use react-native lib directly and peg version, update to react-native 0.10
This commit is contained in:
parent
c09dbad3db
commit
5d0369cea4
25
main.coffee
25
main.coffee
|
@ -8,9 +8,10 @@ fs = require 'fs'
|
|||
crypto = require 'crypto'
|
||||
{execSync} = require 'child_process'
|
||||
chalk = require 'chalk'
|
||||
reactInit = require 'react-native/local-cli/init'
|
||||
rnVersion = require(__dirname + '/package.json').dependencies['react-native']
|
||||
|
||||
resources = __dirname + '/resources/'
|
||||
binPath = __dirname + '/node_modules/.bin/'
|
||||
camelRx = /([a-z])([A-Z])/g
|
||||
projNameRx = /\$PROJECT_NAME\$/g
|
||||
projNameHyphRx = /\$PROJECT_NAME_HYPHENATED\$/g
|
||||
|
@ -63,8 +64,22 @@ init = (projName) ->
|
|||
execSync 'lein cljsbuild once dev'
|
||||
|
||||
log 'Creating React Native skeleton'
|
||||
execSync "#{ binPath }react-native init #{ projName }", stdio: 'ignore'
|
||||
execSync "mv #{ projName } iOS"
|
||||
fs.mkdirSync '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'
|
||||
process.chdir 'iOS'
|
||||
|
@ -73,7 +88,7 @@ init = (projName) ->
|
|||
|
||||
log 'Updating Xcode project'
|
||||
for ext in ['m', 'h']
|
||||
path = "./iOS/AppDelegate.#{ ext }"
|
||||
path = "#{ projName }/AppDelegate.#{ ext }"
|
||||
execSync "cp #{ resources }AppDelegate.#{ ext } #{ path }"
|
||||
editSync path, [[projNameRx, projName], [projNameHyphRx, projNameHyph]]
|
||||
|
||||
|
@ -103,7 +118,7 @@ init = (projName) ->
|
|||
[
|
||||
/\/\* End PBXFileReference section \*\//
|
||||
"\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 */"
|
||||
]
|
||||
[
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "natal",
|
||||
"version": "0.0.0",
|
||||
"version": "0.0.1",
|
||||
"description": "Bootstrap ClojureScript React Native apps",
|
||||
"main": "index.js",
|
||||
"author": {
|
||||
|
@ -12,7 +12,7 @@
|
|||
"dependencies": {
|
||||
"chalk": "^1.1.1",
|
||||
"coffee-script": "^1.9.3",
|
||||
"react-native-cli": "^0.1.4"
|
||||
"react-native": "^0.10.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.12.x",
|
||||
|
|
Loading…
Reference in New Issue