gatsby-codemods
Advanced tools
Comparing version 4.0.0-alpha-v5.d20221010t183635.51 to 4.0.0-alpha-v5.d20221012t101120.57
{ | ||
"name": "gatsby-codemods", | ||
"version": "4.0.0-alpha-v5.d20221010t183635.51+14227ab256", | ||
"version": "4.0.0-alpha-v5.d20221012t101120.57+9c60f1ed1d", | ||
"description": "A collection of codemod scripts for use with JSCodeshift that help migrate to newer versions of Gatsby.", | ||
@@ -40,3 +40,3 @@ "main": "index.js", | ||
"@types/jscodeshift": "^0.11.5", | ||
"babel-preset-gatsby-package": "3.0.0-alpha-v5.d20221010t183635.51+14227ab256", | ||
"babel-preset-gatsby-package": "3.0.0-alpha-v5.d20221012t101120.57+9c60f1ed1d", | ||
"cross-env": "^7.0.3" | ||
@@ -48,3 +48,3 @@ }, | ||
"bin": "./bin/gatsby-codemods.js", | ||
"gitHead": "14227ab2566c56a917280b1e109205ce65d4534c" | ||
"gitHead": "9c60f1ed1de354c49b36c169659c7435bd6cb007" | ||
} |
@@ -11,3 +11,3 @@ # gatsby-codemods | ||
1. Run via npx | ||
### npx | ||
@@ -22,5 +22,5 @@ ```shell | ||
2. Use JSCodeshift directly | ||
### JSCodeshift | ||
- Install JSCodeshift as a global module | ||
1. Install JSCodeshift as a global module | ||
@@ -31,3 +31,3 @@ ```shell | ||
- Install this package | ||
2. Install this package | ||
@@ -38,3 +38,3 @@ ```shell | ||
- Run a transform from this package on your project | ||
3. Run a transform from this package on your project | ||
@@ -58,2 +58,25 @@ ```shell | ||
### `sort-and-aggr-graphql` | ||
Apply changes to the `sort` argument and aggregation's `field` argument as explained in the [RFC: Change to sort and aggregation fields API](https://github.com/gatsbyjs/gatsby/discussions/36242). | ||
See the [Gatsby v4 to v5 migration guide for details on when to use this](https://gatsbyjs.com/docs/migrating-from-v4-to-v5/#graphql-schema-changes-to-sort-and-aggregation-fields). | ||
```shell | ||
npx gatsby-codemods sort-and-aggr-graphql <filepath> | ||
``` | ||
Example result: | ||
```diff | ||
{ | ||
- allMarkdownRemark(sort: { fields: [frontmatter___date], order: DESC }) { | ||
+ allMarkdownRemark(sort: { frontmatter: { date: DESC } }) { | ||
nodes { | ||
...fields | ||
} | ||
} | ||
} | ||
``` | ||
### `global-graphql-calls` | ||
@@ -63,6 +86,6 @@ | ||
See the [Gatsby v2 migration guide for details on when to use this](https://gatsbyjs.com/docs/migrating-from-v1-to-v2/#import-graphql-from-gatsby). | ||
See the [Gatsby v1 to v2 migration guide for details on when to use this](https://gatsbyjs.com/docs/migrating-from-v1-to-v2/#import-graphql-from-gatsby). | ||
```shell | ||
jscodeshift -t node_modules/gatsby-codemods/dist/transforms/global-graphql-calls.js <path> | ||
npx gatsby-codemods global-graphql-calls <filepath> | ||
``` | ||
@@ -95,6 +118,6 @@ | ||
See the [Gatsby v2 migration guide for details on when to use this](https://gatsbyjs.com/docs/migrating-from-v1-to-v2/#import-link-from-gatsby). | ||
See the [Gatsby v1 to v2 migration guide for details on when to use this](https://gatsbyjs.com/docs/migrating-from-v1-to-v2/#import-link-from-gatsby). | ||
```shell | ||
jscodeshift -t node_modules/gatsby-codemods/dist/transforms/import-link.js <path> | ||
npx gatsby-codemods import-link <filepath> | ||
``` | ||
@@ -117,6 +140,6 @@ | ||
See the [Gatsby v2 migration guide for details on when to use this](https://gatsbyjs.com/docs/migrating-from-v1-to-v2/#change-navigateto-to-navigate). | ||
See the [Gatsby v1 to v2 migration guide for details on when to use this](https://gatsbyjs.com/docs/migrating-from-v1-to-v2/#change-navigateto-to-navigate). | ||
```shell | ||
jscodeshift -t node_modules/gatsby-codemods/dist/transforms/navigate-calls.js <path> | ||
npx gatsby-codemods navigate-calls <filepath> | ||
``` | ||
@@ -145,6 +168,6 @@ | ||
See the [Gatsby v2 migration guide for details on when to use this](https://gatsbyjs.com/docs/migrating-from-v1-to-v2/#rename-boundactioncreators-to-actions). | ||
See the [Gatsby v1 to v2 migration guide for details on when to use this](https://gatsbyjs.com/docs/migrating-from-v1-to-v2/#rename-boundactioncreators-to-actions). | ||
```shell | ||
jscodeshift -t node_modules/gatsby-codemods/dist/transforms/rename-bound-action-creators.js <path-to-file> | ||
npx gatsby-codemods rename-bound-action-creators <filepath> | ||
``` | ||
@@ -169,7 +192,1 @@ | ||
``` | ||
## More scripts | ||
Check out [issue 5038 in the Gatsby repo for additional codemod ideas](https://github.com/gatsbyjs/gatsby/issues/5038#issuecomment-411516865). | ||
We'd love your help with writing these! |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
141479
183