@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
55} ;
66Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
77const LogColor = '\x1b[32m' ;
8- const child_process_1 = require ( "child_process" ) ;
8+ const cross_spawn_1 = __importDefault ( require ( "cross-spawn" ) ) ;
99const fs_extra_1 = __importDefault ( require ( "fs-extra" ) ) ;
1010const path_1 = __importDefault ( require ( "path" ) ) ;
1111const yargs_1 = __importDefault ( require ( "yargs" ) ) ;
@@ -113,7 +113,7 @@ async function installPackagesAdvanced(packages, directory, dev) {
113113 return new Promise ( ( resolve , reject ) => {
114114 const joinedPackages = packages . map ( ( p ) => p . name + ( p . version ? `@${ p . version } ` : `` ) ) ;
115115 // console.log({ joinedPackages });
116- const createReactNativeProcess = child_process_1 . spawn ( spawnPlatform ( 'yarn' ) , [
116+ const createReactNativeProcess = cross_spawn_1 . default ( 'yarn' , [
117117 '--cwd' ,
118118 directory ,
119119 'add' ,
@@ -130,7 +130,7 @@ async function installPackagesAdvanced(packages, directory, dev) {
130130}
131131async function createReactNativeApp ( appName ) {
132132 return new Promise ( ( resolve , reject ) => {
133- const createReactNativeProcess = child_process_1 . spawn ( spawnPlatform ( 'npx' ) , [ 'react-native' , 'init' , appName ] , { stdio : 'inherit' , shell : true } ) ;
133+ const createReactNativeProcess = cross_spawn_1 . default ( 'npx' , [ 'react-native' , 'init' , appName ] , { stdio : 'inherit' , shell : true } ) ;
134134 createReactNativeProcess . on ( 'error' , function ( error ) {
135135 reject ( error ) ;
136136 } ) ;
@@ -141,7 +141,7 @@ async function createReactNativeApp(appName) {
141141}
142142async function createReactScriptsApp ( appName ) {
143143 return new Promise ( function ( resolve , reject ) {
144- const createReactNativeProcess = child_process_1 . spawn ( spawnPlatform ( 'npx' ) , [ 'create-react-app' , appName ] , { stdio : 'inherit' , shell : true } ) ;
144+ const createReactNativeProcess = cross_spawn_1 . default ( 'npx' , [ 'create-react-app' , appName ] , { stdio : 'inherit' , shell : true } ) ;
145145 createReactNativeProcess . on ( 'error' , function ( error ) {
146146 reject ( error ) ;
147147 } ) ;
@@ -150,13 +150,6 @@ async function createReactScriptsApp(appName) {
150150 } ) ;
151151 } ) ;
152152}
153- function spawnPlatform ( s ) {
154- const isWin = process . platform === 'win32' ;
155- if ( isWin ) {
156- return s + '.cmd' ;
157- }
158- return s ;
159- }
160153function logSpaced ( args ) {
161154 console . log ( '' ) ;
162155 console . log ( LogColor , args ) ;
0 commit comments