react-native-chart-kit 6.12.2 → 7.0.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/README.md +49 -35
  2. package/dist/{BarChart.d.ts → charts/bar/BarChart.d.ts} +8 -7
  3. package/dist/charts/bar/BarChart.d.ts.map +1 -0
  4. package/dist/charts/bar/BarChart.js +161 -0
  5. package/dist/charts/bar/index.d.ts +3 -0
  6. package/dist/charts/bar/index.d.ts.map +1 -0
  7. package/dist/charts/bar/index.js +3 -0
  8. package/dist/{contribution-graph → charts/contribution-graph}/ContributionGraph.d.ts +7 -6
  9. package/dist/charts/contribution-graph/ContributionGraph.d.ts.map +1 -0
  10. package/dist/charts/contribution-graph/ContributionGraph.js +310 -0
  11. package/dist/charts/contribution-graph/constants.d.ts.map +1 -0
  12. package/dist/charts/contribution-graph/constants.js +17 -0
  13. package/dist/{contribution-graph/DateHelpers.d.ts → charts/contribution-graph/date.d.ts} +1 -1
  14. package/dist/charts/contribution-graph/date.d.ts.map +1 -0
  15. package/dist/charts/contribution-graph/date.js +14 -0
  16. package/dist/{contribution-graph → charts/contribution-graph}/index.d.ts +1 -1
  17. package/dist/charts/contribution-graph/index.d.ts.map +1 -0
  18. package/dist/charts/contribution-graph/index.js +3 -0
  19. package/dist/charts/line/LegendItem.d.ts +12 -0
  20. package/dist/charts/line/LegendItem.d.ts.map +1 -0
  21. package/dist/charts/line/LegendItem.js +23 -0
  22. package/dist/{line-chart → charts/line}/LineChart.d.ts +9 -8
  23. package/dist/charts/line/LineChart.d.ts.map +1 -0
  24. package/dist/charts/line/LineChart.js +481 -0
  25. package/dist/charts/line/index.d.ts.map +1 -0
  26. package/dist/charts/line/index.js +3 -0
  27. package/dist/{PieChart.d.ts → charts/pie/PieChart.d.ts} +3 -2
  28. package/dist/charts/pie/PieChart.d.ts.map +1 -0
  29. package/dist/charts/pie/PieChart.js +103 -0
  30. package/dist/charts/pie/index.d.ts +3 -0
  31. package/dist/charts/pie/index.d.ts.map +1 -0
  32. package/dist/charts/pie/index.js +3 -0
  33. package/dist/{ProgressChart.d.ts → charts/progress/ProgressChart.d.ts} +3 -2
  34. package/dist/charts/progress/ProgressChart.d.ts.map +1 -0
  35. package/dist/charts/progress/ProgressChart.js +136 -0
  36. package/dist/charts/progress/index.d.ts +3 -0
  37. package/dist/charts/progress/index.d.ts.map +1 -0
  38. package/dist/charts/progress/index.js +3 -0
  39. package/dist/{StackedBarChart.d.ts → charts/stacked-bar/StackedBarChart.d.ts} +4 -3
  40. package/dist/charts/stacked-bar/StackedBarChart.d.ts.map +1 -0
  41. package/dist/charts/stacked-bar/StackedBarChart.js +147 -0
  42. package/dist/charts/stacked-bar/index.d.ts +3 -0
  43. package/dist/charts/stacked-bar/index.d.ts.map +1 -0
  44. package/dist/charts/stacked-bar/index.js +3 -0
  45. package/dist/index.d.ts +7 -7
  46. package/dist/index.d.ts.map +1 -1
  47. package/dist/index.js +8 -8
  48. package/dist/{AbstractChart.d.ts → shared/AbstractChart.d.ts} +80 -58
  49. package/dist/shared/AbstractChart.d.ts.map +1 -0
  50. package/dist/shared/AbstractChart.js +283 -0
  51. package/dist/{HelperTypes.d.ts → shared/types.d.ts} +1 -1
  52. package/dist/shared/types.d.ts.map +1 -0
  53. package/dist/shared/types.js +2 -0
  54. package/dist/shared/utils.d.ts +5 -0
  55. package/dist/shared/utils.d.ts.map +1 -0
  56. package/dist/shared/utils.js +10 -0
  57. package/package.json +109 -53
  58. package/scripts/chartkit-codemod.mjs +256 -0
  59. package/dist/AbstractChart.d.ts.map +0 -1
  60. package/dist/AbstractChart.js +0 -261
  61. package/dist/BarChart.d.ts.map +0 -1
  62. package/dist/BarChart.js +0 -159
  63. package/dist/HelperTypes.d.ts.map +0 -1
  64. package/dist/HelperTypes.js +0 -2
  65. package/dist/PieChart.d.ts.map +0 -1
  66. package/dist/PieChart.js +0 -101
  67. package/dist/ProgressChart.d.ts.map +0 -1
  68. package/dist/ProgressChart.js +0 -134
  69. package/dist/StackedBarChart.d.ts.map +0 -1
  70. package/dist/StackedBarChart.js +0 -145
  71. package/dist/Utils.d.ts +0 -2
  72. package/dist/Utils.d.ts.map +0 -1
  73. package/dist/Utils.js +0 -4
  74. package/dist/contribution-graph/ContributionGraph.d.ts.map +0 -1
  75. package/dist/contribution-graph/ContributionGraph.js +0 -309
  76. package/dist/contribution-graph/DateHelpers.d.ts.map +0 -1
  77. package/dist/contribution-graph/DateHelpers.js +0 -14
  78. package/dist/contribution-graph/constants.d.ts.map +0 -1
  79. package/dist/contribution-graph/constants.js +0 -17
  80. package/dist/contribution-graph/index.d.ts.map +0 -1
  81. package/dist/contribution-graph/index.js +0 -3
  82. package/dist/line-chart/LegendItem.d.ts +0 -11
  83. package/dist/line-chart/LegendItem.d.ts.map +0 -1
  84. package/dist/line-chart/LegendItem.js +0 -23
  85. package/dist/line-chart/LineChart.d.ts.map +0 -1
  86. package/dist/line-chart/LineChart.js +0 -459
  87. package/dist/line-chart/index.d.ts.map +0 -1
  88. package/dist/line-chart/index.js +0 -3
  89. /package/dist/{contribution-graph → charts/contribution-graph}/constants.d.ts +0 -0
  90. /package/dist/{line-chart → charts/line}/index.d.ts +0 -0
package/package.json CHANGED
@@ -1,76 +1,132 @@
1
1
  {
2
2
  "name": "react-native-chart-kit",
3
- "version": "6.12.2",
3
+ "version": "7.0.0-next.1",
4
+ "workspaces": [
5
+ "packages/*",
6
+ "apps/expo-showcase"
7
+ ],
4
8
  "devDependencies": {
5
- "@types/react": "16.14.8",
6
- "@types/react-native": "^0.62.13",
7
- "babel-eslint": "10.x",
8
- "babel-plugin-module-resolver": "^3.1.1",
9
- "babel-polyfill": "^6.26.0",
10
- "eslint": "6.x",
11
- "eslint-config-react-app": "^5.0.2",
12
- "eslint-plugin-flowtype": "^4.3.0",
13
- "eslint-plugin-import": "2.x",
14
- "eslint-plugin-jsx-a11y": "6.x",
15
- "eslint-plugin-react": "7.x",
16
- "eslint-plugin-react-hooks": "1.x",
17
- "expo": "^37.0.0",
18
- "husky": "^3.0.7",
19
- "jest-expo": "^37.0.0",
20
- "prettier": "^1.18.2",
21
- "pretty-quick": "^1.11.1",
22
- "react": "16.9.0",
23
- "react-native": "https://github.com/expo/react-native/archive/sdk-37.0.1.tar.gz",
24
- "react-native-flash-message": "^0.1.10",
25
- "react-native-scrollable-tab-view": "^1.0.0",
26
- "react-native-svg": "11.0.1",
27
- "react-test-renderer": "16.7.0",
28
- "typescript": "^5.4.5"
9
+ "@eslint/js": "^9.39.4",
10
+ "@playwright/test": "^1.59.1",
11
+ "@react-native-community/cli": "^20.1.3",
12
+ "@types/node": "^25.6.0",
13
+ "@types/react": "^19.2.14",
14
+ "eslint": "^9.39.4",
15
+ "eslint-plugin-react": "^7.37.5",
16
+ "eslint-plugin-react-hooks": "^7.1.1",
17
+ "globals": "^17.5.0",
18
+ "husky": "^9.1.7",
19
+ "lint-staged": "^16.4.0",
20
+ "prettier": "^3.8.3",
21
+ "react": "^19.2.5",
22
+ "react-native": "^0.83.9",
23
+ "react-native-svg": "^15.15.4",
24
+ "typescript": "^5.9.3",
25
+ "typescript-eslint": "^8.59.1",
26
+ "vitest": "^4.1.5"
29
27
  },
30
- "_main": "./node_modules/expo/AppEntry.js",
31
28
  "main": "./dist/index.js",
29
+ "types": "./dist/index.d.ts",
32
30
  "typings": "./dist/index.d.ts",
33
31
  "files": [
34
- "dist"
32
+ "dist",
33
+ "scripts/chartkit-codemod.mjs"
35
34
  ],
35
+ "bin": {
36
+ "chartkit-codemod": "./scripts/chartkit-codemod.mjs"
37
+ },
38
+ "publishConfig": {
39
+ "access": "public",
40
+ "registry": "https://registry.npmjs.org/"
41
+ },
36
42
  "scripts": {
37
- "start": "expo start",
38
- "eject": "expo eject",
39
- "android": "expo start --android",
40
- "ios": "expo start --ios",
41
- "test": "jest",
42
- "typecheck": "tsc --noEmit",
43
- "build": "tsc",
43
+ "lint": "eslint . && npm run filesize:check",
44
+ "filesize:check": "node scripts/check-file-sizes.mjs",
45
+ "format": "prettier --write .",
46
+ "format:check": "prettier --check .",
47
+ "surface:check": "node scripts/verify-public-surface.mjs && node scripts/verify-package-boundaries.mjs && node scripts/verify-pro-preview-imports.mjs",
48
+ "security:audit": "npm audit --audit-level=high",
49
+ "boundaries:check": "node scripts/verify-package-boundaries.mjs",
50
+ "pack:check": "node scripts/check-package-packs.mjs",
51
+ "test": "npm run typecheck && npm run test:unit && npm run test:compat",
52
+ "test:unit": "vitest run --exclude \"packages/**/test/compat/**/*.test.ts\"",
53
+ "test:visual": "npm run visual:test",
54
+ "test:compat": "vitest run packages/core/test/compat",
55
+ "test:e2e": "npm run e2e:test",
56
+ "typecheck": "tsc --noEmit && npm run core:typecheck && npm run svg:typecheck && npm run skia:typecheck && npm run pro:typecheck && npm run rn:typecheck && npm run showcase:typecheck",
57
+ "core:typecheck": "tsc -p packages/core/tsconfig.json --noEmit && tsc -p packages/core/tsconfig.test.json --noEmit",
58
+ "core:build": "tsc -p packages/core/tsconfig.json",
59
+ "svg:typecheck": "tsc -p packages/svg-renderer/tsconfig.json --noEmit && tsc -p packages/svg-renderer/tsconfig.test.json --noEmit",
60
+ "svg:build": "tsc -p packages/svg-renderer/tsconfig.json",
61
+ "skia:typecheck": "tsc -p packages/skia-renderer/tsconfig.json --noEmit && tsc -p packages/skia-renderer/tsconfig.test.json --noEmit",
62
+ "skia:build": "tsc -p packages/skia-renderer/tsconfig.json",
63
+ "skia:parity": "vitest run packages/skia-renderer/test/skia-renderer.test.ts packages/react-native/test/line-renderer.test.ts packages/react-native/test/bar-renderer.test.ts packages/react-native/test/pie-renderer.test.ts packages/react-native/test/progress-renderer.test.ts packages/react-native/test/contribution-renderer.test.ts packages/react-native/test/combined-renderer.test.ts packages/react-native/test/candlestick-renderer.test.ts",
64
+ "skia:native:dry-run": "node scripts/run-skia-native-release-check.mjs --platform all --dry-run",
65
+ "skia:native:release": "node scripts/run-skia-native-release-check.mjs --platform all",
66
+ "pro:typecheck": "tsc -p packages/pro/tsconfig.json --noEmit && tsc -p packages/pro/tsconfig.test.json --noEmit",
67
+ "pro:build": "tsc -p packages/pro/tsconfig.json",
68
+ "rn:typecheck": "tsc -p packages/react-native/tsconfig.json --noEmit && tsc -p packages/react-native/tsconfig.test.json --noEmit",
69
+ "rn:build": "tsc -p packages/react-native/tsconfig.build.json",
70
+ "benchmark": "npm run benchmark:core-geometry && npm run benchmark:showcase-interaction",
71
+ "benchmark:core-geometry": "node scripts/benchmark-core-line.mjs",
72
+ "benchmark:core-line": "node scripts/benchmark-core-line.mjs",
73
+ "benchmark:showcase-interaction": "npm run showcase:build && playwright test -c apps/expo-showcase/benchmark.config.ts",
74
+ "showcase": "npm --workspace @chart-kit/expo-showcase run web --",
75
+ "showcase:build": "npm --workspace @chart-kit/expo-showcase run web:build",
76
+ "showcase:typecheck": "npm --workspace @chart-kit/expo-showcase run typecheck",
77
+ "expo:typecheck": "npm --workspace @chart-kit/expo-showcase run typecheck",
78
+ "visual:test": "npm run showcase:build && playwright test -c apps/expo-showcase/playwright.config.ts",
79
+ "visual:update": "npm run showcase:build && playwright test -c apps/expo-showcase/playwright.config.ts --update-snapshots",
80
+ "e2e:test": "npm run showcase:build && playwright test -c apps/expo-showcase/playwright.config.ts apps/expo-showcase/visual/chart-interaction.spec.ts",
81
+ "example:ios": "npm --workspace @chart-kit/expo-showcase run ios --",
82
+ "example:android": "npm --workspace @chart-kit/expo-showcase run android --",
83
+ "example:expo": "npm --workspace @chart-kit/expo-showcase run start --",
84
+ "example:rn-cli:typecheck": "tsc -p examples/rn-cli-basic/tsconfig.json --noEmit",
85
+ "example:rn-cli:native:dry-run": "node scripts/run-rn-cli-native-check.mjs --platform all --dry-run",
86
+ "example:rn-cli:android": "node scripts/run-rn-cli-native-check.mjs --platform android",
87
+ "example:rn-cli:ios": "node scripts/run-rn-cli-native-check.mjs --platform ios",
88
+ "native:release": "node scripts/run-expo-native-release-check.mjs --platform all",
89
+ "native:release:android": "node scripts/run-expo-native-release-check.mjs --platform android",
90
+ "native:release:ios": "node scripts/run-expo-native-release-check.mjs --platform ios",
91
+ "native:release:dry-run": "node scripts/run-expo-native-release-check.mjs --platform all --dry-run",
92
+ "release:native-workflow:record": "node scripts/record-native-workflow-evidence.mjs",
93
+ "release:owner:record": "node scripts/record-owner-gate-decision.mjs",
94
+ "release:publish:evidence": "node scripts/record-npm-publish-evidence.mjs",
95
+ "release:publish:status": "node scripts/check-npm-publish-state.mjs",
96
+ "release:preview:publish:preflight": "npm run release:preview:gate && npm run build && npm run pack:check && npm run release:publish:status -- --expect partial",
97
+ "release:preview:gate": "node scripts/check-release-gates.mjs --preview --strict",
98
+ "release:preview:gate:report": "node scripts/check-release-gates.mjs --preview",
99
+ "release:gate": "node scripts/check-release-gates.mjs --strict",
100
+ "release:gate:report": "node scripts/check-release-gates.mjs",
101
+ "docs:build": "node scripts/docs-build.mjs && node scripts/typecheck-doc-examples.mjs",
102
+ "codemod:v1-to-v2": "node scripts/chartkit-codemod.mjs v1-to-v2",
103
+ "clean": "node scripts/clean-dist.mjs",
104
+ "build": "npm run clean && npm run core:build && npm run svg:build && npm run skia:build && npm run pro:build && npm run rn:build && tsc",
44
105
  "dev": "tsc --watch",
45
- "prepare": "npm run build"
46
- },
47
- "jest": {
48
- "preset": "jest-expo"
106
+ "prepare": "npm run build && husky"
49
107
  },
50
108
  "peerDependencies": {
51
- "react": "> 16.7.0",
52
- "react-native": ">= 0.50.0",
53
- "react-native-svg": "> 6.4.1"
109
+ "react": ">=19.2.0 <20",
110
+ "react-native": ">=0.83 <1",
111
+ "react-native-svg": ">=15.13.0 <16"
54
112
  },
55
113
  "dependencies": {
56
- "paths-js": "^0.4.10",
57
- "point-in-polygon": "^1.0.1"
114
+ "paths-js": "^0.4.11"
58
115
  },
59
- "husky": {
60
- "hooks": {
61
- "pre-commit": "pretty-quick --staged"
62
- }
116
+ "lint-staged": {
117
+ "*.{js,jsx,ts,tsx}": [
118
+ "eslint --fix",
119
+ "prettier --write"
120
+ ],
121
+ "*.{json,md,yml,yaml}": "prettier --write"
122
+ },
123
+ "engines": {
124
+ "node": ">=20.19.4"
63
125
  },
64
126
  "license": "MIT",
65
127
  "homepage": "https://github.com/indiespirit/react-native-chart-kit",
66
128
  "repository": {
67
129
  "type": "git",
68
130
  "url": "git+https://github.com/indiespirit/react-native-chart-kit.git"
69
- },
70
- "overrides": {
71
- "@types/react": "16.14.8"
72
- },
73
- "resolutions": {
74
- "@types/react": "16.14.8"
75
131
  }
76
132
  }
@@ -0,0 +1,256 @@
1
+ #!/usr/bin/env node
2
+ import { readdir, readFile, stat, writeFile } from "node:fs/promises";
3
+ import path from "node:path";
4
+ import process from "node:process";
5
+ import { pathToFileURL } from "node:url";
6
+
7
+ export const legacyChartComponents = [
8
+ "LineChart",
9
+ "BarChart",
10
+ "StackedBarChart",
11
+ "PieChart",
12
+ "ProgressChart",
13
+ "ContributionGraph"
14
+ ];
15
+
16
+ const sourceExtensions = new Set([".js", ".jsx", ".ts", ".tsx"]);
17
+ const ignoredDirectoryNames = new Set([
18
+ ".git",
19
+ ".tmp",
20
+ "build",
21
+ "dist",
22
+ "node_modules"
23
+ ]);
24
+ const unsupportedLegacyProps = [
25
+ "decorator",
26
+ "getDotProps",
27
+ "renderDotContent",
28
+ "tooltipDataAttrs"
29
+ ];
30
+
31
+ export const importsReactNativeChartKit = (source) =>
32
+ /from\s+["']react-native-chart-kit["']/.test(source) ||
33
+ /require\(\s*["']react-native-chart-kit["']\s*\)/.test(source);
34
+
35
+ const getImportedLegacyComponents = (source) => {
36
+ const imported = new Set();
37
+ const namedImportPattern =
38
+ /import\s+\{(?<names>[^}]+)\}\s+from\s+["']react-native-chart-kit["']/g;
39
+ let match;
40
+
41
+ while ((match = namedImportPattern.exec(source)) !== null) {
42
+ const names = match.groups?.names ?? "";
43
+
44
+ for (const name of names.split(",")) {
45
+ const localName = name
46
+ .trim()
47
+ .split(/\s+as\s+/i)
48
+ .at(-1)
49
+ ?.trim();
50
+
51
+ if (localName && legacyChartComponents.includes(localName)) {
52
+ imported.add(localName);
53
+ }
54
+ }
55
+ }
56
+
57
+ const requirePattern =
58
+ /(?:const|let|var)\s+\{(?<names>[^}]+)\}\s*=\s*require\(\s*["']react-native-chart-kit["']\s*\)/g;
59
+
60
+ while ((match = requirePattern.exec(source)) !== null) {
61
+ const names = match.groups?.names ?? "";
62
+
63
+ for (const name of names.split(",")) {
64
+ const localName = name
65
+ .trim()
66
+ .split(/\s*:\s*/)
67
+ .at(-1)
68
+ ?.trim();
69
+
70
+ if (localName && legacyChartComponents.includes(localName)) {
71
+ imported.add(localName);
72
+ }
73
+ }
74
+ }
75
+
76
+ return imported;
77
+ };
78
+
79
+ const getLineNumber = (source, index) =>
80
+ source.slice(0, index).split("\n").length;
81
+
82
+ const collectWarnings = ({ filePath, source }) => {
83
+ const warnings = [];
84
+
85
+ for (const prop of unsupportedLegacyProps) {
86
+ const pattern = new RegExp(`\\b${prop}\\s*=`, "g");
87
+ let match;
88
+
89
+ while ((match = pattern.exec(source)) !== null) {
90
+ warnings.push({
91
+ filePath,
92
+ line: getLineNumber(source, match.index),
93
+ message: `${prop} is preserved, but should be manually reviewed for the modern composable API.`
94
+ });
95
+ }
96
+ }
97
+
98
+ if (
99
+ /import\s+\*\s+as\s+\w+\s+from\s+["']react-native-chart-kit["']/.test(
100
+ source
101
+ )
102
+ ) {
103
+ warnings.push({
104
+ filePath,
105
+ line: 1,
106
+ message:
107
+ "Namespace imports are detected but not rewritten; review ChartKit.LineChart-style usages manually."
108
+ });
109
+ }
110
+
111
+ return warnings;
112
+ };
113
+
114
+ export const transformV1ToV2Source = (source) => {
115
+ if (!importsReactNativeChartKit(source)) {
116
+ return {
117
+ changed: false,
118
+ source
119
+ };
120
+ }
121
+
122
+ const importedComponents = getImportedLegacyComponents(source);
123
+
124
+ if (importedComponents.size === 0) {
125
+ return {
126
+ changed: false,
127
+ source
128
+ };
129
+ }
130
+
131
+ const componentAlternation = [...importedComponents].join("|");
132
+ const openingTagPattern = new RegExp(
133
+ `<(?<name>${componentAlternation})(?<attrs>\\s[^<>]*?)?(?<closing>\\/?)>`,
134
+ "g"
135
+ );
136
+ const nextSource = source.replace(
137
+ openingTagPattern,
138
+ (fullMatch, name, attrs = "", closing) => {
139
+ if (/\bcompatibility\s*=/.test(attrs)) {
140
+ return fullMatch;
141
+ }
142
+
143
+ return `<${name} compatibility="v1"${attrs}${closing}>`;
144
+ }
145
+ );
146
+
147
+ return {
148
+ changed: nextSource !== source,
149
+ source: nextSource
150
+ };
151
+ };
152
+
153
+ const collectSourceFiles = async (entry) => {
154
+ const absolutePath = path.resolve(entry);
155
+ const entryStat = await stat(absolutePath);
156
+
157
+ if (entryStat.isFile()) {
158
+ return sourceExtensions.has(path.extname(absolutePath))
159
+ ? [absolutePath]
160
+ : [];
161
+ }
162
+
163
+ if (!entryStat.isDirectory()) {
164
+ return [];
165
+ }
166
+
167
+ const children = await readdir(absolutePath, { withFileTypes: true });
168
+ const nested = await Promise.all(
169
+ children.map((child) => {
170
+ if (child.isDirectory() && ignoredDirectoryNames.has(child.name)) {
171
+ return [];
172
+ }
173
+
174
+ return collectSourceFiles(path.join(absolutePath, child.name));
175
+ })
176
+ );
177
+
178
+ return nested.flat();
179
+ };
180
+
181
+ const runV1ToV2 = async ({ check, entries }) => {
182
+ const files = (await Promise.all(entries.map(collectSourceFiles))).flat();
183
+ const changedFiles = [];
184
+ const warnings = [];
185
+
186
+ for (const filePath of files) {
187
+ const source = await readFile(filePath, "utf8");
188
+ const result = transformV1ToV2Source(source);
189
+
190
+ warnings.push(...collectWarnings({ filePath, source }));
191
+
192
+ if (!result.changed) {
193
+ continue;
194
+ }
195
+
196
+ changedFiles.push(filePath);
197
+
198
+ if (!check) {
199
+ await writeFile(filePath, result.source, "utf8");
200
+ }
201
+ }
202
+
203
+ return {
204
+ changedFiles,
205
+ checkedFiles: files.length,
206
+ warnings
207
+ };
208
+ };
209
+
210
+ const printUsage = () => {
211
+ console.log(`Usage:
212
+ chartkit-codemod v1-to-v2 <path...> [--check]
213
+
214
+ Examples:
215
+ npx chartkit-codemod v1-to-v2 ./src
216
+ npx chartkit-codemod v1-to-v2 ./src --check`);
217
+ };
218
+
219
+ export const runCli = async (argv) => {
220
+ const [, , command, ...rest] = argv;
221
+ const check = rest.includes("--check");
222
+ const entries = rest.filter((item) => item !== "--check");
223
+
224
+ if (command !== "v1-to-v2" || entries.length === 0) {
225
+ printUsage();
226
+ return 1;
227
+ }
228
+
229
+ const result = await runV1ToV2({ check, entries });
230
+
231
+ for (const warning of result.warnings) {
232
+ console.warn(
233
+ `${path.relative(process.cwd(), warning.filePath)}:${warning.line}: ${warning.message}`
234
+ );
235
+ }
236
+
237
+ const action = check ? "would update" : "updated";
238
+ console.log(
239
+ `chartkit-codemod v1-to-v2 checked ${result.checkedFiles} files; ${action} ${result.changedFiles.length}.`
240
+ );
241
+
242
+ for (const filePath of result.changedFiles) {
243
+ console.log(`- ${path.relative(process.cwd(), filePath)}`);
244
+ }
245
+
246
+ return check && result.changedFiles.length > 0 ? 1 : 0;
247
+ };
248
+
249
+ const invokedUrl = process.argv[1]
250
+ ? pathToFileURL(path.resolve(process.argv[1])).href
251
+ : "";
252
+
253
+ if (import.meta.url === invokedUrl) {
254
+ const exitCode = await runCli(process.argv);
255
+ process.exit(exitCode);
256
+ }
@@ -1 +0,0 @@
1
- {"version":3,"file":"AbstractChart.d.ts","sourceRoot":"","sources":["../src/AbstractChart.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGzC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAEhE,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,mBAAmB,CAAC;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM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