Skip to content

Commit

Permalink
Merge pull request #20191 from storybookjs/norbert/sb-1075-listing-mi…
Browse files Browse the repository at this point in the history
…grations-fails

CLI: Fix sb migrate codemods
  • Loading branch information
shilman authored Dec 10, 2022
2 parents 4f511df + f4e313c commit 74c77b8
Show file tree
Hide file tree
Showing 13 changed files with 25 additions and 10 deletions.
7 changes: 2 additions & 5 deletions code/lib/cli/src/migrate.ts
Original file line number Diff line number Diff line change
@@ -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');
}
Expand Down
1 change: 0 additions & 1 deletion code/lib/cli/src/typings.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
declare module '@storybook/codemod';
declare module 'envinfo';
21 changes: 19 additions & 2 deletions code/lib/codemod/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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.ts",
"./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"
Expand Down
6 changes: 4 additions & 2 deletions code/lib/codemod/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"skipLibCheck": true
"skipLibCheck": true,
"allowJs": true
},
"include": ["src/**/*"]
"include": ["src/**/*"],
"exclude": ["node_modules", "__testfixtures__", "__tests__"]
}

0 comments on commit 74c77b8

Please sign in to comment.