mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-05 06:41:17 +08:00
fix migrate command
also bring type safety for migrate command to lib/cli
This commit is contained in:
parent
d283bb812b
commit
c6f4baba2a
@ -1,13 +1,10 @@
|
||||
import { listCodemods, runCodemod } from '@storybook/codemod';
|
||||
|
||||
export async function migrate(
|
||||
migration: any,
|
||||
{ configDir, glob, dryRun, list, rename, logger, parser }: any
|
||||
) {
|
||||
export async function migrate(migration: any, { glob, dryRun, list, rename, logger, parser }: any) {
|
||||
if (list) {
|
||||
listCodemods().forEach((key: any) => logger.log(key));
|
||||
} else if (migration) {
|
||||
await runCodemod(migration, { configDir, glob, dryRun, logger, rename, parser });
|
||||
await runCodemod(migration, { glob, dryRun, logger, rename, parser });
|
||||
} else {
|
||||
throw new Error('Migrate: please specify a migration name or --list');
|
||||
}
|
||||
|
@ -26,11 +26,19 @@
|
||||
"import": "./dist/index.mjs",
|
||||
"types": "./dist/index.d.ts"
|
||||
},
|
||||
"./dist/transforms/add-component-parameters.js": "./dist/transforms/add-component-parameters.js",
|
||||
"./dist/transforms/csf-2-to-3.js": "./dist/transforms/csf-2-to-3.js",
|
||||
"./dist/transforms/csf-hoist-story-annotations.js": "./dist/transforms/csf-hoist-story-annotations.js",
|
||||
"./dist/transforms/csf-to-mdx.js": "./dist/transforms/csf-to-mdx.js",
|
||||
"./dist/transforms/move-builtin-addons.js": "./dist/transforms/move-builtin-addons.js",
|
||||
"./dist/transforms/storiesof-to-csf.js": "./dist/transforms/storiesof-to-csf.js",
|
||||
"./dist/transforms/update-addon-info.js": "./dist/transforms/update-addon-info.js",
|
||||
"./dist/transforms/update-organisation-name.js": "./dist/transforms/update-organisation-name.js",
|
||||
"./dist/transforms/upgrade-hierarchy-separators.js": "./dist/transforms/upgrade-hierarchy-separators.js",
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"main": "dist/index.js",
|
||||
"module": "dist/index.mjs",
|
||||
"jsnext:main": "src/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"scripts": {
|
||||
"check": "../../../scripts/node_modules/.bin/tsc --noEmit",
|
||||
@ -61,7 +69,16 @@
|
||||
"bundler": {
|
||||
"platform": "node",
|
||||
"entries": [
|
||||
"./src/index.js"
|
||||
"./src/index.js",
|
||||
"./src/transforms/add-component-parameters.js",
|
||||
"./src/transforms/csf-2-to-3.js",
|
||||
"./src/transforms/csf-hoist-story-annotations.js",
|
||||
"./src/transforms/csf-to-mdx.js",
|
||||
"./src/transforms/move-builtin-addons.js",
|
||||
"./src/transforms/storiesof-to-csf.js",
|
||||
"./src/transforms/update-addon-info.js",
|
||||
"./src/transforms/update-organisation-name.js",
|
||||
"./src/transforms/upgrade-hierarchy-separators.js"
|
||||
]
|
||||
},
|
||||
"gitHead": "66a0d588184add900c48d49f3a62743fa9cc5185"
|
||||
|
Loading…
x
Reference in New Issue
Block a user