How to use the @sanity/resolver function in @sanity/resolver

To help you get started, we’ve selected a few @sanity/resolver 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 sanity-io / sanity / packages / @sanity / core / src / actions / config / reinitializePluginConfigs.js View on Github external
async function reinitializePluginConfigs(options, flags = {}) {
  const {workDir, output, env} = options

  const localChecksums = await getChecksums(workDir)
  const allPlugins = await resolveTree({basePath: workDir, env})
  const pluginsWithDistConfig = (await Promise.all(allPlugins.map(pluginHasDistConfig))).filter(
    Boolean
  )
  const distChecksums = await Promise.all(pluginsWithDistConfig.map(getPluginConfigChecksum))
  const withLocalConfigs = await Promise.all(distChecksums.map(hasLocalConfig))
  const missingConfigs = await Promise.all(withLocalConfigs.map(createMissingConfig))
  const configPlugins = missingConfigs.map(warnOnDifferingChecksum)

  return missingConfigs.length > 0 ? saveNewChecksums(configPlugins) : Promise.resolve()

  function hasLocalConfig(plugin) {
    return localConfigExists(workDir, plugin.name).then(configDeployed =>
      Object.assign({}, plugin, {configDeployed})
    )
  }

@sanity/resolver

Resolves parts and plugins from a Sanity configuration

MIT
Latest version published 1 year ago

Package Health Score

79 / 100
Full package analysis