Skip to content

Commit d608a27

Browse files
authored
chore: Remove legacy Wizard for Next.js; no Next.js 14 support (#214)
1 parent 370bfc7 commit d608a27

File tree

9 files changed

+42
-1071
lines changed

9 files changed

+42
-1071
lines changed

bin.ts

Lines changed: 1 addition & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,7 @@ if (!satisfies(process.version, NODE_VERSION_RANGE)) {
2020
import { runMCPInstall, runMCPRemove } from './src/mcp';
2121
import type { CloudRegion, WizardOptions } from './src/utils/types';
2222
import { runWizard } from './src/run';
23-
import { runEventSetupWizard } from './src/nextjs/event-setup';
24-
import {
25-
readEnvironment,
26-
isNonInteractiveEnvironment,
27-
} from './src/utils/environment';
28-
import path from 'path';
23+
import { isNonInteractiveEnvironment } from './src/utils/environment';
2924
import clack from './src/utils/clack';
3025

3126
if (isNonInteractiveEnvironment()) {
@@ -113,48 +108,6 @@ yargs(hideBin(process.argv))
113108
void runWizard(options as unknown as WizardOptions);
114109
},
115110
)
116-
.command(
117-
'event-setup',
118-
'Run the event setup wizard',
119-
(yargs) => {
120-
return yargs.options({
121-
'install-dir': {
122-
describe:
123-
'Directory to run the wizard in\nenv: POSTHOG_WIZARD_INSTALL_DIR',
124-
type: 'string',
125-
},
126-
});
127-
},
128-
(argv) => {
129-
const finalArgs = {
130-
...argv,
131-
...readEnvironment(),
132-
} as any;
133-
134-
let resolvedInstallDir: string;
135-
if (finalArgs.installDir) {
136-
if (path.isAbsolute(finalArgs.installDir)) {
137-
resolvedInstallDir = finalArgs.installDir;
138-
} else {
139-
resolvedInstallDir = path.join(process.cwd(), finalArgs.installDir);
140-
}
141-
} else {
142-
resolvedInstallDir = process.cwd();
143-
}
144-
145-
const wizardOptions: WizardOptions = {
146-
debug: finalArgs.debug ?? false,
147-
installDir: resolvedInstallDir,
148-
cloudRegion: finalArgs.region as CloudRegion | undefined,
149-
default: finalArgs.default ?? false,
150-
signup: finalArgs.signup ?? false,
151-
forceInstall: false,
152-
localMcp: finalArgs.localMcp ?? false,
153-
};
154-
155-
void runEventSetupWizard(wizardOptions);
156-
},
157-
)
158111
.command('mcp <command>', 'MCP server management commands', (yargs) => {
159112
return yargs
160113
.command(

src/__tests__/run.test.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
import { runWizard } from '../run';
2-
import { runNextjsWizard } from '../nextjs/nextjs-wizard';
2+
import { runNextjsWizardAgent } from '../nextjs/nextjs-wizard-agent';
33
import { analytics } from '../utils/analytics';
44
import { Integration } from '../lib/constants';
55

6-
jest.mock('../nextjs/nextjs-wizard');
76
jest.mock('../nextjs/nextjs-wizard-agent');
87
jest.mock('../utils/analytics');
98
jest.mock('../utils/clack');
109

11-
const mockRunNextjsWizard = runNextjsWizard as jest.MockedFunction<
12-
typeof runNextjsWizard
10+
const mockRunNextjsWizardAgent = runNextjsWizardAgent as jest.MockedFunction<
11+
typeof runNextjsWizardAgent
1312
>;
1413
const mockAnalytics = analytics as jest.Mocked<typeof analytics>;
1514

@@ -38,7 +37,7 @@ describe('runWizard error handling', () => {
3837
forceInstall: false,
3938
};
4039

41-
mockRunNextjsWizard.mockRejectedValue(testError);
40+
mockRunNextjsWizardAgent.mockRejectedValue(testError);
4241

4342
await expect(runWizard(testArgs)).rejects.toThrow('process.exit called');
4443

@@ -53,7 +52,7 @@ describe('runWizard error handling', () => {
5352
it('should not call captureException when wizard succeeds', async () => {
5453
const testArgs = { integration: Integration.nextjs };
5554

56-
mockRunNextjsWizard.mockResolvedValue(undefined);
55+
mockRunNextjsWizardAgent.mockResolvedValue(undefined);
5756

5857
await runWizard(testArgs);
5958

src/lib/constants.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,6 @@ export enum Integration {
66
astro = 'astro',
77
}
88

9-
export enum FeatureFlagDefinition {
10-
NextV2 = 'wizard-next-v2',
11-
}
12-
13-
export enum WizardVariant {
14-
Legacy = 'legacy',
15-
Agent = 'agent',
16-
}
17-
189
export function getIntegrationDescription(type: string): string {
1910
switch (type) {
2011
case Integration.nextjs:

src/lib/framework-config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ export interface FrameworkMetadata {
3030
/** Message shown when user declines AI consent */
3131
abortMessage: string;
3232

33+
/**
34+
* Optional URL to docs for users with unsupported framework versions.
35+
* If not provided, defaults to docsUrl.
36+
*/
37+
unsupportedVersionDocsUrl?: string;
38+
3339
/**
3440
* Optional function to gather framework-specific context before agent runs.
3541
* For Next.js: detects router type

0 commit comments

Comments
 (0)