Repository: tailwindlabs/tailwindcss
File: packages/@tailwindcss-upgrade/src/index.ts (TypeScript)

Code before:
    {
      // Template migrations
      for (let config of configBySheet.values()) {
        info(
          `Migrating templates using the provided configuration file: ${highlight(relative(config.configFilePath, base))}.`,
        )
        let set = new Set<string>()
        for (let globEntry of config.globs.flatMap((entry) => hoistStaticGlobParts(entry))) {
          let files = await globby([globEntry.pattern], {
            absolute: true,
            gitignore: true,
            cwd: globEntry.base,
          })

          for (let file of files) {
            set.add(file)
          }
        }

        let files = Array.from(set)
        files.sort()

        // Migrate each file
        await Promise.allSettled(
          files.map((file) => migrateTemplate(config.designSystem, config.userConfig, file)),
        )

        success('↳ Template migration complete.')
      }
    }

    // Migrate each CSS file
    info('Migrating stylesheets')
    let migrateResults = await Promise.allSettled(
      stylesheets.map((sheet) => {
        let config = configBySheet.get(sheet)!
        let jsConfigMigration = jsConfigMigrationBySheet.get(sheet)!

        if (!config) {
          for (let parent of sheet.ancestors()) {
            if (parent.isTailwindRoot) {
              config ??= configBySheet.get(parent)!
              jsConfigMigration ??= jsConfigMigrationBySheet.get(parent)!
              break
            }
          }
        }

        return migrateStylesheet(sheet, { ...config, jsConfigMigration })
      }),
    )

Review comment (suggestion):
This is also moved into the loop so you can see each migration complete. I also included `↳` which looked a bit nicer, but this can be changed of course.

Code after:

    // Migrate source files, linked to config files
    info('Migrating templates…')
    {
      // Template migrations
      for (let config of configBySheet.values()) {
        let set = new Set<string>()
        for (let globEntry of config.globs.flatMap((entry) => hoistStaticGlobParts(entry))) {
          let files = await globby([globEntry.pattern], {
            absolute: true,
            gitignore: true,
            cwd: globEntry.base,
          })

          for (let file of files) {
            set.add(file)
          }
        }

        let files = Array.from(set)
        files.sort()

        // Migrate each file
        await Promise.allSettled(
          files.map((file) => migrateTemplate(config.designSystem, config.userConfig, file)),
        )

        success(
          `↳ Migrated templates for configuration file: ${highlight(relative(config.configFilePath, base))}`,
        )
      }
    }

    // Migrate each CSS file
    info('Migrating stylesheets…')
    let migrateResults = await Promise.allSettled(
      stylesheets.map((sheet) => {
        let config = configBySheet.get(sheet)!
        let jsConfigMigration = jsConfigMigrationBySheet.get(sheet)!

        if (!config) {
          for (let parent of sheet.ancestors()) {
            if (parent.isTailwindRoot) {
              config ??= configBySheet.get(parent)!
              jsConfigMigration ??= jsConfigMigrationBySheet.get(parent)!
              break
            }
          }
        }

        return migrateStylesheet(sheet, { ...config, jsConfigMigration })