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

Function generate

src/extras/generate.ts:165–410  ·  view source on GitHub ↗
({
  platforms,
  html,
  flavor,
  plist,
  ...rawProps
}: {
  platforms: Array<"android" | "ios" | "web">;
  html: string;
  flavor: string;
  plist?: string;

  logo: string;
  background: string;
  logoWidth: number;
  assetsOutput: string;
  licenseKey?: string;
  brand?: string;
  brandWidth: number;
  darkBackground?: string;
  darkLogo?: string;
  darkBrand?: string;
})

Source from the content-addressed store, hash-verified

163};
164
165export const generate = async ({
166 platforms,
167 html,
168 flavor,
169 plist,
170 ...rawProps
171}: {
172 platforms: Array<"android" | "ios" | "web">;
173 html: string;
174 flavor: string;
175 plist?: string;
176
177 logo: string;
178 background: string;
179 logoWidth: number;
180 assetsOutput: string;
181 licenseKey?: string;
182 brand?: string;
183 brandWidth: number;
184 darkBackground?: string;
185 darkLogo?: string;
186 darkBrand?: string;
187}) => {
188 const props = await transformProps(cwd, rawProps);
189 const addon = requireAddon(props);
190
191 const { background, brand } = props;
192
193 const androidOutputPath = platforms.includes("android")
194 ? getAndroidOutputPath({ flavor })
195 : undefined;
196
197 const iosOutputPath = platforms.includes("ios")
198 ? getIOSOutputPath()
199 : undefined;
200
201 const htmlTemplatePath = platforms.includes("web")
202 ? getHtmlTemplatePath({ html })
203 : undefined;
204
205 if (androidOutputPath != null) {
206 await writeAndroidAssets({ androidOutputPath, props });
207
208 const manifestXmlPath = path.resolve(
209 androidOutputPath,
210 "..",
211 "AndroidManifest.xml",
212 );
213
214 if (hfs.exists(manifestXmlPath)) {
215 const manifestXml = readXmlLike(manifestXmlPath);
216 const activities = manifestXml.root.querySelectorAll("activity");
217
218 for (const activity of activities) {
219 if (activity.getAttribute("android:name") === ".MainActivity") {
220 activity.setAttribute("android:theme", "@style/BootTheme");
221 }
222 }

Callers 1

cli.jsFile · 0.85

Calls 12

transformPropsFunction · 0.90
requireAddonFunction · 0.90
writeAndroidAssetsFunction · 0.90
readXmlLikeFunction · 0.90
writeXmlLikeFunction · 0.90
writeIOSAssetsFunction · 0.90
writeWebAssetsFunction · 0.90
writeGenericAssetsFunction · 0.90
getAndroidOutputPathFunction · 0.85
getIOSOutputPathFunction · 0.85
getHtmlTemplatePathFunction · 0.85
getInfoPlistPathFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…