Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CPC: Use storybook package as the peerDep #28310

Merged
merged 26 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
525a98b
make the `storybook` package portal to `@storybook/core`
ndelangen Jun 21, 2024
8e2db19
make packages peerDep on `storybook` package instead of `@storybook/c…
ndelangen Jun 21, 2024
cb5b778
make packages peerDep on `storybook` package instead of `@storybook/c…
ndelangen Jun 21, 2024
c6f9289
tried migrating the cli package to type-module to try to get vite to …
ndelangen Jun 21, 2024
7c8cc56
change references from `@storybook/cli` to `storybook`
ndelangen Jun 22, 2024
2ff0087
fix a few unit tests due to the cli now being type:module
ndelangen Jun 22, 2024
f56ef2b
fix linting
ndelangen Jun 22, 2024
2d76a5f
proxy all including `storybook` package
ndelangen Jun 22, 2024
a452400
fix
ndelangen Jun 22, 2024
a18a63f
force close after publishing with --open
ndelangen Jun 22, 2024
4193511
fix script to generate portal to core
ndelangen Jun 22, 2024
40407a6
fix a type issue
ndelangen Jun 23, 2024
e40e275
trial and error
ndelangen Jun 23, 2024
ca0047a
fix mapping to core-events errors
ndelangen Jun 24, 2024
84f2398
trying to make it work
ndelangen Jun 24, 2024
147f78d
fixes
ndelangen Jun 24, 2024
47b3a3f
fixes
ndelangen Jun 24, 2024
6d7e1b3
add cjs files to cli package.json declaration
yannbf Jun 24, 2024
8dcd2f8
Merge branch 'norbert/cpc-storybook' of github.com:storybookjs/storyb…
yannbf Jun 24, 2024
caecadb
fix
yannbf Jun 24, 2024
127c8a5
chore: Remove commented out code in entries.ts
ndelangen Jun 24, 2024
c415320
disable test
ndelangen Jun 24, 2024
eb760b7
Update import paths for core files in update-core-portal.ts
ndelangen Jun 24, 2024
4e2aa1c
cleanup
ndelangen Jun 24, 2024
c1a42e0
cleanup
ndelangen Jun 25, 2024
d813d6c
Merge branch 'norbert/cpc' into norbert/cpc-storybook
ndelangen Jun 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/workflows/canary-release-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ jobs:

| | |
| --- | --- |
| **Published version** | [`${{ steps.version.outputs.next-version }}`](https://npmjs.com/package/@storybook/cli/v/${{ steps.version.outputs.next-version }}) |
| **Published version** | [`${{ steps.version.outputs.next-version }}`](https://npmjs.com/package/storybook/v/${{ steps.version.outputs.next-version }}) |
| **Triggered by** | @${{ github.triggering_actor }} |
| **Repository** | [${{ steps.info.outputs.repository }}](https://github.com/${{ steps.info.outputs.repository }}) |
| **Branch** | [`${{ steps.info.outputs.branch }}`](https://github.com/${{ steps.info.outputs.repository }}/tree/${{ steps.info.outputs.branch }}) |
Expand Down
1 change: 1 addition & 0 deletions code/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ module.exports = {
},
plugins: ['local-rules'],
rules: {
'import/no-unresolved': 'off', // covered by typescript
'eslint-comments/disable-enable-pair': ['error', { allowWholeFile: true }],
'eslint-comments/no-unused-disable': 'error',
'react-hooks/rules-of-hooks': 'off',
Expand Down
2 changes: 1 addition & 1 deletion code/addons/a11y/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"typescript": "^5.3.2"
},
"peerDependencies": {
"@storybook/core": "workspace:^"
"storybook": "workspace:^"
},
"publishConfig": {
"access": "public"
Expand Down
4 changes: 2 additions & 2 deletions code/addons/a11y/src/a11yRunner.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { Mock } from 'vitest';
import { describe, beforeEach, it, expect, vi } from 'vitest';
import { addons } from '@storybook/core/preview-api';
import { addons } from 'storybook/preview-api';
import { EVENTS } from './constants';

vi.mock('@storybook/core/preview-api');
vi.mock('storybook/preview-api');
const mockedAddons = vi.mocked(addons);

describe('a11yRunner', () => {
Expand Down
2 changes: 1 addition & 1 deletion code/addons/a11y/src/a11yRunner.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { global } from '@storybook/global';
import { addons } from '@storybook/core/preview-api';
import { addons } from 'storybook/preview-api';
import { EVENTS } from './constants';
import type { A11yParameters } from './params';

Expand Down
6 changes: 3 additions & 3 deletions code/addons/a11y/src/components/A11YPanel.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import { describe, beforeEach, afterEach, it, expect, vi } from 'vitest';
import React from 'react';
import { render, waitFor, fireEvent, act, cleanup } from '@testing-library/react';

import { ThemeProvider, themes, convert } from '@storybook/core/theming';
import * as api from '@storybook/core/manager-api';
import { ThemeProvider, themes, convert } from 'storybook/theming';
import * as api from 'storybook/manager-api';

import { A11YPanel } from './A11YPanel';
import { EVENTS } from '../constants';

vi.mock('@storybook/core/manager-api');
vi.mock('storybook/manager-api');

global.ResizeObserver = require('resize-observer-polyfill');

Expand Down
6 changes: 3 additions & 3 deletions code/addons/a11y/src/components/A11YPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React, { useCallback, useMemo, useState } from 'react';

import { styled } from '@storybook/core/theming';
import { styled } from 'storybook/theming';

import { ActionBar, ScrollArea } from '@storybook/core/components';
import { ActionBar, ScrollArea } from 'storybook/components';
import { SyncIcon, CheckIcon } from '@storybook/icons';

import type { AxeResults } from 'axe-core';
Expand All @@ -11,7 +11,7 @@ import {
useParameter,
useStorybookApi,
useStorybookState,
} from '@storybook/core/manager-api';
} from 'storybook/manager-api';

import { Report } from './Report';

Expand Down
6 changes: 3 additions & 3 deletions code/addons/a11y/src/components/A11yContext.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import { describe, beforeEach, afterEach, it, expect, vi } from 'vitest';
import * as React from 'react';
import type { AxeResults } from 'axe-core';
import { render, act, cleanup } from '@testing-library/react';
import * as api from '@storybook/core/manager-api';
import { STORY_CHANGED } from '@storybook/core/core-events';
import * as api from 'storybook/manager-api';
import { STORY_CHANGED } from 'storybook/core-events';
import { HIGHLIGHT } from '@storybook/addon-highlight';

import { A11yContextProvider, useA11yContext } from './A11yContext';
import { EVENTS } from '../constants';

vi.mock('@storybook/core/manager-api');
vi.mock('storybook/manager-api');
const mockedApi = vi.mocked(api);

const storyId = 'jest';
Expand Down
6 changes: 3 additions & 3 deletions code/addons/a11y/src/components/A11yContext.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as React from 'react';
import { themes, convert } from '@storybook/core/theming';
import { themes, convert } from 'storybook/theming';
import type { Result } from 'axe-core';
import { useChannel, useAddonState, useStorybookApi } from '@storybook/core/manager-api';
import { STORY_CHANGED, STORY_RENDERED } from '@storybook/core/core-events';
import { useChannel, useAddonState, useStorybookApi } from 'storybook/manager-api';
import { STORY_CHANGED, STORY_RENDERED } from 'storybook/core-events';
import { HIGHLIGHT } from '@storybook/addon-highlight';
import { ADDON_ID, EVENTS } from '../constants';

Expand Down
2 changes: 1 addition & 1 deletion code/addons/a11y/src/components/Report/Elements.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { FC } from 'react';
import React from 'react';

import { styled } from '@storybook/core/theming';
import { styled } from 'storybook/theming';

import type { NodeResult } from 'axe-core';
import { Rules } from './Rules';
Expand Down
2 changes: 1 addition & 1 deletion code/addons/a11y/src/components/Report/HighlightToggle.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { styled } from '@storybook/core/theming';
import { styled } from 'storybook/theming';

import type { NodeResult } from 'axe-core';
import { useA11yContext } from '../A11yContext';
Expand Down
2 changes: 1 addition & 1 deletion code/addons/a11y/src/components/Report/Info.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { FC } from 'react';
import React from 'react';

import { styled } from '@storybook/core/theming';
import { styled } from 'storybook/theming';
import type { Result } from 'axe-core';

const Wrapper = styled.div({
Expand Down
2 changes: 1 addition & 1 deletion code/addons/a11y/src/components/Report/Item.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { Fragment, useState } from 'react';

import { styled } from '@storybook/core/theming';
import { styled } from 'storybook/theming';

import type { Result } from 'axe-core';
import { Info } from './Info';
Expand Down
4 changes: 2 additions & 2 deletions code/addons/a11y/src/components/Report/Rules.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { FC } from 'react';
import React from 'react';
import { styled } from '@storybook/core/theming';
import { Badge } from '@storybook/core/components';
import { styled } from 'storybook/theming';
import { Badge } from 'storybook/components';
import type { CheckResult } from 'axe-core';
import { useResizeDetector } from 'react-resize-detector';

Expand Down
2 changes: 1 addition & 1 deletion code/addons/a11y/src/components/Report/Tags.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { FC } from 'react';
import React from 'react';

import { styled } from '@storybook/core/theming';
import { styled } from 'storybook/theming';
import type { TagValue } from 'axe-core';

const Wrapper = styled.div({
Expand Down
2 changes: 1 addition & 1 deletion code/addons/a11y/src/components/Report/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { FC } from 'react';
import React, { Fragment } from 'react';
import { EmptyTabContent } from '@storybook/core/components';
import { EmptyTabContent } from 'storybook/components';
import type { Result } from 'axe-core';

import { Item } from './Item';
Expand Down
2 changes: 1 addition & 1 deletion code/addons/a11y/src/components/Tabs.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';

import { styled } from '@storybook/core/theming';
import { styled } from 'storybook/theming';
import type { NodeResult, Result } from 'axe-core';
import { useResizeDetector } from 'react-resize-detector';
import HighlightToggle from './Report/HighlightToggle';
Expand Down
2 changes: 1 addition & 1 deletion code/addons/a11y/src/components/VisionSimulator.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { describe, it, expect } from 'vitest';
import React from 'react';
import { render, fireEvent, screen, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { ThemeProvider, themes, convert } from '@storybook/core/theming';
import { ThemeProvider, themes, convert } from 'storybook/theming';
import { VisionSimulator, baseList } from './VisionSimulator';

const getOptionByNameAndPercentage = (option: string, percentage?: number) =>
Expand Down
4 changes: 2 additions & 2 deletions code/addons/a11y/src/components/VisionSimulator.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { ReactNode } from 'react';
import React, { useState } from 'react';
import { Global, styled } from '@storybook/core/theming';
import { IconButton, WithTooltip, TooltipLinkList } from '@storybook/core/components';
import { Global, styled } from 'storybook/theming';
import { IconButton, WithTooltip, TooltipLinkList } from 'storybook/components';

import { AccessibilityIcon } from '@storybook/icons';
import { Filters } from './ColorFilters';
Expand Down
6 changes: 3 additions & 3 deletions code/addons/a11y/src/manager.test.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// @vitest-environment happy-dom

import { describe, it, expect, vi } from 'vitest';
import * as api from '@storybook/core/manager-api';
import type { Addon_BaseType } from '@storybook/core/types';
import * as api from 'storybook/manager-api';
import type { Addon_BaseType } from 'storybook/types';
import { PANEL_ID } from './constants';
import './manager';

vi.mock('@storybook/core/manager-api');
vi.mock('storybook/manager-api');
const mockedApi = vi.mocked<api.API>(api as any);
mockedApi.useAddonState = vi.fn();
const mockedAddons = vi.mocked(api.addons);
Expand Down
4 changes: 2 additions & 2 deletions code/addons/a11y/src/manager.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { addons, types, useAddonState } from '@storybook/core/manager-api';
import { Badge, Spaced } from '@storybook/core/components';
import { addons, types, useAddonState } from 'storybook/manager-api';
import { Badge, Spaced } from 'storybook/components';
import { ADDON_ID, PANEL_ID, PARAM_KEY } from './constants';
import { VisionSimulator } from './components/VisionSimulator';
import { A11YPanel } from './components/A11YPanel';
Expand Down
4 changes: 2 additions & 2 deletions code/addons/actions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@
"typescript": "^5.3.2"
},
"peerDependencies": {
"@storybook/core": "workspace:^",
"@storybook/test": "workspace:*"
"@storybook/test": "workspace:*",
"storybook": "workspace:^"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion code/addons/actions/src/addArgs.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ArgsEnhancer } from '@storybook/core/types';
import type { ArgsEnhancer } from 'storybook/types';
import { addActionsFromArgTypes, inferActionsFromArgTypesRegex } from './addArgsHelpers';

export const argsEnhancers: ArgsEnhancer[] = [
Expand Down
2 changes: 1 addition & 1 deletion code/addons/actions/src/addArgsHelpers.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest';
import type { StoryContext } from '@storybook/core/types';
import type { StoryContext } from 'storybook/types';
import { inferActionsFromArgTypesRegex, addActionsFromArgTypes } from './addArgsHelpers';

describe('actions parameter enhancers', () => {
Expand Down
2 changes: 1 addition & 1 deletion code/addons/actions/src/addArgsHelpers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Args, Renderer, ArgsEnhancer } from '@storybook/core/types';
import type { Args, Renderer, ArgsEnhancer } from 'storybook/types';
import { action } from './runtime/action';

// interface ActionsParameter {
Expand Down
6 changes: 3 additions & 3 deletions code/addons/actions/src/components/ActionLogger/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { ElementRef, ReactNode } from 'react';
import React, { forwardRef, Fragment, useEffect, useRef } from 'react';
import type { Theme } from '@storybook/core/theming';
import { styled, withTheme } from '@storybook/core/theming';
import type { Theme } from 'storybook/theming';
import { styled, withTheme } from 'storybook/theming';

import { Inspector } from 'react-inspector';
import { ActionBar, ScrollArea } from '@storybook/core/components';
import { ActionBar, ScrollArea } from 'storybook/components';

import { Action, Counter, InspectorContainer } from './style';
import type { ActionDisplay } from '../../models';
Expand Down
2 changes: 1 addition & 1 deletion code/addons/actions/src/components/ActionLogger/style.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { styled } from '@storybook/core/theming';
import { styled } from 'storybook/theming';
import { opacify } from 'polished';

export const Action = styled.div({
Expand Down
4 changes: 2 additions & 2 deletions code/addons/actions/src/containers/ActionLogger/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React, { Component } from 'react';
import { dequal as deepEqual } from 'dequal';

import type { API } from '@storybook/core/manager-api';
import { STORY_CHANGED } from '@storybook/core/core-events';
import type { API } from 'storybook/manager-api';
import { STORY_CHANGED } from 'storybook/core-events';

import { ActionLogger as ActionLoggerComponent } from '../../components/ActionLogger';
import type { ActionDisplay } from '../../models';
Expand Down
4 changes: 2 additions & 2 deletions code/addons/actions/src/decorator.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { global } from '@storybook/global';
import { useEffect, makeDecorator } from '@storybook/core/preview-api';
import type { PartialStoryFn, Renderer } from '@storybook/core/types';
import { useEffect, makeDecorator } from 'storybook/preview-api';
import type { PartialStoryFn, Renderer } from 'storybook/types';
import { actions } from './runtime/actions';

import { PARAM_KEY } from './constants';
Expand Down
2 changes: 1 addition & 1 deletion code/addons/actions/src/loaders.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable no-underscore-dangle */
import type { LoaderFunction } from '@storybook/core/types';
import type { LoaderFunction } from 'storybook/types';
import { global } from '@storybook/global';
import type { onMockCall as onMockCallType } from '@storybook/test';
import { action } from './runtime';
Expand Down
6 changes: 3 additions & 3 deletions code/addons/actions/src/manager.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { addons, types, useAddonState, useChannel } from '@storybook/core/manager-api';
import { STORY_CHANGED } from '@storybook/core/core-events';
import { Badge, Spaced } from '@storybook/core/components';
import { addons, types, useAddonState, useChannel } from 'storybook/manager-api';
import { STORY_CHANGED } from 'storybook/core-events';
import { Badge, Spaced } from 'storybook/components';
import ActionLogger from './containers/ActionLogger';
import { ADDON_ID, CLEAR_ID, EVENT_ID, PANEL_ID, PARAM_KEY } from './constants';

Expand Down
4 changes: 2 additions & 2 deletions code/addons/actions/src/runtime/__tests__/action.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { describe, it, expect, vi } from 'vitest';
import { addons } from '@storybook/core/preview-api';
import { addons } from 'storybook/preview-api';
import { action, configureActions } from '../..';

vi.mock('@storybook/core/preview-api');
vi.mock('storybook/preview-api');

const createChannel = () => {
const channel = { emit: vi.fn() };
Expand Down
4 changes: 2 additions & 2 deletions code/addons/actions/src/runtime/__tests__/actions.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { describe, it, expect, vi } from 'vitest';
import { addons } from '@storybook/core/preview-api';
import { addons } from 'storybook/preview-api';
import { actions } from '../..';

vi.mock('@storybook/core/preview-api');
vi.mock('storybook/preview-api');

const createChannel = () => {
const channel = { emit: vi.fn() };
Expand Down
8 changes: 4 additions & 4 deletions code/addons/actions/src/runtime/action.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { v4 as uuidv4 } from 'uuid';
import type { PreviewWeb } from '@storybook/core/preview-api';
import { addons } from '@storybook/core/preview-api';
import type { Renderer } from '@storybook/core/types';
import type { PreviewWeb } from 'storybook/preview-api';
import { addons } from 'storybook/preview-api';
import type { Renderer } from 'storybook/types';
import { global } from '@storybook/global';
import { ImplicitActionsDuringRendering } from '@storybook/core/preview-errors';
import { ImplicitActionsDuringRendering } from 'storybook/preview-errors';
import { EVENT_ID } from '../constants';
import type { ActionDisplay, ActionOptions, HandlerFunction } from '../models';
import { config } from './configureActions';
Expand Down
2 changes: 1 addition & 1 deletion code/addons/actions/src/typings.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
declare var FEATURES: import('@storybook/core/types').StorybookConfigRaw['features'];
declare var FEATURES: import('storybook/types').StorybookConfigRaw['features'];
2 changes: 1 addition & 1 deletion code/addons/backgrounds/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"typescript": "^5.3.2"
},
"peerDependencies": {
"@storybook/core": "workspace:^"
"storybook": "workspace:^"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion code/addons/backgrounds/src/components/ColorIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { styled } from '@storybook/core/theming';
import { styled } from 'storybook/theming';

export const ColorIcon = styled.span(
({ background }: { background: string }) => ({
Expand Down
6 changes: 3 additions & 3 deletions code/addons/backgrounds/src/containers/BackgroundSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import type { FC } from 'react';
import React, { useState, Fragment, useCallback, useMemo, memo } from 'react';
import memoize from 'memoizerific';

import { useParameter, useGlobals } from '@storybook/core/manager-api';
import { logger } from '@storybook/core/client-logger';
import { IconButton, WithTooltip, TooltipLinkList } from '@storybook/core/components';
import { useParameter, useGlobals } from 'storybook/manager-api';
import { logger } from 'storybook/client-logger';
import { IconButton, WithTooltip, TooltipLinkList } from 'storybook/components';

import { PhotoIcon } from '@storybook/icons';
import { PARAM_KEY as BACKGROUNDS_PARAM_KEY } from '../constants';
Expand Down
4 changes: 2 additions & 2 deletions code/addons/backgrounds/src/containers/GridSelector.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { FC } from 'react';
import React, { memo } from 'react';

import { useGlobals, useParameter } from '@storybook/core/manager-api';
import { IconButton } from '@storybook/core/components';
import { useGlobals, useParameter } from 'storybook/manager-api';
import { IconButton } from 'storybook/components';

import { GridIcon } from '@storybook/icons';
import { PARAM_KEY as BACKGROUNDS_PARAM_KEY } from '../constants';
Expand Down
Loading
Loading