From 748e79f29a912590c8ae3c0a393622ea974759a0 Mon Sep 17 00:00:00 2001 From: Ben Newman Date: Tue, 9 Feb 2021 11:48:06 -0500 Subject: [PATCH] Move codemods/ into scripts/, to declutter top-level directories. (#7675) --- CHANGELOG.md | 11 +++++++++-- docs/source/migrating/apollo-client-3-migration.mdx | 2 +- {codemods => scripts/codemods}/ac2-to-ac3/README.md | 6 +++--- .../codemods}/ac2-to-ac3/examples/client-and-cache.ts | 0 .../codemods}/ac2-to-ac3/examples/link-packages.js | 0 .../codemods}/ac2-to-ac3/examples/react-packages.tsx | 0 {codemods => scripts/codemods}/ac2-to-ac3/imports.js | 0 .../codemods}/ac2-to-ac3/package.json | 0 .../codemods}/misc/mockLinkRejection.ts | 0 9 files changed, 13 insertions(+), 6 deletions(-) rename {codemods => scripts/codemods}/ac2-to-ac3/README.md (92%) rename {codemods => scripts/codemods}/ac2-to-ac3/examples/client-and-cache.ts (100%) rename {codemods => scripts/codemods}/ac2-to-ac3/examples/link-packages.js (100%) rename {codemods => scripts/codemods}/ac2-to-ac3/examples/react-packages.tsx (100%) rename {codemods => scripts/codemods}/ac2-to-ac3/imports.js (100%) rename {codemods => scripts/codemods}/ac2-to-ac3/package.json (100%) rename {codemods => scripts/codemods}/misc/mockLinkRejection.ts (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e79762ef8f..58916789f74 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## Apollo Client 3.3.10 (not yet released) + +### Improvements + +- The `codemods/` top-level directory has been moved into the `scripts/` directory.
+ [@benjamn](https://github.com/benjamn) in [#7675](https://github.com/apollographql/apollo-client/pull/7675) + ## Apollo Client 3.3.9 ### Bug Fixes @@ -314,7 +321,7 @@ - Implement `useReactiveVar` hook for consuming reactive variables in React components.
[@benjamn](https://github.com/benjamn) in [#6867](https://github.com/apollographql/apollo-client/pull/6867) -- Move `apollo-link-persisted-queries` implementation to `@apollo/client/link/persisted-queries`. Try running our [automated imports transform](https://github.com/apollographql/apollo-client/tree/main/codemods/ac2-to-ac3) to handle this conversion, if you're using `apollo-link-persisted-queries`.
+- Move `apollo-link-persisted-queries` implementation to `@apollo/client/link/persisted-queries`. Try running our [automated imports transform](https://github.com/apollographql/apollo-client/tree/main/scripts/codemods/ac2-to-ac3) to handle this conversion, if you're using `apollo-link-persisted-queries`.
[@hwillson](https://github.com/hwillson) in [#6837](https://github.com/apollographql/apollo-client/pull/6837) - Disable feud-stopping logic after any `cache.evict` or `cache.modify` operation.
@@ -368,7 +375,7 @@ ### Improvements -- Provide [jscodeshift](https://www.npmjs.com/package/jscodeshift) transform for automatically converting Apollo Client 2.x `import` declarations to use Apollo Client 3.x packages. [Instructions](https://github.com/apollographql/apollo-client/tree/main/codemods/ac2-to-ac3).
+- Provide [jscodeshift](https://www.npmjs.com/package/jscodeshift) transform for automatically converting Apollo Client 2.x `import` declarations to use Apollo Client 3.x packages. [Instructions](https://github.com/apollographql/apollo-client/tree/main/scripts/codemods/ac2-to-ac3).
[@dminkovsky](https://github.com/dminkovsky) and [@jcreighton](https://github.com/jcreighton) in [#6486](https://github.com/apollographql/apollo-client/pull/6486) ## Apollo Client 3.1.2 diff --git a/docs/source/migrating/apollo-client-3-migration.mdx b/docs/source/migrating/apollo-client-3-migration.mdx index a68aa9b4159..d133f41cb13 100644 --- a/docs/source/migrating/apollo-client-3-migration.mdx +++ b/docs/source/migrating/apollo-client-3-migration.mdx @@ -33,7 +33,7 @@ If you’re installing Apollo Client 3.0 in a project that already uses an earli The `@apollo/client` library includes functionality that previously required installing additional packages. As part of migrating to Apollo Client 3.0, follow the instructions below for each library your application currently uses. -> To simplify the process of converting your `import` declarations from older packages to `@apollo/client`, we provide an automated [transform](https://github.com/apollographql/apollo-client/tree/main/codemods/ac2-to-ac3) based on [`jscodeshift`](https://www.npmjs.com/package/jscodeshift). Note that this transform merely moves `import` specifiers between `import` declarations, without checking for proper usage of the imported values. Since the transform cannot take care of everything, pay close attention to any errors produced by TypeScript or your bundling tools, and be sure to verify all changes made by the transform. A more detailed list of caveats can be found in the [`README.md`](https://github.com/apollographql/apollo-client/tree/main/codemods/ac2-to-ac3#known-limitations). +> To simplify the process of converting your `import` declarations from older packages to `@apollo/client`, we provide an automated [transform](https://github.com/apollographql/apollo-client/tree/main/scripts/codemods/ac2-to-ac3) based on [`jscodeshift`](https://www.npmjs.com/package/jscodeshift). Note that this transform merely moves `import` specifiers between `import` declarations, without checking for proper usage of the imported values. Since the transform cannot take care of everything, pay close attention to any errors produced by TypeScript or your bundling tools, and be sure to verify all changes made by the transform. A more detailed list of caveats can be found in the [`README.md`](https://github.com/apollographql/apollo-client/tree/main/scripts/codemods/ac2-to-ac3#known-limitations). ### @apollo/react-hoc and @apollo/react-components diff --git a/codemods/ac2-to-ac3/README.md b/scripts/codemods/ac2-to-ac3/README.md similarity index 92% rename from codemods/ac2-to-ac3/README.md rename to scripts/codemods/ac2-to-ac3/README.md index 9a46a28efc0..b75294334eb 100644 --- a/codemods/ac2-to-ac3/README.md +++ b/scripts/codemods/ac2-to-ac3/README.md @@ -18,19 +18,19 @@ following commands to run, depending on the types of files you have: ```sh # To transform all .js files: npx jscodeshift \ - -t apollo-client/codemods/ac2-to-ac3/imports.js \ + -t apollo-client/scripts/codemods/ac2-to-ac3/imports.js \ --extensions js \ source-directory # To transform all .ts files: npx jscodeshift \ - -t apollo-client/codemods/ac2-to-ac3/imports.js \ + -t apollo-client/scripts/codemods/ac2-to-ac3/imports.js \ --extensions ts --parser ts \ source-directory # To transform all .tsx files: npx jscodeshift \ - -t apollo-client/codemods/ac2-to-ac3/imports.js \ + -t apollo-client/scripts/codemods/ac2-to-ac3/imports.js \ --extensions tsx --parser tsx \ source-directory ``` diff --git a/codemods/ac2-to-ac3/examples/client-and-cache.ts b/scripts/codemods/ac2-to-ac3/examples/client-and-cache.ts similarity index 100% rename from codemods/ac2-to-ac3/examples/client-and-cache.ts rename to scripts/codemods/ac2-to-ac3/examples/client-and-cache.ts diff --git a/codemods/ac2-to-ac3/examples/link-packages.js b/scripts/codemods/ac2-to-ac3/examples/link-packages.js similarity index 100% rename from codemods/ac2-to-ac3/examples/link-packages.js rename to scripts/codemods/ac2-to-ac3/examples/link-packages.js diff --git a/codemods/ac2-to-ac3/examples/react-packages.tsx b/scripts/codemods/ac2-to-ac3/examples/react-packages.tsx similarity index 100% rename from codemods/ac2-to-ac3/examples/react-packages.tsx rename to scripts/codemods/ac2-to-ac3/examples/react-packages.tsx diff --git a/codemods/ac2-to-ac3/imports.js b/scripts/codemods/ac2-to-ac3/imports.js similarity index 100% rename from codemods/ac2-to-ac3/imports.js rename to scripts/codemods/ac2-to-ac3/imports.js diff --git a/codemods/ac2-to-ac3/package.json b/scripts/codemods/ac2-to-ac3/package.json similarity index 100% rename from codemods/ac2-to-ac3/package.json rename to scripts/codemods/ac2-to-ac3/package.json diff --git a/codemods/misc/mockLinkRejection.ts b/scripts/codemods/misc/mockLinkRejection.ts similarity index 100% rename from codemods/misc/mockLinkRejection.ts rename to scripts/codemods/misc/mockLinkRejection.ts