-
-
Notifications
You must be signed in to change notification settings - Fork 9.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
apply more migrations listed in #25433
- Loading branch information
Showing
4 changed files
with
57 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { dedent } from 'ts-dedent'; | ||
|
||
import { writeConfig } from '@storybook/csf-tools'; | ||
|
||
import type { Fix } from '../types'; | ||
import { updateMainConfig } from '../helpers/mainConfigFile'; | ||
|
||
const logger = console; | ||
|
||
interface RemoveLegacyMDX1Options { | ||
hasFeature: boolean; | ||
} | ||
|
||
/** | ||
* Does the user have 'legacyMdx1' in their main.ts? | ||
* | ||
* If so, prompt them to upgrade to delete it. | ||
*/ | ||
export const removeLegacyMDX1: Fix<RemoveLegacyMDX1Options> = { | ||
id: 'builder-vite', | ||
|
||
async check({ mainConfig }) { | ||
if (mainConfig.features) { | ||
// | ||
return { | ||
hasFeature: !!Object.hasOwn(mainConfig.features, 'legacyMdx1'), | ||
}; | ||
} | ||
|
||
return null; | ||
}, | ||
|
||
prompt({}) { | ||
return dedent` | ||
You have features.legacyMdx1 in your Storybook main config file, this feature has been removed, shall we remove it from you main.ts file? | ||
Link: https://storybook.js.org/docs/7.6/migration-guide | ||
`; | ||
}, | ||
|
||
async run({ dryRun, mainConfigPath, skipInstall, packageManager }) { | ||
logger.info(`✅ Removing legacyMdx1 feature`); | ||
if (!dryRun) { | ||
await updateMainConfig({ dryRun: !!dryRun, mainConfigPath }, async (main) => { | ||
main.removeField(['features', 'legacyMdx1']); | ||
await writeConfig(main); | ||
}); | ||
|
||
const packageJson = await packageManager.retrievePackageJson(); | ||
|
||
await packageManager.removeDependencies({ skipInstall: skipInstall, packageJson }, [ | ||
'@storybook/mdx1-csf', | ||
]); | ||
} | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,6 @@ Type: | |
{ | ||
argTypeTargetsV7?: boolean; | ||
legacyDecoratorFileOrder?: boolean; | ||
legacyMdx1?: boolean; | ||
} | ||
``` | ||
|
||
|