Initial commit
This commit is contained in:
26
lib/fetch-remote-component.js
Normal file
26
lib/fetch-remote-component.js
Normal file
@@ -0,0 +1,26 @@
|
||||
// Suppress console.log from the resolver during fetching
|
||||
const originalLog = console.log;
|
||||
console.log = () => {};
|
||||
|
||||
const { fetchRemoteComponent } = require('./metro-ior-resolver.js');
|
||||
|
||||
// Restore console.log for our output
|
||||
console.log = originalLog;
|
||||
|
||||
const ior = process.argv[2];
|
||||
if (!ior) {
|
||||
console.error('No IOR provided');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
fetchRemoteComponent(ior)
|
||||
.then(path => {
|
||||
// Output only the path on stdout
|
||||
console.log(path);
|
||||
process.exit(0);
|
||||
})
|
||||
.catch(err => {
|
||||
// Output error to stderr
|
||||
console.error('FETCH_ERROR:', err.message);
|
||||
process.exit(1);
|
||||
});
|
||||
Reference in New Issue
Block a user