Skip to content

Commit 779ea91

Browse files
Raise an error when there are unsupported plugins
1 parent 1565cbc commit 779ea91

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

packages/cli-kit/src/public/node/base-command.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {showNotificationsIfNeeded} from './notifications-system.js'
1212
import {setCurrentCommandId} from './global-context.js'
1313
import {JsonMap} from '../../private/common/json.js'
1414
import {underscore} from '../common/string.js'
15-
import {Command, Errors} from '@oclif/core'
15+
import {Command, Config, Errors} from '@oclif/core'
1616
import {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+
339353
export default BaseCommand

0 commit comments

Comments
 (0)