How to use the @expo/json-file.default function in @expo/json-file

To help you get started, we’ve selected a few @expo/json-file 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 / tools-public / generate-dynamic-macros.js View on Github external
async function getTemplateSubstitutions() {
  try {
    return await new JsonFile(path.join(EXPONENT_DIR, 'secrets', 'keys.json')).readAsync();
  } catch (e) {
    // Don't have access to decrypted secrets, use public keys
    console.log('generate-dynamic-macros is falling back to `template-files/keys.json`');
    return await new JsonFile(path.join(EXPONENT_DIR, 'template-files', 'keys.json')).readAsync();
  }
}
github expo / expo / tools-public / generate-dynamic-macros.js View on Github external
async function getSavedDevHomeUrlAsync(platform) {
  let devHomeConfig = await new JsonFile(
    path.join(EXPONENT_DIR, 'dev-home-config.json')
  ).readAsync();
  return devHomeConfig.url;
}
github expo / expo / tools-public / generate-dynamic-macros.js View on Github external
async function copyTemplateFilesAsync(platform, args, templateSubstitutions) {
  let templateFilesPath = args.templateFilesPath || path.join(EXPONENT_DIR, 'template-files');
  let templatePaths = await new JsonFile(
    path.join(templateFilesPath, `${platform}-paths.json`)
  ).readAsync();

  let promises = [];
  _.forEach(templatePaths, (dest, source) => {
    promises.push(
      copyTemplateFileAsync(
        path.join(templateFilesPath, platform, source),
        path.join(EXPONENT_DIR, dest, source),
        templateSubstitutions,
        args.configuration
      )
    );
  });

  await Promise.all(promises);
github expo / expo / tools-public / project-versions.js View on Github external
function sdkVersionAsync(packageJsonFilePath) {
  return new JsonFile(packageJsonFilePath).getAsync('exp').then(exp => {
    if (!exp.hasOwnProperty('sdkVersion')) {
      throw new Error(`SDK version is missing from the project's package.json file`);
    }
    return exp.sdkVersion;
  });
}

@expo/json-file

A module for reading, writing, and manipulating JSON files

MIT
Latest version published 2 months ago

Package Health Score

92 / 100
Full package analysis