diff --git a/packages/cli/package.json b/packages/cli/package.json index 101389fe..f7ad0762 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@ag-grid-devtools/cli", - "version": "33.0.0", + "version": "33.0.1", "license": "MIT", "description": "AG Grid developer toolkit", "author": "AG Grid ", diff --git a/packages/cli/src/codemods/transforms/transform-modules-to-packages-v33/__fixtures__/scenarios/js/columnsToolPanel/input.ts b/packages/cli/src/codemods/transforms/transform-modules-to-packages-v33/__fixtures__/scenarios/js/columnsToolPanel/input.ts new file mode 100644 index 00000000..a80f41a8 --- /dev/null +++ b/packages/cli/src/codemods/transforms/transform-modules-to-packages-v33/__fixtures__/scenarios/js/columnsToolPanel/input.ts @@ -0,0 +1,14 @@ +// @ts-nocheck +import '@ag-grid-community/styles/ag-grid.css'; +import '@ag-grid-community/styles/ag-theme-quartz.css'; + +import { ServerSideRowModelModule } from '@ag-grid-enterprise/server-side-row-model'; + +import { GridOptions, ModuleRegistry } from '@ag-grid-community/core'; +import { ColumnsToolPanelModule } from '@ag-grid-enterprise/column-tool-panel'; + +ModuleRegistry.registerModules([ServerSideRowModelModule, ColumnsToolPanelModule]); + +const gridOptions: GridOptions = { + rowSelection: { mode: 'multiRow' }, +}; diff --git a/packages/cli/src/codemods/transforms/transform-modules-to-packages-v33/__fixtures__/scenarios/js/columnsToolPanel/output.ts b/packages/cli/src/codemods/transforms/transform-modules-to-packages-v33/__fixtures__/scenarios/js/columnsToolPanel/output.ts new file mode 100644 index 00000000..92764ffa --- /dev/null +++ b/packages/cli/src/codemods/transforms/transform-modules-to-packages-v33/__fixtures__/scenarios/js/columnsToolPanel/output.ts @@ -0,0 +1,30 @@ +// @ts-nocheck +import 'ag-grid-community/styles/ag-grid.css'; +import 'ag-grid-community/styles/ag-theme-quartz.css'; + +import { AllCommunityModule, ServerSideRowModelModule } from 'ag-grid-enterprise'; + +import { GridOptions, ModuleRegistry } from 'ag-grid-community'; +import { + ColumnsToolPanelModule, + GroupFilterModule, + PivotModule, + RowGroupingModule, + RowGroupingPanelModule, + TreeDataModule, +} from 'ag-grid-enterprise'; + +ModuleRegistry.registerModules([ + ServerSideRowModelModule, + AllCommunityModule, + ColumnsToolPanelModule, + RowGroupingPanelModule, + RowGroupingModule, + GroupFilterModule, + TreeDataModule, + PivotModule +]); + +const gridOptions: GridOptions = { + rowSelection: { mode: 'multiRow' }, +}; diff --git a/packages/cli/src/codemods/transforms/transform-modules-to-packages-v33/__fixtures__/scenarios/js/columnsToolPanel/scenario.json b/packages/cli/src/codemods/transforms/transform-modules-to-packages-v33/__fixtures__/scenarios/js/columnsToolPanel/scenario.json new file mode 100644 index 00000000..fd5a6f27 --- /dev/null +++ b/packages/cli/src/codemods/transforms/transform-modules-to-packages-v33/__fixtures__/scenarios/js/columnsToolPanel/scenario.json @@ -0,0 +1,6 @@ +{ + "scenario": { + "input": "input.ts", + "output": "output.ts" + } +} diff --git a/packages/cli/src/codemods/transforms/transform-modules-to-packages-v33/__fixtures__/scenarios/js/enterprise/output.ts b/packages/cli/src/codemods/transforms/transform-modules-to-packages-v33/__fixtures__/scenarios/js/enterprise/output.ts index 59899136..0a757c74 100644 --- a/packages/cli/src/codemods/transforms/transform-modules-to-packages-v33/__fixtures__/scenarios/js/enterprise/output.ts +++ b/packages/cli/src/codemods/transforms/transform-modules-to-packages-v33/__fixtures__/scenarios/js/enterprise/output.ts @@ -13,7 +13,13 @@ import { FiltersToolPanelModule } from 'ag-grid-enterprise'; import { ColumnMenuModule, ContextMenuModule } from 'ag-grid-enterprise'; import { MultiFilterModule } from 'ag-grid-enterprise'; import { CellSelectionModule } from 'ag-grid-enterprise'; -import { RowGroupingModule } from 'ag-grid-enterprise'; +import { + GroupFilterModule, + PivotModule, + RowGroupingModule, + RowGroupingPanelModule, + TreeDataModule, +} from 'ag-grid-enterprise'; import { SetFilterModule } from 'ag-grid-enterprise'; import { SideBarModule } from 'ag-grid-enterprise'; import { StatusBarModule } from 'ag-grid-enterprise'; @@ -31,6 +37,10 @@ ModuleRegistry.registerModules([ MultiFilterModule, CellSelectionModule, RowGroupingModule, + RowGroupingPanelModule, + GroupFilterModule, + TreeDataModule, + PivotModule, SetFilterModule, SideBarModule, StatusBarModule diff --git a/packages/cli/src/codemods/transforms/transform-modules-to-packages-v33/__fixtures__/scenarios/js/excelWithCsv/input.ts b/packages/cli/src/codemods/transforms/transform-modules-to-packages-v33/__fixtures__/scenarios/js/excelWithCsv/input.ts new file mode 100644 index 00000000..eb3cda94 --- /dev/null +++ b/packages/cli/src/codemods/transforms/transform-modules-to-packages-v33/__fixtures__/scenarios/js/excelWithCsv/input.ts @@ -0,0 +1,14 @@ +// @ts-nocheck +import '@ag-grid-community/styles/ag-grid.css'; +import '@ag-grid-community/styles/ag-theme-quartz.css'; + +import { ServerSideRowModelModule } from '@ag-grid-enterprise/server-side-row-model'; + +import { GridOptions, ModuleRegistry } from '@ag-grid-community/core'; +import { ExcelExportModule } from '@ag-grid-enterprise/excel-export'; + +ModuleRegistry.registerModules([ServerSideRowModelModule, ExcelExportModule]); + +const gridOptions: GridOptions = { + rowSelection: { mode: 'multiRow' }, +}; diff --git a/packages/cli/src/codemods/transforms/transform-modules-to-packages-v33/__fixtures__/scenarios/js/excelWithCsv/output.ts b/packages/cli/src/codemods/transforms/transform-modules-to-packages-v33/__fixtures__/scenarios/js/excelWithCsv/output.ts new file mode 100644 index 00000000..96dee3ba --- /dev/null +++ b/packages/cli/src/codemods/transforms/transform-modules-to-packages-v33/__fixtures__/scenarios/js/excelWithCsv/output.ts @@ -0,0 +1,19 @@ +// @ts-nocheck +import 'ag-grid-community/styles/ag-grid.css'; +import 'ag-grid-community/styles/ag-theme-quartz.css'; + +import { AllCommunityModule, ServerSideRowModelModule } from 'ag-grid-enterprise'; + +import { CsvExportModule, GridOptions, ModuleRegistry } from 'ag-grid-community'; +import { ExcelExportModule } from 'ag-grid-enterprise'; + +ModuleRegistry.registerModules([ + ServerSideRowModelModule, + AllCommunityModule, + ExcelExportModule, + CsvExportModule +]); + +const gridOptions: GridOptions = { + rowSelection: { mode: 'multiRow' }, +}; diff --git a/packages/cli/src/codemods/transforms/transform-modules-to-packages-v33/__fixtures__/scenarios/js/excelWithCsv/scenario.json b/packages/cli/src/codemods/transforms/transform-modules-to-packages-v33/__fixtures__/scenarios/js/excelWithCsv/scenario.json new file mode 100644 index 00000000..fd5a6f27 --- /dev/null +++ b/packages/cli/src/codemods/transforms/transform-modules-to-packages-v33/__fixtures__/scenarios/js/excelWithCsv/scenario.json @@ -0,0 +1,6 @@ +{ + "scenario": { + "input": "input.ts", + "output": "output.ts" + } +} diff --git a/packages/cli/src/codemods/transforms/transform-modules-to-packages-v33/__fixtures__/scenarios/js/locales/output.ts b/packages/cli/src/codemods/transforms/transform-modules-to-packages-v33/__fixtures__/scenarios/js/locales/output.ts index 4df6b23b..16522b1e 100644 --- a/packages/cli/src/codemods/transforms/transform-modules-to-packages-v33/__fixtures__/scenarios/js/locales/output.ts +++ b/packages/cli/src/codemods/transforms/transform-modules-to-packages-v33/__fixtures__/scenarios/js/locales/output.ts @@ -14,7 +14,13 @@ import { FiltersToolPanelModule } from 'ag-grid-enterprise'; import { ColumnMenuModule, ContextMenuModule } from 'ag-grid-enterprise'; import { MultiFilterModule } from 'ag-grid-enterprise'; import { CellSelectionModule } from 'ag-grid-enterprise'; -import { RowGroupingModule } from 'ag-grid-enterprise'; +import { + GroupFilterModule, + PivotModule, + RowGroupingModule, + RowGroupingPanelModule, + TreeDataModule, +} from 'ag-grid-enterprise'; import { SetFilterModule } from 'ag-grid-enterprise'; import { SideBarModule } from 'ag-grid-enterprise'; import { StatusBarModule } from 'ag-grid-enterprise'; @@ -33,6 +39,10 @@ ModuleRegistry.registerModules([ MultiFilterModule, CellSelectionModule, RowGroupingModule, + RowGroupingPanelModule, + GroupFilterModule, + TreeDataModule, + PivotModule, SetFilterModule, SideBarModule, StatusBarModule diff --git a/packages/cli/src/codemods/transforms/transform-modules-to-packages-v33/__fixtures__/scenarios/js/rowGroupWithExtras/input.ts b/packages/cli/src/codemods/transforms/transform-modules-to-packages-v33/__fixtures__/scenarios/js/rowGroupWithExtras/input.ts new file mode 100644 index 00000000..4742d3ab --- /dev/null +++ b/packages/cli/src/codemods/transforms/transform-modules-to-packages-v33/__fixtures__/scenarios/js/rowGroupWithExtras/input.ts @@ -0,0 +1,14 @@ +// @ts-nocheck +import '@ag-grid-community/styles/ag-grid.css'; +import '@ag-grid-community/styles/ag-theme-quartz.css'; + +import { ServerSideRowModelModule } from '@ag-grid-enterprise/server-side-row-model'; + +import { GridOptions, ModuleRegistry } from '@ag-grid-community/core'; +import { RowGroupingModule } from '@ag-grid-enterprise/row-grouping'; + +ModuleRegistry.registerModules([ServerSideRowModelModule, RowGroupingModule]); + +const gridOptions: GridOptions = { + rowSelection: { mode: 'multiRow' }, +}; diff --git a/packages/cli/src/codemods/transforms/transform-modules-to-packages-v33/__fixtures__/scenarios/js/rowGroupWithExtras/output.ts b/packages/cli/src/codemods/transforms/transform-modules-to-packages-v33/__fixtures__/scenarios/js/rowGroupWithExtras/output.ts new file mode 100644 index 00000000..90028fda --- /dev/null +++ b/packages/cli/src/codemods/transforms/transform-modules-to-packages-v33/__fixtures__/scenarios/js/rowGroupWithExtras/output.ts @@ -0,0 +1,28 @@ +// @ts-nocheck +import 'ag-grid-community/styles/ag-grid.css'; +import 'ag-grid-community/styles/ag-theme-quartz.css'; + +import { AllCommunityModule, ServerSideRowModelModule } from 'ag-grid-enterprise'; + +import { GridOptions, ModuleRegistry } from 'ag-grid-community'; +import { + GroupFilterModule, + PivotModule, + RowGroupingModule, + RowGroupingPanelModule, + TreeDataModule, +} from 'ag-grid-enterprise'; + +ModuleRegistry.registerModules([ + ServerSideRowModelModule, + AllCommunityModule, + RowGroupingModule, + RowGroupingPanelModule, + GroupFilterModule, + TreeDataModule, + PivotModule +]); + +const gridOptions: GridOptions = { + rowSelection: { mode: 'multiRow' }, +}; diff --git a/packages/cli/src/codemods/transforms/transform-modules-to-packages-v33/__fixtures__/scenarios/js/rowGroupWithExtras/scenario.json b/packages/cli/src/codemods/transforms/transform-modules-to-packages-v33/__fixtures__/scenarios/js/rowGroupWithExtras/scenario.json new file mode 100644 index 00000000..fd5a6f27 --- /dev/null +++ b/packages/cli/src/codemods/transforms/transform-modules-to-packages-v33/__fixtures__/scenarios/js/rowGroupWithExtras/scenario.json @@ -0,0 +1,6 @@ +{ + "scenario": { + "input": "input.ts", + "output": "output.ts" + } +} diff --git a/packages/cli/src/codemods/transforms/transform-modules-to-packages-v33/transformers/deprecated-modules.ts b/packages/cli/src/codemods/transforms/transform-modules-to-packages-v33/transformers/deprecated-modules.ts index 1d0def4d..eba432ce 100644 --- a/packages/cli/src/codemods/transforms/transform-modules-to-packages-v33/transformers/deprecated-modules.ts +++ b/packages/cli/src/codemods/transforms/transform-modules-to-packages-v33/transformers/deprecated-modules.ts @@ -8,6 +8,8 @@ import { addNewIdentifierNextToGiven, addNewImportNextToGiven } from './sharedUt export const updateDeprecatedModules: JSCodeShiftTransformer = (root) => { swapRangeSelectionForCellSelectionModule(root); swapMenuModuleForColumnAndContextModule(root); + addPivotTreeDataModulesForRowGroupingModule(root); + addCsvToExcelExport(root); }; function swapRangeSelectionForCellSelectionModule(root: Collection) { @@ -27,3 +29,29 @@ function swapMenuModuleForColumnAndContextModule(root: Collection) { addNewImportNextToGiven(root, 'ColumnMenuModule', 'ContextMenuModule'); addNewIdentifierNextToGiven(root, 'ColumnMenuModule', 'ContextMenuModule'); } + +function addPivotTreeDataModulesForRowGroupingModule(root: Collection) { + const oldDepsAsNewModules = [ + 'PivotModule', + 'TreeDataModule', + 'GroupFilterModule', + 'RowGroupingModule', + 'RowGroupingPanelModule', + ]; + + for (const dep of oldDepsAsNewModules) { + addNewImportNextToGiven(root, 'RowGroupingModule', dep); + addNewIdentifierNextToGiven(root, 'RowGroupingModule', dep); + } + for (const dep of oldDepsAsNewModules) { + addNewImportNextToGiven(root, 'ColumnsToolPanelModule', dep); + addNewIdentifierNextToGiven(root, 'ColumnsToolPanelModule', dep); + } +} + +function addCsvToExcelExport(root: Collection) { + if (root.find(j.Identifier, { name: 'ExcelExportModule' }).length > 0) { + addNewImportNextToGiven(root, 'ModuleRegistry', 'CsvExportModule'); + addNewIdentifierNextToGiven(root, 'ExcelExportModule', 'CsvExportModule'); + } +}