Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Wait for and parse results
const allDone = new Promise(resolve => {
ProjectUtils.attachLoggerStream(testSuitePath, {
type: 'raw',
stream: {
write: chunk => {
if (chunk.msg.indexOf('[TEST-SUITE-END]') >= 0) {
resolve(JSON.parse(chunk.msg));
}
},
},
});
});
const results = await allDone;
await Project.stopAsync(testSuitePath);
process.exit(results.failed);
}
if (!exp.sdkVersion) {
if (workflow === 'bare') {
log.error(
'This command only works for bare workflow projects that also have the expo package installed and sdkVersion configured in app.json.'
);
throw new CommandError('SDK_VERSION_REQUIRED_FOR_UPGRADE_COMMAND_IN_BARE');
} else {
log.error('No sdkVersion field is present in app.json, cannot upgrade project.');
throw new CommandError('SDK_VERSION_REQUIRED_FOR_UPGRADE_COMMAND_IN_MANAGED');
}
}
// Can't upgrade if Expo is running
let status = await Project.currentStatus(projectRoot);
if (status === 'running') {
await Project.stopAsync(projectRoot);
log(
chalk.bold.underline(
'We found an existing expo-cli instance running for this project and closed it to continue.'
)
);
log.addNewLineIfNone();
}
let currentSdkVersionString = exp.sdkVersion;
let sdkVersions = await Versions.releasedSdkVersionsAsync();
let latestSdkVersion = await Versions.newestReleasedSdkVersionAsync();
let latestSdkVersionString = latestSdkVersion.version;
let targetSdkVersionString =
maybeFormatSdkVersion(requestedSdkVersion) || latestSdkVersion.version;
let targetSdkVersion = sdkVersions[targetSdkVersionString];
dumpAssetmap: options.dumpAssetmap,
dumpSourcemap: options.dumpSourcemap,
isDev: options.dev,
};
const absoluteOutputDir = path.resolve(process.cwd(), options.outputDir);
await Project.exportForAppHosting(
projectDir,
options.publicUrl,
options.assetUrl,
absoluteOutputDir,
exportOptions
);
if (startedOurOwn) {
log('Terminating server processes.');
await Project.stopAsync(projectDir);
}
// Merge src dirs/urls into a multimanifest if specified
const mergeSrcDirs = [];
// src urls were specified to merge in, so download and decompress them
if (options.mergeSrcUrl.length > 0) {
// delete .tmp if it exists and recreate it anew
const tmpFolder = path.resolve(projectDir, path.join('.tmp'));
await fs.remove(tmpFolder);
await fs.ensureDir(tmpFolder);
// Download the urls into a tmp dir
const downloadDecompressPromises = options.mergeSrcUrl.map(async url => {
// Add the absolute paths to srcDir
const uniqFilename = `${path.basename(url, '.tar.gz')}_${crypto
process.on('SIGINT', () => {
console.log(chalk.blue('\nStopping packager...'));
Project.stopAsync(projectDir).then(() => {
console.log(chalk.green('Packager stopped.'));
process.exit();
});
});
}
if (currentState === STATE_INITIAL) {
console.log('Triggering a live reload...');
Fixtures.recordFindTextOnScreenEvent('INITIAL_STATE');
currentState = STATE_FINISHED_FIRST_LOAD;
await _rewriteAppJsFileAsync(projectDir, 'AFTER_LIVE_RELOAD');
console.log(
`Sometimes triggering a live reload doesn't work. If it's not happening please run 'touch ${path.join(
projectDir,
'App.js'
)}'`
);
} else {
console.log('Shutting down...');
Fixtures.recordFindTextOnScreenEvent('AFTER_LIVE_RELOAD');
await Project.stopAsync(projectDir);
await _rewriteAppJsFileAsync(projectDir, 'INITIAL_STATE');
process.exit(0);
}
}
},
},
let url = result.url;
if (options.quiet) {
simpleSpinner.stop();
}
log('Published');
log('Your URL is\n\n' + chalk.underline(url) + '\n');
log.raw(url);
if (recipient) {
await sendTo.sendUrlAsync(url, recipient);
}
} finally {
if (startedOurOwn) {
await Project.stopAsync(projectDir);
}
}
return result;
}
let url = result.url;
if (options.quiet) {
simpleSpinner.stop();
}
log('Published');
log('Your URL is\n\n' + chalk.underline(url) + '\n');
log.raw(url);
if (recipient) {
await sendTo.sendUrlAsync(url, recipient);
}
} finally {
if (startedOurOwn) {
await Project.stopAsync(projectDir);
}
}
return result;
}