@@ -36,8 +36,8 @@ module.exports = function getStartAndEndCommands({
3636 projectName,
3737 packageName : 'ember-cli' ,
3838 commandName : 'ember' ,
39- createProjectFromCache,
40- createProjectFromRemote,
39+ createProjectFromCache : createProject ( runEmberLocally ) ,
40+ createProjectFromRemote : createProject ( runEmberRemotely ) ,
4141 startOptions : {
4242 baseBlueprint,
4343 blueprint : startBlueprint ,
@@ -100,37 +100,6 @@ function getArgs(projectName, blueprint) {
100100 ] ;
101101}
102102
103- function createProject ( {
104- packageRoot,
105- options,
106- runEmber
107- } ) {
108- return async function createProject ( cwd ) {
109- if ( ! options . blueprint || ! options . blueprint . isBaseBlueprint ) {
110- await runEmber ( {
111- packageRoot,
112- cwd,
113- projectName : options . projectName ,
114- blueprint : options . baseBlueprint
115- } ) ;
116- }
117-
118- if ( options . blueprint ) {
119- await runEmber ( {
120- packageRoot,
121- cwd,
122- projectName : options . projectName ,
123- blueprint : options . blueprint
124- } ) ;
125- }
126-
127- return await postCreateProject ( {
128- cwd,
129- options
130- } ) ;
131- } ;
132- }
133-
134103module . exports . spawn = async function spawn ( command , args , options ) {
135104 debug ( `${ command } ${ args . join ( ' ' ) } ` ) ;
136105
@@ -144,6 +113,14 @@ module.exports.spawn = async function spawn(command, args, options) {
144113 await ps ;
145114} ;
146115
116+ module . exports . npx = async function npx ( args , options ) {
117+ let ps = utils . npx ( args . join ( ' ' ) , options ) ;
118+
119+ overwriteBlueprintFiles ( ps ) ;
120+
121+ await ps ;
122+ } ;
123+
147124async function runEmberLocally ( {
148125 packageRoot,
149126 cwd,
@@ -162,25 +139,6 @@ async function runEmberLocally({
162139 ] , { cwd } ) ;
163140}
164141
165- function createProjectFromCache ( {
166- packageRoot,
167- options
168- } ) {
169- return createProject ( {
170- packageRoot,
171- options,
172- runEmber : runEmberLocally
173- } ) ;
174- }
175-
176- module . exports . npx = async function npx ( args , options ) {
177- let ps = utils . npx ( args . join ( ' ' ) , options ) ;
178-
179- overwriteBlueprintFiles ( ps ) ;
180-
181- await ps ;
182- } ;
183-
184142async function runEmberRemotely ( {
185143 cwd,
186144 projectName,
@@ -204,13 +162,36 @@ async function runEmberRemotely({
204162 await module . exports . npx ( args , { cwd } ) ;
205163}
206164
207- function createProjectFromRemote ( {
208- options
209- } ) {
210- return createProject ( {
211- options,
212- runEmber : runEmberRemotely
213- } ) ;
165+ function createProject ( runEmber ) {
166+ return ( {
167+ packageRoot,
168+ options
169+ } ) => {
170+ return async function createProject ( cwd ) {
171+ if ( ! options . blueprint || ! options . blueprint . isBaseBlueprint ) {
172+ await runEmber ( {
173+ packageRoot,
174+ cwd,
175+ projectName : options . projectName ,
176+ blueprint : options . baseBlueprint
177+ } ) ;
178+ }
179+
180+ if ( options . blueprint ) {
181+ await runEmber ( {
182+ packageRoot,
183+ cwd,
184+ projectName : options . projectName ,
185+ blueprint : options . blueprint
186+ } ) ;
187+ }
188+
189+ return await postCreateProject ( {
190+ cwd,
191+ options
192+ } ) ;
193+ } ;
194+ } ;
214195}
215196
216197async function postCreateProject ( {
0 commit comments