mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-05 16:11:33 +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';
|
import { listCodemods, runCodemod } from '@storybook/codemod';
|
||||||
|
|
||||||
export async function migrate(
|
export async function migrate(migration: any, { glob, dryRun, list, rename, logger, parser }: any) {
|
||||||
migration: any,
|
|
||||||
{ configDir, glob, dryRun, list, rename, logger, parser }: any
|
|
||||||
) {
|
|
||||||
if (list) {
|
if (list) {
|
||||||
listCodemods().forEach((key: any) => logger.log(key));
|
listCodemods().forEach((key: any) => logger.log(key));
|
||||||
} else if (migration) {
|
} else if (migration) {
|
||||||
await runCodemod(migration, { configDir, glob, dryRun, logger, rename, parser });
|
await runCodemod(migration, { glob, dryRun, logger, rename, parser });
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Migrate: please specify a migration name or --list');
|
throw new Error('Migrate: please specify a migration name or --list');
|
||||||
}
|
}
|
||||||
|
@ -26,11 +26,19 @@
|
|||||||
"import": "./dist/index.mjs",
|
"import": "./dist/index.mjs",
|
||||||
"types": "./dist/index.d.ts"
|
"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"
|
"./package.json": "./package.json"
|
||||||
},
|
},
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"module": "dist/index.mjs",
|
"module": "dist/index.mjs",
|
||||||
"jsnext:main": "src/index.js",
|
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"check": "../../../scripts/node_modules/.bin/tsc --noEmit",
|
"check": "../../../scripts/node_modules/.bin/tsc --noEmit",
|
||||||
@ -61,7 +69,16 @@
|
|||||||
"bundler": {
|
"bundler": {
|
||||||
"platform": "node",
|
"platform": "node",
|
||||||
"entries": [
|
"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"
|
"gitHead": "66a0d588184add900c48d49f3a62743fa9cc5185"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user