Skip to content

Commit b65ce0a

Browse files
committed
feat(cli): add enablePlugins to setup wizard and ENABLE_PLUGINS mapping
Mirrors the host project's new `features.plugins` flag: env-config now reports plugins in FEATURE_ENV, and setup.ts exposes enablePlugins in ProjectConfig, DEFAULT_CONFIG, FEATURE_ENV_VARS and MODULE_REMOVALS (removes marketing/dashboard plugin pages, /api/plugins, lib/plugins and the plugin components when the flag is false). The marketing preset leaves plugins on by default.
1 parent 9691ec5 commit b65ce0a

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

‎src/commands/setup.ts‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ interface ProjectConfig {
7676
enableReports: boolean;
7777
enableBranding: boolean;
7878
enableTwoFactor: boolean;
79+
enablePlugins: boolean;
7980
}
8081

8182
// ---------------------------------------------------------------------------
@@ -111,6 +112,8 @@ const BUILT_IN_PRESETS: Record<string, Partial<ProjectConfig>> = {
111112
enableReports: false,
112113
enableBranding: false,
113114
enableTwoFactor: false,
115+
// Plugins page stays in marketing navbar by default — preset keeps the
116+
// feature on. Override with `marketing;enablePlugins=false` to drop it.
114117
},
115118
demo: {
116119
authProvider: 'better-auth',
@@ -150,6 +153,7 @@ const DEFAULT_CONFIG: ProjectConfig = {
150153
enableReports: true,
151154
enableBranding: true,
152155
enableTwoFactor: true,
156+
enablePlugins: true,
153157
};
154158

155159
function parsePresetValue(raw: string): Partial<ProjectConfig> {
@@ -459,6 +463,19 @@ const MODULE_REMOVALS: {
459463
paths: ['src/components/dashboard/TwoFactorSettings.tsx'],
460464
label: 'Two-factor Authentication (UI)',
461465
},
466+
{
467+
key: 'enablePlugins',
468+
paths: [
469+
`${APP}/(marketing)/plugins`,
470+
`${APP}/(dashboard)/dashboard/plugins`,
471+
'src/app/api/plugins',
472+
'src/lib/plugins',
473+
'src/components/marketing/PluginsShowcase.tsx',
474+
'src/components/marketing/PluginDetail.tsx',
475+
'src/components/dashboard/PluginMarketplace.tsx',
476+
],
477+
label: 'Plugin Marketplace',
478+
},
462479
];
463480

464481
// Maps CLI enable* flags → server-side ENABLE_* env var names.
@@ -490,6 +507,7 @@ const FEATURE_ENV_VARS: Partial<Record<keyof ProjectConfig, string>> = {
490507
enableReports: 'ENABLE_REPORTS',
491508
enableBranding: 'ENABLE_BRANDING',
492509
enableTwoFactor: 'ENABLE_TWO_FACTOR',
510+
enablePlugins: 'ENABLE_PLUGINS',
493511
};
494512

495513
function generateEnvFile(root: string, config: ProjectConfig): void {
@@ -652,6 +670,7 @@ async function interactiveSetup(): Promise<ProjectConfig> {
652670
enableTwoFactor:
653671
authProvider !== 'none' &&
654672
(await confirmPrompt(iface, 'Enable two-factor authentication (TOTP)?')),
673+
enablePlugins: await confirmPrompt(iface, 'Enable plugin marketplace (/plugins)?'),
655674
};
656675

657676
if (await confirmPrompt(iface, 'Remove unused module code?', false)) {

‎src/utils/env-config.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export const FEATURE_ENV: Readonly<Record<string, string>> = {
3939
sso: 'ENABLE_SSO',
4040
experiments: 'ENABLE_EXPERIMENTS',
4141
dripCampaigns: 'ENABLE_DRIP_CAMPAIGNS',
42+
plugins: 'ENABLE_PLUGINS',
4243
};
4344

4445
/** Auth-gated features: when AUTH_PROVIDER=none, these are forced off. */

0 commit comments

Comments
 (0)