async function generatePackageJson(name) {
  const packageUrl = new URL(name + '/', packagesUrl)
  const folderPath = path.relative(
    fileURLToPath(new URL('../', packagesUrl)),
    fileURLToPath(packageUrl)
  )

  const [files, file, commitResult] = await Promise.all([
    findDownAll(['.js', '.map', '.ts'], fileURLToPath(packageUrl)),
    read(new URL('package.json', packageUrl)),
    exec('git log --all --format="%cN <%cE>" "' + folderPath + '"')
  ])

  const codePaths = files.map(function (file) {
    return path.relative(fileURLToPath(packageUrl), file.path)
  })

  /** @type {PackageJson} */
  const previousPackage = JSON.parse(String(file))
  assert(ancestorPackage.author)

  const gitContributors = [...new Set(commitResult.stdout.split('\n'))]
    .sort()
    .filter(Boolean)
    .filter(function (d) {
      return !d.includes('<noreply')
    })

  // @ts-expect-error: `type-fest` has bugs.
  /** @satisfies {Partial<PackageJson>} */
  const packageJson = {
    author: ancestorPackage.author,
    bugs: ancestorPackage.bugs,
    contributors:
      gitContributors.length > 0 ? gitContributors : [ancestorPackage.author],
    dependencies: previousPackage.dependencies,
    description: previousPackage.description,
    exports: './index.js',
    files: codePaths
      .map((d) => {
        const index = d.indexOf(path.sep)
        return index === -1 ? d : d.slice(0, index + 1)
      })
      .filter(function (d, index, all) {
        return all.indexOf(d) === index
      })
      .sort(),
    funding: ancestorPackage.funding,
    keywords: (previousPackage.keywords || []).sort(),
    license: ancestorPackage.license,
    name,
    repository: ancestorPackage.repository + '/tree/main/' + folderPath,
    scripts: {},
    sideEffects: false,
    typeCoverage: {atLeast: 100, strict: true},
    type: 'module',
    version: previousPackage.version,
    xo: previousPackage.xo || {
      prettier: true,
      rules: {'capitalized-comments': 'off'}
    }
  }

  file.value = JSON.stringify(packageJson, undefined, 2) + '\n'
  file.data.changed = true

  return file
}
@param {string} name
  Name.
@returns {Promise<VFile>}
  Files.