(code: string)
| 16 | } |
| 17 | |
| 18 | function updateGeneratedThemeChecksum(code: string): string { |
| 19 | const checksum = extractChecksum(code) |
| 20 | const codeWithoutChecksum = code.replace( |
| 21 | `* @checksum - ${checksum}`, |
| 22 | '* @checksum -' |
| 23 | ) |
| 24 | const newChecksum = createHash('sha256') |
| 25 | .update(codeWithoutChecksum) |
| 26 | .digest('hex') |
| 27 | return code.replace( |
| 28 | `* @checksum - ${checksum}`, |
| 29 | `* @checksum - ${newChecksum}` |
| 30 | ) |
| 31 | } |
| 32 | |
| 33 | function extractChecksum(theme: string): string { |
| 34 | const checksumStart = theme.indexOf('@checksum -') |
no test coverage detected