mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-07 19:11:48 +08:00
Merge branch 'tom/sb-512-angular-14' into tom/sb-606-migrate-stories-and-delete-angular-cli
This commit is contained in:
commit
b5cc92b087
@ -1,6 +1,6 @@
|
|||||||
import './globals';
|
import './globals';
|
||||||
|
|
||||||
export { render, renderToDOM } from './render';
|
export { render, renderToDOM } from './render';
|
||||||
export { decorateStory } from './decorateStory';
|
export { decorateStory as applyDecorators } from './decorateStory';
|
||||||
|
|
||||||
export const parameters = { framework: 'angular' as const };
|
export const parameters = { framework: 'angular' as const };
|
||||||
|
@ -180,19 +180,17 @@ async function findFirstPath(paths: string[], { cwd }: { cwd: string }) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function addPackageScripts({
|
async function updatePackageScripts({ cwd, prefix }: { cwd: string; prefix: string }) {
|
||||||
cwd,
|
|
||||||
scripts,
|
|
||||||
}: {
|
|
||||||
cwd: string;
|
|
||||||
scripts: Record<string, string>;
|
|
||||||
}) {
|
|
||||||
logger.info(`🔢 Adding package scripts:`);
|
logger.info(`🔢 Adding package scripts:`);
|
||||||
const packageJsonPath = path.join(cwd, 'package.json');
|
const packageJsonPath = path.join(cwd, 'package.json');
|
||||||
const packageJson = await readJSON(packageJsonPath);
|
const packageJson = await readJSON(packageJsonPath);
|
||||||
packageJson.scripts = {
|
packageJson.scripts = {
|
||||||
...packageJson.scripts,
|
...packageJson.scripts,
|
||||||
...scripts,
|
storybook: packageJson.scripts.storybook.replace(/(npx )?storybook/, `${prefix} storybook`),
|
||||||
|
'build-storybook': packageJson.scripts['build-storybook'].replace(
|
||||||
|
/(npx )?storybook/,
|
||||||
|
`${prefix} storybook`
|
||||||
|
),
|
||||||
};
|
};
|
||||||
await writeJSON(packageJsonPath, packageJson, { spaces: 2 });
|
await writeJSON(packageJsonPath, packageJson, { spaces: 2 });
|
||||||
}
|
}
|
||||||
@ -507,14 +505,9 @@ export async function sandbox(optionValues: OptionValues<typeof options>) {
|
|||||||
// Some addon stories require extra dependencies
|
// Some addon stories require extra dependencies
|
||||||
addExtraDependencies({ cwd, dryRun, debug });
|
addExtraDependencies({ cwd, dryRun, debug });
|
||||||
|
|
||||||
await addPackageScripts({
|
await updatePackageScripts({
|
||||||
cwd,
|
cwd,
|
||||||
scripts: {
|
prefix: 'NODE_OPTIONS="--preserve-symlinks --preserve-symlinks-main"',
|
||||||
storybook:
|
|
||||||
'NODE_OPTIONS="--preserve-symlinks --preserve-symlinks-main" storybook dev -p 6006',
|
|
||||||
'build-storybook':
|
|
||||||
'NODE_OPTIONS="--preserve-symlinks --preserve-symlinks-main" storybook build',
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user