-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[expo-updates] Fetch asset manifest through programmatic CLI interfac…
…e instead of depending on a running React Native CLI server (#9372) * Fetch asset manifest through programmatic CLI interface instead of depending on a running React Native CLI server * Update CHANGELOG
- Loading branch information
1 parent
f3e9100
commit a8a3044
Showing
7 changed files
with
129 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
const { loadAsync } = require('@expo/metro-config'); | ||
const Server = require('metro/src/Server'); | ||
|
||
async function fetchAssetManifestAsync(platform, projectRoot) { | ||
const config = await loadAsync(projectRoot); | ||
const server = new Server(config); | ||
|
||
const requestOpts = { | ||
entryFile: process.env.ENTRY_FILE || 'index.js', | ||
dev: false, | ||
minify: false, | ||
platform, | ||
}; | ||
|
||
let assetManifest; | ||
let error; | ||
try { | ||
assetManifest = await server.getAssets({ | ||
...Server.DEFAULT_BUNDLE_OPTIONS, | ||
...requestOpts, | ||
}); | ||
} catch (e) { | ||
error = e; | ||
} finally { | ||
server.end(); | ||
} | ||
|
||
if (error) { | ||
throw error; | ||
} | ||
|
||
return assetManifest; | ||
} | ||
|
||
module.exports = fetchAssetManifestAsync; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters