How to use the @expo/xdl.Project.buildAsync function in @expo/xdl

To help you get started, we’ve selected a few @expo/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 expo / expo-cli / packages / expo-cli / src / commands / build / BaseBuilder.js View on Github external
if (platform === 'ios') {
        opts = {
          ...opts,
          type: this.options.type,
          bundleIdentifier,
        };
      } else if (platform === 'android') {
        opts = {
          ...opts,
          type: this.options.type,
        };
      }

      // call out to build api here with url
      result = await Project.buildAsync(this.projectDir, opts);
    }
    const { id: buildId, priority, canPurchasePriorityBuilds } = result;

    log('Build started, it may take a few minutes to complete.');
    log(
      `You can check the queue length at ${chalk.underline(UrlUtils.constructTurtleStatusUrl())}\n`
    );
    if (priority === 'normal' && canPurchasePriorityBuilds) {
      log(
        'You can make this faster. 🐢\nGet priority builds at: https://expo.io/settings/billing\n'
      );
    }

    const username = this.manifest.owner
      ? this.manifest.owner
      : await UserManager.getCurrentUsernameAsync();
github expo / expo-cli / packages / expo-cli / src / commands / build / BaseBuilder.js View on Github external
async wait(buildId, { timeout = 1200, interval = 30, publicUrl } = {}) {
    log(`Waiting for build to complete. You can press Ctrl+C to exit.`);
    let spinner = ora().start();
    let time = new Date().getTime();
    const endTime = time + secondsToMilliseconds(timeout);
    while (time <= endTime) {
      let res;
      if (process.env.EXPO_NEXT_API) {
        res = await Project.getBuildStatusAsync(this.projectDir, {
          current: false,
          ...(publicUrl ? { publicUrl } : {}),
        });
      } else {
        res = await Project.buildAsync(this.projectDir, {
          current: false,
          mode: 'status',
          ...(publicUrl ? { publicUrl } : {}),
        });
      }
      const job = fp.compose(
        fp.head,
        fp.filter(job => buildId && job.id === buildId),
        fp.getOr([], 'jobs')
      )(res);

      switch (job.status) {
        case 'finished':
          spinner.succeed('Build finished.');
          return job;
        case 'pending':
github expo / expo-cli / packages / expo-cli / src / commands / build / BaseBuilder.js View on Github external
async checkForBuildInProgress() {
    log('Checking if there is a build in progress...\n');
    let buildStatus;
    if (process.env.EXPO_NEXT_API) {
      buildStatus = await Project.getBuildStatusAsync(this.projectDir, {
        platform: this.platform(),
        current: true,
        releaseChannel: this.options.releaseChannel,
        publicUrl: this.options.publicUrl,
        sdkVersion: this.manifest.sdkVersion,
      });
    } else {
      buildStatus = await Project.buildAsync(this.projectDir, {
        mode: 'status',
        platform: this.platform(),
        current: true,
        releaseChannel: this.options.releaseChannel,
        publicUrl: this.options.publicUrl,
        sdkVersion: this.manifest.sdkVersion,
      });
    }
    if (buildStatus.jobs && buildStatus.jobs.length) {
      throw new BuildError('Cannot start a new build, as there is already an in-progress build.');
    }
  }
github expo / expo-cli / packages / expo-cli / src / commands / publish.js View on Github external
const startOpts = { reset: options.clear, nonPersistent: true };
    if (options.maxWorkers) {
      startOpts.maxWorkers = options.maxWorkers;
    }

    await Project.startAsync(projectDir, startOpts, !options.quiet);
    startedOurOwn = true;
  }

  let recipient = await sendTo.getRecipient(options.sendTo);
  log(`Publishing to channel '${options.releaseChannel}'...`);

  const { args: { sdkVersion } } = await Exp.getPublishInfoAsync(projectDir);

  const buildStatus = await Project.buildAsync(projectDir, {
    mode: 'status',
    platform: 'all',
    current: true,
    releaseChannel: options.releaseChannel,
    sdkVersion,
  });

  const { exp } = await readConfigJsonAsync(projectDir, { requireLocalConfig: true });

  if (
    buildStatus.userHasBuiltExperienceBefore &&
    !buildStatus.userHasBuiltAppBefore &&
    !options.duringBuild &&
    !exp.isDetached
  ) {
    log.warn(
github expo / expo-cli / packages / expo-cli / src / commands / publish.js View on Github external
if (options.maxWorkers) {
      startOpts.maxWorkers = options.maxWorkers;
    }

    await Project.startAsync(projectDir, startOpts, !options.quiet);
    startedOurOwn = true;
  }

  let recipient = await sendTo.getRecipient(options.sendTo);
  log(`Publishing to channel '${options.releaseChannel}'...`);

  const {
    args: { sdkVersion },
  } = await Exp.getPublishInfoAsync(projectDir);

  const buildStatus = await Project.buildAsync(projectDir, {
    mode: 'status',
    platform: 'all',
    current: true,
    releaseChannel: options.releaseChannel,
    sdkVersion,
  });

  const { exp } = await ProjectUtils.readConfigJsonAsync(projectDir);

  if (
    buildStatus.userHasBuiltExperienceBefore &&
    !buildStatus.userHasBuiltAppBefore &&
    !options.duringBuild &&
    !exp.isDetached
  ) {
    log.warn(
github expo / expo-cli / packages / expo-cli / src / commands / build / BaseBuilder.js View on Github external
async checkStatus(platform: string = 'all'): Promise {
    log('Fetching build history...\n');

    let buildStatus;
    if (process.env.EXPO_NEXT_API) {
      buildStatus = await Project.getBuildStatusAsync(this.projectDir, {
        platform,
        current: false,
        releaseChannel: this.options.releaseChannel,
      });
    } else {
      buildStatus = await Project.buildAsync(this.projectDir, {
        mode: 'status',
        platform,
        current: false,
        releaseChannel: this.options.releaseChannel,
      });
    }
    if (buildStatus.err) {
      throw new Error('Error getting current build status for this project.');
    }

    if (!(buildStatus.jobs && buildStatus.jobs.length)) {
      log('No currently active or previous builds for this project.');
      return;
    }

    await this.logBuildStatuses(buildStatus);
github expo / expo-cli / packages / expo-cli / src / commands / url.ts View on Github external
const logArtifactUrl = (platform: 'ios' | 'android') => async (
  projectDir: string,
  options: ArtifactUrlOptions
) => {
  if (options.publicUrl && !UrlUtils.isHttps(options.publicUrl)) {
    throw new CommandError('INVALID_PUBLIC_URL', '--public-url must be a valid HTTPS URL.');
  }

  let res;
  if (process.env.EXPO_NEXT_API) {
    res = await Project.getBuildStatusAsync(projectDir, {
      current: false,
      ...(options.publicUrl ? { publicUrl: options.publicUrl } : {}),
    });
  } else {
    res = await Project.buildAsync(projectDir, {
      current: false,
      mode: 'status',
      ...(options.publicUrl ? { publicUrl: options.publicUrl } : {}),
    });
  }
  const url = fp.compose(
    fp.get(['artifacts', 'url']),
    fp.head,
    fp.filter((job: any) => platform && job.platform === platform),
    fp.getOr([], 'jobs')
  )(res as any);
  if (url) {
    log.nested(url);
  } else {
    throw new Error(
      `No ${platform} binary file found. Use "expo build:${platform}" to create one.`