Skip to content

Commit

Permalink
Merge pull request #28855 from storybookjs/version-patch-from-8.2.8
Browse files Browse the repository at this point in the history
Release: Patch 8.2.9
  • Loading branch information
shilman authored Aug 13, 2024
2 parents 2faeae2 + b82c7ca commit dbc77bf
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 17 deletions.
17 changes: 17 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,23 @@ jobs:
IN_STORYBOOK_SANDBOX: true
STORYBOOK_INIT_EMPTY_TYPE: << parameters.template >>
STORYBOOK_DISABLE_TELEMETRY: true
- when:
condition:
equal: ["react-vite-ts", << parameters.template >>]
steps:
- run:
name: Storybook init from empty directory (--skip-install)
command: |
cd code
yarn local-registry --open &
cd ../../
mkdir empty-<< parameters.template >>-no-install
cd empty-<< parameters.template >>-no-install
npx storybook init --yes --skip-install
environment:
IN_STORYBOOK_SANDBOX: true
STORYBOOK_INIT_EMPTY_TYPE: << parameters.template >>
STORYBOOK_DISABLE_TELEMETRY: true
- report-workflow-on-failure
test-portable-stories:
parameters:
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 8.2.9

- CLI: Fix `init --skip-install` - [#28853](https://github.com/storybookjs/storybook/pull/28853), thanks @ndelangen!
- Telemetry: Disable save-from-controls logs for example stories - [#28870](https://github.com/storybookjs/storybook/pull/28870), thanks @shilman!

## 8.2.8

- CLI: Parse more Yarn Berry errors - [#28816](https://github.com/storybookjs/storybook/pull/28816), thanks @yannbf!
Expand Down
2 changes: 1 addition & 1 deletion code/core/src/core-server/utils/doTelemetry.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import invariant from 'tiny-invariant';
import type { CoreConfig, Options, StoryIndex } from '@storybook/core/types';
import type { CoreConfig, Options } from '@storybook/core/types';
import { telemetry, getPrecedingUpgrade } from '@storybook/core/telemetry';
import { useStorybookMetadata } from './metadata';
import type { StoryIndexGenerator } from './StoryIndexGenerator';
Expand Down
6 changes: 4 additions & 2 deletions code/core/src/core-server/utils/save-story/save-story.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { storyNameFromExport, toId } from '@storybook/csf';
import { printCsf, readCsf } from '@storybook/core/csf-tools';
import { logger } from '@storybook/core/node-logger';
import type { CoreConfig, Options } from '@storybook/core/types';
import { telemetry } from '@storybook/core/telemetry';
import { isExampleStoryId, telemetry } from '@storybook/core/telemetry';

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

if (!coreConfig.disableTelemetry) {
// don't take credit for save-from-controls actions against CLI example stories
const isCLIExample = isExampleStoryId(newStoryId ?? csfId);
if (!coreConfig.disableTelemetry && !isCLIExample) {
await telemetry('save-story', {
action: name ? 'createStory' : 'updateStory',
success: true,
Expand Down
12 changes: 2 additions & 10 deletions code/core/src/core-server/utils/summarizeIndex.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { isExampleStoryId } from '@storybook/core/telemetry';
import type { IndexEntry, StoryIndex } from '@storybook/core/types';

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

/**
* Is this story part of the CLI generated examples,
* including user-created stories in those files
*/
const isAnyExampleEntry = (entry: IndexEntry) =>
entry.id.startsWith('example-button--') ||
entry.id.startsWith('example-header--') ||
entry.id.startsWith('example-page--');

export function summarizeIndex(storyIndex: StoryIndex) {
let storyCount = 0;
const componentTitles = new Set<string>();
Expand All @@ -49,7 +41,7 @@ export function summarizeIndex(storyIndex: StoryIndex) {
if (isCLIExampleEntry(entry)) {
if (entry.type === 'story') exampleStoryCount += 1;
if (entry.type === 'docs') exampleDocsCount += 1;
} else if (isAnyExampleEntry(entry)) {
} else if (isExampleStoryId(entry.id)) {
if (entry.type === 'story') onboardingStoryCount += 1;
if (entry.type === 'docs') onboardingDocsCount += 1;
} else if (entry.type === 'story') {
Expand Down
9 changes: 9 additions & 0 deletions code/core/src/telemetry/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ export { getPrecedingUpgrade } from './event-cache';

export { addToGlobalContext } from './telemetry';

/**
* Is this story part of the CLI generated examples,
* including user-created stories in those files
*/
export const isExampleStoryId = (storyId: string) =>
storyId.startsWith('example-button--') ||
storyId.startsWith('example-header--') ||
storyId.startsWith('example-page--');

export const telemetry = async (
eventType: EventType,
payload: Payload = {},
Expand Down
10 changes: 8 additions & 2 deletions code/lib/cli/src/dirs.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { dirname, join } from 'path';

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

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

// an artifact of esbuild + type=commonjs + exportmap
// @ts-expect-error (default export)
const getNpmTarballUrl = getNpmTarballUrlDefault.default || getNpmTarballUrlDefault;
// @ts-expect-error (default export)
const downloadTarball = downloadTarballDefault.default || downloadTarballDefault;

const url = getNpmTarballUrl(request, version, {
registry: await packageManager.getRegistryURL(),
});
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.9"
}
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.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!"}}
{"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 comments on commit dbc77bf

Please sign in to comment.