Created
January 31, 2024 19:21
-
-
Save sliptype/47468c2823944735ccccf10e510dd44f to your computer and use it in GitHub Desktop.
Audius common unbundling - Convert to nested imports
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const glob = require('glob') | |
const fs = require('fs') | |
var getDirectories = function (callback) { | |
glob('./mobile/src/**/*', callback) | |
} | |
const DIRECTORY = 'store' | |
const EXPORTS = [ | |
'accountReducer', | |
'accountActions', | |
'accountSelectors', | |
'accountSagas', | |
'averageColorReducer', | |
'averageColorActions', | |
'averageColorSelectors', | |
'buyCryptoReducer', | |
'buyCryptoActions', | |
'buyCryptoSagas', | |
'buyUSDCReducer', | |
'buyUSDCActions', | |
'buyUSDCSelectors', | |
'buyUSDCSagas', | |
'getUSDCUserBank', | |
'getBuyUSDCRemoteConfig', | |
'BuyUSDCStage', | |
'BuyUSDCErrorCode', | |
'BuyUSDCError', | |
'cacheCollectionsActions', | |
'cacheCollectionsReducer', | |
'cacheCollectionsSelectors', | |
'cacheTracksActions', | |
'cacheTracksReducer', | |
'cacheTracksSelectors', | |
'cacheUsersActions', | |
'cacheUsersReducer', | |
'cacheActions', | |
'CIDCache', | |
'cacheConfig', | |
'cacheReducer', | |
'cacheSelectors', | |
'processAndCacheUsers', | |
'reformatUser', | |
'PlaylistOperations', | |
'reformatCollection', | |
'cacheUsersSelectors', | |
'castSagas', | |
'castSelectors', | |
'castReducer', | |
'castActions', | |
'CAST_METHOD', | |
'challengesSelectors', | |
'changePasswordSelectors', | |
'changePasswordReducer', | |
'changePasswordActions', | |
'ChangePasswordPageStep', | |
'lineupActions', | |
'lineupReducer', | |
'lineupSelectors', | |
'LineupBaseActions', | |
'lineupRegistry', | |
'notificationsReducer', | |
'notificationsActions', | |
'notificationsSelectors', | |
'NotificationType', | |
'PushNotificationType', | |
'Entity', | |
'Achievement', | |
'trendingUndergroundLineupPageReducer', | |
'trendingUndergroundPageLineupSelectors', | |
'trendingUndergroundPageLineupActions', | |
'trendingUndergroundPageReducer', | |
'trendingPlaylistsPageLineupReducer', | |
'trendingPlaylistsPageLineupSelectors', | |
'trendingPlaylistsPageLineupActions', | |
'trendingPlaylistsPageReducer', | |
'trendingPageLineupReducer', | |
'trendingPageLineupSelectors', | |
'trendingPageLineupActions', | |
'trendingPageReducer', | |
'trendingPageActions', | |
'trendingPageSelectors', | |
'trackPageLineupReducer', | |
'trackPageLineupActions', | |
'trackPageReducer', | |
'trackPageActions', | |
'trackPageSelectors', | |
'tokenDashboardPageSelectors', | |
'tokenDashboardPageReducer', | |
'tokenDashboardPageActions', | |
'smartCollectionPageSelectors', | |
'smartCollectionPageReducer', | |
'smartCollectionPageActions', | |
'settingsPageSelectors', | |
'settingsPageReducer', | |
'settingsPageInitialState', | |
'settingsPageActions', | |
'searchResultsPageTracksLineupReducer', | |
'searchResultsPageTracksLineupActions', | |
'searchResultsPageActions', | |
'searchResultsPageSelectors', | |
'searchResultsPageReducer', | |
'savedPageTracksLineupReducer', | |
'savedPageTracksLineupActions', | |
'savedPageActions', | |
'savedPageSelectors', | |
'persistedSavePageReducer', | |
'remixesPageLineupReducer', | |
'remixesPageLineupInitialState', | |
'remixesPageLineupActions', | |
'remixesPageReducer', | |
'remixesPageActions', | |
'remixesPageSelectors', | |
'aiPageLineupReducer', | |
'aiPageLineupInitialState', | |
'aiPageLineupActions', | |
'aiPageReducer', | |
'aiPageActions', | |
'aiPageSelectors', | |
'profilePageFeedLineupReducer', | |
'profilePageFeedLineupActions', | |
'profilePageTracksLineupReducer', | |
'profilePageTracksLineupActions', | |
'profilePageActions', | |
'profilePageSelectors', | |
'profilePageReducer', | |
'historyPageTracksLineupReducer', | |
'historyPageTracksLineupActions', | |
'historyPageSelectors', | |
'historyPageReducer', | |
'feedPageLineupReducer', | |
'feedPageLineupActions', | |
'feedPageSelectors', | |
'feedPageActions', | |
'feedPageReducer', | |
'explorePageCollectionsSelectors', | |
'explorePageCollectionsReducer', | |
'explorePageCollectionsActions', | |
'explorePageSelectors', | |
'explorePageReducer', | |
'explorePageActions', | |
'collectionPageLineupReducer', | |
'collectionPageLineupActions', | |
'collectionPageSelectors', | |
'collectionPageActions', | |
'collectionPageReducer', | |
'audioRewardsPageSelectors', | |
'audioRewardsPageReducer', | |
'audioRewardsPageActions', | |
'audioTransactionsPageSelectors', | |
'audioTransactionsPageReducer', | |
'audioTransactionsPageActions', | |
'premiumTracksPageLineupReducer', | |
'premiumTracksPageLineupSelectors', | |
'premiumTracksPageLineupActions', | |
'BrowserNotificationSetting', | |
'PushNotificationSetting', | |
'EmailFrequency', | |
'emailFrequency', | |
'Cast', | |
'SearchKind', | |
'LibraryCategory', | |
'isLibraryCategory', | |
'SavedPageTabs', | |
'calculateNewLibraryCategories', | |
'FollowType', | |
'CollectionSortMode', | |
'TracksSortMode', | |
'ProfilePageTabs', | |
'ProfilePageTabRoute', | |
'getTabForRoute', | |
'ExplorePageTabs', | |
'ExploreCollectionsVariant', | |
'HCaptchaStatus', | |
'ClaimStatus', | |
'deactivateAccountReducer', | |
'deactivateAccountActions', | |
'deactivateAccountSelectors', | |
'chatReducer', | |
'chatActions', | |
'chatSelectors', | |
'chatSagas', | |
'chatMiddleware', | |
'makeChatId', | |
'ChatPermissionAction', | |
'ChatWebsocketError', | |
'playlistLibraryReducer', | |
'playlistLibraryActions', | |
'playlistLibraryHelpers', | |
'playlistLibrarySelectors', | |
'queueReducer', | |
'queueActions', | |
'initialQueueState', | |
'queueSelectors', | |
'RepeatMode', | |
'QueueSource', | |
'reachabilityActions', | |
'reachabilityReducer', | |
'reachabilitySelectors', | |
'reachabilitySagas', | |
'recoveryEmailReducer', | |
'recoveryEmailActions', | |
'recoveryEmailSelectors', | |
'remoteConfigSagas', | |
'remoteConfigSelectors', | |
'remoteConfigActions', | |
'remoteConfigReducer', | |
'remoteConfigInitialState', | |
'signOutReducer', | |
'signOutActions', | |
'collectionsSocialActions', | |
'tracksSocialActions', | |
'usersSocialActions', | |
'solanaSelectors', | |
'solanaReducer', | |
'solanaActions', | |
'solanaSagas', | |
'stemsUploadActions', | |
'stemsUploadReducer', | |
'stemsUploadSelectors', | |
'tippingSelectors', | |
'tippingReducer', | |
'tippingActions', | |
'walletSelectors', | |
'walletReducer', | |
'walletActions', | |
'badgeTiers', | |
'getVerifiedForUser', | |
'getWeiBalanceForUser', | |
'makeGetTierAndVerifiedForUser', | |
'getTierAndNumberForBalance', | |
'getTierNumber', | |
'getUserBalance', | |
'getTierForUser', | |
'addToCollectionUISelectors', | |
'addToCollectionUIActions', | |
'addToCollectionUIReducer', | |
'relatedArtistsUISelectors', | |
'relatedArtistsUIReducer', | |
'relatedArtistsUIActions', | |
'relatedArtistsSagas', | |
'collectibleDetailsUISelectors', | |
'collectibleDetailsUIReducer', | |
'collectibleDetailsUIActions', | |
'deletePlaylistConfirmationModalUISelectors', | |
'deletePlaylistConfirmationModalUIReducer', | |
'deletePlaylistConfirmationModalUIActions', | |
'deletePlaylistConfirmationModalUISagas', | |
'duplicateAddConfirmationModalUISelectors', | |
'duplicateAddConfirmationModalUIReducer', | |
'duplicateAddConfirmationModalUIActions', | |
'duplicateAddConfirmationModalUISagas', | |
'mobileOverflowMenuUISelectors', | |
'mobileOverflowMenuUIReducer', | |
'mobileOverflowMenuUIActions', | |
'mobileOverflowMenuUISagas', | |
'nowPlayingUISelectors', | |
'nowPlayingUIReducer', | |
'nowPlayingUIActions', | |
'publishPlaylistConfirmationModalUISelectors', | |
'publishPlaylistConfirmationModalUIReducer', | |
'publishPlaylistConfirmationModalUIActions', | |
'publishPlaylistConfirmationModalUISagas', | |
'reactionsUIReducer', | |
'reactionsUIActions', | |
'reactionsUISelectors', | |
'shareModalUIReducer', | |
'shareModalUIActions', | |
'shareModalUISelectors', | |
'shareModalUISagas', | |
'stripeModalUIReducer', | |
'stripeModalUIActions', | |
'stripeModalUISelectors', | |
'stripeModalUISagas', | |
'coinflowModalUIReducer', | |
'coinflowModalUIActions', | |
'vipDiscordModalReducer', | |
'vipDiscordModalActions', | |
'vipDiscordModalSelectors', | |
'vipDiscordModalSagas', | |
'shareSoundToTiktokModalReducer', | |
'shareSoundToTiktokModalActions', | |
'shareSoundToTiktokModalSelectors', | |
'themeReducer', | |
'themeActions', | |
'themeSelectors', | |
'toastReducer', | |
'toastActions', | |
'toastSelectors', | |
'toastSagas', | |
'buyAudioReducer', | |
'buyAudioActions', | |
'buyAudioSelectors', | |
'uploadConfirmationModalUISelectors', | |
'uploadConfirmationModalUIReducer', | |
'uploadConfirmationModalUIActions', | |
'uploadConfirmationModalUISagas', | |
'publishTrackConfirmationModalUISelectors', | |
'publishTrackConfirmationModalUIReducer', | |
'publishTrackConfirmationModalUIActions', | |
'publishTrackConfirmationModalUISagas', | |
'withdrawUSDCReducer', | |
'withdrawUSDCActions', | |
'withdrawUSDCSelectors', | |
'transactionDetailsReducer', | |
'transactionDetailsActions', | |
'transactionDetailsSelectors', | |
'searchUsersModalReducer', | |
'searchUsersModalActions', | |
'searchUsersModalSelectors', | |
'searchUsersModalSagas', | |
'OverflowAction', | |
'OverflowSource', | |
'modalsSelectors', | |
'modalsActions', | |
'modalsReducer', | |
'modalsSagas', | |
'useCreateChatModal', | |
'createChatModalActions', | |
'createChatModalReducer', | |
'useCoinflowOnrampModal', | |
'coinflowOnrampModalActions', | |
'coinflowOnrampModalReducer', | |
'useCoinflowWithdrawModal', | |
'coinflowWithdrawModalActions', | |
'coinflowWithdrawModalReducer', | |
'useLeavingAudiusModal', | |
'leavingAudiusModalReducer', | |
'useInboxUnavailableModal', | |
'inboxUnavailableModalActions', | |
'inboxUnavailableModalReducer', | |
'useUSDCPurchaseDetailsModal', | |
'usdcPurchaseDetailsModalReducer', | |
'useUSDCTransactionDetailsModal', | |
'usdcTransactionDetailsModalReducer', | |
'WithdrawUSDCModalPages', | |
'useWithdrawUSDCModal', | |
'withdrawUSDCModalReducer', | |
'withdrawUSDCModalActions', | |
'useEditPlaylistModal', | |
'editPlaylistModalActions', | |
'editPlaylistModalReducer', | |
'editTrackModalSelectors', | |
'useEditTrackModal', | |
'editTrackModalActions', | |
'editTrackModalReducer', | |
'usePremiumContentPurchaseModal', | |
'premiumContentPurchaseModalReducer', | |
'useUSDCManualTransferModal', | |
'usdcManualTransferModalReducer', | |
'useAddFundsModal', | |
'addFundsModalReducer', | |
'reactionOrder', | |
'reactionsMap', | |
'getReactionFromRawValue', | |
'StripeSessionCreationError', | |
'ShareSoundToTiktokModalStatus', | |
'OnRampProvider', | |
'PurchaseInfoErrorType', | |
'BuyAudioStage', | |
'TOKEN_LISTING_MAP', | |
'CoinflowWithdrawState', | |
'WithdrawMethod', | |
'TransactionType', | |
'TransactionMethod', | |
'TransactionMetadataType', | |
'userListActions', | |
'UserListSagaFactory', | |
'userListSelectors', | |
'topSupportersUserListActions', | |
'topSupportersUserListSelectors', | |
'supportingUserListActions', | |
'supportingUserListSelectors', | |
'repostsUserListActions', | |
'repostsUserListSelectors', | |
'notificationsUserListActions', | |
'notificationsUserListSelectors', | |
'notificationsUserListReducer', | |
'mutualsUserListActions', | |
'mutualsUserListSelectors', | |
'mutualsUserListReducer', | |
'followingUserListActions', | |
'followingUserListSelectors', | |
'followersUserListActions', | |
'followersUserListSelectors', | |
'favoritesUserListActions', | |
'favoritesUserListSelectors', | |
'relatedArtistsUserListActions', | |
'relatedArtistsUserListSelectors', | |
'UserListReducerFactory', | |
'TOP_SUPPORTERS_USER_LIST_TAG', | |
'SUPPORTING_USER_LIST_TAG', | |
'RepostType', | |
'REPOSTS_USER_LIST_TAG', | |
'NOTIFICATIONS_USER_LIST_TAG', | |
'MUTUALS_USER_LIST_TAG', | |
'FOLLOWING_USER_LIST_TAG', | |
'FOLLOWERS_USER_LIST_TAG', | |
'FAVORITES_USER_LIST_TAG', | |
'RELATED_ARTISTS_USER_LIST_TAG', | |
'reducers', | |
'sagas', | |
'getContext', | |
'playerReducer', | |
'playerActions', | |
'initialPlayerState', | |
'playerSelectors', | |
'playerSagas', | |
'PLAYBACK_RATE_LS_KEY', | |
'playbackRateValueMap', | |
'playbackPositionReducer', | |
'playbackPositionActions', | |
'playbackPositionSelectors', | |
'playbackPositionSagas', | |
'LEGACY_PLAYBACK_POSITION_LS_KEY', | |
'PLAYBACK_POSITION_LS_KEY', | |
'musicConfettiSelectors', | |
'musicConfettiReducer', | |
'musicConfettiActions', | |
'uploadReducer', | |
'uploadActions', | |
'uploadSelectors', | |
'UploadType', | |
'ProgressStatus', | |
'remixSettingsSelectors', | |
'remixSettingsReducer', | |
'remixSettingsActions', | |
'gatedContentReducer', | |
'gatedContentActions', | |
'gatedContentSelectors', | |
'gatedContentSagas', | |
'purchaseContentReducer', | |
'purchaseContentActions', | |
'purchaseContentSelectors', | |
'purchaseContentSagas', | |
'ContentType', | |
'PurchaseContentStage', | |
'PurchaseContentPage', | |
'PurchaseErrorCode', | |
'PurchaseContentError', | |
'zeroBalance', | |
'isContentPurchaseInProgress', | |
'getPurchaseSummaryValues', | |
'getBalanceNeeded', | |
'collectiblesReducer', | |
'collectiblesActions', | |
'collectiblesSelectors', | |
'playlistUpdatesActions', | |
'playlistUpdatesReducer', | |
'playlistUpdatesSelectors', | |
'playlistUpdatesSagas', | |
'savedCollectionsReducer', | |
'savedCollectionsActions', | |
'savedCollectionsSelectors', | |
'confirmerActions', | |
'confirmerReducer', | |
'confirmerSelectors', | |
'confirmerSagas', | |
'confirmTransaction', | |
'AccountCollection', | |
'TwitterAccountPayload', | |
'InstagramAccountPayload', | |
'TikTokAccountPayload', | |
'InstagramProfile', | |
'TwitterProfile', | |
'TikTokProfile', | |
'BuyCryptoConfig', | |
'BuyCryptoViaSolLocalStorageState', | |
'PurchaseInfo', | |
'AddSuccededAction', | |
'AddEntriesAction', | |
'CacheType', | |
'SetCacheConfigAction', | |
'EnhancedCollection', | |
'EnhancedCollectionTrack', | |
'CollectionsCacheState', | |
'Image', | |
'EditPlaylistValues', | |
'TracksCacheState', | |
'Metadata', | |
'UsersCacheState', | |
'CastMethod', | |
'ChangePasswordState', | |
'ConfirmationOptions', | |
'ConfirmerState', | |
'RequestConfirmationError', | |
'MusicConfettiState', | |
'TrackEntity', | |
'CollectionEntity', | |
'EntityType', | |
'BaseNotification', | |
'DiscoveryBaseNotification', | |
'DiscoveryAction', | |
'DiscoveryAnnouncementNotificationAction', | |
'DiscoveryFollowNotificationAction', | |
'DiscoverySaveNotificationAction', | |
'DiscoverySaveOfRepostNotificationAction', | |
'DiscoveryRepostNotificationAction', | |
'DiscoveryRepostOfRepostNotificationAction', | |
'DiscoveryTastemakerNotificationAction', | |
'DiscoveryTipSendNotificationAction', | |
'DiscoveryTipReceiveNotificationAction', | |
'DiscoveryAddTrackToPlaylistNotificationAction', | |
'DiscoveryMilestoneFollowNotificationAction', | |
'DiscoveryMilestoneTrackNotificationAction', | |
'DiscoveryMilestonePlaylistNotificationAction', | |
'DiscoveryRemixNotificationAction', | |
'DiscoveryCosignNotificationAction', | |
'DiscoverySupporterRankUpNotificationAction', | |
'DiscoverySupportingRankUpNotificationAction', | |
'DiscoverySupporterDethronedNotificationAction', | |
'DiscoveryReactionNotificationAction', | |
'DiscoveryChallengeRewardNotificationAction', | |
'DiscoveryTierChangeNotificationAction', | |
'DiscoveryCreateTrackNotificationAction', | |
'DiscoveryCreatePlaylistNotificationAction', | |
'DiscoveryUSDCPurchaseNotificationAction', | |
'TrendingRange', | |
'DiscoveryTrendingNotificationAction', | |
'DiscoveryAnnouncementNotification', | |
'DiscoveryFollowNotification', | |
'DiscoverySaveNotification', | |
'DiscoveryRepostNotification', | |
'DiscoveryTastemakerNotification', | |
'DiscoveryAddTrackToPlaylistNotification', | |
'DiscoveryTipSendNotification', | |
'DiscoveryTipReceiveNotification', | |
'DiscoveryRemixNotification', | |
'DiscoveryCosignNotification', | |
'DiscoverySupporterRankUpNotification', | |
'DiscoverySupportingRankUpNotification', | |
'DiscoverySupporterDethronedNotification', | |
'DiscoveryReactionNotification', | |
'DiscoveryChallengeRewardNotification', | |
'DiscoveryTierChangeNotification', | |
'DiscoveryCreateNotification', | |
'DiscoveryUSDCPurchaseBuyerNotification', | |
'DiscoveryUSDCPurchaseSellerNotification', | |
'DiscoveryTrendingPlaylistNotification', | |
'DiscoveryTrendingNotification', | |
'DiscoveryTrendingUndergroundNotification', | |
'DiscoveryMilestoneNotification', | |
'DiscoveryRepostOfRepostNotification', | |
'DiscoverySaveOfRepostNotification', | |
'DiscoveryNotification', | |
'AnnouncementNotification', | |
'UserSubscriptionNotification', | |
'FollowNotification', | |
'FollowPushNotification', | |
'RepostNotification', | |
'RepostPushNotification', | |
'RepostOfRepostNotification', | |
'RepostOfRepostPushNotification', | |
'FavoriteOfRepostNotification', | |
'FavoriteOfRepostPushNotification', | |
'FavoriteNotification', | |
'FavoritePushNotification', | |
'MilestoneNotification', | |
'MilestoneFollowPushNotification', | |
'MilestoneListenPushNotification', | |
'MilestoneRepostPushNotification', | |
'MilestoneFavoritePushNotification', | |
'RemixCreateNotification', | |
'RemixCreatePushNotification', | |
'RemixCosignNotification', | |
'RemixCosignPushNotification', | |
'TrendingPlaylistNotification', | |
'TrendingTrackNotification', | |
'TrendingUndergroundNotification', | |
'TastemakerNotification', | |
'ChallengeRewardNotification', | |
'TierChangeNotification', | |
'ReactionNotification', | |
'ReactionPushNotification', | |
'TipReceiveNotification', | |
'TipReceivePushNotification', | |
'TipSendNotification', | |
'TipSendPushNotification', | |
'SupporterRankUpNotification', | |
'SupporterRankUpPushNotification', | |
'SupportingRankUpNotification', | |
'SupportingRankUpPushNotification', | |
'SupporterDethronedNotification', | |
'AddTrackToPlaylistNotification', | |
'AddTrackToPlaylistPushNotification', | |
'USDCPurchaseSellerNotification', | |
'USDCPurchaseBuyerNotification', | |
'Notification', | |
'IdentityNotification', | |
'NotificationsState', | |
'AddNotificationsAction', | |
'UpdateNotificationsAction', | |
'FetchNotificationsAction', | |
'FetchNotificationsFailedAction', | |
'MessagePushNotification', | |
'MessageReactionPushNotification', | |
'AiPageState', | |
'FetchAiUserAction', | |
'TrendingRewardsModalType', | |
'ChallengeRewardsModalType', | |
'ClaimState', | |
'AudioRewardsClaim', | |
'UndisbursedUserChallenge', | |
'ChatMessageTileProps', | |
'CollectionTrack', | |
'CollectionsPageState', | |
'CollectionsPageType', | |
'CollectionPageTrackRecord', | |
'DeactivateAccountState', | |
'ErrorState', | |
'CollectionsState', | |
'GetExplore', | |
'ExploreContent', | |
'FeedPageState', | |
'HistoryPageState', | |
'ProfilePageFollow', | |
'ProfileState', | |
'ProfilePageState', | |
'ProfileUser', | |
'LibraryCategoryType', | |
'SavedPageState', | |
'SavedPageTrack', | |
'TrackRecord', | |
'SavedPageCollection', | |
'FetchSearchPageResultsAction', | |
'FetchSearchPageResultsSuceededAction', | |
'FetchSearchPageResultsFailedAction', | |
'FetchSearchPageTagsSucceededAction', | |
'FetchSearchPageTagsFailedAction', | |
'FetchSearchPageTagsAction', | |
'SearchPageActions', | |
'SearchPageState', | |
'ToggleNotificationSetting', | |
'TogglePushNotificationSetting', | |
'TogglePushNotificationSettingFailed', | |
'RequestPushNotificationPermissions', | |
'UpdateEmailFrequency', | |
'GetNotificationSettings', | |
'GetNotificationSettingsFailed', | |
'SetNotificationSettings', | |
'GetPushNotificationSettings', | |
'GetPushNotificationSettingsFailed', | |
'SetPushNotificationSettings', | |
'SetBrowserNotificationPermission', | |
'SetBrowserNotificationEnabled', | |
'SetBrowserNotificationSettingsOn', | |
'SetBrowserNotificationSettingsOff', | |
'BrowserPushNotificationFailed', | |
'SetAiAttribution', | |
'SettingActions', | |
'Notifications', | |
'PushNotifications', | |
'SettingsPageState', | |
'SmartCollectionState', | |
'ConnectWalletsState', | |
'TokenDashboardPageModalState', | |
'CanReceiveWAudio', | |
'AssociatedWallet', | |
'AssociatedWallets', | |
'ConfirmRemoveWalletAction', | |
'InputSendDataAction', | |
'AssociatedWalletsState', | |
'TokenDashboardState', | |
'TrackPageState', | |
'TrendingPageState', | |
'PlaybackStatus', | |
'PlaybackPositionInfo', | |
'PlaybackPositionState', | |
'PlayerState', | |
'PlaybackRate', | |
'PlaylistLibraryState', | |
'UpdatePayload', | |
'ReorderAction', | |
'AddToFolderAction', | |
'PlaylistUpdate', | |
'PlaylistUpdateState', | |
'PlaylistUpdatesReceivedAction', | |
'UpdatedPlaylistViewedAction', | |
'PurchaseContentErrorCode', | |
'Queueable', | |
'QueueItem', | |
'ReachabilityState', | |
'RecoveryEmailState', | |
'CommonState', | |
'RemixSettingsState', | |
'RemoteConfigState', | |
'StateWithRemoteConfig', | |
'CollectionListState', | |
'SavedCollectionsState', | |
'CollectionType', | |
'CommonStoreContext', | |
'TippingSendStatus', | |
'SupportersMapForUser', | |
'SupportersMap', | |
'SupportingMapForUser', | |
'SupportingMap', | |
'TippingState', | |
'RefreshSupportPayloadAction', | |
'AddToCollectionState', | |
'AddToPlaylistState', | |
'JupiterTokenListing', | |
'JupiterTokenSymbol', | |
'AmountObject', | |
'CollectibleDetailsState', | |
'OpenPayload', | |
'DeletePlaylistConfirmationModalState', | |
'OpenPayload', | |
'DuplicateAddConfirmationModalState', | |
'OpenOverflowMenuPayload', | |
'OverflowActionCallbacks', | |
'MobileOverflowModalState', | |
'AddFundsModalState', | |
'CoinflowPurchaseMetadata', | |
'CoinflowOnrampModalState', | |
'CoinflowWithdrawModalState', | |
'CreateChatModalState', | |
'BaseModalState', | |
'FocusableFields', | |
'EditPlaylistModalState', | |
'EditTrackModalState', | |
'InboxUnavailableModalState', | |
'LeavingAudiusModalState', | |
'PremiumContentPurchaseModalState', | |
'Modals', | |
'BasicModalsState', | |
'StatefulModalsState', | |
'ModalsState', | |
'TrackModalOpenedActionPayload', | |
'TrackModalClosedActionPayload', | |
'USDCManualTransferModalState', | |
'USDCPurchaseDetailsModalState', | |
'USDCTransactionDetailsModalState', | |
'WithdrawUSDCModalState', | |
'NowPlayingState', | |
'OpenPayload', | |
'PublishPlaylistConfirmationModalState', | |
'OpenPayload', | |
'PublishTrackConfirmationState', | |
'PublishTrackConfirmationModalState', | |
'ReactionsState', | |
'ReactionTypes', | |
'RelatedArtists', | |
'RelatedArtistsState', | |
'SearchUsersModalState', | |
'ShareType', | |
'ShareContent', | |
'ShareModalState', | |
'ShareModalRequestOpenAction', | |
'ShareModalOpenAction', | |
'ShareSoundToTiktokModalTrack', | |
'ShareSoundToTikTokModalState', | |
'ShareSoundToTiktokModalAuthenticatedPayload', | |
'ShareSoundToTiktokModalRequestOpenPayload', | |
'ShareSoundToTiktokModalOpenPayload', | |
'ShareSoundToTiktokModalSetStatusPayload', | |
'StripeSessionStatus', | |
'StripeFixedTransactionDetails', | |
'StripeTransactionDetails', | |
'StripeQuoteDetails', | |
'StripeSessionData', | |
'StripeDestinationCurrencyType', | |
'StripeModalState', | |
'StripeSessionCreationErrorResponseData', | |
'ThemeState', | |
'SetThemeAction', | |
'SetSystemAppearanceAction', | |
'ToastType', | |
'Toast', | |
'ToastState', | |
'ToastAction', | |
'AddToastAction', | |
'DissmissToastAction', | |
'ManualClearToastAction', | |
'InAppAudioPurchaseMetadata', | |
'TransactionDetails', | |
'TransactionDetailsState', | |
'OpenPayload', | |
'UploadConfirmationState', | |
'UploadConfirmationModalState', | |
'VipDiscordModalState', | |
'NativeFile', | |
'UploadTrack', | |
'ExtendedTrackMetadata', | |
'ExtendedCollectionMetadata', | |
'Progress', | |
'ProgressState', | |
'UploadState', | |
'FavoritesOwnState', | |
'FavoritesPageState', | |
'FollowersOwnState', | |
'FollowersPageState', | |
'FollowingOwnState', | |
'FollowingPageState', | |
'MutualsOwnState', | |
'MutualsPageState', | |
'NotificationUsersPageOwnState', | |
'NotificationUsersPageState', | |
'RelatedArtistsOwnState', | |
'RelatedArtistsPageState', | |
'RepostsOwnState', | |
'RepostsPageState', | |
'SupportingOwnState', | |
'SupportingPageState', | |
'TopSupportersOwnState', | |
'TopSupportersPageState', | |
'UserListStoreState', | |
'FetchUserIdsSaga', | |
'BadgeTierInfo' | |
] | |
getDirectories(async function (err, res) { | |
res | |
.filter((path) => path.match(/\/[^\/]+\.(ts|tsx|js|jsx)$/)) | |
.forEach((path) => { | |
const content = fs.readFileSync(path, { encoding: 'utf8', flag: 'r' }) | |
let matches = [] | |
let newContent = content | |
EXPORTS.forEach((exportName) => { | |
let regex = new RegExp( | |
`(import[^{]*{[^}]* )(${exportName}( as [^,]*)*[, \\n])([^}]*}\\s*from '@audius/common')` | |
) | |
let match = content.match(regex)?.[2] | |
if (match) { | |
matches.push(match.replace(',', '')) | |
// Delete old import | |
newContent = newContent.replace(regex, '$1$4') | |
} | |
}) | |
// Add new imports | |
if (matches.length) { | |
console.log('matches', matches) | |
const matchesList = matches.join(', ') | |
newContent = `import { ${matchesList} } from '@audius/common/${DIRECTORY}' | |
${newContent}` | |
fs.writeFileSync(path, newContent) | |
} | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment