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: Patch 8.0.6 #26672

Merged
merged 21 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
f6c6b99
Update ./docs/versions/next.json for v8.1.0-alpha.5
storybook-bot Mar 27, 2024
675ead8
Merge branch 'latest-release'
storybook-bot Mar 28, 2024
27d5c35
fix(vue): disable controls for events, slots and expose
larsrickert Mar 28, 2024
185b761
only disable events and exposed
larsrickert Mar 29, 2024
cbd8cb3
update vitest snapshots
larsrickert Mar 29, 2024
e67517b
Merge pull request #26675 from storybookjs/fix/disable-controls
kasperpeulen Mar 31, 2024
f85c5ac
Rename snippet
kylegach Apr 2, 2024
174579d
Merge pull request #26717 from storybookjs/docs-fix-html-snippet-file…
kylegach Apr 2, 2024
2513270
Revert "Vue: Disable controls for events and exposed by default"
shilman Apr 5, 2024
1a8e112
Update ./docs/versions/next.json for v8.1.0-alpha.6
storybook-bot Apr 5, 2024
60e8942
Merge pull request #26748 from storybookjs/revert-26675-fix/disable-c…
shilman Apr 5, 2024
f4dfbf6
Merge pull request #26645 from storybookjs/valentin/bump-node-version…
valentinpalkovic Mar 27, 2024
16fc87e
Merge pull request #26676 from storybookjs/valentin/fix-webpack-react…
valentinpalkovic Mar 28, 2024
064dc95
Merge pull request #26651 from storybookjs/yann/fix-tsconfig-paths-ne…
valentinpalkovic Mar 27, 2024
6af31bf
Merge pull request #26544 from storybookjs/update-docs-multiple-compo…
kylegach Apr 2, 2024
31d5e2c
Merge pull request #26700 from storybookjs/valentin/fix-next-font-on-…
valentinpalkovic Apr 1, 2024
7180724
Merge pull request #26721 from storybookjs/yann/add-config-dir-flag-t…
yannbf Apr 3, 2024
241d83a
Merge pull request #26741 from storybookjs/docs_fix_styling
jonniebigodes Apr 4, 2024
a90b1b8
Merge pull request #26724 from storybookjs/yann/document-cli-flags
jonniebigodes Apr 4, 2024
3f76f06
Merge pull request #26742 from larsdouweschuitema/patch-1
jonniebigodes Apr 5, 2024
7704ea7
Write changelog for 8.0.6 [skip ci]
storybook-bot Apr 5, 2024
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
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ executors:
default: "small"
working_directory: /tmp/storybook
docker:
- image: cimg/node:18.18.0
- image: cimg/node:18.19.1
environment:
NODE_OPTIONS: --max_old_space_size=6144
resource_class: <<parameters.class>>
Expand All @@ -30,7 +30,7 @@ executors:
default: "small"
working_directory: /tmp/storybook
docker:
- image: cimg/node:18.18.0-browsers
- image: cimg/node:18.19.1-browsers
environment:
NODE_OPTIONS: --max_old_space_size=6144
resource_class: <<parameters.class>>
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.18.2
18.19.1
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 8.0.6

- CLI: Add --config-dir flag to migrate command - [#26721](https://github.com/storybookjs/storybook/pull/26721), thanks @yannbf!
- Next.js: Fix next/font usage on Windows machines - [#26700](https://github.com/storybookjs/storybook/pull/26700), thanks @valentinpalkovic!
- Next.js: Support path aliases when no base url is set - [#26651](https://github.com/storybookjs/storybook/pull/26651), thanks @yannbf!
- Webpack: Fix sourcemap generation in webpack react-docgen-loader - [#26676](https://github.com/storybookjs/storybook/pull/26676), thanks @valentinpalkovic!

## 8.0.5

- Addon-docs: Fix `react-dom/server` imports breaking stories and docs - [#26557](https://github.com/storybookjs/storybook/pull/26557), thanks @JReinhold!
Expand Down
2 changes: 1 addition & 1 deletion code/frameworks/nextjs/src/css/webpack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const configureCss = (baseConfig: WebpackConfig, nextConfig: NextConfig):
],
// We transform the "target.css" files from next.js into Javascript
// for Next.js to support fonts, so it should be ignored by the css-loader.
exclude: /next\/.*\/target.css$/,
exclude: /next(\\|\/|\\\\).*(\\|\/|\\\\)target\.css$/,
};
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export function configureNextFont(baseConfig: Configuration, isSWC?: boolean) {

if (isSWC) {
baseConfig.module?.rules?.push({
test: /next\/.*\/target.css$/,
test: /next(\\|\/|\\\\).*(\\|\/|\\\\)target\.css$/,
loader: fontLoaderPath,
});
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,9 @@ export async function getFontFaceDeclarations(
.map(({ prop, value }: { prop: string; value: string }) => `${prop}: ${value};`)
.join('\n');

const arePathsWin32Format = /^[a-z]:\\/iu.test(options.filename);
const cleanWin32Path = (pathString: string): string =>
arePathsWin32Format ? pathString.replace(/\\/gu, '/') : pathString;

const getFontFaceCSS = () => {
if (typeof localFontSrc === 'string') {
const localFontPath = cleanWin32Path(path.join(parentFolder, localFontSrc));
const localFontPath = path.join(parentFolder, localFontSrc).replaceAll('\\', '/');

return `@font-face {
font-family: ${id};
Expand All @@ -55,7 +51,7 @@ export async function getFontFaceDeclarations(
}
return localFontSrc
.map((font) => {
const localFontPath = cleanWin32Path(path.join(parentFolder, font.path));
const localFontPath = path.join(parentFolder, font.path).replaceAll('\\', '/');

return `@font-face {
font-family: ${id};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { getFontFaceDeclarations as getLocalFontFaceDeclarations } from './local
import type { LoaderOptions } from './types';
import { getCSSMeta } from './utils/get-css-meta';
import { setFontDeclarationsInHead } from './utils/set-font-declarations-in-head';
import path from 'path';

type FontFaceDeclaration = {
id: string;
Expand Down Expand Up @@ -39,11 +40,19 @@ export default async function storybookNextjsFontLoader(this: any) {

let fontFaceDeclaration: FontFaceDeclaration | undefined;

if (options.source.endsWith('next/font/google') || options.source.endsWith('@next/font/google')) {
const pathSep = path.sep;

if (
options.source.endsWith(`next${pathSep}font${pathSep}google`) ||
options.source.endsWith(`@next${pathSep}font${pathSep}google`)
) {
fontFaceDeclaration = await getGoogleFontFaceDeclarations(options);
}

if (options.source.endsWith('next/font/local') || options.source.endsWith('@next/font/local')) {
if (
options.source.endsWith(`next${pathSep}font${pathSep}local`) ||
options.source.endsWith(`@next${pathSep}font${pathSep}local`)
) {
fontFaceDeclaration = await getLocalFontFaceDeclarations(options, rootCtx, swcMode);
}

Expand Down
4 changes: 2 additions & 2 deletions code/frameworks/nextjs/src/imports/webpack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ export const configureImports = ({
}): void => {
const configLoadResult = loadConfig(configDir);

if (configLoadResult.resultType === 'failed' || !configLoadResult.baseUrl) {
// either not a typescript project or tsconfig contains no baseUrl
if (configLoadResult.resultType === 'failed') {
// either not a typescript project or tsconfig is not found - we bail
return;
}

Expand Down
2 changes: 1 addition & 1 deletion code/lib/cli/src/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ command('migrate [migration]')
.option('-l --list', 'List available migrations')
.option('-g --glob <glob>', 'Glob for files upon which to apply the migration', '**/*.js')
.option('-p --parser <babel | babylon | flow | ts | tsx>', 'jscodeshift parser')
.option('-c, --config-dir <dir-name>', 'Directory where to load Storybook configurations from')
.option(
'-n --dry-run',
'Dry run: verify the migration exists and show the files to which it will be applied'
Expand All @@ -142,7 +143,6 @@ command('migrate [migration]')
list,
rename,
parser,
logger: consoleLogger,
}).catch((err) => {
logger.error(err);
process.exit(1);
Expand Down
29 changes: 24 additions & 5 deletions code/lib/cli/src/migrate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,40 @@ import { getStorybookVersionSpecifier } from './helpers';

const logger = console;

export async function migrate(migration: any, { glob, dryRun, list, rename, parser }: any) {
type CLIOptions = {
glob: string;
configDir?: string;
dryRun?: boolean;
list?: string[];
/**
* Rename suffix of matching files after codemod has been applied, e.g. ".js:.ts"
*/
rename?: string;
/**
* jscodeshift parser
*/
parser?: 'babel' | 'babylon' | 'flow' | 'ts' | 'tsx';
};

export async function migrate(
migration: any,
{ glob, dryRun, list, rename, parser, configDir: userSpecifiedConfigDir }: CLIOptions
) {
if (list) {
listCodemods().forEach((key: any) => logger.log(key));
} else if (migration) {
if (migration === 'mdx-to-csf' && !dryRun) {
const packageManager = JsPackageManagerFactory.getPackageManager();

const [packageJson, storybookVersion] = await Promise.all([
//
packageManager.retrievePackageJson(),
getCoercedStorybookVersion(packageManager),
]);
const { configDir: inferredConfigDir, mainConfig: mainConfigPath } =
getStorybookInfo(packageJson);
const configDir = inferredConfigDir || '.storybook';
const { configDir: inferredConfigDir, mainConfig: mainConfigPath } = getStorybookInfo(
packageJson,
userSpecifiedConfigDir
);
const configDir = userSpecifiedConfigDir || inferredConfigDir || '.storybook';

// GUARDS
if (!storybookVersion) {
Expand Down
3 changes: 2 additions & 1 deletion code/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -295,5 +295,6 @@
"Dependency Upgrades"
]
]
}
},
"deferredNextVersion": "8.0.6"
}
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,10 @@ export default async function reactDocgenLoader(
}
});

const map = magicString.generateMap({ hires: true });
const map = magicString.generateMap({
includeContent: true,
source: this.resourcePath,
});
callback(null, magicString.toString(), map);
} catch (error: any) {
if (error.code === ERROR_CODES.MISSING_DEFINITION) {
Expand Down
Loading