(
command: 'check' | 'static' | 'full',
args: string[]
)
| 122 | } |
| 123 | } |
| 124 | |
| 125 | async function updateExtensions( |
| 126 | command: 'check' | 'static' | 'full', |
| 127 | args: string[] |
| 128 | ): Promise<void> { |
| 129 | const quick = command === 'check'; |
| 130 | const useCache = command === 'full' && !args.includes('--no-cache'); |
| 131 | |
| 132 | if (useCache) { |
| 133 | await restoreStaticCache(); |
| 134 | } else { |
| 135 | logger.info( |
| 136 | 'cache', |
| 137 | quick ? 'cache disabled mode="quick"' : 'cache disabled mode="command"' |
| 138 | ); |
| 139 | } |
| 140 | |
| 141 | const data = await loadExtensionsData(); |
| 142 | const pruned = !quick ? await pruneRemovedRepos(data) : 0; |
| 143 | |
| 144 | const updates = await findExtensionUpdates(data, { quick }); |
| 145 | |
| 146 | if (updates.length === 0) { |
| 147 | await persistQuickUpdates(false); |
| 148 | // Persist removed sources in the cache even without repo updates, so |
| 149 | // the next restore doesn't resurrect files for deleted extensions.json |
| 150 | // entries (e.g. a deprecated repo removed after a cache was saved). |
| 151 | if (pruned > 0 && useCache) await saveStaticCache(); |
| 152 | return; |
| 153 | } |
| 154 | |
| 155 | if (quick) { |
| 156 | await handleQuickUpdates(data, updates); |
| 157 | return; |
| 158 | } |
| 159 | |
| 160 | const { changed, failures } = await materializeExtensions(data, updates); |
no test coverage detected