How to use the xdl.Config.developerTool function in xdl

To help you get started, we’ve selected a few xdl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github react-community / create-react-native-app / react-native-scripts / src / scripts / ios.js View on Github external
// @flow

import { Config, ProjectSettings, Simulator, UrlUtils } from 'xdl';

import chalk from 'chalk';
import indent from 'indent-string';
import path from 'path';
import pathExists from 'path-exists';
import qr from 'qrcode-terminal';
import log from '../util/log';
import { hasYarn } from '../util/pm';

import packager from '../util/packager';

Config.validation.reactNativeVersionWarnings = false;
Config.developerTool = 'crna';
Config.offline = true;

const command: string = hasYarn(process.cwd()) ? 'yarnpkg' : 'npm';

if (!Simulator.isPlatformSupported()) {
  log(
    chalk.red(
      '\nThis command only works on macOS computers with Xcode and the iOS simulator installed.'
    )
  );
  log(
    chalk.yellow(
      `If you run \`${chalk.cyan(command + ' start')}\` then you can view your app on a physical device.\n`
    )
  );
  process.exit(1);
github react-community / create-react-native-app / react-native-scripts / src / scripts / android.js View on Github external
// @flow

import { Android, Config, ProjectSettings, UrlUtils } from 'xdl';

import chalk from 'chalk';
import indent from 'indent-string';
import path from 'path';
import pathExists from 'path-exists';
import qr from 'qrcode-terminal';
import log from '../util/log';

import packager from '../util/packager';

Config.validation.reactNativeVersionWarnings = false;
Config.developerTool = 'crna';
Config.offline = true;

packager.run(startAndroidAndPrintInfo);

// print a nicely formatted message with setup information
async function startAndroidAndPrintInfo() {
  const address = await UrlUtils.constructManifestUrlAsync(process.cwd());
  log.withTimestamp('Starting Android...');

  const { success, error } = await Android.openProjectAsync(process.cwd());

  qr.generate(address, qrCode => {
    log.withTimestamp(`${chalk.green('Packager started!')}`);
    log(
      `
To view your app with live reloading, point the Expo app to this QR code.
github expo / exp / src / exp.js View on Github external
// Setup analytics
    Analytics.setSegmentNodeKey('vGu92cdmVaggGA26s3lBX6Y5fILm8SQ7');
    Analytics.setVersionName(require('../package.json').version);
    _registerLogs();

    if (process.env.SERVER_URL) {
      let serverUrl = process.env.SERVER_URL;
      if (!serverUrl.startsWith('http')) {
        serverUrl = `http://${serverUrl}`;
      }
      let parsedUrl = url.parse(serverUrl);
      Config.api.host = parsedUrl.hostname;
      Config.api.port = parsedUrl.port;
    }

    Config.developerTool = 'exp';

    // Setup our commander instance
    program.name = 'exp';
    program
      .version(require('../package.json').version)
      .option('-o, --output [format]', 'Output format. pretty (default), raw');

    // Load each module found in ./commands by 'registering' it with our commander instance
    glob
      .sync('commands/*.js', {
        cwd: __dirname,
      })
      .forEach(file => {
        const commandModule = require(`./${file}`);
        if (typeof commandModule === 'function') {
          commandModule(program);
github expo / exp / src / exp.js View on Github external
Analytics.setVersionName(packageJSON.version);
    _registerLogs();

    UserManager.setInteractiveAuthenticationCallback(loginOrRegisterIfLoggedOut);

    if (process.env.SERVER_URL) {
      let serverUrl = process.env.SERVER_URL;
      if (!serverUrl.startsWith('http')) {
        serverUrl = `http://${serverUrl}`;
      }
      let parsedUrl = url.parse(serverUrl);
      Config.api.host = parsedUrl.hostname;
      Config.api.port = parsedUrl.port;
    }

    Config.developerTool = packageJSON.name;

    // Setup our commander instance
    program.name = programName;
    program
      .version(packageJSON.version)
      .option('-o, --output [format]', 'Output format. pretty (default), raw')
      .option(
        '--non-interactive',
        'Fail, if an interactive prompt would be required to continue. Enabled by default if stdin is not a TTY.'
      );

    // Load each module found in ./commands by 'registering' it with our commander instance
    const files = _.uniqBy(
      [
        ...(programName === 'exp'
          ? glob.sync('exp_commands/*.js', { cwd: __dirname })
github expo / xde / src / ui / MainScreen.js View on Github external
import NewProjectModal from './NewProjectModal';
import NewVersionAvailable from './NewVersionAvailable';
import Notification from './Notification';
import NotificationsTab from './NotificationsTab';
import StatusItem from './components/StatusItem';
import ProjectList from './ProjectList';
import StyleConstants from './StyleConstants';
import SharedStyles from './Styles';
import MenuItem from './toolbar/MenuItem';
import Popover from './toolbar/Popover';
import ToolBar from './toolbar/ToolBar';
import PackagerNotificationsSwitcher from './PackagerNotificationsSwitcher';
import Tab from './Tab';
import { installShellCommandsAsync } from '../utils/binaries';

Config.developerTool = 'xde';
Config.useReduxNotifications = true;

const NOTIFICATION_TIMEOUT_MS = 5000;
const OPTIONS_ICON_SIZE = 22;
const PROJECT_OPENED_MESSAGE =
  'Project opened! You can now use the "Share" or "Device" buttons to view your project.';

const TAB_LEFT_VISIBLE = 'tab-left-visible',
  TAB_RIGHT_VISIBLE = 'tab-right-visible',
  TAB_BOTH_VISIBLE = 'tab-both-visible';

const mapStateToProps = (state, props) => {
  return {
    projects: state.projects,
  };
};
github NervJS / taro / packages / taro-rn-runner / src / index.js View on Github external
UrlUtils,
  UserSettings,
  Exp
} = require('xdl')

const chalk = require('chalk')
const indent = require('indent-string')
const qr = require('qrcode-terminal')
const readline = require('readline')

const clearConsole = require('./util/clearConsole')
const log = require('./util/log')
const packager = require('./util/packager')

Config.validation.reactNativeVersionWarnings = false
Config.developerTool = 'crna'
Config.offline = true

let dev = true
let projectDir

const options = {
  interactive: true
}

const { stdin } = process
const startWaitingForCommand = () => {
  stdin.setRawMode(true)
  stdin.resume()
  stdin.setEncoding('utf8')
  stdin.on('data', handleKeypress)
}
github sysgears / apollo-universal-starter-kit / tools / webpack.run.js View on Github external
async function startExpoServer(projectRoot, packagerPort) {
  Config.validation.reactNativeVersionWarnings = false;
  Config.developerTool = 'crna';
  Config.offline = true;

  await Project.startExpoServerAsync(projectRoot);
  await ProjectSettings.setPackagerInfoAsync(projectRoot, {
    packagerPort
  });
}
github expo / xde / src / ui / App.js View on Github external
Binaries,
  Config,
  Env,
  Exp,
  Logger,
  NotificationCode,
  Project,
  ProjectSettings,
  ProjectUtils,
  Simulator,
  UrlUtils,
  User,
  UserSettings,
  Versions,
} from 'xdl';
Config.developerTool = 'xde';

import _ from 'lodash';
import bunyan from 'bunyan';
import { ipcRenderer, remote } from 'electron';
import path from 'path';
import React, {PropTypes} from 'react';
import JsonFile from '@exponent/json-file';

import {
  ModalEnum,
  PopoverEnum,
} from './Constants';

import Commands from './Commands';
import ConsoleLog from './ConsoleLog';
import LoginPage from './LoginPage';
github react-community / create-react-native-app / react-native-scripts / src / scripts / start.js View on Github external
import { Android, Config, Project, ProjectSettings, Simulator, UrlUtils, UserSettings } from 'xdl';

import chalk from 'chalk';
import indent from 'indent-string';
import qr from 'qrcode-terminal';
import minimist from 'minimist';
import readline from 'readline';
import { Exp } from 'xdl';

import clearConsole from '../util/clearConsole';
import log from '../util/log';
import packager from '../util/packager';

Config.validation.reactNativeVersionWarnings = false;
Config.developerTool = 'crna';
Config.offline = true;

const args = minimist(process.argv.slice(2), {
  boolean: ['reset-cache', 'interactive'],
  default: { interactive: true },
});
let dev = true;

const options = {};
if (args['reset-cache']) {
  options.reset = true;
  log('Asking packager to reset its cache...');
}

const { stdin } = process;
const startWaitingForCommand = () => {