Repository: prisma/prisma
File: scripts/ci/publish.ts (TypeScript)

Code before:
      }

      // set the version in package.json for current package
      await writeVersion(pkgDir, newVersion, dryRun)

      // For package `prisma`, get latest commit hash (that is being released)
      // and put into `prisma.prismaCommit` in `package.json` before publishing
      if (pkgName === 'prisma') {
        const latestCommitHash = await getLatestCommitHash('.')
        await writeToPkgJson(pkgDir, (pkg) => {
          // Note: this is the only non-deprecated usage of `prisma` config in `package.json`.
          // It's for internal usage only.
          pkg.prisma.prismaCommit = latestCommitHash
        })
      }

      if (!isSkipped(pkgName)) {
        /*
         *  About `--no-git-checks`
         *  By default, `pnpm publish` will make some checks before actually publishing a new version of your package.
         *  The next checks will happen:
         *  - The current branch is your publish branch. The publish branch is `master` by default. This is configurable through the `publish-branch` setting.
         *  - Your working directory is clean (there are no uncommitted changes).
         *  - The branch is up-to-date.
         */
        await run(pkgDir, `pnpm publish --no-git-checks --access public${tag ? ` --tag ${tag}` : ''}`, dryRun)
      }
    }
  }
}

function isSkipped(pkgName) {
  if (skipPackages && skipPackages.includes(pkgName)) {
    return true
  }

  if (onlyPackages && !onlyPackages.includes(pkgName)) {
    return true
  }

  return false
}

async function writeToPkgJson(pkgDir, cb: (pkg: any) => any, dryRun?: boolean) {
  const pkgJsonPath = path.join(pkgDir, 'package.json')
  const file = await fs.promises.readFile(pkgJsonPath, 'utf-8')
  let packageJson = JSON.parse(file)
  if (dryRun) {
    console.log(`Would write to ${pkgJsonPath} from ${packageJson.version} now`)
  } else {
    const result = cb(packageJson)

Review comment (suggestion):
I believe this will publish on the `latest` tag by default. I'm not sure if pnpm as the client and the npm registry allow it, but in npm CLI you can't actually publish a package without a dist-tag at all, you can only remove the dist-tag from the package after publishing.

I also think that we should, actually, have a dedicated dist-tag for the 6.x release line (`classic`/`old`/`prev`/whatever).

Code after:
        )
      }

      // set the version in package.json for current package
      await writeVersion(pkgDir, newVersion, dryRun)

      // For package `prisma`, get latest commit hash (that is being released)
      // and put into `prisma.prismaCommit` in `package.json` before publishing
      if (pkgName === 'prisma') {
        const latestCommitHash = await getLatestCommitHash('.')
        await writeToPkgJson(pkgDir, (pkg) => {
          // Note: this is the only non-deprecated usage of `prisma` config in `package.json`.
          // It's for internal usage only.
          pkg.prisma.prismaCommit = latestCommitHash
        })
      }

      if (!isSkipped(pkgName)) {
        /*
         *  About `--no-git-checks`
         *  By default, `pnpm publish` will make some checks before actually publishing a new version of your package.
         *  The next checks will happen:
         *  - The current branch is your publish branch. The publish branch is `master` by default. This is configurable through the `publish-branch` setting.
         *  - Your working directory is clean (there are no uncommitted changes).
         *  - The branch is up-to-date.
         */
        await run(pkgDir, `pnpm publish --no-git-checks --access public --tag ${tag}`, dryRun)
      }
    }
  }
}

function isSkipped(pkgName) {
  if (skipPackages && skipPackages.includes(pkgName)) {
    return true
  }

  if (onlyPackages && !onlyPackages.includes(pkgName)) {
    return true
  }

  return false
}

async function writeToPkgJson(pkgDir, cb: (pkg: any) => any, dryRun?: boolean) {
  const pkgJsonPath = path.join(pkgDir, 'package.json')
  const file = await fs.promises.readFile(pkgJsonPath, 'utf-8')
  let packageJson = JSON.parse(file)
  if (dryRun) {
    console.log(`Would write to ${pkgJsonPath} from ${packageJson.version} now`)
  } else {