-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,11 @@ import { readConfig, writeConfig } from 'storybook/internal/csf-tools'; | |
import SemVer from 'semver'; | ||
import { dedent } from 'ts-dedent'; | ||
|
||
import { | ||
getRequireWrapperName, | ||
isRequireWrapperNecessary, | ||
wrapValueWithRequireWrapper, | ||
} from './automigrate/fixes/wrap-require-utils'; | ||
import { postinstallAddon } from './postinstallAddon'; | ||
|
||
export interface PostinstallOptions { | ||
|
@@ -136,7 +141,17 @@ export async function add( | |
await packageManager.addDependencies({ installAsDevDependencies: true }, [addonWithVersion]); | ||
|
||
logger.log(`Adding '${addon}' to main.js addons field.`); | ||
main.appendValueToArray(['addons'], addonName); | ||
|
||
const mainConfigAddons = main.getFieldNode(['addons']); | ||
Check failure on line 145 in code/lib/cli-storybook/src/add.ts GitHub Actions / Core Unit Tests, windows-latestsrc/add.test.ts > add > 'aa'
Check failure on line 145 in code/lib/cli-storybook/src/add.ts GitHub Actions / Core Unit Tests, windows-latestsrc/add.test.ts > add > 'aa@4'
Check failure on line 145 in code/lib/cli-storybook/src/add.ts GitHub Actions / Core Unit Tests, windows-latestsrc/add.test.ts > add > '[email protected]'
Check failure on line 145 in code/lib/cli-storybook/src/add.ts GitHub Actions / Core Unit Tests, windows-latestsrc/add.test.ts > add > 'aa@^4'
Check failure on line 145 in code/lib/cli-storybook/src/add.ts GitHub Actions / Core Unit Tests, windows-latestsrc/add.test.ts > add > 'aa@~4'
Check failure on line 145 in code/lib/cli-storybook/src/add.ts GitHub Actions / Core Unit Tests, windows-latestsrc/add.test.ts > add > '[email protected]'
Check failure on line 145 in code/lib/cli-storybook/src/add.ts GitHub Actions / Core Unit Tests, windows-latestsrc/add.test.ts > add > 'aa@next'
Check failure on line 145 in code/lib/cli-storybook/src/add.ts GitHub Actions / Core Unit Tests, windows-latestsrc/add.test.ts > add > '@org/aa'
Check failure on line 145 in code/lib/cli-storybook/src/add.ts GitHub Actions / Core Unit Tests, windows-latestsrc/add.test.ts > add > '@org/aa@4'
Check failure on line 145 in code/lib/cli-storybook/src/add.ts GitHub Actions / Core Unit Tests, windows-latestsrc/add.test.ts > add > '@org/[email protected]'
|
||
|
||
if (mainConfigAddons && getRequireWrapperName(main) !== null) { | ||
const addonNode = main.valueToNode(addonName); | ||
main.appendNodeToArray(['addons'], addonNode as any); | ||
wrapValueWithRequireWrapper(main, addonNode as any); | ||
} else { | ||
main.appendValueToArray(['addons'], addonName); | ||
} | ||
|
||
await writeConfig(main); | ||
|
||
if (!skipPostinstall && isCoreAddon(addonName)) { | ||
|