diff --git a/src/cmd/flash.js b/src/cmd/flash.js index a52ff462e..41f7d54ae 100644 --- a/src/cmd/flash.js +++ b/src/cmd/flash.js @@ -101,6 +101,8 @@ module.exports = class FlashCommand extends CLICommandBase { } else { filesToProgram = files; } + + // TODO: we shouldn't have to remove slashes. In what situation is this code necessary? // remove the first / from the update folder and all the files includeDir = includeDir.replace(/^\//, ''); @@ -140,11 +142,11 @@ module.exports = class FlashCommand extends CLICommandBase { // const baseDir = path.join(path.dirname(manifestPath), parsed.base); const baseDir = parsed.base; - const filesToProgram = await this._getFilesInOrder({ - programXml: parsed.programXml, - patchXml: parsed.patchXml.map, - firehoseElf: parsed.firehose - }); + const filesToProgram = [ + parsed.firehose, + ...parsed.programXml, + ...parsed.patchXml + ]; return { baseDir, filesToProgram }; } @@ -157,12 +159,11 @@ module.exports = class FlashCommand extends CLICommandBase { const parsed = this._parseManfiestData(data); const baseDir = parsed.base; - - const filesToProgram = await this._getFilesInOrder({ - programXml: parsed.programXml, - patchXml: parsed.patchXml, - firehoseElf: parsed.firehose - }); + const filesToProgram = [ + parsed.firehose, + ...parsed.programXml, + ...parsed.patchXml + ]; return { baseDir, filesToProgram }; } @@ -192,24 +193,6 @@ module.exports = class FlashCommand extends CLICommandBase { }; } - async _getFilesInOrder({ programXml, patchXml, firehoseElf }) { - if (!firehoseElf) { - throw new Error('Unable to find firehose file'); - } - if (programXml.length === 0) { - throw new Error('Unable to find program xml files'); - } - let files = [ - firehoseElf, - ...programXml.flatMap((programFile, i) => [ - programFile, - patchXml[i] - ].filter(Boolean)) - ].filter(Boolean); - - return files; - } - async flashOverUsb({ binary, factory }) { if (utilities.getFilenameExt(binary) === '.zip') { throw new Error("Use 'particle flash --local' to flash a zipped bundle.");