diff --git a/.changeset/free-suns-stand.md b/.changeset/free-suns-stand.md new file mode 100644 index 0000000000..b1dd013b48 --- /dev/null +++ b/.changeset/free-suns-stand.md @@ -0,0 +1,5 @@ +--- +'@shopify/theme': patch +--- + +Change download files loop to a Promise all to ensure all files are always downloaded and display more accurate progress diff --git a/packages/theme/src/cli/utilities/theme-downloader.ts b/packages/theme/src/cli/utilities/theme-downloader.ts index fae80deb31..f0841361f5 100644 --- a/packages/theme/src/cli/utilities/theme-downloader.ts +++ b/packages/theme/src/cli/utilities/theme-downloader.ts @@ -2,7 +2,7 @@ import {batchedTasks, Task} from './batching.js' import {MAX_GRAPHQL_THEME_FILES} from '../constants.js' import {AdminSession} from '@shopify/cli-kit/node/session' import {fetchThemeAssets} from '@shopify/cli-kit/node/themes/api' -import {ThemeFileSystem, Theme, Checksum, ThemeAsset} from '@shopify/cli-kit/node/themes/types' +import {ThemeFileSystem, Theme, Checksum} from '@shopify/cli-kit/node/themes/types' import {renderTasks} from '@shopify/cli-kit/node/ui' import {Writable} from 'stream' @@ -90,8 +90,5 @@ async function downloadFiles(theme: Theme, fileSystem: ThemeFileSystem, filename const assets = await fetchThemeAssets(theme.id, filenames, session) if (!assets) return - // eslint-disable-next-line @typescript-eslint/no-misused-promises - assets.forEach(async (asset: ThemeAsset) => { - await fileSystem.write(asset) - }) + await Promise.all(assets.map((asset) => fileSystem.write(asset))) }