Skip to content

Commit

Permalink
AG-13294 - rename folder
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephanemw committed Nov 18, 2024
1 parent 1f512ee commit f416988
Show file tree
Hide file tree
Showing 46 changed files with 68 additions and 31 deletions.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# `transform-sparklines-options-v33-0`

> _Transform sparklines configuration_
## Common tasks

### Add a test case

Create a new unit test scenario for this transform:

```
pnpm run task:create-test --type transform --target transform-sparklines-options-v33-0
```

### Add to a codemod release

Add this source code transformation to a codemod release:

```
pnpm run task:include-transform --transform transform-sparklines-options-v33-0
```
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './transform-sparklines-options-v33-0';
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { type TransformManifest } from '@ag-grid-devtools/types';

const manifest: TransformManifest = {
name: 'migrate-sparklines-options',
description: 'Migrate sparklines configuration',
name: 'Transform Sparklines options v33.0',
description: 'Transform sparklines options',
};

export default manifest;
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import { fileURLToPath } from 'node:url';
import { describe, expect, onTestFinished, test } from 'vitest';
import { loadTransformScenarios } from '../../test/runners/transform';

import migrateSparklinesOptions from './migrate-sparklines-options';
import transformSparklinesOptionsV33_0 from './transform-sparklines-options-v33-0';

const __dirname = dirname(fileURLToPath(import.meta.url));

describe(migrateSparklinesOptions, () => {
describe(transformSparklinesOptionsV33_0, () => {
const scenariosPath = join(__dirname, './__fixtures__/scenarios');
loadTransformScenarios(scenariosPath, {
transforms: [migrateSparklinesOptions],
transforms: [transformSparklinesOptionsV33_0],
vitest: { describe, expect, test, onTestFinished },
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { type AstCliContext, type AstTransform } from '@ag-grid-devtools/ast';

import * as m from './match-utils';
import * as t from '@babel/types';
import * as v from './visitor-utils';
import { mergeImports, mergeTypecasts } from './transform-utils';

const parser = require('@babel/parser');
const traverse = require('@babel/traverse').default;

const transform: AstTransform<AstCliContext> = function migrateSparklinesOptions(_babel) {
const oldOptionNames = [
'AreaSparklineOptions',
'BarSparklineOptions',
'ColumnSparklineOptions',
'LineSparklineOptions',
];

const newOptionName = 'AgSparklineOptions';
const newPackage = 'ag-charts-types';

const js = `{sparklineOptions: {type: 'column'}}`;
const ast = parser.parse(js);
// traverse(ast, v.createVisitor([

// ], (results) => {

// }));

return {
visitor: v.combineVisitors(
v.createComplexVisitor(c2bTransform),
v.createComplexVisitor(mergeImports(oldOptionNames, newOptionName, newPackage)),
v.createComplexVisitor(mergeTypecasts(oldOptionNames, newOptionName)),
),
};
};
4 changes: 2 additions & 2 deletions packages/cli/src/codemods/versions/33.0.0/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import { type TransformManifest, type VersionManifest } from '@ag-grid-devtools/

import transformGridApiMethodsV33_0 from '../../transforms/transform-grid-api-methods-v33-0/manifest.ts';

import migrateSparklinesOptions from '../../transforms/migrate-sparklines-options/manifest.ts';
import transformSparklinesOptionsV33_0 from '../../transforms/transform-sparklines-options-v33-0/manifest.ts';

const transforms: Array<TransformManifest> = [
transformGridApiMethodsV33_0,
migrateSparklinesOptions,
transformSparklinesOptionsV33_0,
];

const manifest: VersionManifest = {
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/codemods/versions/33.0.0/transforms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import { type AstCliContext, type AstTransform } from '@ag-grid-devtools/ast';

import transformGridApiMethodsV33_0 from '../../transforms/transform-grid-api-methods-v33-0';

import migrateSparklinesOptions from '../../transforms/migrate-sparklines-options';
import transformSparklinesOptionsV33_0 from '../../transforms/transform-sparklines-options-v33-0';

const transforms: Array<AstTransform<AstCliContext>> = [
transformGridApiMethodsV33_0,
migrateSparklinesOptions,
transformSparklinesOptionsV33_0,
];

export default transforms;

0 comments on commit f416988

Please sign in to comment.