|
11 | 11 | import { languages } from '$lib/localization'; |
12 | 12 | import { type PopupSettings, getModalStore, popup } from '$lib/skeletonExtensions'; |
13 | 13 | import { addQueuedModAction, hasPendingProfileChange, queuedMods } from '$lib/store/actionQueue'; |
14 | | - import { lockfileMods, manifestMods } from '$lib/store/ficsitCLIStore'; |
| 14 | + import { lockfileMods } from '$lib/store/ficsitCLIStore'; |
15 | 15 | import { error } from '$lib/store/generalStore'; |
16 | 16 | import { |
17 | 17 | debug, |
|
148 | 148 |
|
149 | 149 | async function copyModList() { |
150 | 150 | // Generate mod entries |
151 | | - const modList = (await Promise.all(Object.keys($manifestMods).map(async (modReference) => { |
| 151 | + const modList = (await Promise.all(Object.keys($lockfileMods).map(async (modReference) => { |
152 | 152 | let modName = modReference; |
153 | 153 | if($offline) { |
154 | 154 | modName = (await OfflineGetMod(modReference)).name; |
|
159 | 159 | } |
160 | 160 | } |
161 | 161 |
|
162 | | - // Only return info if the mod is enabled |
163 | | - if($lockfileMods[modReference]) { |
164 | | - return { |
165 | | - friendlyName: modName, |
166 | | - modReference, |
167 | | - version: $lockfileMods[modReference].version, |
168 | | - }; |
169 | | - } else { |
170 | | - return undefined; |
171 | | - } |
172 | | - }))).filter((mod) => mod !== undefined); |
| 162 | + return { |
| 163 | + friendlyName: modName, |
| 164 | + modReference, |
| 165 | + version: $lockfileMods[modReference].version, |
| 166 | + }; |
| 167 | + }))); |
173 | 168 | // Sort by Friendly Name |
174 | | - // TODO Once we upgrade to Typescript 5.5 we don't need the non-null assertion operators https://stackoverflow.com/a/78681671 |
175 | 169 | modList.sort((a, b) => { |
176 | | - const x = a!.friendlyName.toLowerCase(); |
177 | | - const y = b!.friendlyName.toLowerCase(); |
| 170 | + const x = a.friendlyName.toLowerCase(); |
| 171 | + const y = b.friendlyName.toLowerCase(); |
178 | 172 | return x.localeCompare(y); |
179 | 173 | }); |
180 | 174 | // Get max lengths to use for padding |
181 | | - const maxFriendlyNameLen = Math.max(...modList.map((mod) => mod!.friendlyName.length)); |
182 | | - const maxModReferenceLen = Math.max(...modList.map((mod) => mod!.modReference.length)); |
| 175 | + const maxFriendlyNameLen = Math.max(...modList.map((mod) => mod.friendlyName.length)); |
| 176 | + const maxModReferenceLen = Math.max(...modList.map((mod) => mod.modReference.length)); |
183 | 177 | // Create header and add all mods to string |
184 | 178 | let modListString = `${'Mod Name'.padEnd(maxFriendlyNameLen + 1) + 'Mod Reference'.padEnd(maxModReferenceLen + 1)}Version\n`; |
185 | 179 | modList.forEach((mod) => { |
186 | | - mod!.friendlyName = mod!.friendlyName.padEnd(maxFriendlyNameLen, ' '); |
187 | | - mod!.modReference = mod!.modReference.padEnd(maxModReferenceLen, ' '); |
188 | | - modListString += `${mod!.friendlyName} ${mod!.modReference} ${mod!.version}\n`; |
| 180 | + mod.friendlyName = mod.friendlyName.padEnd(maxFriendlyNameLen, ' '); |
| 181 | + mod.modReference = mod.modReference.padEnd(maxModReferenceLen, ' '); |
| 182 | + modListString += `${mod.friendlyName} ${mod.modReference} ${mod.version}\n`; |
189 | 183 | }); |
190 | 184 | const markdownCodeblockFence = '```'; |
191 | 185 | navigator.clipboard.writeText(`${markdownCodeblockFence}\n${modListString.trim()}\n${markdownCodeblockFence}`); |
|
0 commit comments