Skip to content

Instantly share code, notes, and snippets.

@PicchiKevin
Last active November 16, 2023 11:02
Show Gist options
  • Save PicchiKevin/86d0a4cc0a872a1ae4dfac919b7c49ce to your computer and use it in GitHub Desktop.
Save PicchiKevin/86d0a4cc0a872a1ae4dfac919b7c49ce to your computer and use it in GitHub Desktop.
Heroicons v1 to v2

Heroicons v1 to v2 migration script

The goal of this script is to simply replce all the old heroicons icon name by the new one. (v1 -> v2) The script is probably the less efficient piece of code I ever wrote but it does the job. Thanks to @steveoh & @ryanburns23 for creating the initial list of changes in tailwindlabs/heroicons#750


The migrate.sh is generated by the few lines bellow. If you're running on MacOS you don't have to make any changes but if you're running it on Linux you might have to replace sed -i '' -e by sed -i. The script will avoid replacing strings in hidden folders (such as .git) but also node_modules/ anf the migrate.js file.


const heroiconsV1toV2 = {
  AdjustmentsVerticalIcon: 'AdjustmentsVerticalIcon',
  ChatBubbleBottomCenterTextIcon: 'ChatBubbleBottomCenterTextIcon',
  ArchiveBoxIcon: 'ArchiveBoxIcon',
  ArrowDownCircleIcon: 'ArrowDownCircleIcon',
  ArrowLeftCircleIcon: 'ArrowLeftCircleIcon',
  ArrowRightCircleIcon: 'ArrowRightCircleIcon',
  ArrowUpCircleIcon: 'ArrowUpCircleIcon',
  ArrowLongDownIcon: 'ArrowLongDownIcon',
  ArrowLongLeftIcon: 'ArrowLongLeftIcon',
  ArrowLongRightIcon: 'ArrowLongRightIcon',
  ArrowLongUpIcon: 'ArrowLongUpIcon',
  ArrowsPointingOutIcon: 'ArrowsPointingOutIcon',
  CheckBadgeIcon: 'CheckBadgeIcon',
  NoSymbolIcon: 'NoSymbolIcon',
  BookmarkSquareIcon: 'BookmarkSquareIcon',
  BanknotesIcon: 'BanknotesIcon',
  ChartBarSquareIcon: 'ChartBarSquareIcon',
  ChatBubbleLeftRightIcon: 'ChatBubbleLeftRightIcon',
  ChatBubbleLeftEllipsisIcon: 'ChatBubbleLeftEllipsisIcon',
  ChatBubbleOvalLeftEllipsisIcon: 'ChatBubbleOvalLeftEllipsisIcon',
  CpuChipIcon: 'CpuCpuChipIcon',
  ClipboardDocumentCheckIcon: 'ClipboardDocumentCheckIcon',
  ClipboardDocumentIcon: 'ClipboardDocumentIcon',
  ClipboardDocumentListIcon: 'ClipboardDocumentListIcon',
  CloudArrowDownIcon: 'CloudArrowDownIcon',
  CloudArrowUpIcon: 'CloudArrowUpIcon',
  CodeBracketIcon: 'CodeBracketIcon',
  RectangleStackIcon: 'RectangleStackIcon',
  SwatchIcon: 'SwatchIcon',
  CursorArrowRaysIcon: 'CursorArrowRaysIcon',
  CircleStackIcon: 'CircleStackIcon',
  ComputerDesktopIcon: 'ComputerDesktopIcon',
  DevicePhoneMobileIcon: 'DevicePhoneMobileIcon',
  DocumentPlusIcon: 'DocumentPlusIcon',
  DocumentArrowDownIcon: 'DocumentArrowDownIcon',
  DocumentMinusIcon: 'DocumentMinusIcon',
  DocumentChartBarIcon: 'DocumentChartBarIcon',
  DocumentMagnifyingGlassIcon: 'DocumentMagnifyingGlassIcon',
  EllipsisHorizontalCircleIcon: 'EllipsisHorizontalCircleIcon',
  EllipsisHorizontalIcon: 'EllipsisHorizontalIcon',
  EllipsisVerticalIcon: 'EllipsisVerticalIcon',
  ArrowDownTrayIcon: 'ArrowDownTrayIcon',
  Square2StackIcon: 'Square2StackIcon',
  FaceSmileIcon: 'FaceSmileIcon',
  FaceFrownIcon: 'FaceFrownIcon',
  ExclamationIcon: 'ExclamationIcon',
  ArrowTopRightOnSquareIcon: 'ArrowTopRightOnSquareIcon',
  EyeSlashIcon: 'EyeSlashIcon',
  ForwardIcon: 'ForwardIcon',
  FunnelIcon: 'FunnelIcon',
  FolderPlusIcon: 'FolderPlusIcon',
  FolderArrowDownTrayIcon: 'FolderArrowDownIcon',
  FolderMinusIcon: 'FolderMinusIcon',
  GlobeEuropeAfricaIcon: 'GlobeEuropeAfricaIcon',
  HandRaisedIcon: 'HandRaisedIcon',
  InboxArrowDownIcon: 'InboxArrowDownIcon',
  BuildingLibraryIcon: 'BuildingBuildingLibraryIcon',
  BoltIcon: 'BoltIcon',
  MapPinIcon: 'MapPinIcon',
  ArrowLeftOnRectangleIcon: 'ArrowLeftOnRectangleIcon',
  ArrowRightOnRectangleIcon: 'ArrowRightOnRectangleIcon',
  EnvelopeOpenIcon: 'EnvelopeOpenIcon',
  EnvelopeIcon: 'EnvelopeIcon',
  Bars3CenterLeftIcon: 'Bars3CenterLeftIcon',
  Bars3BottomLeftIcon: 'Bars3BottomLeftIcon',
  Bars3BottomRightIcon: 'Bars3BottomRightIcon',
  Bars2Icon: 'Bars2Icon',
  Bars3Icon: 'Bars3Icon',
  MusicalNoteIcon: 'MusicalNoteIcon',
  BuildingOfficeIcon: 'BuildingOfficeIcon',
  PencilSquareIcon: 'PencilSquareIcon',
  PhoneArrowDownLeftIcon: 'PhoneArrowDownLeftIcon',
  PhoneXMarkIcon: 'PhoneXMarkIcon',
  PhoneArrowUpRightIcon: 'PhoneArrowUpRightIcon',
  PhotoIcon: 'PhotoIcon',
  PuzzlePieceIcon: 'PuzzlePieceIcon',
  QrCodeIcon: 'QrCodeBracketIcon',
  ReceiptPercentIcon: 'ReceiptPercentIcon',
  ArrowPathIcon: 'ArrowPathIcon',
  ArrowUturnLeftIcon: 'ArrowUturnLeftIcon',
  BackwardIcon: 'BackwardIcon',
  ArrowDownOnSquareStackIcon: 'ArrowDownOnSquareStackIcon',
  ArrowDownOnSquareIcon: 'ArrowDownOnSquareIcon',
  MagnifyingGlassCircleIcon: 'MagnifyingGlassCircleIcon',
  MagnifyingGlassIcon: 'MagnifyingGlassIcon',
  MegaphoneIcon: 'MegaphoneIcon',
  SignalSlashIcon: 'SignalSlashIcon',
  SignalIcon: 'SignalIcon',
  LifebuoyIcon: 'LifebuoyIcon',
  ArrowRightLeftIcon: 'ArrowRightLeftIcon',
  ArrowUpDownIcon: 'ArrowUpDownIcon',
  TableCellsIcon: 'TableCellsIcon',
  RectangleGroupIcon: 'RectangleGroupIcon',
  CommandLineIcon: 'CommandLineIcon',
  HandThumbDownIcon: 'HandHandThumbDownIcon',
  HandThumbUpIcon: 'HandHandThumbUpIcon',
  LanguageIcon: 'LanguageIcon',
  ArrowTrendingDownIcon: 'ArrowArrowTrendingDownIcon',
  ArrowTrendingUpIcon: 'ArrowArrowTrendingUpIcon',
  ArrowUpTrayIcon: 'ArrowUpTrayIcon',
  UserPlusIcon: 'UserPlusIcon',
  ViewColumnsIcon: 'ViewColumnsIcon',
  SquaresPlusIcon: 'SquaresPlusIcon',
  Squares2x2Icon: 'Squares2x2Icon',
  Bars4Icon: 'Bars4Icon',
  SpeakerXMarkIcon: 'SpeakerXMarkIcon',
  SpeakerWaveIcon: 'SpeakerWaveIcon',
  XMarkIcon: 'XMarkIcon',
  MagnifyingGlassPlusIcon: 'MagnifyingGlassPlusIcon',
  MagnifyingGlassMinusIcon: 'MagnifyingGlassMinusIcon',
  BanIcon: 'NoSymbolIcon',
  CloudArrowDownTrayIcon: 'CloudArrowDownIcon',
  ArrowsExpandIcon: 'ArrowsPointingOutIcon',
  ArchiveIcon: 'ArchiveBoxIcon',
  SelectorIcon: 'ChevronUpDownIcon',
  ChatIcon: 'ChatBubbleOvalLeftEllipsisIcon',
  AdjustmentsIcon: 'AdjustmentsVerticalIcon',
  ExclamationIcon: 'ExclamationTriangleIcon',
  
};

Object.entries(heroiconsV1toV2).map(element => {
  const [a, b] = element;
  console.log(`find . -type f -not -path '*/\.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/${a}/${b}/g' {} +`)
});

Happy with the script? Come say hi on Twitter @KevinPicchi

find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/AdjustmentsVerticalIcon/AdjustmentsVerticalIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/ChatBubbleBottomCenterTextIcon/ChatBubbleBottomCenterTextIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/ArchiveBoxIcon/ArchiveBoxIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/ArrowDownCircleIcon/ArrowDownCircleIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/ArrowLeftCircleIcon/ArrowLeftCircleIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/ArrowRightCircleIcon/ArrowRightCircleIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/ArrowUpCircleIcon/ArrowUpCircleIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/ArrowLongDownIcon/ArrowLongDownIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/ArrowLongLeftIcon/ArrowLongLeftIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/ArrowLongRightIcon/ArrowLongRightIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/ArrowLongUpIcon/ArrowLongUpIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/ArrowsPointingOutIcon/ArrowsPointingOutIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/CheckBadgeIcon/CheckBadgeIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/NoSymbolIcon/NoSymbolIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/BookmarkSquareIcon/BookmarkSquareIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/BanknotesIcon/BanknotesIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/ChartBarSquareIcon/ChartBarSquareIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/ChatBubbleLeftRightIcon/ChatBubbleLeftRightIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/ChatBubbleLeftEllipsisIcon/ChatBubbleLeftEllipsisIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/ChatBubbleOvalLeftEllipsisIcon/ChatBubbleOvalLeftEllipsisIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/CpuChipIcon/CpuCpuChipIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/ClipboardDocumentCheckIcon/ClipboardDocumentCheckIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/ClipboardDocumentIcon/ClipboardDocumentIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/ClipboardDocumentListIcon/ClipboardDocumentListIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/CloudArrowDownIcon/CloudArrowDownIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/CloudArrowUpIcon/CloudArrowUpIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/CodeBracketIcon/CodeBracketIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/RectangleStackIcon/RectangleStackIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/SwatchIcon/SwatchIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/CursorArrowRaysIcon/CursorArrowRaysIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/CircleStackIcon/CircleStackIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/ComputerDesktopIcon/ComputerDesktopIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/DevicePhoneMobileIcon/DevicePhoneMobileIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/DocumentPlusIcon/DocumentPlusIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/DocumentArrowDownIcon/DocumentArrowDownIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/DocumentMinusIcon/DocumentMinusIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/DocumentChartBarIcon/DocumentChartBarIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/DocumentMagnifyingGlassIcon/DocumentMagnifyingGlassIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/EllipsisHorizontalCircleIcon/EllipsisHorizontalCircleIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/EllipsisHorizontalIcon/EllipsisHorizontalIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/EllipsisVerticalIcon/EllipsisVerticalIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/ArrowDownTrayIcon/ArrowDownTrayIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/Square2StackIcon/Square2StackIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/FaceSmileIcon/FaceSmileIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/FaceFrownIcon/FaceFrownIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/ExclamationIcon/ExclamationTriangleIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/ArrowTopRightOnSquareIcon/ArrowTopRightOnSquareIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/EyeSlashIcon/EyeSlashIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/ForwardIcon/ForwardIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/FunnelIcon/FunnelIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/FolderPlusIcon/FolderPlusIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/FolderArrowDownTrayIcon/FolderArrowDownIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/FolderMinusIcon/FolderMinusIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/GlobeEuropeAfricaIcon/GlobeEuropeAfricaIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/HandRaisedIcon/HandRaisedIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/InboxArrowDownIcon/InboxArrowDownIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/BuildingLibraryIcon/BuildingBuildingLibraryIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/BoltIcon/BoltIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/MapPinIcon/MapPinIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/ArrowLeftOnRectangleIcon/ArrowLeftOnRectangleIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/ArrowRightOnRectangleIcon/ArrowRightOnRectangleIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/EnvelopeOpenIcon/EnvelopeOpenIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/EnvelopeIcon/EnvelopeIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/Bars3CenterLeftIcon/Bars3CenterLeftIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/Bars3BottomLeftIcon/Bars3BottomLeftIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/Bars3BottomRightIcon/Bars3BottomRightIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/Bars2Icon/Bars2Icon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/Bars3Icon/Bars3Icon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/MusicalNoteIcon/MusicalNoteIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/BuildingOfficeIcon/BuildingOfficeIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/PencilSquareIcon/PencilSquareIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/PhoneArrowDownLeftIcon/PhoneArrowDownLeftIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/PhoneXMarkIcon/PhoneXMarkIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/PhoneArrowUpRightIcon/PhoneArrowUpRightIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/PhotoIcon/PhotoIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/PuzzlePieceIcon/PuzzlePieceIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/QrCodeIcon/QrCodeBracketIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/ReceiptPercentIcon/ReceiptPercentIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/ArrowPathIcon/ArrowPathIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/ArrowUturnLeftIcon/ArrowUturnLeftIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/BackwardIcon/BackwardIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/ArrowDownOnSquareStackIcon/ArrowDownOnSquareStackIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/ArrowDownOnSquareIcon/ArrowDownOnSquareIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/MagnifyingGlassCircleIcon/MagnifyingGlassCircleIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/MagnifyingGlassIcon/MagnifyingGlassIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/MegaphoneIcon/MegaphoneIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/SignalSlashIcon/SignalSlashIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/SignalIcon/SignalIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/LifebuoyIcon/LifebuoyIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/ArrowRightLeftIcon/ArrowRightLeftIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/ArrowUpDownIcon/ArrowUpDownIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/TableCellsIcon/TableCellsIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/RectangleGroupIcon/RectangleGroupIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/CommandLineIcon/CommandLineIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/HandThumbDownIcon/HandHandThumbDownIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/HandThumbUpIcon/HandHandThumbUpIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/LanguageIcon/LanguageIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/ArrowTrendingDownIcon/ArrowArrowTrendingDownIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/ArrowTrendingUpIcon/ArrowArrowTrendingUpIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/ArrowUpTrayIcon/ArrowUpTrayIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/UserPlusIcon/UserPlusIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/ViewColumnsIcon/ViewColumnsIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/SquaresPlusIcon/SquaresPlusIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/Squares2x2Icon/Squares2x2Icon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/Bars4Icon/Bars4Icon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/SpeakerXMarkIcon/SpeakerXMarkIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/SpeakerWaveIcon/SpeakerWaveIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/XMarkIcon/XMarkIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/MagnifyingGlassPlusIcon/MagnifyingGlassPlusIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/MagnifyingGlassMinusIcon/MagnifyingGlassMinusIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/BanIcon/NoSymbolIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/CloudArrowDownTrayIcon/CloudArrowDownIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/ArrowsExpandIcon/ArrowsPointingOutIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/ArchiveIcon/ArchiveBoxIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/SelectorIcon/ChevronUpDownIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/ChatIcon/ChatBubbleOvalLeftEllipsisIcon/g' {} +
find . -type f -not -path '*/.*' -path '*.js' -not -path './node_modules*' -not -path 'migrate.js' -exec sed -i '' -e 's/AdjustmentsIcon/AdjustmentsVerticalIcon/g' {} +
@THOUSAND-SKY
Copy link

Script is missing SelectorIcon => ChevronUpDownIcon.

Thanks!

@mauriziocarella
Copy link

Thank you very much for your script!

Some icon definitions are missing.

BanIconNoSymbolIcon
CloudArrowDownTrayIconCloudArrowDownIcon
ArrowsExpandIconArrowsPointingOutIcon
ArchiveIconArchiveBoxIcon
SelectorIconChevronUpDownIcon
ChatIconChatBubbleOvalLeftEllipsisIcon
AdjustmentsIconAdjustmentsVerticalIcon
ExclamationIconExclamationTriangleIcon This icon definition was wrong. 'ExclamationIcon' does no more exists.

Javascript object changes
const heroiconsV1toV2 = {
  ...
  BanIcon: 'NoSymbolIcon',
  CloudArrowDownTrayIcon: 'CloudArrowDownIcon',
  ArrowsExpandIcon: 'ArrowsPointingOutIcon',
  ArchiveIcon: 'ArchiveBoxIcon',
  SelectorIcon: 'ChevronUpDownIcon',
  ChatIcon: 'ChatBubbleOvalLeftEllipsisIcon',
  AdjustmentsIcon: 'AdjustmentsVerticalIcon',
  ExclamationIcon: 'ExclamationTriangleIcon',
}

@PicchiKevin
Copy link
Author

updated! Thanks @mauriziocarella & @THOUSAND-SKY

@christiangenco
Copy link

Oh my gosh this is saving me so much time. Thank you!

@christiangenco
Copy link

Oh hey I think your last update mistakenly replaced all the v1 names with v2 names—the keys and values of the heroiconsV1toV2 object are the same.

From the v2 release announcement I think this object should be:

const heroiconsV1toV2 = {
  AdjustmentsIcon: "AdjustmentsVerticalIcon",
  AnnotationIcon: "ChatBubbleBottomCenterTextIcon",
  ArchiveIcon: "ArchiveBoxIcon",
  ArrowCircleDownIcon: "ArrowDownCircleIcon",
  ArrowCircleLeftIcon: "ArrowLeftCircleIcon",
  ArrowCircleRightIcon: "ArrowRightCircleIcon",
  ArrowCircleUpIcon: "ArrowUpCircleIcon",
  ArrowNarrowDownIcon: "ArrowLongDownIcon",
  ArrowNarrowLeftIcon: "ArrowLongLeftIcon",
  ArrowNarrowRightIcon: "ArrowLongRightIcon",
  ArrowNarrowUpIcon: "ArrowLongUpIcon",
  ArrowsExpandIcon: "ArrowsPointingOutIcon",
  ArrowSmDownIcon: "ArrowSmallDownIcon",
  ArrowSmLeftIcon: "ArrowSmallLeftIcon",
  ArrowSmRightIcon: "ArrowSmallRightIcon",
  ArrowSmUpIcon: "ArrowSmallUpIcon",
  BadgeCheckIcon: "CheckBadgeIcon",
  BanIcon: "NoSymbolIcon",
  BookmarkAltIcon: "BookmarkSquareIcon",
  CashIcon: "BanknotesIcon",
  ChartSquareBarIcon: "ChartBarSquareIcon",
  ChatAlt2Icon: "ChatBubbleLeftRightIcon",
  ChatAltIcon: "ChatBubbleLeftEllipsisIcon",
  ChatIcon: "ChatBubbleOvalLeftEllipsisIcon",
  ChipIcon: "CpuChipIcon",
  ClipboardCheckIcon: "ClipboardDocumentCheckIcon",
  ClipboardCopyIcon: "ClipboardDocumentIcon",
  ClipboardListIcon: "ClipboardDocumentListIcon",
  CloudDownloadIcon: "CloudArrowDownIcon",
  CloudUploadIcon: "CloudArrowUpIcon",
  CodeIcon: "CodeBracketIcon",
  CollectionIcon: "RectangleStackIcon",
  ColorSwatchIcon: "SwatchIcon",
  CursorClickIcon: "CursorArrowRaysIcon",
  DatabaseIcon: "CircleStackIcon",
  DesktopComputerIcon: "ComputerDesktopIcon",
  DeviceMobileIcon: "DevicePhoneMobileIcon",
  DocumentAddIcon: "DocumentPlusIcon",
  DocumentDownloadIcon: "DocumentArrowDownIcon",
  DocumentRemoveIcon: "DocumentMinusIcon",
  DocumentReportIcon: "DocumentChartBarIcon",
  DocumentSearchIcon: "DocumentMagnifyingGlassIcon",
  DotsCircleHorizontalIcon: "EllipsisHorizontalCircleIcon",
  DotsHorizontalIcon: "EllipsisHorizontalIcon",
  DotsVerticalIcon: "EllipsisVerticalIcon",
  DownloadIcon: "ArrowDownTrayIcon",
  DuplicateIcon: "Square2StackIcon",
  EmojiHappyIcon: "FaceSmileIcon",
  EmojiSadIcon: "FaceFrownIcon",
  ExclamationIcon: "ExclamationTriangleIcon",
  ExternalLinkIcon: "ArrowTopRightOnSquareIcon",
  EyeOffIcon: "EyeSlashIcon",
  FastForwardIcon: "ForwardIcon",
  FilterIcon: "FunnelIcon",
  FolderAddIcon: "FolderPlusIcon",
  FolderDownloadIcon: "FolderArrowDownIcon",
  FolderRemoveIcon: "FolderMinusIcon",
  GlobeIcon: "GlobeAmericasIcon",
  HandIcon: "HandRaisedIcon",
  InboxInIcon: "InboxArrowDownIcon",
  LibraryIcon: "BuildingLibraryIcon",
  LightningBoltIcon: "BoltIcon",
  LocationMarkerIcon: "MapPinIcon",
  LoginIcon: "ArrowLeftOnRectangleIcon",
  LogoutIcon: "ArrowRightOnRectangleIcon",
  MailIcon: "EnvelopeIcon",
  MailOpenIcon: "EnvelopeOpenIcon",
  MenuAlt1Icon: "Bars3CenterLeftIcon",
  MenuAlt2Icon: "Bars3BottomLeftIcon",
  MenuAlt3Icon: "Bars3BottomRightIcon",
  MenuAlt4Icon: "Bars2Icon",
  MenuIcon: "Bars3Icon",
  MinusSmIcon: "MinusSmallIcon",
  MusicNoteIcon: "MusicalNoteIcon",
  OfficeBuildingIcon: "BuildingOfficeIcon",
  PencilAltIcon: "PencilSquareIcon",
  PhoneIncomingIcon: "PhoneArrowDownLeftIcon",
  PhoneMissedCallIcon: "PhoneXMarkIcon",
  PhoneOutgoingIcon: "PhoneArrowUpRightIcon",
  PhotographIcon: "PhotoIcon",
  PlusSmIcon: "PlusSmallIcon",
  PuzzleIcon: "PuzzlePieceIcon",
  QrcodeIcon: "QrCodeIcon",
  ReceiptTaxIcon: "ReceiptPercentIcon",
  RefreshIcon: "ArrowPathIcon",
  ReplyIcon: "ArrowUturnLeftIcon",
  RewindIcon: "BackwardIcon",
  SaveAsIcon: "ArrowDownOnSquareStackIcon",
  SaveIcon: "ArrowDownOnSquareIcon",
  SearchCircleIcon: "MagnifyingGlassCircleIcon",
  SearchIcon: "MagnifyingGlassIcon",
  SelectorIcon: "ChevronUpDownIcon",
  SortAscendingIcon: "BarsArrowUpIcon",
  SortDescendingIcon: "BarsArrowDownIcon",
  SpeakerphoneIcon: "MegaphoneIcon",
  StatusOfflineIcon: "SignalSlashIcon",
  StatusOnlineIcon: "SignalIcon",
  SupportIcon: "LifebuoyIcon",
  SwitchHorizontalIcon: "ArrowsRightLeftIcon",
  SwitchVerticalIcon: "ArrowsUpDownIcon",
  TableIcon: "TableCellsIcon",
  TemplateIcon: "RectangleGroupIcon",
  TerminalIcon: "CommandLineIcon",
  ThumbDownIcon: "HandThumbDownIcon",
  ThumbUpIcon: "HandThumbUpIcon",
  TranslateIcon: "LanguageIcon",
  TrendingDownIcon: "ArrowTrendingDownIcon",
  TrendingUpIcon: "ArrowTrendingUpIcon",
  UploadIcon: "ArrowUpTrayIcon",
  UserAddIcon: "UserPlusIcon",
  UserRemoveIcon: "UserMinusIcon",
  ViewBoardsIcon: "ViewColumnsIcon",
  ViewGridAddIcon: "SquaresPlusIcon",
  ViewGridIcon: "Squares2x2Icon",
  ViewListIcon: "Bars4Icon",
  VolumeOffIcon: "SpeakerXMarkIcon",
  VolumeUpIcon: "SpeakerWaveIcon",
  XIcon: "XMarkIcon",
  ZoomInIcon: "MagnifyingGlassPlusIcon",
  ZoomOutIcon: "MagnifyingGlassMinusIcon",
};

@christiangenco
Copy link

christiangenco commented Oct 28, 2022

I just had to do this again so I wrote a heroicons v2 migration script with the above icon changes and it also:

  • upgrades you to the latest heroicons library for either vue or react with either yarn or npm, and
  • upgrades your import statements

You can run it with:

curl https://gist.githubusercontent.com/christiangenco/470a99f4823ee81f2b22bad83119f599/raw/migrateHeroicons.js | node | bash

@HemalR
Copy link

HemalR commented Jan 24, 2023

Hero! Thanks!

@dredshep
Copy link

dredshep commented Apr 26, 2023

Just wanted to mention, this is helpful for an unexpected reason. In ChatGPT's Tailwind generations, when asked for icons, it tends to use HeroIcons, but v1 only because its info is old, which means it's necessary to come to this gist and Ctrl F whatever heroicon ChatGPT gives you to find the current one 😂 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment