({ props }: { props: Props })
| 762 | }; |
| 763 | |
| 764 | export const writeGenericAssets = async ({ props }: { props: Props }) => { |
| 765 | const { assetsOutputPath, background, logo } = props; |
| 766 | |
| 767 | log.title("📄", "Assets"); |
| 768 | hfs.ensureDir(assetsOutputPath); |
| 769 | |
| 770 | writeJson(path.resolve(assetsOutputPath, "manifest.json"), { |
| 771 | background: background.hex, |
| 772 | logo: { |
| 773 | width: logo.width, |
| 774 | height: logo.height, |
| 775 | }, |
| 776 | } satisfies Manifest); |
| 777 | |
| 778 | await Promise.all( |
| 779 | [ |
| 780 | { ratio: 1, suffix: "" }, |
| 781 | { ratio: 1.5, suffix: "@1,5x" }, |
| 782 | { ratio: 2, suffix: "@2x" }, |
| 783 | { ratio: 3, suffix: "@3x" }, |
| 784 | { ratio: 4, suffix: "@4x" }, |
| 785 | ].map(({ ratio, suffix }) => { |
| 786 | const filePath = path.resolve(assetsOutputPath, `logo${suffix}.png`); |
| 787 | |
| 788 | return logo.image |
| 789 | .clone() |
| 790 | .resize(Math.round(logo.width * ratio)) |
| 791 | .png({ quality: 100 }) |
| 792 | .toFile(filePath) |
| 793 | .then(({ width, height }) => { |
| 794 | log.write(filePath, { width, height }); |
| 795 | }); |
| 796 | }), |
| 797 | ); |
| 798 | }; |
| 799 | |
| 800 | export type AddonConfig = { |
| 801 | props: Props; |
no test coverage detected
searching dependent graphs…