Skip to content

Commit

Permalink
Merge pull request #28790 from storybookjs/version-patch-from-8.2.7
Browse files Browse the repository at this point in the history
Release: Patch 8.2.8
  • Loading branch information
yannbf authored Aug 7, 2024
2 parents 97d8476 + f114187 commit a779a54
Show file tree
Hide file tree
Showing 12 changed files with 79 additions and 51 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 8.2.8

- CLI: Parse more Yarn Berry errors - [#28816](https://github.com/storybookjs/storybook/pull/28816), thanks @yannbf!
- Fix: Invariant failed: Expected package.json#version to be defined in the "undefined" package - [#28752](https://github.com/storybookjs/storybook/pull/28752), thanks @abcdmku!

## 8.2.7

- CPC: Fix type usage in renderers - [#28745](https://github.com/storybookjs/storybook/pull/28745), thanks @ndelangen!
Expand Down
9 changes: 9 additions & 0 deletions code/core/src/common/js-package-manager/Yarn2Proxy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,15 @@ describe('Yarn 2 Proxy', () => {
expect(yarn2Proxy.parseErrorFromLogs(YARN2_ERROR_SAMPLE)).toMatchInlineSnapshot(
`
"YARN2 error
YN0002: MISSING_PEER_DEPENDENCY
-> before-storybook@workspace:. doesn't provide @testing-library/dom (p1ac37), requested by @testing-library/user-event.
YN0002: MISSING_PEER_DEPENDENCY
-> before-storybook@workspace:. doesn't provide eslint (p1f657), requested by eslint-plugin-storybook.
YN0086: EXPLAIN_PEER_DEPENDENCIES_CTA
-> Some peer dependencies are incorrectly met; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code.
YN0014: YARN_IMPORT_FAILED
-> Failed to import certain dependencies
Expand Down
60 changes: 23 additions & 37 deletions code/core/src/common/js-package-manager/Yarn2Proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,74 +12,60 @@ import type { PackageJson } from './PackageJson';
import type { InstallationMetadata, PackageMetadata } from './types';
import { parsePackageData } from './util';

// more info at https://yarnpkg.com/advanced/error-codes
const CRITICAL_YARN2_ERROR_CODES = {
YN0001: 'EXCEPTION',
YN0009: 'BUILD_FAILED',
YN0010: 'RESOLVER_NOT_FOUND',
YN0011: 'FETCHER_NOT_FOUND',
YN0012: 'LINKER_NOT_FOUND',
YN0014: 'YARN_IMPORT_FAILED',
YN0015: 'REMOTE_INVALID',
YN0016: 'REMOTE_NOT_FOUND',
YN0020: 'MISSING_LOCKFILE_ENTRY',
YN0021: 'WORKSPACE_NOT_FOUND',
YN0028: 'FROZEN_LOCKFILE_EXCEPTION',
YN0030: 'FETCH_FAILED',
YN0046: 'AUTOMERGE_FAILED_TO_PARSE',
YN0062: 'INCOMPATIBLE_OS',
YN0063: 'INCOMPATIBLE_CPU',
YN0071: 'NM_CANT_INSTALL_EXTERNAL_SOFT_LINK',
YN0072: 'NM_PRESERVE_SYMLINKS_REQUIRED',
YN0075: 'PROLOG_INSTANTIATION_ERROR',
YN0076: 'INCOMPATIBLE_ARCHITECTURE',
YN0078: 'RESOLUTION_MISMATCH',
YN0081: 'NETWORK_UNSAFE_HTTP',
YN0082: 'RESOLUTION_FAILED',
YN0083: 'AUTOMERGE_GIT_ERROR',
};

// @ts-expect-error If we want a code to be parsed, we move from the list below to the list above
// Keep the codes here, they might be helpful in the future
const YARN2_ERROR_CODES = {
...CRITICAL_YARN2_ERROR_CODES,
YN0000: 'UNNAMED',
YN0002: 'MISSING_PEER_DEPENDENCY',
YN0003: 'CYCLIC_DEPENDENCIES',
YN0004: 'DISABLED_BUILD_SCRIPTS',
YN0005: 'BUILD_DISABLED',
YN0006: 'SOFT_LINK_BUILD',
YN0007: 'MUST_BUILD',
YN0008: 'MUST_REBUILD',
YN0009: 'BUILD_FAILED',
YN0010: 'RESOLVER_NOT_FOUND',
YN0011: 'FETCHER_NOT_FOUND',
YN0012: 'LINKER_NOT_FOUND',
YN0013: 'FETCH_NOT_CACHED',
YN0017: 'RESOLUTION_PACK',
YN0014: 'YARN_IMPORT_FAILED',
YN0015: 'REMOTE_INVALID',
YN0016: 'REMOTE_NOT_FOUND',
YN0018: 'CACHE_CHECKSUM_MISMATCH',
YN0019: 'UNUSED_CACHE_ENTRY',
YN0020: 'MISSING_LOCKFILE_ENTRY',
YN0022: 'TOO_MANY_MATCHING_WORKSPACES',
YN0023: 'CONSTRAINTS_MISSING_DEPENDENCY',
YN0024: 'CONSTRAINTS_INCOMPATIBLE_DEPENDENCY',
YN0025: 'CONSTRAINTS_EXTRANEOUS_DEPENDENCY',
YN0026: 'CONSTRAINTS_INVALID_DEPENDENCY',
YN0027: 'CANT_SUGGEST_RESOLUTIONS',
YN0028: 'FROZEN_LOCKFILE_EXCEPTION',
YN0029: 'CROSS_DRIVE_VIRTUAL_LOCAL',
YN0030: 'FETCH_FAILED',
YN0031: 'DANGEROUS_NODE_MODULES',
YN0032: 'NODE_GYP_INJECTED',
YN0035: 'NETWORK_ERROR',
YN0046: 'AUTOMERGE_FAILED_TO_PARSE',
YN0047: 'AUTOMERGE_IMMUTABLE',
YN0048: 'AUTOMERGE_SUCCESS',
YN0049: 'AUTOMERGE_REQUIRED',
YN0050: 'DEPRECATED_CLI_SETTINGS',
YN0059: 'INVALID_RANGE_PEER_DEPENDENCY',
YN0060: 'INCOMPATIBLE_PEER_DEPENDENCY',
YN0061: 'DEPRECATED_PACKAGE',
YN0068: 'UNUSED_PACKAGE_EXTENSION',
YN0062: 'INCOMPATIBLE_OS',
YN0063: 'INCOMPATIBLE_CPU',
YN0069: 'REDUNDANT_PACKAGE_EXTENSION',
YN0071: 'NM_CANT_INSTALL_EXTERNAL_SOFT_LINK',
YN0072: 'NM_PRESERVE_SYMLINKS_REQUIRED',
YN0074: 'NM_HARDLINKS_MODE_DOWNGRADED',
YN0075: 'PROLOG_INSTANTIATION_ERROR',
YN0076: 'INCOMPATIBLE_ARCHITECTURE',
YN0077: 'GHOST_ARCHITECTURE',
YN0078: 'RESOLUTION_MISMATCH',
YN0080: 'NETWORK_DISABLED',
YN0085: 'UPDATED_RESOLUTION_RECORD',
YN0081: 'NETWORK_UNSAFE_HTTP',
YN0082: 'RESOLUTION_FAILED',
YN0083: 'AUTOMERGE_GIT_ERROR',
YN0086: 'EXPLAIN_PEER_DEPENDENCIES_CTA',
YN0087: 'MIGRATION_SUCCESS',
YN0088: 'VERSION_NOTICE',
YN0089: 'TIPS_NOTICE',
YN0090: 'OFFLINE_MODE_ENABLED',
};

Expand Down
3 changes: 2 additions & 1 deletion code/core/src/core-server/standalone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { dirname } from 'node:path';

async function build(options: any = {}, frameworkOptions: any = {}) {
const { mode = 'dev' } = options;
const packageJson = dirname(require.resolve('@storybook/core/package.json'));
const packageJsonDir = dirname(require.resolve('@storybook/core/package.json'));
const packageJson = JSON.parse(require('fs').readFileSync(`${packageJsonDir}/package.json`));

const commonOptions = {
...options,
Expand Down
3 changes: 2 additions & 1 deletion code/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -278,5 +278,6 @@
"Dependency Upgrades"
]
]
}
},
"deferredNextVersion": "8.2.8"
}
14 changes: 14 additions & 0 deletions docs/_snippets/angular-builder-production.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
```shell renderer="angular" tabTitle="with-builder"
# Builds Storybook with Angular's custom builder
# See https://storybook.js.org/docs/get-started/frameworks/angular#how-do-i-migrate-to-an-angular-storybook-builder
# to learn how to create the custom builder
ng run my-project:build-storybook
```

```json renderer="angular" language="js" filename="package.json" tabTitle="script-for-builder"
{
"scripts": {
"build-storybook": "ng run my-project:build-storybook"
}
}
```
8 changes: 0 additions & 8 deletions docs/_snippets/custom-build-script-production.md

This file was deleted.

4 changes: 4 additions & 0 deletions docs/api/portable-stories/portable-stories-jest.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ sidebar:

Normally, Storybook composes a story and its [annotations](#annotations) automatically, as part of the [story pipeline](#story-pipeline). When using stories in Jest tests, you must handle the story pipeline yourself, which is what the [`composeStories`](#composestories) and [`composeStory`](#composestory) functions enable.

<Callout variant="info">
The API specified here is available in Storybook `8.2.7` and up. If you're using an older version of Storybook, you can upgrade to the latest version (`npx storybook@latest upgrade`) to use this API. If you're unable to upgrade, you can use previous API, which uses the `.play()` method instead of `.run()`, but is otherwise identical.
</Callout>

<If renderer="react">
<Callout variant="info">
**Using `Next.js`?** You need to do three things differently when using portable stories in Jest with Next.js projects:
Expand Down
4 changes: 4 additions & 0 deletions docs/api/portable-stories/portable-stories-vitest.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ sidebar:

Normally, Storybook composes a story and its [annotations](#annotations) automatically, as part of the [story pipeline](#story-pipeline). When using stories in Vitest tests, you must handle the story pipeline yourself, which is what the [`composeStories`](#composestories) and [`composeStory`](#composestory) functions enable.

<Callout variant="info">
The API specified here is available in Storybook `8.2.7` and up. If you're using an older version of Storybook, you can upgrade to the latest version (`npx storybook@latest upgrade`) to use this API. If you're unable to upgrade, you can use previous API, which uses the `.play()` method instead of `.run()`, but is otherwise identical.
</Callout>

<If renderer="react">
<Callout variant="warning">
**Using `Next.js`?** Next.js requires specific configuration that is only available in [Jest](./portable-stories-jest.mdx). The portable stories API is not supported in Next.js with Vitest.
Expand Down
16 changes: 14 additions & 2 deletions docs/sharing/publish-storybook.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,26 @@ Teams publish Storybook online to review and collaborate on works in progress. T

## Build Storybook as a static web application

First, we'll need to build Storybook as a static web application. The functionality is already built-in and pre-configured for most supported frameworks. Others require a bit of customization (e.g., Angular). Run the following command inside your project's root directory:
First, we'll need to build Storybook as a static web application. The functionality is already built-in and pre-configured for most supported frameworks. Run the following command inside your project's root directory:

{/* prettier-ignore-start */}

<CodeSnippets path="custom-build-script-production.md" />
<CodeSnippets path="build-storybook-production-mode.md" />

{/* prettier-ignore-end */}

<If renderer="angular">

If you're using Angular, it's often better to use the [Angular builder](../get-started/frameworks/angular.mdx#how-do-i-migrate-to-an-angular-storybook-builder) to build Storybook:

{/* prettier-ignore-start */}

<CodeSnippets path="angular-builder-production.md" />

{/* prettier-ignore-end */}

</If>

<Callout variant="info" icon="💡">
You can provide additional flags to customize the command. Read more about the flag options [here](../api/cli-options.mdx).
</Callout>
Expand Down
2 changes: 1 addition & 1 deletion docs/versions/latest.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":"8.2.7","info":{"plain":"- CPC: Fix type usage in renderers - [#28745](https://github.com/storybookjs/storybook/pull/28745), thanks @ndelangen!\n- Core: Introduce run over play in portable stories, and revert back play changes of 8.2 - [#28764](https://github.com/storybookjs/storybook/pull/28764), thanks @kasperpeulen!"}}
{"version":"8.2.8","info":{"plain":"- CLI: Parse more Yarn Berry errors - [#28816](https://github.com/storybookjs/storybook/pull/28816), thanks @yannbf!\n- Fix: Invariant failed: Expected package.json#version to be defined in the \\\"undefined\\\" package - [#28752](https://github.com/storybookjs/storybook/pull/28752), thanks @abcdmku!"}}
2 changes: 1 addition & 1 deletion docs/versions/next.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":"8.3.0-alpha.3","info":{"plain":"- Angular: Fix Angular template error for props with a circular reference - [#28498](https://github.com/storybookjs/storybook/pull/28498), thanks @Marklb!\n- Angular: Fix template props not able to use dot notation - [#28588](https://github.com/storybookjs/storybook/pull/28588), thanks @Marklb!\n- CLI: Fix the initialization of Storybook in workspaces - [#28699](https://github.com/storybookjs/storybook/pull/28699), thanks @valentinpalkovic!\n- CPC: Fix missing exports for addon-kit - [#28691](https://github.com/storybookjs/storybook/pull/28691), thanks @ndelangen!\n- CPC: Fix type usage in renderers - [#28745](https://github.com/storybookjs/storybook/pull/28745), thanks @ndelangen!\n- Controls: Add disableSave parameter - [#28734](https://github.com/storybookjs/storybook/pull/28734), thanks @valentinpalkovic!\n- React: Avoid 'Dynamic require of react is not possible' issue - [#28730](https://github.com/storybookjs/storybook/pull/28730), thanks @valentinpalkovic!\n- Telemetry: Add mount, beforeEach, moduleMock stats - [#28624](https://github.com/storybookjs/storybook/pull/28624), thanks @shilman!\n- Telemetry: CSF feature usage - [#28622](https://github.com/storybookjs/storybook/pull/28622), thanks @shilman!\n- Types: Adjust beforeAll to be non-nullable in NormalizedProjectAnnotations - [#28671](https://github.com/storybookjs/storybook/pull/28671), thanks @kasperpeulen!\n- Vue: Fix out of memory error when using vue-component-meta for events and slots - [#28674](https://github.com/storybookjs/storybook/pull/28674), thanks @larsrickert!\n- Vue: Improve generated code snippets - [#27194](https://github.com/storybookjs/storybook/pull/27194), thanks @larsrickert!"}}
{"version":"8.3.0-alpha.4","info":{"plain":"- CSF: Allow overridding globals at the story level - [#26654](https://github.com/storybookjs/storybook/pull/26654), thanks @tmeasday!\n- Core: Introduce run over play in portable stories, and revert back play changes of 8.2 - [#28764](https://github.com/storybookjs/storybook/pull/28764), thanks @kasperpeulen!\n- Core: Split Storybook CLI - [#28519](https://github.com/storybookjs/storybook/pull/28519), thanks @kasperpeulen!\n- Fix: Invariant failed: Expected package.json#version to be defined in the \\\"undefined\\\" package - [#28752](https://github.com/storybookjs/storybook/pull/28752), thanks @abcdmku!\n- Next.js: Make RSC portable-stories compatible - [#28756](https://github.com/storybookjs/storybook/pull/28756), thanks @valentinpalkovic!\n- UI: Fix collapse/expand all functionality - [#28582](https://github.com/storybookjs/storybook/pull/28582), thanks @filipemelo2002!"}}

0 comments on commit a779a54

Please sign in to comment.