From a88a9352ade92ee0e34ce9009ab3e1dfbeadecdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Berkefeld?= Date: Mon, 2 Sep 2024 13:27:02 +0200 Subject: [PATCH] #1646: fix config not getting updated during mcdev upgrade --- @types/lib/util/init.config.d.ts.map | 2 +- lib/util/init.config.js | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/@types/lib/util/init.config.d.ts.map b/@types/lib/util/init.config.d.ts.map index 99597c45c..b5e27d81c 100644 --- a/@types/lib/util/init.config.d.ts.map +++ b/@types/lib/util/init.config.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"init.config.d.ts","sourceRoot":"","sources":["../../../lib/util/init.config.js"],"names":[],"mappings":";yBAaa,OAAO,wBAAwB,EAAE,UAAU;uBAC3C,OAAO,wBAAwB,EAAE,QAAQ;oBACzC,OAAO,wBAAwB,EAAE,KAAK;0BACtC,OAAO,wBAAwB,EAAE,WAAW;8BAC5C,OAAO,wBAAwB,EAAE,eAAe;2BAChD,OAAO,wBAAwB,EAAE,YAAY;sBAC7C,OAAO,wBAAwB,EAAE,OAAO;+BACxC,OAAO,wBAAwB,EAAE,gBAAgB;mCACjD,OAAO,wBAAwB,EAAE,oBAAoB;kCACrD,OAAO,wBAAwB,EAAE,mBAAmB;8BACpD,OAAO,wBAAwB,EAAE,eAAe;iCAChD,OAAO,wBAAwB,EAAE,kBAAkB;oCACnD,OAAO,wBAAwB,EAAE,qBAAqB;mCACtD,OAAO,wBAAwB,EAAE,oBAAoB;gCACrD,OAAO,wBAAwB,EAAE,iBAAiB;0BAClD,OAAO,wBAAwB,EAAE,WAAW;2BAC5C,OAAO,wBAAwB,EAAE,YAAY;;IAQtD;;;;;OAKG;IACH,oCAHW,OAAO,GACL,OAAO,CAAE,OAAO,CAAC,CA4L7B;IAED;;;;;OAKG;IACH,oDAHW,MAAM,GACJ,OAAO,CAAE,OAAO,CAAC,CAmE7B;IAED;;;;;;;OAOG;IACH,qCALW,MAAM,mBACN,MAAM,aACN,MAAM,GACJ,IAAI,CAkBhB;IAED;;;;;OAKG;IACH,8CAHW,MAAM,GACJ,OAAO,CAAE;QAAC,OAAO,EAAC,MAAM,EAAE,CAAC;QAAA,OAAO,EAAC,MAAM,EAAE,CAAA;KAAC,CAAC,CA+BzD;IAED;;;;;;;OAOG;IACH,2CALW,MAAM,EAAE,kBACR;QAAC,OAAO,EAAC,MAAM,EAAE,CAAC;QAAA,OAAO,EAAC,MAAM,EAAE,CAAA;KAAC,2BACnC,MAAM,GACJ,OAAO,CAAE,OAAO,CAAC,CAkF7B;IAED;;;;;OAKG;IACH,+CAHW;QAAC,OAAO,EAAC,MAAM,EAAE,CAAC;QAAA,OAAO,EAAC,MAAM,EAAE,CAAA;KAAC,GACjC,OAAO,CAAE,OAAO,CAAC,CAc7B;IAED;;;;OAIG;IACH,4BAFa,OAAO,CAAE,OAAO,CAAC,CAyB7B"} \ No newline at end of file +{"version":3,"file":"init.config.d.ts","sourceRoot":"","sources":["../../../lib/util/init.config.js"],"names":[],"mappings":";yBAaa,OAAO,wBAAwB,EAAE,UAAU;uBAC3C,OAAO,wBAAwB,EAAE,QAAQ;oBACzC,OAAO,wBAAwB,EAAE,KAAK;0BACtC,OAAO,wBAAwB,EAAE,WAAW;8BAC5C,OAAO,wBAAwB,EAAE,eAAe;2BAChD,OAAO,wBAAwB,EAAE,YAAY;sBAC7C,OAAO,wBAAwB,EAAE,OAAO;+BACxC,OAAO,wBAAwB,EAAE,gBAAgB;mCACjD,OAAO,wBAAwB,EAAE,oBAAoB;kCACrD,OAAO,wBAAwB,EAAE,mBAAmB;8BACpD,OAAO,wBAAwB,EAAE,eAAe;iCAChD,OAAO,wBAAwB,EAAE,kBAAkB;oCACnD,OAAO,wBAAwB,EAAE,qBAAqB;mCACtD,OAAO,wBAAwB,EAAE,oBAAoB;gCACrD,OAAO,wBAAwB,EAAE,iBAAiB;0BAClD,OAAO,wBAAwB,EAAE,WAAW;2BAC5C,OAAO,wBAAwB,EAAE,YAAY;;IAQtD;;;;;OAKG;IACH,oCAHW,OAAO,GACL,OAAO,CAAE,OAAO,CAAC,CA4L7B;IAED;;;;;OAKG;IACH,oDAHW,MAAM,GACJ,OAAO,CAAE,OAAO,CAAC,CAmE7B;IAED;;;;;;;OAOG;IACH,qCALW,MAAM,mBACN,MAAM,aACN,MAAM,GACJ,IAAI,CAkBhB;IAED;;;;;OAKG;IACH,8CAHW,MAAM,GACJ,OAAO,CAAE;QAAC,OAAO,EAAC,MAAM,EAAE,CAAC;QAAA,OAAO,EAAC,MAAM,EAAE,CAAA;KAAC,CAAC,CA+BzD;IAED;;;;;;;OAOG;IACH,2CALW,MAAM,EAAE,kBACR;QAAC,OAAO,EAAC,MAAM,EAAE,CAAC;QAAA,OAAO,EAAC,MAAM,EAAE,CAAA;KAAC,2BACnC,MAAM,GACJ,OAAO,CAAE,OAAO,CAAC,CAsF7B;IAED;;;;;OAKG;IACH,+CAHW;QAAC,OAAO,EAAC,MAAM,EAAE,CAAC;QAAA,OAAO,EAAC,MAAM,EAAE,CAAA;KAAC,GACjC,OAAO,CAAE,OAAO,CAAC,CAc7B;IAED;;;;OAIG;IACH,4BAFa,OAAO,CAAE,OAAO,CAAC,CAyB7B"} \ No newline at end of file diff --git a/lib/util/init.config.js b/lib/util/init.config.js index c339b2d82..568e79d7b 100644 --- a/lib/util/init.config.js +++ b/lib/util/init.config.js @@ -374,7 +374,6 @@ const Init = { * @returns {Promise.} install successful or error occured */ async _createIdeConfigFile(fileNameArr, relevantForced, boilerplateFileContent) { - let update = false; const fileName = fileNameArr.join(''); const boilerplateFileName = path.resolve( __dirname, @@ -409,17 +408,20 @@ const Init = { Util.logger.info( `- ✋ ${fileName} found with differences to the new standard version. We recommend updating it.` ); - if (!Util.skipInteraction) { + if (Util.skipInteraction) { + todo = 'update'; + } else { const overrideFile = await confirm({ message: 'Would you like to update (override) it?', default: true, }); - if (!overrideFile) { + if (overrideFile) { + todo = 'update'; + } else { // skip override without error return true; } } - update = true; } // ensure our update is not leading to data loss in case config files were not versioned correctly by the user @@ -438,14 +440,16 @@ const Init = { if (saveStatus) { Util.logger.info( `- ✔️ ${fileName} ${ - update + todo === 'update' ? `updated (we created a backup of the old file under ${fileName + '.BAK'})` : 'created' }` ); return true; } else { - Util.logger.warn(`- ❌ ${fileName} ${update ? 'update' : 'creation'} failed`); + Util.logger.warn( + `- ❌ ${fileName} ${todo === 'update' ? 'update' : 'creation'} failed` + ); return false; } } else if (todo === 'delete') {