Skip to content

Commit

Permalink
Revert "Add ctx.projectMetadata.hasRouter"
Browse files Browse the repository at this point in the history
This reverts commit 5b5eea5.
  • Loading branch information
tmeasday committed Oct 30, 2024
1 parent 6e22224 commit 961bf6f
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 73 deletions.
33 changes: 0 additions & 33 deletions node-src/lib/getHasRouter.ts

This file was deleted.

32 changes: 1 addition & 31 deletions node-src/tasks/storybookInfo.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,38 +12,8 @@ describe('storybookInfo', () => {
const storybook = { version: '1.0.0', viewLayer: 'react', addons: [] };
getStorybookInfo.mockResolvedValue(storybook);

const ctx = { packageJson: {} } as any;
const ctx = {} as any;
await setStorybookInfo(ctx);
expect(ctx.storybook).toEqual(storybook);
});

it('sets hasRouter=true if there is a routing package in package.json', async () => {
const ctx = {
packageJson: {
dependencies: {
react: '^18',
'react-dom': '^18',
'react-router': '^6',
},
},
} as any;
await setStorybookInfo(ctx);
expect(ctx.projectMetadata.hasRouter).toEqual(true);
});

it('sets hasRouter=false if there is a routing package in package.json dependenices', async () => {
const ctx = {
packageJson: {
dependencies: {
react: '^18',
'react-dom': '^18',
},
devDependencies: {
'react-router': '^6',
},
},
} as any;
await setStorybookInfo(ctx);
expect(ctx.projectMetadata.hasRouter).toEqual(false);
});
});
6 changes: 0 additions & 6 deletions node-src/tasks/storybookInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import getStorybookInfo from '../lib/getStorybookInfo';
import { createTask, transitionTo } from '../lib/tasks';
import { Context } from '../types';
import { initial, pending, success } from '../ui/tasks/storybookInfo';
import { getHasRouter } from '../lib/getHasRouter';

export const setStorybookInfo = async (ctx: Context) => {
ctx.storybook = (await getStorybookInfo(ctx)) as Context['storybook'];
Expand All @@ -18,11 +17,6 @@ export const setStorybookInfo = async (ctx: Context) => {
}
Sentry.setContext('storybook', ctx.storybook);
}

// Also get some project-level data for analytics
ctx.projectMetadata = {
hasRouter: getHasRouter(ctx.packageJson),
};
};

/**
Expand Down
3 changes: 0 additions & 3 deletions node-src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,6 @@ export interface Context {
};
mainConfigFilePath?: string;
};
projectMetadata: {
hasRouter: boolean;
};
storybookUrl?: string;
announcedBuild: {
id: string;
Expand Down

0 comments on commit 961bf6f

Please sign in to comment.