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

Hotfix/7.6.20 #28320

Merged
merged 13 commits into from
Jun 24, 2024
34 changes: 18 additions & 16 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ parameters:
default: 'skipped'

executors:
sb_node_16_classic:
sb_node_18_classic:
parameters:
class:
description: The Resource class
Expand All @@ -21,7 +21,7 @@ executors:
environment:
NODE_OPTIONS: --max_old_space_size=6144
resource_class: <<parameters.class>>
sb_node_16_browsers:
sb_node_18_browsers:
parameters:
class:
description: The Resource class
Expand Down Expand Up @@ -85,7 +85,7 @@ jobs:
pretty-docs:
executor:
class: medium
name: sb_node_16_classic
name: sb_node_18_classic
steps:
- git-shallow-clone/checkout_advanced:
clone_options: '--depth 1 --verbose'
Expand All @@ -110,8 +110,8 @@ jobs:
yarn docs:prettier:check
build:
executor:
class: large
name: sb_node_16_classic
class: xlarge
name: sb_node_18_classic
steps:
- git-shallow-clone/checkout_advanced:
clone_options: '--depth 1 --verbose'
Expand Down Expand Up @@ -154,7 +154,7 @@ jobs:
lint:
executor:
class: large
name: sb_node_16_classic
name: sb_node_18_classic
steps:
- git-shallow-clone/checkout_advanced:
clone_options: '--depth 1 --verbose'
Expand All @@ -170,7 +170,7 @@ jobs:
check:
executor:
class: xlarge
name: sb_node_16_classic
name: sb_node_18_classic
steps:
- git-shallow-clone/checkout_advanced:
clone_options: '--depth 1 --verbose'
Expand All @@ -184,7 +184,7 @@ jobs:
- report-workflow-on-failure
- cancel-workflow-on-failure
script-checks:
executor: sb_node_16_browsers
executor: sb_node_18_browsers
steps:
- git-shallow-clone/checkout_advanced:
clone_options: '--depth 1 --verbose'
Expand Down Expand Up @@ -212,7 +212,7 @@ jobs:
unit-tests:
executor:
class: xlarge
name: sb_node_16_browsers
name: sb_node_18_browsers
steps:
- git-shallow-clone/checkout_advanced:
clone_options: '--depth 1 --verbose'
Expand All @@ -234,7 +234,7 @@ jobs:
coverage:
executor:
class: small
name: sb_node_16_browsers
name: sb_node_18_browsers
steps:
- git-shallow-clone/checkout_advanced:
clone_options: '--depth 1 --verbose'
Expand All @@ -245,7 +245,7 @@ jobs:
chromatic-internal-storybooks:
executor:
class: medium+
name: sb_node_16_browsers
name: sb_node_18_browsers
environment:
NODE_OPTIONS: --max_old_space_size=6144
steps:
Expand All @@ -269,13 +269,16 @@ jobs:
type: integer
executor:
class: medium
name: sb_node_16_browsers
name: sb_node_18_browsers
parallelism: << parameters.parallelism >>
steps:
- git-shallow-clone/checkout_advanced:
clone_options: '--depth 1 --verbose'
- attach_workspace:
at: .
- run:
name: Enable Corepack
command: sudo corepack enable yarn
- run:
name: Creating Sandboxes
command: yarn task --task sandbox --template $(yarn get-template --cadence << pipeline.parameters.workflow >> --task sandbox) --no-link --start-from=never --junit
Expand All @@ -293,7 +296,7 @@ jobs:
type: integer
executor:
class: medium
name: sb_node_16_browsers
name: sb_node_18_browsers
parallelism: << parameters.parallelism >>
steps:
- git-shallow-clone/checkout_advanced:
Expand All @@ -313,7 +316,7 @@ jobs:
type: integer
executor:
class: large
name: sb_node_16_browsers
name: sb_node_18_browsers
parallelism: << parameters.parallelism >>
steps:
- git-shallow-clone/checkout_advanced:
Expand Down Expand Up @@ -392,7 +395,7 @@ jobs:
type: integer
executor:
class: medium
name: sb_node_16_browsers
name: sb_node_18_browsers
parallelism: << parameters.parallelism >>
steps:
- checkout
Expand Down Expand Up @@ -472,7 +475,6 @@ jobs:
command: yarn upload-bench $(yarn get-template --cadence << pipeline.parameters.workflow >> --task bench)
- report-workflow-on-failure:
template: $(yarn get-template --cadence << pipeline.parameters.workflow >> --task bench)

workflows:
docs:
when:
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
## 7.6.18

- Core: Replace ip function to address security concerns [#27529](https://github.com/storybookjs/storybook/pull/27529), thanks @tony19
- Telemetry: Detect Node version [#28299](https://github.com/storybookjs/storybook/pull/28299), thanks @yannbf
- Angular: Support v18 [#27237](https://github.com/storybookjs/storybook/pull/27237), thanks @valentinpalkovic

## 7.6.18
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

7.6.18 is here three times.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks :)


- Fix bad release in `7.6.18` thanks @jreinhold!

## 7.6.18
Expand Down
22 changes: 11 additions & 11 deletions code/frameworks/angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,17 @@
"zone.js": "^0.13.0"
},
"peerDependencies": {
"@angular-devkit/architect": ">=0.1400.0 < 0.1800.0",
"@angular-devkit/build-angular": ">=14.1.0 < 18.0.0",
"@angular-devkit/core": ">=14.1.0 < 18.0.0",
"@angular/cli": ">=14.1.0 < 18.0.0",
"@angular/common": ">=14.1.0 < 18.0.0",
"@angular/compiler": ">=14.1.0 < 18.0.0",
"@angular/compiler-cli": ">=14.1.0 < 18.0.0",
"@angular/core": ">=14.1.0 < 18.0.0",
"@angular/forms": ">=14.1.0 < 18.0.0",
"@angular/platform-browser": ">=14.1.0 < 18.0.0",
"@angular/platform-browser-dynamic": ">=14.1.0 < 18.0.0",
"@angular-devkit/architect": ">=0.1400.0 < 0.1900.0",
"@angular-devkit/build-angular": ">=14.1.0 < 19.0.0",
"@angular-devkit/core": ">=14.1.0 < 19.0.0",
"@angular/cli": ">=14.1.0 < 19.0.0",
"@angular/common": ">=14.1.0 < 19.0.0",
"@angular/compiler": ">=14.1.0 < 19.0.0",
"@angular/compiler-cli": ">=14.1.0 < 19.0.0",
"@angular/core": ">=14.1.0 < 19.0.0",
"@angular/forms": ">=14.1.0 < 19.0.0",
"@angular/platform-browser": ">=14.1.0 < 19.0.0",
"@angular/platform-browser-dynamic": ">=14.1.0 < 19.0.0",
"@babel/core": "*",
"rxjs": "^6.0.0 || ^7.4.0",
"typescript": "^4.0.0 || ^5.0.0",
Expand Down
2 changes: 0 additions & 2 deletions code/lib/core-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@
"express": "^4.17.3",
"fs-extra": "^11.1.0",
"globby": "^11.0.2",
"ip": "^2.0.1",
"lodash": "^4.17.21",
"open": "^8.4.0",
"pretty-hrtime": "^1.0.3",
Expand All @@ -105,7 +104,6 @@
"devDependencies": {
"@storybook/addon-docs": "workspace:*",
"@types/compression": "^1.7.0",
"@types/ip": "^1.1.0",
"@types/node-fetch": "^2.5.7",
"@types/ws": "^8",
"boxen": "^5.1.2",
Expand Down
31 changes: 26 additions & 5 deletions code/lib/core-server/src/utils/__tests__/server-address.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
import ip from 'ip';
import type { NetworkInterfaceInfoIPv4 } from 'os';
import os from 'os';
import { getServerAddresses } from '../server-address';

jest.mock('ip');
const mockedIp = ip as jest.Mocked<typeof ip>;
jest.mock('os');
const mockedOs = os as jest.Mocked<typeof os>;

describe('getServerAddresses', () => {
const mockedNetworkAddress: NetworkInterfaceInfoIPv4 = {
address: '192.168.0.5',
netmask: '255.255.255.0',
family: 'IPv4',
mac: '01:02:03:0a:0b:0c',
internal: false,
cidr: '192.168.0.5/24',
};

beforeEach(() => {
mockedIp.address.mockReturnValue('192.168.0.5');
mockedOs.networkInterfaces.mockReturnValue({
eth0: [mockedNetworkAddress],
});
});

it('builds addresses with a specified host', () => {
Expand All @@ -18,6 +30,15 @@ describe('getServerAddresses', () => {
it('builds addresses with local IP when host is not specified', () => {
const { address, networkAddress } = getServerAddresses(9009, '', 'http');
expect(address).toEqual('http://localhost:9009/');
expect(networkAddress).toEqual('http://192.168.0.5:9009/');
expect(networkAddress).toEqual(`http://${mockedNetworkAddress.address}:9009/`);
});

it('builds addresses with default address when host is not specified and external IPv4 is not found', () => {
mockedOs.networkInterfaces.mockReturnValueOnce({
eth0: [{ ...mockedNetworkAddress, internal: true }],
});
const { address, networkAddress } = getServerAddresses(9009, '', 'http');
expect(address).toEqual('http://localhost:9009/');
expect(networkAddress).toEqual('http://0.0.0.0:9009/');
});
});
2 changes: 1 addition & 1 deletion code/lib/core-server/src/utils/server-address.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import detectPort from 'detect-port';
import { getServerAddresses, getServerPort, getServerChannelUrl } from './server-address';

jest.mock('ip');
jest.mock('os');
jest.mock('detect-port');
jest.mock('@storybook/node-logger');

Expand Down
11 changes: 9 additions & 2 deletions code/lib/core-server/src/utils/server-address.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ip from 'ip';
import os from 'os';

import { logger } from '@storybook/node-logger';
import detectFreePort from 'detect-port';
Expand All @@ -10,7 +10,7 @@ export function getServerAddresses(
initialPath?: string
) {
const address = new URL(`${proto}://localhost:${port}/`);
const networkAddress = new URL(`${proto}://${host || ip.address()}:${port}/`);
const networkAddress = new URL(`${proto}://${host || getLocalIp()}:${port}/`);

if (initialPath) {
const searchParams = `?path=${decodeURIComponent(
Expand All @@ -35,3 +35,10 @@ export const getServerPort = (port?: number) =>
export const getServerChannelUrl = (port: number, { https }: { https?: boolean }) => {
return `${https ? 'wss' : 'ws'}://localhost:${port}/storybook-server-channel`;
};

const getLocalIp = () => {
const allIps = Object.values(os.networkInterfaces()).flat();
const allFilteredIps = allIps.filter((ip) => ip && ip.family === 'IPv4' && !ip.internal);

return allFilteredIps.length ? allFilteredIps[0]?.address : '0.0.0.0';
};
4 changes: 2 additions & 2 deletions code/lib/telemetry/src/storybook-metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ export const computeStorybookMetadata = async ({

try {
const packageManagerType = await detect({ cwd: getProjectRoot() });
const packageManagerVerson = await getNpmVersion(packageManagerType);
const packageManagerVersion = await getNpmVersion(packageManagerType);

metadata.packageManager = {
type: packageManagerType,
version: packageManagerVerson,
version: packageManagerVersion,
};
// Better be safe than sorry, some codebases/paths might end up breaking with something like "spawn pnpm ENOENT"
// so we just set the package manager if the detection is successful
Expand Down
1 change: 1 addition & 0 deletions code/lib/telemetry/src/telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const globalContext = {
inCI: Boolean(process.env.CI),
isTTY: process.stdout.isTTY,
platform: getOperatingSystem(),
nodeVersion: process.versions.node,
} as Record<string, any>;

const prepareRequest = async (data: TelemetryData, context: Record<string, any>, options: any) => {
Expand Down
1 change: 1 addition & 0 deletions code/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@
"type": "opencollective",
"url": "https://opencollective.com/storybook"
},
"deferredNextVersion": "7.6.20",
"pr-log": {
"skipLabels": [
"cleanup"
Expand Down
Loading
Loading