@@ -22,6 +22,7 @@ const isDefaultBlueprint = require('./is-default-blueprint');
2222const findBlueprint = require ( './find-blueprint' ) ;
2323const getBaseBlueprint = require ( './get-base-blueprint' ) ;
2424const chooseBlueprintUpdates = require ( './choose-blueprint-updates' ) ;
25+ const getBlueprintFilePath = require ( './get-blueprint-file-path' ) ;
2526
2627const {
2728 'to' : { default : toDefault } ,
@@ -47,7 +48,12 @@ module.exports = async function emberCliUpdate({
4748} ) {
4849 let cwd = process . cwd ( ) ;
4950
50- let emberCliUpdateJson = await loadSafeBlueprintFile ( cwd ) ;
51+ // A custom config location in package.json may be reset/init away,
52+ // so we can no longer look it up on the fly after the run.
53+ // We must rely on a lookup before the run.
54+ let emberCliUpdateJsonPath = await getBlueprintFilePath ( cwd ) ;
55+
56+ let emberCliUpdateJson = await loadSafeBlueprintFile ( emberCliUpdateJsonPath ) ;
5157
5258 let blueprint ;
5359 let packageUrl ;
@@ -248,35 +254,41 @@ All blueprints are up-to-date!`;
248254 } ) ) . promise ;
249255
250256 if ( _blueprint ) {
251- let emberCliUpdateJson = await loadBlueprintFile ( cwd ) ;
257+ let emberCliUpdateJson = await loadBlueprintFile ( emberCliUpdateJsonPath ) ;
252258
253259 // If you don't have a state file, save the default blueprint,
254260 // even if you are currently working on a custom blueprint.
255261 if ( ! emberCliUpdateJson || ! isCustomBlueprint ) {
256262 await saveBlueprint ( {
257- cwd ,
263+ emberCliUpdateJsonPath ,
258264 blueprint : defaultBlueprint
259265 } ) ;
260266 }
261267
262268 if ( isCustomBlueprint ) {
263269 await saveBlueprint ( {
264- cwd ,
270+ emberCliUpdateJsonPath ,
265271 blueprint : endBlueprint
266272 } ) ;
267273 }
268274
269275 if ( ! reset ) {
270- await stageBlueprintFile ( cwd ) ;
276+ await stageBlueprintFile ( {
277+ cwd,
278+ emberCliUpdateJsonPath
279+ } ) ;
271280 }
272281 } else if ( isPersistedBlueprint ) {
273282 await saveBlueprint ( {
274- cwd ,
283+ emberCliUpdateJsonPath ,
275284 blueprint : endBlueprint
276285 } ) ;
277286
278287 if ( ! reset ) {
279- await stageBlueprintFile ( cwd ) ;
288+ await stageBlueprintFile ( {
289+ cwd,
290+ emberCliUpdateJsonPath
291+ } ) ;
280292 }
281293 }
282294
0 commit comments