diff --git a/code/lib/cli/src/migrate.ts b/code/lib/cli/src/migrate.ts index 89e3e6759fa9..0e4ab495a744 100644 --- a/code/lib/cli/src/migrate.ts +++ b/code/lib/cli/src/migrate.ts @@ -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'); } diff --git a/code/lib/cli/src/typings.d.ts b/code/lib/cli/src/typings.d.ts index 75cb2ee22218..409993b0710b 100644 --- a/code/lib/cli/src/typings.d.ts +++ b/code/lib/cli/src/typings.d.ts @@ -1,2 +1 @@ -declare module '@storybook/codemod'; declare module 'envinfo'; diff --git a/code/lib/codemod/package.json b/code/lib/codemod/package.json index 80177688847a..0d9d31817208 100644 --- a/code/lib/codemod/package.json +++ b/code/lib/codemod/package.json @@ -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.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" diff --git a/code/lib/codemod/src/transforms/__testfixtures__/mdx-to-csf/basic.input.js b/code/lib/codemod/src/transforms/__testfixtures__/mdx-to-csf/basic.input.mdx similarity index 100% rename from code/lib/codemod/src/transforms/__testfixtures__/mdx-to-csf/basic.input.js rename to code/lib/codemod/src/transforms/__testfixtures__/mdx-to-csf/basic.input.mdx diff --git a/code/lib/codemod/src/transforms/__testfixtures__/mdx-to-csf/component-id.input.js b/code/lib/codemod/src/transforms/__testfixtures__/mdx-to-csf/component-id.input.mdx similarity index 100% rename from code/lib/codemod/src/transforms/__testfixtures__/mdx-to-csf/component-id.input.js rename to code/lib/codemod/src/transforms/__testfixtures__/mdx-to-csf/component-id.input.mdx diff --git a/code/lib/codemod/src/transforms/__testfixtures__/mdx-to-csf/decorators.input.js b/code/lib/codemod/src/transforms/__testfixtures__/mdx-to-csf/decorators.input.mdx similarity index 100% rename from code/lib/codemod/src/transforms/__testfixtures__/mdx-to-csf/decorators.input.js rename to code/lib/codemod/src/transforms/__testfixtures__/mdx-to-csf/decorators.input.mdx diff --git a/code/lib/codemod/src/transforms/__testfixtures__/mdx-to-csf/exclude-stories.input.js b/code/lib/codemod/src/transforms/__testfixtures__/mdx-to-csf/exclude-stories.input.mdx similarity index 100% rename from code/lib/codemod/src/transforms/__testfixtures__/mdx-to-csf/exclude-stories.input.js rename to code/lib/codemod/src/transforms/__testfixtures__/mdx-to-csf/exclude-stories.input.mdx diff --git a/code/lib/codemod/src/transforms/__testfixtures__/mdx-to-csf/parameters.input.js b/code/lib/codemod/src/transforms/__testfixtures__/mdx-to-csf/parameters.input.mdx similarity index 100% rename from code/lib/codemod/src/transforms/__testfixtures__/mdx-to-csf/parameters.input.js rename to code/lib/codemod/src/transforms/__testfixtures__/mdx-to-csf/parameters.input.mdx diff --git a/code/lib/codemod/src/transforms/__testfixtures__/mdx-to-csf/plaintext.input.js b/code/lib/codemod/src/transforms/__testfixtures__/mdx-to-csf/plaintext.input.mdx similarity index 100% rename from code/lib/codemod/src/transforms/__testfixtures__/mdx-to-csf/plaintext.input.js rename to code/lib/codemod/src/transforms/__testfixtures__/mdx-to-csf/plaintext.input.mdx diff --git a/code/lib/codemod/src/transforms/__testfixtures__/mdx-to-csf/story-function.input.js b/code/lib/codemod/src/transforms/__testfixtures__/mdx-to-csf/story-function.input.mdx similarity index 100% rename from code/lib/codemod/src/transforms/__testfixtures__/mdx-to-csf/story-function.input.js rename to code/lib/codemod/src/transforms/__testfixtures__/mdx-to-csf/story-function.input.mdx diff --git a/code/lib/codemod/src/transforms/__testfixtures__/mdx-to-csf/story-parameters.input.js b/code/lib/codemod/src/transforms/__testfixtures__/mdx-to-csf/story-parameters.input.mdx similarity index 100% rename from code/lib/codemod/src/transforms/__testfixtures__/mdx-to-csf/story-parameters.input.js rename to code/lib/codemod/src/transforms/__testfixtures__/mdx-to-csf/story-parameters.input.mdx diff --git a/code/lib/codemod/src/transforms/__testfixtures__/mdx-to-csf/story-refs.input.js b/code/lib/codemod/src/transforms/__testfixtures__/mdx-to-csf/story-refs.input.mdx similarity index 100% rename from code/lib/codemod/src/transforms/__testfixtures__/mdx-to-csf/story-refs.input.js rename to code/lib/codemod/src/transforms/__testfixtures__/mdx-to-csf/story-refs.input.mdx diff --git a/code/lib/codemod/tsconfig.json b/code/lib/codemod/tsconfig.json index cf1e09965901..b00caeb54501 100644 --- a/code/lib/codemod/tsconfig.json +++ b/code/lib/codemod/tsconfig.json @@ -1,7 +1,9 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "skipLibCheck": true + "skipLibCheck": true, + "allowJs": true }, - "include": ["src/**/*"] + "include": ["src/**/*"], + "exclude": ["node_modules", "__testfixtures__", "__tests__"] }