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

Function writeIOSAssets

src/extras/utils.ts:568–686  ·  view source on GitHub ↗
({
  iosOutputPath,
  props,
}: {
  iosOutputPath: string;
  props: Props;
})

Source from the content-addressed store, hash-verified

566};
567
568export const writeIOSAssets = async ({
569 iosOutputPath,
570 props,
571}: {
572 iosOutputPath: string;
573 props: Props;
574}) => {
575 const { background, logo, fileNameSuffix } = props;
576
577 log.title("🍏", "iOS");
578 hfs.ensureDir(iosOutputPath);
579
580 // clean existing assets
581 hfs
582 .readDir(iosOutputPath)
583 .filter((file) => file === "Colors.xcassets" || file === "Images.xcassets")
584 .map((file) => path.join(iosOutputPath, file))
585 .flatMap((dir) =>
586 hfs
587 .readDir(dir)
588 .filter((file) => file.startsWith("BootSplash"))
589 .map((file) => path.join(dir, file)),
590 )
591 .forEach((file) => {
592 hfs.rm(file);
593 });
594
595 const storyboardPath = path.resolve(iosOutputPath, "BootSplash.storyboard");
596
597 await writeXmlLike(storyboardPath, getStoryboard(props), {
598 formatter: "xmlFormatter",
599 whiteSpaceAtEndOfSelfclosingTag: false,
600 });
601
602 const colorsSetPath = path.resolve(
603 iosOutputPath,
604 "Colors.xcassets",
605 `BootSplashBackground-${fileNameSuffix}.colorset`,
606 );
607
608 hfs.ensureDir(colorsSetPath);
609
610 writeJson(path.resolve(colorsSetPath, "Contents.json"), {
611 colors: [
612 {
613 idiom: "universal",
614 color: {
615 "color-space": "srgb",
616 components: {
617 blue: background.rgb.B,
618 green: background.rgb.G,
619 red: background.rgb.R,
620 alpha: "1.000",
621 },
622 },
623 },
624 ],
625 info: {

Callers 2

generateFunction · 0.90
withIOSAssetsFunction · 0.90

Calls 3

writeXmlLikeFunction · 0.85
getStoryboardFunction · 0.85
writeJsonFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…