Skip to content

Commit

Permalink
Publish 32.2.1 (#91)
Browse files Browse the repository at this point in the history
* customizable allowed import libs, user configuration js file (#52)

- Adds the ability to define and load a js or ts configuration
- Expose a way in the configuration to register interceptor methods that can be used to allow custom modules and custom exports from custom libraries to be processed
- Fix the import.ts code to handle properly the configuration file interceptors
- Adds cli end to end tests

* fix build, add link to help screen (#57)

- Add link to the documentation when running migrate --help
- Add tsx as a dependency so typescript support for configuration is always available
- Fix the build configuration to properly emit user-config.cjs and user-config.d.ts
- Update some packages
- Fix user-config.ts so proper d.ts is generated correctly - the previous version was not generating a valid d.ts

* AG-12173 Allow processing the .gitignore file (#58)

After the command npx @ag-grid-devtools/cli@32.0 migrate --from=31.2.1, error message Error: Untracked input files stop the process of migration. We can make it work by processing the .gitignore file

NOTE: this is a breaking change, files specified in .gitignore will NOT be processed anymore when running the command in a directory, agreed with Stephen that this is however the right behaviour - to decide if we want to alert the users or not in the release info

use "glob" and "ignore" to process correctly gitignore files recursively.
update e2e tests to verify gitignore files are ignored as expected

* AG-11722 improve and fix commandline parsing (#59)

Fix command line parsing

The "--config=file" should not be included in the files to be processed
Partial semvers should be supported, "from=30" should work the same as "from=30.0.0"
All boolean flags should have an implicit "--no-flag" so they can be overridden when chaining commangs (normal cli behaviour)
--to= should support "latest" and partial semver, for example --to=32.1 or --to=latest

* release-32.0.2 (#60)

release-32.0.2

Updates in the migrate CLI:

- support for .gitignore files - when running in a folder without passing a list of files, .gitignore will be honoured
- support for configuration file - this allows to define custom matchers to apply codemods also in wrapped or re-exported AG Grid components.

* fix dynamic require (#62)

* fix dynamic require

* release-32.0.3 (#63)

* Release 32.0.3 (#64)

* release-32.0.3

* merge main into develop

* add package.json to exports

* Publish v32.0.3 (#66) (#73)

* fix loading of dynamic modules in windows, export map, .cjs and .mjs support

* AG-12276 support vue ts (#74)

* support typescript language in vue

* release-32.0.4 (#75)

add support for vue typescript language

* support ts language in vue (2) - fix loading of typescript eslint parser module

* increment version

* AG-12615 remove @ag-grid-devtools/codemods from dependencies, update packages (#80)

* remove codemods dependency, update packages
* increase test timeout, as node 18 is slower

* version-32.0.6

* AG-12615 removes the bundled codemods, use a folder instead (#82)

* move codemods in a subfolder, avoid bundled package

* AG-12669 - Deprecate getInfiniteRowCount (#84)

* ignore .d.ts files and process input directories (#86)

* ignore .d.ts files and process input directories

* AG-12549 Selection API codemods (#87)

* fix create-transform task

* add grid options codemod for v32.2

* fix simple js test

* wip

* codemods for selection properties

* add tests

* warn on unimplemented transformations

* rename scenario

* add comments, tidy, reduce type casting

* uncommit

* missing manifest

* update test

* Increment package version

* test case for deprecated colDef props

* pre-compute the value and exit early if no valid transformation

* AG-12800 add api renames (#85)

* AG-12929 Update for 32.2.1 (#89)

* wip

* wip

* migrate enableRangeSelection, not other nested cell selection properties

* wip

* wip

* wip

* wip

* increment version to v32.2.1 (#90)

---------

Co-authored-by: Salvatore Previti <roorback@gmail.com>
Co-authored-by: Salvatore Previti <salvatore.previti@ag-grid.com>
Co-authored-by: Andrew Glazier <andrewcglazier@gmail.com>
Co-authored-by: Stephen Cooper <scooperdev@gmail.com>
  • Loading branch information
5 people authored Sep 27, 2024
1 parent 66165fa commit b4cb82d
Show file tree
Hide file tree
Showing 25 changed files with 312 additions and 220 deletions.
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,13 @@
"@babel/template": "7.22.15",
"@babel/traverse": "7.23.2",
"@babel/types": "7.23.0",
"@types/glob": "8.1.0",
"@types/glob": "^8.1.0",
"@types/estree": "^1.0.6",
"@types/hast": "^3.0.4",
"@types/minimatch": "^5.1.2",
"@types/mdast": "^4.0.4",
"@types/node": "22.7.3",
"@types/unist": "^3.0.3",
"glob": "11.0.0",
"prettier": "3.3.3",
"typedoc": "^0.26.7",
Expand Down
2 changes: 1 addition & 1 deletion packages/build-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"lint": "eslint --ext js,cjs,mjs,ts ."
},
"dependencies": {
"@types/node": "22.4.1",
"@types/node": "22.7.3",
"@types/react": "18.3.3",
"@typescript-eslint/eslint-plugin": "7.18.0",
"@typescript-eslint/parser": "7.18.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@ag-grid-devtools/cli",
"version": "32.2.0",
"version": "32.2.1",
"license": "MIT",
"description": "AG Grid developer toolkit",
"author": "AG Grid <info@ag-grid.com>",
Expand Down Expand Up @@ -94,7 +94,7 @@
"@ag-grid-devtools/worker-utils": "workspace:*",
"@types/diff": "5.2.2",
"@types/graceful-fs": "4.1.9",
"@types/node": "22.4.1",
"@types/node": "22.7.3",
"@types/semver": "7.5.8",
"diff": "5.2.0",
"glob": "11.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,15 @@ export function migrateDeepProperty<S extends AstTransformContext<AstCliContext>
initializer = createSiblingPropertyInitializer(rootNode, rootAccessor);
}
if (!initializer) return;
const newObj = initializer.get('value');
let newObj = initializer.get('value');
if (!newObj.isObjectExpression()) {
// overwrite value with a new object expression
const [transformed] = initializer.replaceWith(
t.objectProperty(initializer.node.key, t.objectExpression([])),
);
initializer = transformed;
newObj = initializer.get('value') as NodePath<ObjectExpression>;
}
if (!newObj.isObjectExpression()) return;
rootNode = newObj;

Expand All @@ -787,6 +795,10 @@ export function migrateDeepProperty<S extends AstTransformContext<AstCliContext>
}
}

const key = node.get('key');
if (key.isIdentifier() && key.node.name === path[0]) {
return;
}
node.remove();
},

Expand Down Expand Up @@ -859,9 +871,24 @@ export function migrateDeepProperty<S extends AstTransformContext<AstCliContext>
if (!rootSibling) return;

// Fish out the reference to the object expression
const jsxExpressionContainer = rootSibling?.get('value');
if (!jsxExpressionContainer?.isJSXExpressionContainer()) return;
const objExp = jsxExpressionContainer.get('expression');
const jsxAttributeValue = rootSibling?.get('value');
let objExp: NodePath<Expression | JSXEmptyExpression>;
if (jsxAttributeValue?.isJSXExpressionContainer()) {
objExp = jsxAttributeValue.get('expression');
if (!objExp.isObjectExpression()) {
// overwrite value with a new object expression
const [transformed] = objExp.replaceWith(t.objectExpression([]));
objExp = transformed;
}
} else if (jsxAttributeValue?.isStringLiteral()) {
// overwrite value with a new object expression
const [transformed] = jsxAttributeValue.replaceWith(
t.jsxExpressionContainer(t.objectExpression([])),
);
objExp = transformed.get('expression');
} else {
return;
}
if (!objExp.isObjectExpression()) return;

// This loop is doing largely the same thing as the loop in the `.init` transformer:
Expand All @@ -876,7 +903,15 @@ export function migrateDeepProperty<S extends AstTransformContext<AstCliContext>
initializer = createSiblingPropertyInitializer(rootNode, accessor);
}
if (!initializer) return;
const newObj = initializer.get('value');
let newObj = initializer.get('value');
if (!newObj.isObjectExpression()) {
// overwrite value with a new object expression
const [transformed] = initializer.replaceWith(
t.objectProperty(initializer.node.key, t.objectExpression([])),
);
initializer = transformed;
newObj = initializer.get('value') as NodePath<ObjectExpression>;
}
if (!newObj.isObjectExpression()) return;
rootNode = newObj;

Expand All @@ -886,6 +921,10 @@ export function migrateDeepProperty<S extends AstTransformContext<AstCliContext>
}
}

const key = node.get('name');
if (key.isJSXIdentifier() && key.node.name === path[0]) {
return;
}
node.remove();
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { IOlympicData } from './interfaces';
[rowMultiSelectWithClick]="true"
[groupSelectsChildren]="true"
[groupSelectsFiltered]="true"
[enableRangeSelection]="true"
[cellSelection]="true"
[suppressMultiRangeSelection]="true"
[suppressClearOnFillReduction]="true"
[enableRangeHandle]="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ module.exports = [
new SyntaxError('The grid option "rowMultiSelectWithClick" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/'),
new SyntaxError('The grid option "groupSelectsChildren" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/'),
new SyntaxError('The grid option "groupSelectsFiltered" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/'),
new SyntaxError('The grid option "enableRangeSelection" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/'),
new SyntaxError('The grid option "suppressMultiRangeSelection" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/'),
new SyntaxError('The grid option "suppressClearOnFillReduction" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/'),
new SyntaxError('The grid option "enableRangeHandle" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@ const gridApi = createGrid(document.body, {
onCellSelectionChanged: onRangeSelectionChanged,
onCellSelectionDeleteStart: foo,
onCellSelectionDeleteEnd: () => {},
enableRangeSelection: cellSelection,

cellSelection: cellSelection,
enableRangeHandle: isEnableRangeHandle(),
suppressMultiRangeSelection: suppressMultiRangeSelection,
suppressClearOnFillReduction,

suppressCopyRowsToClipboard: true,
suppressCopySingleCellRanges: true,

selection: {
suppressMultiRanges: suppressMultiRangeSelection,
suppressClearOnFillReduction: suppressClearOnFillReduction
}
});
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
module.exports = [
new SyntaxError(`The grid option "enableRangeSelection" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/
> | enableRangeSelection: cellSelection,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^`),
new SyntaxError(`The grid option "enableRangeHandle" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/
> | enableRangeHandle: isEnableRangeHandle(),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^`),
new SyntaxError(`The grid option "suppressMultiRangeSelection" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/
> | suppressMultiRangeSelection: suppressMultiRangeSelection,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^`),
new SyntaxError(`The grid option "suppressClearOnFillReduction" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/
> | suppressClearOnFillReduction,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^`),
new SyntaxError(`The grid option "suppressCopyRowsToClipboard" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/
> | suppressCopyRowsToClipboard: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,14 @@ const gridApi = createGrid(document.body, {
onCellSelectionChanged: onRangeSelectionChanged,
onCellSelectionDeleteStart: foo,
onCellSelectionDeleteEnd: () => {},
suppressCopyRowsToClipboard: true,
suppressCopySingleCellRanges: true,

selection: {
mode: "cell",

handle: {
mode: "fill",
direction: getFillDirection(),
setFillValue: () => {console.log('filling')}
},
cellSelection: true,
enableFillHandle: true,
suppressMultiRangeSelection: suppressMultiRangeSelection,
suppressClearOnFillReduction,
fillHandleDirection: getFillDirection(),
fillOperation: () => {console.log('filling')},

suppressMultiRanges: suppressMultiRangeSelection,
suppressClearOnFillReduction: suppressClearOnFillReduction
}
suppressCopyRowsToClipboard: true,
suppressCopySingleCellRanges: true,
});
Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@
module.exports = [
new SyntaxError(`The grid option "enableFillHandle" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/
> | enableFillHandle: true,
| ^^^^^^^^^^^^^^^^^^^^^^`),
new SyntaxError(`The grid option "suppressMultiRangeSelection" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/
> | suppressMultiRangeSelection: suppressMultiRangeSelection,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^`),
new SyntaxError(`The grid option "suppressClearOnFillReduction" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/
> | suppressClearOnFillReduction,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^`),
new SyntaxError(`The grid option "fillHandleDirection" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/
> | fillHandleDirection: getFillDirection(),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^`),
new SyntaxError(`The grid option "fillOperation" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/
> | fillOperation: () => {console.log('filling')},
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^`),
new SyntaxError(`The grid option "suppressCopyRowsToClipboard" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/
> | suppressCopyRowsToClipboard: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,12 @@ const gridApi = createGrid(document.body, {
onCellSelectionChanged: onRangeSelectionChanged,
onCellSelectionDeleteStart: foo,
onCellSelectionDeleteEnd: () => {},
suppressCopyRowsToClipboard: true,
suppressCopySingleCellRanges: true,

selection: {
mode: "cell",

handle: {
mode: "range"
},
cellSelection: true,
enableRangeHandle: true,
suppressMultiRangeSelection: suppressMultiRangeSelection,
suppressClearOnFillReduction,

suppressMultiRanges: suppressMultiRangeSelection,
suppressClearOnFillReduction: suppressClearOnFillReduction
}
suppressCopyRowsToClipboard: true,
suppressCopySingleCellRanges: true,
});
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
module.exports = [
new SyntaxError(`The grid option "enableRangeHandle" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/
> | enableRangeHandle: true,
| ^^^^^^^^^^^^^^^^^^^^^^^`),
new SyntaxError(`The grid option "suppressMultiRangeSelection" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/
> | suppressMultiRangeSelection: suppressMultiRangeSelection,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^`),
new SyntaxError(`The grid option "suppressClearOnFillReduction" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/
> | suppressClearOnFillReduction,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^`),
new SyntaxError(`The grid option "suppressCopyRowsToClipboard" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/
> | suppressCopyRowsToClipboard: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ const gridApi = createGrid(document.body, {
headerCheckboxSelection: true,
headerCheckboxSelectionCurrentPageOnly: true,
}],

rowData: [],

selection: {
rowSelection: {
mode: "multiRow"
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@ const gridApi = createGrid(document.body, {
onCellSelectionChanged: () => {},
onCellSelectionDeleteStart: () => {},
onCellSelectionDeleteEnd: () => {},

rowSelection: {
mode: "multiRow",
isRowSelectable: (params) => params.data.year < 2007,
enableSelectionWithoutKeys: true
},

suppressRowClickSelection: true,
suppressRowDeselection: true,
groupSelectsChildren: true,
groupSelectsFiltered: true,
suppressCopyRowsToClipboard: true,
suppressCopySingleCellRanges: true,

selection: {
mode: "multiRow",
isRowSelectable: (params) => params.data.year < 2007,
enableMultiSelectWithClick: true
}
suppressCopySingleCellRanges: true
});
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ const gridApi = createGrid(document.body, {
onCellSelectionChanged: () => {},
onCellSelectionDeleteStart: () => {},
onCellSelectionDeleteEnd: () => {},
suppressRowClickSelection: true,
suppressRowDeselection: true,
suppressCopyRowsToClipboard: true,
suppressCopySingleCellRanges: true,

selection: {
rowSelection: {
mode: "singleRow",
isRowSelectable: (params) => params.data.year < 2007
}
},

suppressRowClickSelection: true,
suppressRowDeselection: true,
suppressCopyRowsToClipboard: true,
suppressCopySingleCellRanges: true
});
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,19 @@ function foo() {}
function MyComponent(props) {
return (
(<AgGridReact
columnDefs={[]}
rowData={[]}
onCellSelectionChanged={onRangeSelectionChanged}
onCellSelectionDeleteStart={foo}
onCellSelectionDeleteEnd={() => {}}
suppressCopyRowsToClipboard={true}
suppressCopySingleCellRanges={true}
selection={{
mode: "cell",
suppressMultiRanges: suppressMultiRangeSelection,
suppressClearOnFillReduction: suppressClearOnFillReduction,

handle: {
mode: "fill",
direction: 'x',
setFillValue: () => {console.log('filling')}
}
}} />)
columnDefs={[]}
rowData={[]}
onCellSelectionChanged={onRangeSelectionChanged}
onCellSelectionDeleteStart={foo}
onCellSelectionDeleteEnd={() => {}}
cellSelection={true}
suppressMultiRangeSelection={suppressMultiRangeSelection}
suppressClearOnFillReduction={suppressClearOnFillReduction}
enableFillHandle={true}
fillHandleDirection={'x'}
fillOperation={() => {console.log('filling')}}
suppressCopyRowsToClipboard={true}
suppressCopySingleCellRanges={true}
/>)
);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,23 @@
module.exports = [
new SyntaxError(`The grid option "suppressMultiRangeSelection" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/
> | suppressMultiRangeSelection={suppressMultiRangeSelection}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^`),
new SyntaxError(`The grid option "suppressClearOnFillReduction" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/
> | suppressClearOnFillReduction={suppressClearOnFillReduction}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^`),
new SyntaxError(`The grid option "enableFillHandle" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/
> | enableFillHandle={true}
| ^^^^^^^^^^^^^^^^^^^^^^^`),
new SyntaxError(`The grid option "fillHandleDirection" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/
> | fillHandleDirection={'x'}
| ^^^^^^^^^^^^^^^^^^^^^^^^^`),new SyntaxError(`The grid option "fillOperation" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/
> | fillOperation={() => {console.log('filling')}}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^`),
new SyntaxError(`The grid option "suppressCopyRowsToClipboard" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/
> | suppressCopyRowsToClipboard={true}
Expand Down
Loading

0 comments on commit b4cb82d

Please sign in to comment.