@cedarjs/codemods 2.5.0 → 2.5.1-next.27
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 +7 -7
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -43,7 +43,7 @@ cd packages/codemods
|
|
|
43
43
|
yarn generate:codemod
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
-
Follow the interactive guide to specify the
|
|
46
|
+
Follow the interactive guide to specify the CedarJS framework version for the codemod and type of codemod.
|
|
47
47
|
|
|
48
48
|
### Structure of this package
|
|
49
49
|
|
|
@@ -60,7 +60,7 @@ Each codemod has the following files:
|
|
|
60
60
|
|
|
61
61
|
### Different types of codemods
|
|
62
62
|
|
|
63
|
-
Codemods are sometimes really simple, e.g. just normal string replace or updating a package.json. But other times we use jscodeshift to change code on a
|
|
63
|
+
Codemods are sometimes really simple, e.g. just normal string replace or updating a package.json. But other times we use jscodeshift to change code on a Cedar project
|
|
64
64
|
|
|
65
65
|
Here are a few different examples to help you get familiarised:
|
|
66
66
|
|
|
@@ -141,7 +141,7 @@ export default function transform(file: FileInfo, api: API) {
|
|
|
141
141
|
return root.find(j.ImportDeclaration, {
|
|
142
142
|
source: {
|
|
143
143
|
type: 'Literal',
|
|
144
|
-
value: '@
|
|
144
|
+
value: '@cedarjs/router',
|
|
145
145
|
},
|
|
146
146
|
})
|
|
147
147
|
}
|
|
@@ -166,7 +166,7 @@ But sometimes you'll just have to use one of the more generic methods: `replaceW
|
|
|
166
166
|
|
|
167
167
|
Although jscodeshift has a built-in way of doing testing, we have a slightly different way of testing.
|
|
168
168
|
|
|
169
|
-
There are 3 key test utils you need to be aware of (located in [packages/codemods/testUtils/index.ts](https://github.com/
|
|
169
|
+
There are 3 key test utils you need to be aware of (located in [packages/codemods/testUtils/index.ts](https://github.com/cedarjs/cedar/blob/main/packages/codemods/testUtils/index.ts)).
|
|
170
170
|
|
|
171
171
|
1. `matchTransformSnapshot`—this lets you give it a transformName (i.e. the transform you're writing), and a fixtureName. The fixtures should be located in `__testfixtures__`, and have `{fixtureName}.input.{js,ts}` and `{fixtureName}.output.{js,ts}` files.
|
|
172
172
|
|
|
@@ -174,7 +174,7 @@ Note that the fixtureName can be anything you want, and you can have multiple fi
|
|
|
174
174
|
|
|
175
175
|
```js
|
|
176
176
|
describe('Update API Imports', () => {
|
|
177
|
-
it('Updates @
|
|
177
|
+
it('Updates @cedarjs/api imports', async () => {
|
|
178
178
|
await matchTransformSnapshot('updateApiImports', 'apiImports')
|
|
179
179
|
})
|
|
180
180
|
})
|
|
@@ -213,7 +213,7 @@ The `matchFolderTransform` helper will check
|
|
|
213
213
|
a) If the files in the output fixture folder are present after transform
|
|
214
214
|
b) If their contents match
|
|
215
215
|
|
|
216
|
-
## How to run your changes on a test
|
|
216
|
+
## How to run your changes on a test Cedar project
|
|
217
217
|
|
|
218
218
|
1. Clean all your other packages, and rebuild once:
|
|
219
219
|
|
|
@@ -232,7 +232,7 @@ yarn build
|
|
|
232
232
|
|
|
233
233
|
3. Running the updated CLI
|
|
234
234
|
|
|
235
|
-
The CLI is meant to be run on a
|
|
235
|
+
The CLI is meant to be run on a Cedar project (i.e. it expects you to be cd'd into a Cedar project), but you can provide it as an environment variable too!
|
|
236
236
|
|
|
237
237
|
```shell
|
|
238
238
|
RWJS_CWD=/path/to/rw-project node "./packages/codemods/dist/codemods.js" {your-codemod-name}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/codemods",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.1-next.27+4a00a5632",
|
|
4
4
|
"description": "Codemods to ease upgrading a CedarJS Project",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@babel/cli": "7.28.6",
|
|
28
28
|
"@babel/core": "^7.26.10",
|
|
29
|
-
"@babel/parser": "7.
|
|
29
|
+
"@babel/parser": "7.29.0",
|
|
30
30
|
"@babel/plugin-transform-typescript": "^7.26.8",
|
|
31
|
-
"@babel/runtime-corejs3": "7.
|
|
32
|
-
"@babel/traverse": "7.
|
|
33
|
-
"@cedarjs/project-config": "2.5.
|
|
31
|
+
"@babel/runtime-corejs3": "7.29.0",
|
|
32
|
+
"@babel/traverse": "7.29.0",
|
|
33
|
+
"@cedarjs/project-config": "2.5.1-next.27+4a00a5632",
|
|
34
34
|
"@svgr/core": "8.1.0",
|
|
35
35
|
"@svgr/plugin-jsx": "8.1.0",
|
|
36
36
|
"@vscode/ripgrep": "1.17.0",
|
|
@@ -44,12 +44,12 @@
|
|
|
44
44
|
"jscodeshift": "17.0.0",
|
|
45
45
|
"pascalcase": "1.0.0",
|
|
46
46
|
"prettier": "3.8.1",
|
|
47
|
-
"tasuku": "2.0.
|
|
47
|
+
"tasuku": "2.0.8",
|
|
48
48
|
"typescript": "5.9.3",
|
|
49
49
|
"yargs": "17.7.2"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@cedarjs/framework-tools": "
|
|
52
|
+
"@cedarjs/framework-tools": "2.5.1-next.27",
|
|
53
53
|
"@types/babel__core": "7.20.5",
|
|
54
54
|
"@types/jscodeshift": "0.12.0",
|
|
55
55
|
"@types/yargs": "17.0.35",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"publishConfig": {
|
|
61
61
|
"access": "public"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "4a00a56324db4db5db1559e21850f4d9b5856b52"
|
|
64
64
|
}
|