diff --git a/packages/codemod/transforms/__testfixtures__/obui-to-oceanbase-design-and-ui/obui.input.js b/packages/codemod/transforms/__testfixtures__/obui-to-oceanbase-design-and-ui/obui.input.js index 94a892ead..598aeb676 100644 --- a/packages/codemod/transforms/__testfixtures__/obui-to-oceanbase-design-and-ui/obui.input.js +++ b/packages/codemod/transforms/__testfixtures__/obui-to-oceanbase-design-and-ui/obui.input.js @@ -1,5 +1,6 @@ import React from 'react'; -import { Alert, Button, BasicLayout, Login, PageContainer } from '@alipay/ob-ui'; +import { Alert, Button, BackgroundTaskManager, BackgroundTaskManagerConstants, BasicLayout, Login, PageContainer } from '@alipay/ob-ui'; +import type { BackgroundTaskManagerRef, ITaskMgrPreset, ITaskMgrQueue, TaskMgrID } from '@alipay/ob-ui'; import type { BasicLayoutProps } from '@alipay/ob-ui/es/BasicLayout'; import type { LoginProps } from '@alipay/ob-ui/es/Login'; import type { PageContainerProps } from '@alipay/ob-ui/es/PageContainer'; diff --git a/packages/codemod/transforms/__testfixtures__/obui-to-oceanbase-design-and-ui/obui.output.js b/packages/codemod/transforms/__testfixtures__/obui-to-oceanbase-design-and-ui/obui.output.js index af90259f7..0f799dd69 100644 --- a/packages/codemod/transforms/__testfixtures__/obui-to-oceanbase-design-and-ui/obui.output.js +++ b/packages/codemod/transforms/__testfixtures__/obui-to-oceanbase-design-and-ui/obui.output.js @@ -1,6 +1,7 @@ import React from 'react'; import { Alert, Button } from '@oceanbase/design'; -import { BasicLayout, Login, PageContainer } from '@oceanbase/ui'; +import { BackgroundTaskManager, BackgroundTaskManagerConstants, BasicLayout, Login, PageContainer } from '@oceanbase/ui'; +import type { BackgroundTaskManagerRef, ITaskMgrPreset, ITaskMgrQueue, TaskMgrID } from '@oceanbase/ui'; import type { BasicLayoutProps } from '@oceanbase/ui/es/BasicLayout'; import type { LoginProps } from '@oceanbase/ui/es/Login'; import type { PageContainerProps } from '@oceanbase/ui/es/PageContainer'; diff --git a/packages/codemod/transforms/obui-to-oceanbase-design-and-ui.js b/packages/codemod/transforms/obui-to-oceanbase-design-and-ui.js index 88ebe775f..1eb73184a 100644 --- a/packages/codemod/transforms/obui-to-oceanbase-design-and-ui.js +++ b/packages/codemod/transforms/obui-to-oceanbase-design-and-ui.js @@ -12,6 +12,7 @@ module.exports = (file, api, options) => { 'PageContainer', 'Action', 'BackgroundTaskManager', + 'BackgroundTaskManagerConstants', 'BasicLayout', 'BatchOperationBar', 'Boundary', @@ -27,6 +28,10 @@ module.exports = (file, api, options) => { 'PageContainerProps', 'ActionProps', 'BackgroundTaskManagerProps', + 'BackgroundTaskManagerRef', + 'ITaskMgrPreset', + 'ITaskMgrQueue', + 'TaskMgrID', 'BasicLayoutProps', 'BatchOperationBarProps', 'BoundaryProps', diff --git a/packages/codemod/transforms/utils/config.js b/packages/codemod/transforms/utils/config.js index 3e6a1fb7d..aef82d443 100644 --- a/packages/codemod/transforms/utils/config.js +++ b/packages/codemod/transforms/utils/config.js @@ -1,6 +1,7 @@ // https://github.com/benjamn/recast/blob/master/lib/options.ts const printOptions = { quote: 'single', + wrapColumn: 500, }; module.exports = { diff --git a/packages/codemod/transforms/utils/index.js b/packages/codemod/transforms/utils/index.js index 122fcf410..5f12c0eaf 100644 --- a/packages/codemod/transforms/utils/index.js +++ b/packages/codemod/transforms/utils/index.js @@ -138,7 +138,9 @@ function addModuleImport(j, root, { pkgName, importSpecifier, importKind, before return a.imported.name.localeCompare(b.imported.name); }); - return j.importDeclaration(mergedImportSpecifiers, j.literal(pkgName)); + const importStatement = j.importDeclaration(mergedImportSpecifiers, j.literal(pkgName)); + importStatement.importKind = importKind; + return importStatement; }); return true; }