Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion packages/cli-kit/src/public/node/base-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {showNotificationsIfNeeded} from './notifications-system.js'
import {setCurrentCommandId} from './global-context.js'
import {JsonMap} from '../../private/common/json.js'
import {underscore} from '../common/string.js'
import {Command, Errors} from '@oclif/core'
import {Command, Config, Errors} from '@oclif/core'
import {OutputFlags, Input, ParserOutput, FlagInput, OutputArgs} from '@oclif/core/parser'

// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand Down Expand Up @@ -56,6 +56,7 @@ abstract class BaseCommand extends Command {
// This function runs just prior to `run`
await registerCleanBugsnagErrorsFromWithinPlugins(this.config)
}
await warnOnUnsupportedPlugins(this.config)
this.showNpmFlagWarning()
await showNotificationsIfNeeded()
return super.init()
Expand Down Expand Up @@ -336,4 +337,17 @@ function commandSupportsFlag(flags: FlagInput | undefined, flagName: string): bo
return Boolean(flags) && Object.prototype.hasOwnProperty.call(flags, flagName)
}

export async function warnOnUnsupportedPlugins(config: Config): Promise<void> {
const bundlePlugins = ['@shopify/app', '@shopify/plugin-cloudflare']
const unsupportedPlugins = Array.from(config.plugins.values())
.filter((plugin) => bundlePlugins.includes(plugin.name))
.map((plugin) => plugin.name)
if (unsupportedPlugins.length > 0) {
const commandsToRun = unsupportedPlugins.map((plugin) => ` - shopify plugins remove ${plugin}`).join('\n')
throw new AbortError(`Unsupported plugins detected: ${unsupportedPlugins.join(', ')}`, [
`They are already included in the CLI and installing them as custom plugins can cause conflicts. You can fix it by running:\n${commandsToRun}`,
])
}
}

export default BaseCommand