@arcgis/codemod 5.2.0-next.112 → 5.2.0-next.114
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.
- package/README.md +59 -32
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -2,15 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
A codemod toolkit for updating and modernizing ArcGIS Maps SDK for JavaScript codebases.
|
|
4
4
|
|
|
5
|
-
This package provides automated refactors to help migrate away from deprecated or legacy patterns.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
- Converts global namespace types to explicit `@arcgis/core` imports
|
|
11
|
-
- Normalizes legacy Calcite icon names
|
|
12
|
-
- Detects edge cases and warns when changes can’t be safely automated
|
|
13
|
-
- Respects `.gitignore` by default
|
|
5
|
+
This package provides automated refactors to help migrate away from deprecated or legacy patterns.
|
|
6
|
+
These include codemods for removing the `__esri` namespace and
|
|
7
|
+
converting global namespace types to explicit `@arcgis/core` imports,
|
|
8
|
+
normalizing legacy Calcite icon names,
|
|
9
|
+
and updating geometry operator usage.
|
|
14
10
|
|
|
15
11
|
## Requirements
|
|
16
12
|
|
|
@@ -20,12 +16,25 @@ This package provides automated refactors to help migrate away from deprecated o
|
|
|
20
16
|
|
|
21
17
|
## Before you begin
|
|
22
18
|
|
|
19
|
+
Ensure your project's dependencies are up to date, for example with `pnpm install`.
|
|
20
|
+
|
|
23
21
|
If your project uses **ESLint, Prettier, or other formatters/linters**, run them after the codemod to ensure consistent formatting.
|
|
24
22
|
|
|
25
23
|
> [!Note]
|
|
26
|
-
>
|
|
24
|
+
> Codemods modify files in place and do not provide an interactive dry-run mode. We recommend running it in a project
|
|
25
|
+
> that is under version control (Git) so you can review changes using `git diff` or your IDE’s diff tools. If your
|
|
26
|
+
> project is not under version control, create a backup before running the codemod.
|
|
27
|
+
|
|
28
|
+
By default, codemods run on all TypeScript files in the current directory and subdirectories.
|
|
29
|
+
You can manually run it on a different directory by providing it as an argument.
|
|
27
30
|
|
|
28
|
-
|
|
31
|
+
Codemods respect `.gitignore` files and will not modify any files ignored by them.
|
|
32
|
+
|
|
33
|
+
## Available codemods
|
|
34
|
+
|
|
35
|
+
- [`refactor-out-esri-namespace`](#refactor-out-the-__esri-namespace)
|
|
36
|
+
- [`normalize-calcite-icon-names`](#normalize-calcite-icon-names)
|
|
37
|
+
- [`geometry-operator-renames`](#rename-geometry-operators)
|
|
29
38
|
|
|
30
39
|
### Refactor out the `__esri` namespace
|
|
31
40
|
|
|
@@ -33,21 +42,12 @@ The `refactor-out-esri-namespace` codemod replaces `__esri` types with explicit
|
|
|
33
42
|
|
|
34
43
|
> Note: Before running the codemod, update all `@arcgis/*` packages in your `package.json` to the most recent version.
|
|
35
44
|
|
|
36
|
-
Run it in the root of your project:
|
|
37
|
-
|
|
38
|
-
```sh
|
|
39
|
-
npx @arcgis/codemod run refactor-out-esri-namespace
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
By default, the codemod runs on all TypeScript files in the current directory and subdirectories, excluding files ignored by your `.gitignore`.
|
|
43
|
-
You can manually run it on a different directory by providing an argument:
|
|
45
|
+
Run it in the root of your project or with an explicit target directory:
|
|
44
46
|
|
|
45
47
|
```sh
|
|
46
|
-
npx @arcgis/codemod run refactor-out-esri-namespace target-directory
|
|
48
|
+
npx @arcgis/codemod run refactor-out-esri-namespace [<target-directory>]
|
|
47
49
|
```
|
|
48
50
|
|
|
49
|
-
#### What the codemod does
|
|
50
|
-
|
|
51
51
|
**Before:**
|
|
52
52
|
|
|
53
53
|
```tsx
|
|
@@ -78,18 +78,16 @@ These will be reported in the console, manually review all changes before commit
|
|
|
78
78
|
|
|
79
79
|
### Normalize Calcite icon names
|
|
80
80
|
|
|
81
|
-
The `normalize-calcite-icon-names` codemod updates camelCase and legacy Calcite icon names to their normalized
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
npx @arcgis/codemod run normalize-calcite-icon-names
|
|
87
|
-
```
|
|
81
|
+
The `normalize-calcite-icon-names` codemod updates camelCase and legacy Calcite icon names to their normalized
|
|
82
|
+
kebab-case equivalents. It handles icon attributes on Calcite components and traces icon values through variables,
|
|
83
|
+
properties, assignments, function returns, and forwarded component properties. This helps prepare for
|
|
84
|
+
[calcite-design-system#14967](https://github.com/Esri/calcite-design-system/issues/14967) and
|
|
85
|
+
[calcite-design-system#14966](https://github.com/Esri/calcite-design-system/issues/14966).
|
|
88
86
|
|
|
89
|
-
|
|
87
|
+
Run it in the root of your project or with an explicit target directory:
|
|
90
88
|
|
|
91
89
|
```sh
|
|
92
|
-
npx @arcgis/codemod run normalize-calcite-icon-names target-directory
|
|
90
|
+
npx @arcgis/codemod run normalize-calcite-icon-names [<target-directory>]
|
|
93
91
|
```
|
|
94
92
|
|
|
95
93
|
**Before:**
|
|
@@ -104,7 +102,36 @@ npx @arcgis/codemod run normalize-calcite-icon-names target-directory
|
|
|
104
102
|
<calcite-button iconStart="3d-glasses" iconEnd="arrow-left-10" />
|
|
105
103
|
```
|
|
106
104
|
|
|
105
|
+
### Rename Geometry Operators
|
|
106
|
+
|
|
107
|
+
At 5.2, geometry operator functions were renamed to improve consistency and discoverability.
|
|
108
|
+
The `geometry-operator-renames` codemod updates geometry operator calls to use the new names.
|
|
109
|
+
It additionally inlines namespace imports, which are now unnecessary.
|
|
110
|
+
|
|
111
|
+
Run it in the root of your project or with an explicit target directory:
|
|
112
|
+
|
|
113
|
+
```sh
|
|
114
|
+
npx @arcgis/codemod run geometry-operator-renames [<target-directory>]
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
**Before:**
|
|
118
|
+
|
|
119
|
+
````ts
|
|
120
|
+
import * as bufferOperator from "@arcgis/core/geometry/operators/bufferOperator";
|
|
121
|
+
const options: bufferOperator.Options = { unit: "meters" };
|
|
122
|
+
const buffered = bufferOperator.execute(polyline, 250, options);
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
**After:**
|
|
126
|
+
|
|
127
|
+
```ts
|
|
128
|
+
import { bufferExecute, type BufferExecuteOptions } from "@arcgis/core/geometry/operators/bufferOperator";
|
|
129
|
+
const options: BufferExecuteOptions = { unit: "meters" };
|
|
130
|
+
const buffered = bufferExecute(polyline, 250, options);
|
|
131
|
+
````
|
|
132
|
+
|
|
107
133
|
## License
|
|
108
134
|
|
|
109
|
-
This package is licensed under the terms described in the `LICENSE.md` file,
|
|
135
|
+
This package is licensed under the terms described in the `LICENSE.md` file,
|
|
136
|
+
located in the root of the package, and at https://js.arcgis.com/5.2/LICENSE.txt.
|
|
110
137
|
For third party notices, see https://js.arcgis.com/5.2/third-party-notices.txt.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcgis/codemod",
|
|
3
|
-
"version": "5.2.0-next.
|
|
3
|
+
"version": "5.2.0-next.114",
|
|
4
4
|
"description": "A codemod toolkit for updating and modernizing ArcGIS Maps SDK for JavaScript codebases.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
],
|
|
12
12
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@arcgis/api-extractor": "5.2.0-next.
|
|
15
|
-
"@arcgis/node-toolkit": "5.2.0-next.
|
|
16
|
-
"@arcgis/toolkit": "5.2.0-next.
|
|
14
|
+
"@arcgis/api-extractor": "5.2.0-next.114",
|
|
15
|
+
"@arcgis/node-toolkit": "5.2.0-next.114",
|
|
16
|
+
"@arcgis/toolkit": "5.2.0-next.114",
|
|
17
17
|
"@commander-js/extra-typings": "^15.0.0",
|
|
18
18
|
"commander": "^15.0.0",
|
|
19
19
|
"tinyglobby": "~0.2.17",
|