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

Release: Prerelease 8.5.0-alpha.10 #29678

Merged
merged 6 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 8.4.5

- Angular: Support v19 - [#29659](https://github.com/storybookjs/storybook/pull/29659), thanks @leosvelperez!
- CLI: Disable corepack auto pin behavior - [#29627](https://github.com/storybookjs/storybook/pull/29627), thanks @yannbf!
- CLI: Fix qwik init - [#29632](https://github.com/storybookjs/storybook/pull/29632), thanks @shilman!
- Nextjs-Vite: Add Next.js 15 support - [#29640](https://github.com/storybookjs/storybook/pull/29640), thanks @yannbf!

## 8.4.4

- Addon Test: Only optimize react deps if applicable in vitest-plugin - [#29617](https://github.com/storybookjs/storybook/pull/29617), thanks @yannbf!
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.prerelease.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 8.5.0-alpha.10

- Addon Test: Use pathe for better windows support - [#29676](https://github.com/storybookjs/storybook/pull/29676), thanks @yannbf!
- Angular: Default to standalone components in Angular v19 - [#29677](https://github.com/storybookjs/storybook/pull/29677), thanks @ingowagner!

## 8.5.0-alpha.9

- Angular: Support v19 - [#29659](https://github.com/storybookjs/storybook/pull/29659), thanks @leosvelperez!
Expand Down
1 change: 1 addition & 0 deletions code/addons/test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
"execa": "^8.0.1",
"find-up": "^7.0.0",
"formik": "^2.2.9",
"pathe": "^1.1.2",
"picocolors": "^1.1.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand Down
2 changes: 1 addition & 1 deletion code/addons/test/src/node/boot-test-runner.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { type ChildProcess } from 'node:child_process';
import { join } from 'node:path';

import type { Channel } from 'storybook/internal/channels';
import {
Expand All @@ -13,6 +12,7 @@ import {

// eslint-disable-next-line depend/ban-dependencies
import { execaNode } from 'execa';
import { join } from 'pathe';

import { TEST_PROVIDER_ID } from '../constants';
import { log } from '../logger';
Expand Down
2 changes: 1 addition & 1 deletion code/addons/test/src/node/test-manager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { createVitest } from 'vitest/node';

import { Channel, type ChannelTransport } from '@storybook/core/channels';

import path from 'path';
import path from 'pathe';

import { TEST_PROVIDER_ID } from '../constants';
import { TestManager } from './test-manager';
Expand Down
2 changes: 1 addition & 1 deletion code/addons/test/src/node/vitest-manager.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { existsSync } from 'node:fs';
import path, { normalize } from 'node:path';

import type { TestProject, TestSpecification, Vitest, WorkspaceProject } from 'vitest/node';

import type { Channel } from 'storybook/internal/channels';
import type { TestingModuleRunRequestPayload } from 'storybook/internal/core-events';

import path, { normalize } from 'pathe';
import slash from 'slash';

import { log } from '../logger';
Expand Down
33 changes: 17 additions & 16 deletions code/addons/test/src/postinstall.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { existsSync } from 'node:fs';
import * as fs from 'node:fs/promises';
import { writeFile } from 'node:fs/promises';
import { dirname, join, relative } from 'node:path';
import * as path from 'node:path';

import {
JsPackageManagerFactory,
Expand All @@ -16,6 +14,7 @@ import { colors, logger } from 'storybook/internal/node-logger';
// eslint-disable-next-line depend/ban-dependencies
import { execa } from 'execa';
import { findUp } from 'find-up';
import { dirname, extname, join, relative, resolve } from 'pathe';
import picocolors from 'picocolors';
import prompts from 'prompts';
import { coerce, satisfies } from 'semver';
Expand All @@ -27,7 +26,8 @@ import { printError, printInfo, printSuccess, step } from './postinstall-logger'
const ADDON_NAME = '@storybook/experimental-addon-test' as const;
const EXTENSIONS = ['.js', '.jsx', '.ts', '.tsx', '.cts', '.mts', '.cjs', '.mjs'] as const;

const findFile = async (basename: string) => findUp(EXTENSIONS.map((ext) => basename + ext));
const findFile = async (basename: string, extraExtensions: string[] = []) =>
findUp([...EXTENSIONS, ...extraExtensions].map((ext) => basename + ext));

export default async function postInstall(options: PostinstallOptions) {
printSuccess(
Expand Down Expand Up @@ -244,7 +244,10 @@ export default async function postInstall(options: PostinstallOptions) {
args: ['playwright', 'install', 'chromium', '--with-deps'],
});

const vitestSetupFile = path.resolve(options.configDir, 'vitest.setup.ts');
const fileExtension =
allDeps['typescript'] || (await findFile('tsconfig', ['.json'])) ? 'ts' : 'js';

const vitestSetupFile = resolve(options.configDir, `vitest.setup.${fileExtension}`);
if (existsSync(vitestSetupFile)) {
printError(
'🚨 Oh no!',
Expand All @@ -264,9 +267,9 @@ export default async function postInstall(options: PostinstallOptions) {
logger.plain(`${step} Creating a Vitest setup file for Storybook:`);
logger.plain(colors.gray(` ${vitestSetupFile}`));

const previewExists = EXTENSIONS.map((ext) =>
path.resolve(options.configDir, `preview${ext}`)
).some((config) => existsSync(config));
const previewExists = EXTENSIONS.map((ext) => resolve(options.configDir, `preview${ext}`)).some(
(config) => existsSync(config)
);

await writeFile(
vitestSetupFile,
Expand Down Expand Up @@ -331,10 +334,10 @@ export default async function postInstall(options: PostinstallOptions) {

if (rootConfig) {
// If there's an existing config, we create a workspace file so we can run Storybook tests alongside.
const extname = path.extname(rootConfig);
const browserWorkspaceFile = path.resolve(dirname(rootConfig), `vitest.workspace${extname}`);
const extension = extname(rootConfig);
const browserWorkspaceFile = resolve(dirname(rootConfig), `vitest.workspace${extension}`);
// to be set in vitest config
const vitestSetupFilePath = path.relative(path.dirname(browserWorkspaceFile), vitestSetupFile);
const vitestSetupFilePath = relative(dirname(browserWorkspaceFile), vitestSetupFile);

logger.line(1);
logger.plain(`${step} Creating a Vitest project workspace file:`);
Expand Down Expand Up @@ -373,9 +376,9 @@ export default async function postInstall(options: PostinstallOptions) {
);
} else {
// If there's no existing Vitest/Vite config, we create a new Vitest config file.
const newVitestConfigFile = path.resolve('vitest.config.ts');
const newVitestConfigFile = resolve(`vitest.config.${fileExtension}`);
// to be set in vitest config
const vitestSetupFilePath = path.relative(path.dirname(newVitestConfigFile), vitestSetupFile);
const vitestSetupFilePath = relative(dirname(newVitestConfigFile), vitestSetupFile);

logger.line(1);
logger.plain(`${step} Creating a Vitest project config file:`);
Expand Down Expand Up @@ -497,17 +500,15 @@ async function getStorybookInfo({ configDir, packageManager: pkgMgr }: Postinsta
}

const builderPackageJson = await fs.readFile(
require.resolve(
path.join(typeof builder === 'string' ? builder : builder.name, 'package.json')
),
require.resolve(join(typeof builder === 'string' ? builder : builder.name, 'package.json')),
'utf8'
);
const builderPackageName = JSON.parse(builderPackageJson).name;

let rendererPackageName: string | undefined;
if (renderer) {
const rendererPackageJson = await fs.readFile(
require.resolve(path.join(renderer, 'package.json')),
require.resolve(join(renderer, 'package.json')),
'utf8'
);
rendererPackageName = JSON.parse(rendererPackageJson).name;
Expand Down
2 changes: 1 addition & 1 deletion code/addons/test/src/preset.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { readFileSync } from 'node:fs';
import { isAbsolute, join } from 'node:path';

import type { Channel } from 'storybook/internal/channels';
import { checkAddonOrder, getFrameworkName, serverRequire } from 'storybook/internal/common';
Expand All @@ -11,6 +10,7 @@ import {
import { oneWayHash, telemetry } from 'storybook/internal/telemetry';
import type { Options, PresetProperty, StoryId } from 'storybook/internal/types';

import { isAbsolute, join } from 'pathe';
import picocolors from 'picocolors';
import { dedent } from 'ts-dedent';

Expand Down
4 changes: 2 additions & 2 deletions code/addons/test/src/vitest-plugin/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
/* eslint-disable no-underscore-dangle */
import { join, resolve } from 'node:path';

import type { Plugin } from 'vitest/config';

import {
Expand All @@ -12,6 +10,8 @@ import { readConfig, vitestTransform } from 'storybook/internal/csf-tools';
import { MainFileMissingError } from 'storybook/internal/server-errors';
import type { StoriesEntry } from 'storybook/internal/types';

import { join, resolve } from 'pathe';

import type { InternalOptions, UserOptions } from './types';

const defaultOptions: UserOptions = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
Provider,
ɵReflectionCapabilities as ReflectionCapabilities,
importProvidersFrom,
VERSION,
} from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import {
Expand Down Expand Up @@ -176,15 +177,20 @@ export class PropertyExtractor implements NgModuleMetadata {
const isDeclarable = isComponent || isDirective || isPipe;

// Check if the hierarchically lowest Component or Directive decorator (the only relevant for importing dependencies) is standalone.
const isStandalone = !!(

let isStandalone =
(isComponent || isDirective) &&
[...decorators]
.reverse() // reflectionCapabilities returns decorators in a hierarchically top-down order
.find(
(d) =>
this.isDecoratorInstanceOf(d, 'Component') || this.isDecoratorInstanceOf(d, 'Directive')
)?.standalone
);
)?.standalone;

//Starting in Angular 19 the default (in case it's undefined) value for standalone is true
if (isStandalone === undefined) {
isStandalone = !!(VERSION.major && Number(VERSION.major) >= 19);
}

return { isDeclarable, isStandalone };
};
Expand Down
3 changes: 2 additions & 1 deletion code/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -293,5 +293,6 @@
"Dependency Upgrades"
]
]
}
},
"deferredNextVersion": "8.5.0-alpha.10"
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: version field on line 3 needs to be updated to match deferredNextVersion

}
1 change: 1 addition & 0 deletions code/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6612,6 +6612,7 @@ __metadata:
execa: "npm:^8.0.1"
find-up: "npm:^7.0.0"
formik: "npm:^2.2.9"
pathe: "npm:^1.1.2"
picocolors: "npm:^1.1.0"
polished: "npm:^4.2.2"
prompts: "npm:^2.4.0"
Expand Down
2 changes: 1 addition & 1 deletion docs/versions/next.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":"8.5.0-alpha.9","info":{"plain":"- Angular: Support v19 - [#29659](https://github.com/storybookjs/storybook/pull/29659), thanks @leosvelperez!\n- Manager: Fix size regression - [#29660](https://github.com/storybookjs/storybook/pull/29660), thanks @JReinhold!\n- Nextjs-Vite: Add Next.js 15 support - [#29640](https://github.com/storybookjs/storybook/pull/29640), thanks @yannbf!"}}
{"version":"8.5.0-alpha.10","info":{"plain":"- Addon Test: Use pathe for better windows support - [#29676](https://github.com/storybookjs/storybook/pull/29676), thanks @yannbf!\n- Angular: Default to standalone components in Angular v19 - [#29677](https://github.com/storybookjs/storybook/pull/29677), thanks @ingowagner!"}}