MCPcopy
hub / github.com/zoontek/react-native-bootsplash / writeGenericAssets

Function writeGenericAssets

src/extras/utils.ts:764–798  ·  view source on GitHub ↗
({ props }: { props: Props })

Source from the content-addressed store, hash-verified

762};
763
764export 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
800export type AddonConfig = {
801 props: Props;

Callers 2

generateFunction · 0.90
withGenericAssetsFunction · 0.90

Calls 1

writeJsonFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…