How to use the json-future.saveAsync function in json-future

To help you get started, we’ve selected a few json-future 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 microlinkhq / www / scripts / fetch-data.js View on Github external
module.exports = async ({ dist, url }) => {
  try {
    if (await existsFile(dist)) return
    const { body } = await got(url, { json: true })
    return jsonFuture.saveAsync(dist, body)
  } catch (err) {
    console.log(beautyError(err))
    process.exit(1)
  }
}
github Kikobeats / git-authors-cli / bin / index.js View on Github external
: !isSameEmail(pkgAuthor.email, email)
    )
    .sort((c1, c2) => c2.commits - c1.commits)

  const maxIndent = contributors.length
    ? getMaxIndent(contributors, 'commits')
    : ''

  if (contributors.length) {
    if (print) renderContributors(contributors, maxIndent)
    const pkg = await loadPkg(pkgPath)

    if (pkg && save) {
      const newContributors = contributors.map(({ author }) => author)
      const newPkg = { ...pkg, contributors: newContributors }
      await jsonFuture.saveAsync(pkgPath, newPkg)
      if (print) {
        console.log(
          `\n${indent(maxIndent)} ${chalk.gray(
            `Added into ${chalk.white('package.json')} ✨`
          )}`
        )
      }
    }
  }
}
github microlinkhq / www / scripts / fetch-introspection-query.js View on Github external
const main = async () => {
  if (!existsFile.sync(INTROSPECTION_PATH)) {
    throw new Error('Introspection file not detected!')
  }

  if (NODE_ENV === 'production') return

  const graphqlEndpoint = `${MICROLINK_API_ENDPOINT}/graphql`
  const query = stringify({ query: getIntrospectionQuery() })
  const { body } = await got(`${graphqlEndpoint}?${query}`, { json: true })
  return jsonFuture.saveAsync(INTROSPECTION_PATH, body)
}

json-future

Unbelievable and Modern JSON interface.

MIT
Latest version published 6 months ago

Package Health Score

67 / 100
Full package analysis