Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI: Fix sb migrate codemods #20191

Merged
merged 3 commits into from
Dec 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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__"]
}