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

fix(nuxt): fix storybook preview config path #22020

Merged
merged 1 commit into from Feb 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -1,5 +1,6 @@
import {
formatFiles,
joinPathFragments,
readProjectConfiguration,
runTasksInSerial,
Tree,
Expand All @@ -13,38 +14,35 @@ import { Schema } from './schema';
* are just adding the styles in `.storybook/preview.ts`
*/
export async function storybookConfigurationGenerator(
host: Tree,
tree: Tree,
options: Schema
) {
const storybookConfigurationGenerator =
await vueStorybookConfigurationGenerator(host, {
await vueStorybookConfigurationGenerator(tree, {
...options,
addPlugin: true,
});

const projectConfiguration = readProjectConfiguration(host, options.project);
const { root } = readProjectConfiguration(tree, options.project);

const storybookConfigFolder =
projectConfiguration.targets?.storybook?.options?.configDir;

host.write(
`${storybookConfigFolder}/preview.${options.tsConfiguration ? 'ts' : 'js'}`,
tree.write(
joinPathFragments(
root,
'.storybook',
'preview.' + options.tsConfiguration ? 'ts' : 'js'
),
`import '../src/assets/css/styles.css';`
);

updateJson(
host,
`${projectConfiguration.root}/tsconfig.storybook.json`,
(json) => {
json.compilerOptions = {
...json.compilerOptions,
composite: true,
};
return json;
}
);
updateJson(tree, `${root}/tsconfig.storybook.json`, (json) => {
json.compilerOptions = {
...json.compilerOptions,
composite: true,
};
return json;
});

await formatFiles(host);
await formatFiles(tree);
return runTasksInSerial(storybookConfigurationGenerator);
}

Expand Down