How to use the @expo/xdl.ExponentTools.parseSdkMajorVersion 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 / turtle / src / bin / setup / android / index.ts View on Github external
const inWorkingdir = (filename: string) => path.join(workingdir, filename);

  if (await fs.pathExists(inWorkingdir('universe-package.json'))) {
    // legacy shell app built from universe
    await fs.move(inWorkingdir('package.json'), inWorkingdir('exponent-package.json'));
    await fs.move(inWorkingdir('universe-package.json'), inWorkingdir('package.json'));
    await _installNodeModules(workingdir);
    await fs.move(inWorkingdir('package.json'), inWorkingdir('universe-package.json'));
    await fs.move(inWorkingdir('exponent-package.json'), inWorkingdir('package.json'));
  } else {
    // new shell app built from expo or not
    await _installNodeModules(workingdir);
  }

  // TODO: remove this after making sure that we don't need node_modules in tools-public for older sdks
  if (ExponentTools.parseSdkMajorVersion(sdkVersion) < 33) {
    const toolsPublicDir = path.join(workingdir, 'tools-public');
    await _installNodeModules(toolsPublicDir);
  }
}
github expo / turtle / src / builders / ios / context.ts View on Github external
export function createBuilderContext(job: IJob): IContext {
  const { join } = path;
  const appUUID = uuidv4();
  const {
    manifest: {
      sdkVersion: sdkVersionFromManifest = null,
    } = {},
    sdkVersion: sdkVersionFromJob,
    config: { buildType },
  } = job;

  const sdkVersion = sdkVersionFromJob || sdkVersionFromManifest;
  const workingDir = formatShellAppDirectory({ sdkVersion, buildType: buildType! });
  const majorSdkVersion = ExponentTools.parseSdkMajorVersion(sdkVersion);

  const context: any = {
    appDir: join(config.directories.temporaryFilesRoot, appUUID),
    appUUID,
    workingDir,
  };
  context.buildDir = join(context.appDir, 'build');
  context.provisioningProfileDir = join(context.appDir, 'provisioning');
  context.provisioningProfilePath = join(
    context.provisioningProfileDir,
    `${appUUID}.mobileprovision`,
  );
  context.tempCertPath = join(context.appDir, 'cert.p12');
  context.baseArchiveDir = join(context.appDir, 'archive');

  if (buildType === IOS_BUILD_TYPES.CLIENT) {
github expo / turtle / src / builders / utils / android / workingdir.ts View on Github external
export function formatShellAppDirectory({ sdkVersion }: IShellAppDirectoryConfig) {
  const majorSdkVersion = ExponentTools.parseSdkMajorVersion(sdkVersion);
  return config.builder.useLocalWorkingDir
    ? path.join(config.directories.workingDir, 'local')
    : path.join(config.directories.workingDir, PLATFORMS.ANDROID, `sdk${majorSdkVersion}`);
}
github expo / turtle / src / builders / utils / ios / workingdir.ts View on Github external
export function formatShellAppDirectory({ sdkVersion, buildType }: IShellAppDirectoryConfig) {
  const { workingDir } = config.directories;
  if (buildType === IOS_BUILD_TYPES.CLIENT) {
    return path.join(workingDir, PLATFORMS.IOS, 'client');
  } else if (config.builder.useLocalWorkingDir) {
    return path.join(workingDir, 'local');
  } else {
    const majorVersion = ExponentTools.parseSdkMajorVersion(sdkVersion);
    return path.join(workingDir, PLATFORMS.IOS, `sdk${majorVersion}`);
  }
}
github expo / turtle / src / bin / setup / utils / common.ts View on Github external
async function _readShellAppTarballS3Uri(sdkVersion: string, formatters: IShellAppFormaters) {
  const sdkMajorVersion = ExponentTools.parseSdkMajorVersion(sdkVersion);
  const filePath = formatters.formatShellAppTarballUriPath(sdkMajorVersion);
  const data = await fs.readFile(filePath, 'utf8');
  return data.trim();
}
github expo / turtle / src / builders / utils / version.ts View on Github external
export async function ensureCanBuildSdkVersion(job: IJob) {
  if (config.builder.useLocalWorkingDir) {
    return;
  }

  const platformVersions = await findSupportedSdkVersions(job.platform);
  const targetMajorSdkVersion = ExponentTools.parseSdkMajorVersion(job.sdkVersion || job.manifest.sdkVersion);
  if (!platformVersions.includes(targetMajorSdkVersion)) {
    throw new Error(`Unsupported SDK Version!`);
  }
}