MCPcopy Create free account
hub / github.com/ptmt/react-native-macos / saveAssets

Function saveAssets

local-cli/bundle/saveAssets.js:19–44  ·  view source on GitHub ↗
(
  assets,
  platform,
  assetsDest
)

Source from the content-addressed store, hash-verified

17const path = require('path');
18
19function saveAssets(
20 assets,
21 platform,
22 assetsDest
23) {
24 if (!assetsDest) {
25 console.warn('Assets destination folder is not set, skipping...');
26 return Promise.resolve();
27 }
28
29 const getAssetDestPath = platform === 'android'
30 ? getAssetDestPathAndroid
31 : getAssetDestPathIOS;
32
33 const filesToCopy = Object.create(null); // Map src -> dest
34 assets
35 .forEach(asset =>
36 filterPlatformAssetScales(platform, asset.scales).forEach((scale, idx) => {
37 const src = asset.files[idx];
38 const dest = path.join(assetsDest, getAssetDestPath(asset, scale));
39 filesToCopy[src] = dest;
40 })
41 );
42
43 return copyAll(filesToCopy);
44}
45
46function copyAll(filesToCopy) {
47 const queue = Object.keys(filesToCopy);

Callers 1

buildBundleFunction · 0.85

Calls 4

copyAllFunction · 0.85
resolveMethod · 0.65
createMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…