Skip to content

Commit dbc77bf

Browse files
authored
Merge pull request #28855 from storybookjs/version-patch-from-8.2.8
Release: Patch 8.2.9
2 parents 2faeae2 + b82c7ca commit dbc77bf

File tree

9 files changed

+49
-17
lines changed

9 files changed

+49
-17
lines changed

.circleci/config.yml

+17
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,23 @@ jobs:
594594
IN_STORYBOOK_SANDBOX: true
595595
STORYBOOK_INIT_EMPTY_TYPE: << parameters.template >>
596596
STORYBOOK_DISABLE_TELEMETRY: true
597+
- when:
598+
condition:
599+
equal: ["react-vite-ts", << parameters.template >>]
600+
steps:
601+
- run:
602+
name: Storybook init from empty directory (--skip-install)
603+
command: |
604+
cd code
605+
yarn local-registry --open &
606+
cd ../../
607+
mkdir empty-<< parameters.template >>-no-install
608+
cd empty-<< parameters.template >>-no-install
609+
npx storybook init --yes --skip-install
610+
environment:
611+
IN_STORYBOOK_SANDBOX: true
612+
STORYBOOK_INIT_EMPTY_TYPE: << parameters.template >>
613+
STORYBOOK_DISABLE_TELEMETRY: true
597614
- report-workflow-on-failure
598615
test-portable-stories:
599616
parameters:

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 8.2.9
2+
3+
- CLI: Fix `init --skip-install` - [#28853](https://github.com/storybookjs/storybook/pull/28853), thanks @ndelangen!
4+
- Telemetry: Disable save-from-controls logs for example stories - [#28870](https://github.com/storybookjs/storybook/pull/28870), thanks @shilman!
5+
16
## 8.2.8
27

38
- CLI: Parse more Yarn Berry errors - [#28816](https://github.com/storybookjs/storybook/pull/28816), thanks @yannbf!

code/core/src/core-server/utils/doTelemetry.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import invariant from 'tiny-invariant';
2-
import type { CoreConfig, Options, StoryIndex } from '@storybook/core/types';
2+
import type { CoreConfig, Options } from '@storybook/core/types';
33
import { telemetry, getPrecedingUpgrade } from '@storybook/core/telemetry';
44
import { useStorybookMetadata } from './metadata';
55
import type { StoryIndexGenerator } from './StoryIndexGenerator';

code/core/src/core-server/utils/save-story/save-story.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { storyNameFromExport, toId } from '@storybook/csf';
1616
import { printCsf, readCsf } from '@storybook/core/csf-tools';
1717
import { logger } from '@storybook/core/node-logger';
1818
import type { CoreConfig, Options } from '@storybook/core/types';
19-
import { telemetry } from '@storybook/core/telemetry';
19+
import { isExampleStoryId, telemetry } from '@storybook/core/telemetry';
2020

2121
import { basename, join } from 'node:path';
2222
import { updateArgsInCsfFile } from './update-args-in-csf-file';
@@ -120,7 +120,9 @@ export function initializeSaveStory(channel: Channel, options: Options, coreConf
120120
error: null,
121121
} satisfies ResponseData<SaveStoryResponsePayload>);
122122

123-
if (!coreConfig.disableTelemetry) {
123+
// don't take credit for save-from-controls actions against CLI example stories
124+
const isCLIExample = isExampleStoryId(newStoryId ?? csfId);
125+
if (!coreConfig.disableTelemetry && !isCLIExample) {
124126
await telemetry('save-story', {
125127
action: name ? 'createStory' : 'updateStory',
126128
success: true,

code/core/src/core-server/utils/summarizeIndex.ts

+2-10
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { isExampleStoryId } from '@storybook/core/telemetry';
12
import type { IndexEntry, StoryIndex } from '@storybook/core/types';
23

34
import { isMdxEntry, AUTODOCS_TAG, PLAY_FN_TAG } from './StoryIndexGenerator';
@@ -25,15 +26,6 @@ const isCLIExampleEntry = (entry: IndexEntry) =>
2526
'example-page--logged-out',
2627
].includes(entry.id);
2728

28-
/**
29-
* Is this story part of the CLI generated examples,
30-
* including user-created stories in those files
31-
*/
32-
const isAnyExampleEntry = (entry: IndexEntry) =>
33-
entry.id.startsWith('example-button--') ||
34-
entry.id.startsWith('example-header--') ||
35-
entry.id.startsWith('example-page--');
36-
3729
export function summarizeIndex(storyIndex: StoryIndex) {
3830
let storyCount = 0;
3931
const componentTitles = new Set<string>();
@@ -49,7 +41,7 @@ export function summarizeIndex(storyIndex: StoryIndex) {
4941
if (isCLIExampleEntry(entry)) {
5042
if (entry.type === 'story') exampleStoryCount += 1;
5143
if (entry.type === 'docs') exampleDocsCount += 1;
52-
} else if (isAnyExampleEntry(entry)) {
44+
} else if (isExampleStoryId(entry.id)) {
5345
if (entry.type === 'story') onboardingStoryCount += 1;
5446
if (entry.type === 'docs') onboardingDocsCount += 1;
5547
} else if (entry.type === 'story') {

code/core/src/telemetry/index.ts

+9
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@ export { getPrecedingUpgrade } from './event-cache';
1515

1616
export { addToGlobalContext } from './telemetry';
1717

18+
/**
19+
* Is this story part of the CLI generated examples,
20+
* including user-created stories in those files
21+
*/
22+
export const isExampleStoryId = (storyId: string) =>
23+
storyId.startsWith('example-button--') ||
24+
storyId.startsWith('example-header--') ||
25+
storyId.startsWith('example-page--');
26+
1827
export const telemetry = async (
1928
eventType: EventType,
2029
payload: Payload = {},

code/lib/cli/src/dirs.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { dirname, join } from 'path';
22

3-
import downloadTarball from '@ndelangen/get-tarball';
4-
import getNpmTarballUrl from 'get-npm-tarball-url';
3+
import downloadTarballDefault from '@ndelangen/get-tarball';
4+
import getNpmTarballUrlDefault from 'get-npm-tarball-url';
55

66
import invariant from 'tiny-invariant';
77
import { externalFrameworks } from './project_types';
@@ -22,6 +22,12 @@ const resolveUsingBranchInstall = async (packageManager: JsPackageManager, reque
2222
// FIXME: this might not be the right version for community packages
2323
const version = versions[name] || (await packageManager.latestVersion(request));
2424

25+
// an artifact of esbuild + type=commonjs + exportmap
26+
// @ts-expect-error (default export)
27+
const getNpmTarballUrl = getNpmTarballUrlDefault.default || getNpmTarballUrlDefault;
28+
// @ts-expect-error (default export)
29+
const downloadTarball = downloadTarballDefault.default || downloadTarballDefault;
30+
2531
const url = getNpmTarballUrl(request, version, {
2632
registry: await packageManager.getRegistryURL(),
2733
});

code/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -278,5 +278,6 @@
278278
"Dependency Upgrades"
279279
]
280280
]
281-
}
281+
},
282+
"deferredNextVersion": "8.2.9"
282283
}

docs/versions/latest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"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!"}}
1+
{"version":"8.2.9","info":{"plain":"- CLI: Fix `init --skip-install` - [#28853](https://github.com/storybookjs/storybook/pull/28853), thanks @ndelangen!\n- Telemetry: Disable save-from-controls logs for example stories - [#28870](https://github.com/storybookjs/storybook/pull/28870), thanks @shilman!"}}

0 commit comments

Comments
 (0)