Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async sendProjectUrl(parent, { recipient }, context) {
const currentProject = context.getCurrentProject();
let url = await UrlUtils.constructManifestUrlAsync(currentProject.projectDir);
let result = await Exp.sendAsync(recipient, url);
await UserSettings.setAsync('sendTo', recipient);
return { medium: result.medium, url }; // medium can be a phone number or email
},
setProjectManagerLayout(parent, { input }, context) {
async BUILD_MACHINE_KERNEL_MANIFEST(platform) {
if (process.env.SHELL_APP_BUILDER) {
return '';
}
const pathToHome = 'home';
const url = await UrlUtils.constructManifestUrlAsync(path.join(EXPO_DIR, pathToHome));
try {
const manifest = await getManifestAsync(url, platform, null);
if (manifest.name !== 'expo-home') {
console.log(
`Manifest at ${url} is not expo-home; using published kernel manifest instead...`
);
return '';
}
return kernelManifestObjectToJson(manifest);
} catch (e) {
console.error(
chalk.red(
`Unable to generate manifest from ${chalk.cyan(
pathToHome
async BUILD_MACHINE_KERNEL_MANIFEST(platform) {
if (process.env.SHELL_APP_BUILDER) {
return '';
}
let projectRoot = path.join(EXPONENT_DIR, 'home');
let manifest;
try {
let url = await UrlUtils.constructManifestUrlAsync(projectRoot);
console.log(
`Generating local kernel manifest from project root ${projectRoot} and url ${url}...`
);
manifest = await ExponentTools.getManifestAsync(url, {
'Exponent-Platform': platform,
Accept: 'application/expo+json,application/json',
}, { logger: getManifestAsyncLogger });
if (manifest.name !== 'expo-home') {
console.log(
`Manifest at ${url} is not expo-home; using published kernel manifest instead...`
);
return '';
}
} catch (e) {
console.error(`Unable to generate manifest from ${projectRoot}: ${e.message}`);
return '';
async function action(projectDir: string, options: ProjectUrlOptions) {
await urlOpts.optsAsync(projectDir, options);
if ((await Project.currentStatus(projectDir)) !== 'running') {
throw new CommandError(
'NOT_RUNNING',
`Project is not running. Please start it with \`expo start\`.`
);
}
const url = options.web
? await getWebAppUrlAsync(projectDir)
: await UrlUtils.constructManifestUrlAsync(projectDir);
log.newLine();
urlOpts.printQRCode(url);
log('Your URL is\n\n' + chalk.underline(url) + '\n');
log.raw(url);
if (!options.web) {
await printRunInstructionsAsync();
await urlOpts.handleMobileOptsAsync(projectDir, options);
}
}
async TEST_APP_URI() {
if (process.env.TEST_SUITE_URI) {
return process.env.TEST_SUITE_URI;
} else {
try {
let testSuitePath = path.join(__dirname, '..', 'apps', 'test-suite');
let status = await Project.currentStatus(testSuitePath);
if (status === 'running') {
return await UrlUtils.constructManifestUrlAsync(testSuitePath);
} else {
return '';
}
} catch (e) {
return '';
}
}
},
export const printServerInfo = async (projectDir, options = {}) => {
if (options.webOnly) {
Webpack.printConnectionInstructions(projectDir);
printHelp();
return;
}
const url = await UrlUtils.constructManifestUrlAsync(projectDir);
const username = await UserManager.getCurrentUsernameAsync();
log.newLine();
log.nested(` ${u(url)}`);
log.newLine();
urlOpts.printQRCode(url);
const wrap = wordwrap(2, process.stdout.columns || 80);
const wrapItem = wordwrap(4, process.stdout.columns || 80);
const item = text => ' \u2022 ' + trimStart(wrapItem(text));
const iosInfo = process.platform === 'darwin' ? `, or ${b('i')} for iOS simulator` : '';
log.nested(wrap(u('To run the app with live reloading, choose one of:')));
if (username) {
log.nested(
item(
`Sign in as ${i(
'@' + username
)} in Expo Client on Android or iOS. Your projects will automatically appear in the "Projects" tab.`
async function action(projectDir, options) {
const { exp, pkg, rootPath } = await configureProjectAsync(projectDir, options);
await validateDependenciesVersions(projectDir, exp, pkg);
const startOpts = parseStartOptions(projectDir, options);
await Project.startAsync(rootPath, startOpts);
const url = await UrlUtils.constructManifestUrlAsync(projectDir);
const recipient = await sendTo.getRecipient(options.sendTo);
if (recipient) {
await sendTo.sendUrlAsync(url, recipient);
}
await urlOpts.handleMobileOptsAsync(projectDir, options);
if (!startOpts.nonInteractive && !exp.isDetached) {
await TerminalUI.startAsync(projectDir, startOpts);
} else {
if (!exp.isDetached) {
log.newLine();
urlOpts.printQRCode(url);
}
log(`Your native app is running at ${chalk.underline(url)}`);
async function action(projectDir: string, options: { sendTo?: string }) {
await urlOpts.optsAsync(projectDir, options);
let url = await UrlUtils.constructManifestUrlAsync(projectDir);
log('Your URL is\n\n' + chalk.underline(url) + '\n');
log.raw(url);
let shouldQuit = false;
if (await urlOpts.handleMobileOptsAsync(projectDir, options)) {
shouldQuit = true;
}
if (shouldQuit) {
return;
}
var recipient;
if (typeof options.sendTo !== 'boolean') {
recipient = options.sendTo;
async TEST_APP_URI() {
if (process.env.TEST_SUITE_URI) {
return process.env.TEST_SUITE_URI;
} else {
try {
let testSuitePath = path.join(__dirname, '..', 'apps', 'test-suite');
let status = await Project.currentStatus(testSuitePath);
if (status === 'running') {
return await UrlUtils.constructManifestUrlAsync(testSuitePath);
} else {
return '';
}
} catch (e) {
return '';
}
}
},