@@ -12,7 +12,7 @@ import {showNotificationsIfNeeded} from './notifications-system.js'
1212import { setCurrentCommandId } from './global-context.js'
1313import { JsonMap } from '../../private/common/json.js'
1414import { underscore } from '../common/string.js'
15- import { Command , Errors } from '@oclif/core'
15+ import { Command , Config , Errors } from '@oclif/core'
1616import { OutputFlags , Input , ParserOutput , FlagInput , OutputArgs } from '@oclif/core/parser'
1717
1818// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -56,6 +56,7 @@ abstract class BaseCommand extends Command {
5656 // This function runs just prior to `run`
5757 await registerCleanBugsnagErrorsFromWithinPlugins ( this . config )
5858 }
59+ await warnOnUnsupportedPlugins ( this . config )
5960 this . showNpmFlagWarning ( )
6061 await showNotificationsIfNeeded ( )
6162 return super . init ( )
@@ -336,4 +337,17 @@ function commandSupportsFlag(flags: FlagInput | undefined, flagName: string): bo
336337 return Boolean ( flags ) && Object . prototype . hasOwnProperty . call ( flags , flagName )
337338}
338339
340+ export async function warnOnUnsupportedPlugins ( config : Config ) : Promise < void > {
341+ const bundlePlugins = [ '@shopify/app' , '@shopify/plugin-cloudflare' ]
342+ const unsupportedPlugins = Array . from ( config . plugins . values ( ) )
343+ . filter ( ( plugin ) => bundlePlugins . includes ( plugin . name ) )
344+ . map ( ( plugin ) => plugin . name )
345+ if ( unsupportedPlugins . length > 0 ) {
346+ const commandsToRun = unsupportedPlugins . map ( ( plugin ) => ` - shopify plugins remove ${ plugin } ` ) . join ( '\n' )
347+ throw new AbortError ( `Unsupported plugins detected: ${ unsupportedPlugins . join ( ', ' ) } ` , [
348+ `They are already included in the CLI and installing them as custom plugins can cause conflicts. You can fix it by running:\n${ commandsToRun } ` ,
349+ ] )
350+ }
351+ }
352+
339353export default BaseCommand
0 commit comments