Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to v2 #1295

Merged
merged 60 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
4fa60c8
Swith to protobuf v2
srikrsna-buf Jun 14, 2024
2caeea1
Use string instead of `*n` in bigint test
srikrsna-buf Jun 25, 2024
6a7f30b
V2: Bump protobuf version (#1119)
srikrsna-buf Jun 27, 2024
4406276
V2: Fix skipped tests (#1120)
srikrsna-buf Jun 27, 2024
850cc09
Merge remote-tracking branch 'origin/main' into v2
srikrsna-buf Jun 28, 2024
91df9de
Fix release script
srikrsna-buf Jul 1, 2024
4378268
Release 2.0.0-alpha.1 (#1121)
srikrsna-buf Jul 1, 2024
f7b9194
V2: Update dependencies (#1133)
srikrsna-buf Jul 2, 2024
8288a07
V2: Remove unused .npmignore file (#1134)
timostamm Jul 9, 2024
14ab5f8
V2: Fix connect-migrate tsconfig.json (#1135)
timostamm Jul 9, 2024
45876d5
V2: Support removal of dependencies in connect-migrate (#1137)
timostamm Jul 10, 2024
848dce0
V2: Improve testing codemods in connect-migration (#1138)
timostamm Jul 11, 2024
6a399a6
V2: Support buf.gen.yaml in connect-migrate (#1141)
timostamm Jul 11, 2024
99c2ada
Add migration to v2 (#1142)
timostamm Jul 15, 2024
abbd55b
V2: Update JSDoc for ConnectRouter methods service and rpc (#1147)
timostamm Jul 16, 2024
c919a65
V2: Use base64Encoding options from @bufbuild/protobuf v2 (#1148)
timostamm Jul 17, 2024
baa2f4c
Merge remote-tracking branch 'origin/main' into v2
timostamm Jul 18, 2024
6c4e9a7
V2: Allow inline type imports in linter (#1150)
timostamm Jul 22, 2024
91006d0
V2: Update bundle-size benchmark (#1152)
timostamm Jul 22, 2024
5ac11ec
V2: Update to Protobuf-ES 2.0.0-beta.3 (#1153)
timostamm Jul 24, 2024
938d528
Merge remote-tracking branch 'origin/main' into v2
timostamm Aug 27, 2024
b92b370
V2: Update to Protobuf-ES 2.0.0 (#1189)
timostamm Aug 27, 2024
ef48f10
V2: Correct type inference for ConnectError#findDetails (#1188)
bhollis Aug 28, 2024
f8fd18c
Lint and format (#1191)
timostamm Aug 28, 2024
ee8dcc7
Merge remote-tracking branch 'origin/main' into v2
srikrsna-buf Sep 11, 2024
c482703
Revert changes to Migrate package.json
srikrsna-buf Sep 11, 2024
2670571
V2: Remove protoc-gen-connect-es (#1224)
timostamm Sep 12, 2024
a054d37
V2: Remove Node10 subpath fallbacks (#1227)
timostamm Sep 12, 2024
cabda22
V2: Remove support for Node.js v16 (#1225)
timostamm Sep 12, 2024
7ca8eac
Fix type type error in `bigint` test (#1229)
srikrsna-buf Sep 13, 2024
ab1b7c2
V2: Use `Stream{Request|Response}` types in interceptors for all stre…
srikrsna-buf Sep 13, 2024
ed4b0e5
V2: Bump minimum supported TypeScript version to 4.9.5 (#1231)
timostamm Sep 13, 2024
25ca96e
V2: Don't trigger handler signal on success (#1234)
srikrsna-buf Sep 17, 2024
fe5e10d
V2: Update dependencies (#1239)
timostamm Sep 19, 2024
d0b30f3
Merge remote-tracking branch 'origin/main' into v2
srikrsna-buf Sep 19, 2024
8b25cf3
V2: Remove `createPromiseClient` and `PromiseClient` (#1240)
srikrsna-buf Sep 19, 2024
33be09c
Bump browser versions tested on Browserstack (#1241)
timostamm Sep 19, 2024
d42db7a
V2: Remove "credentials" option from transports (#1242)
timostamm Sep 20, 2024
8356e5a
V2: Run `createPromiseClient` -> `createClient` codemod on all v1 ver…
srikrsna-buf Sep 20, 2024
3ebee77
V2: Update migration versions (#1245)
timostamm Sep 20, 2024
413d0e7
Release 2.0.0-beta.1 (#1246)
timostamm Sep 20, 2024
1e09ec8
V2: Remove obsolete todo (#1254)
srikrsna-buf Oct 3, 2024
f8fc90e
V2: Replace MethodInfo with Descriptor Types (#1255)
srikrsna-buf Oct 3, 2024
77fb02d
V2: Use `DescMethod*` types from `@bufbuild/protobuf` (#1260)
srikrsna-buf Oct 9, 2024
c4b0bf9
Merge remote-tracking branch 'origin/main' into v2
timostamm Oct 9, 2024
f637557
V2: Add Connect-Query v2.0.0-beta.1 to connect-migrate (#1264)
timostamm Oct 10, 2024
bc11967
V2: Fix Connect-Query v2.0.0-beta.1 in connect-migrate (#1266)
timostamm Oct 10, 2024
0f284e4
Release 2.0.0-beta.2 (#1265)
timostamm Oct 10, 2024
3f95330
V2: Fix transform for `createPromiseClient` -> `createClient` in conn…
paul-sachs Oct 10, 2024
d81d475
V2: Fix CI (#1278)
srikrsna-buf Oct 16, 2024
f6c9fac
V2: Require HTTP/2 for the gRPC transport (#1279)
timostamm Oct 17, 2024
00004e3
V2: Ensure that a signal exists for a completed RPC (#1282)
timostamm Oct 18, 2024
075f0e1
Release 2.0.0-rc.1 (#1283)
timostamm Oct 18, 2024
92dcc1a
Allow user-provided User-Agent request header (#1272)
polRk Oct 28, 2024
da706e0
V2: Add support for Next.js v15 (#1290)
timostamm Oct 31, 2024
0323619
Release 2.0.0-rc.2 (#1291)
timostamm Oct 31, 2024
af47285
V2: Update makeAnyClient signature to carry type information to narro…
timostamm Oct 31, 2024
b79668b
Merge remote-tracking branch 'origin/v2' into tstamm/Switch-to-v2
timostamm Nov 4, 2024
df4fb65
Add note in README.md
timostamm Nov 4, 2024
f506f94
Update note in README.md
timostamm Nov 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
V2: Update migration versions (#1245)
  • Loading branch information
timostamm authored Sep 20, 2024
commit 3ebee77c84204e9ae9739e230dd6a3c2aaab3500
4 changes: 2 additions & 2 deletions packages/connect-migrate/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { scan } from "./lib/scan";
import { Logger } from "./lib/logger";
import { v0_13_1 } from "./migrations/v0.13.1";
import { v2_0_0 } from "./migrations/v2.0.0";
import { v1_16_0 } from "./migrations/v1.16.0";
import { v1_6_0 } from "./migrations/v1.6.0";
import type { Migration } from "./migration";

const usage = `USAGE: connect-migrate [flags]
Expand All @@ -35,7 +35,7 @@ Flags:
`;

const logger = new Logger();
const migrations = [v0_13_1, v1_16_0, v2_0_0];
const migrations = [v0_13_1, v1_6_0, v2_0_0];
void main();

async function main() {
Expand Down
2 changes: 1 addition & 1 deletion packages/connect-migrate/src/migrations/v0.13.1.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ describe("migration to v0.13.1", function () {
expect(packageJsonWritten.length).toBe(1);
expect(packageJsonWritten[0].pkg).toEqual({
dependencies: {
"@connectrpc/connect": "^1.1.2",
"@connectrpc/connect": "^1.6.0",
},
});
expect(lockFilesUpdated.length).toBe(1);
Expand Down
4 changes: 2 additions & 2 deletions packages/connect-migrate/src/migrations/v0.13.1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ import {
import { migratePackages } from "../lib/migrate-packages";
import { migrateLockFiles } from "../lib/migrate-lock-files";

export const targetVersionConnectEs = "1.1.2";
export const targetVersionConnectQuery = "0.5.1";
export const targetVersionConnectEs = "1.6.0";
export const targetVersionConnectQuery = "1.4.2";

/**
* The latest available version of protoc-gen-connect-web is v0.11.0.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.

import jscodeshift from "jscodeshift";
import transform from "./v1.16.0-transform";
import transform from "./v1.6.0-transform";

function t(
source: string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

import { v1_16_0 } from "./v1.16.0";
import { v1_6_0 } from "./v1.6.0";
import type { PackageJson } from "../lib/package-json";
import type { MigrateOptions } from "../migration";

Expand Down Expand Up @@ -55,20 +55,20 @@ describe("migration", function () {
};
});
describe("should be applicable", function () {
it("for 1.16.0", () => {
it("for 1.6.0", () => {
opt.scanned.packageFiles = [
{
path: "package.json",
pkg: {
dependencies: {
"@connectrpc/connect": "^1.16.0",
"@connectrpc/connect": "^1.6.0",
},
},
},
];
expect(v1_16_0.applicable(opt.scanned)).toBeTrue();
expect(v1_6_0.applicable(opt.scanned)).toBeTrue();
});
it("after 1.16.0", () => {
it("after 1.6.0", () => {
opt.scanned.packageFiles = [
{
path: "package.json",
Expand All @@ -79,20 +79,20 @@ describe("migration", function () {
},
},
];
expect(v1_16_0.applicable(opt.scanned)).toBeTrue();
expect(v1_6_0.applicable(opt.scanned)).toBeTrue();
});
it("before 1.16.0", () => {
it("before 1.6.0", () => {
opt.scanned.packageFiles = [
{
path: "package.json",
pkg: {
dependencies: {
"@connectrpc/connect": "^1.15.0",
"@connectrpc/connect": "^1.5.0",
},
},
},
];
expect(v1_16_0.applicable(opt.scanned)).toBeTrue();
expect(v1_6_0.applicable(opt.scanned)).toBeTrue();
});
});
describe("should not be applicable", function () {
Expand All @@ -107,7 +107,7 @@ describe("migration", function () {
},
},
];
expect(v1_16_0.applicable(opt.scanned)).toBeFalse();
expect(v1_6_0.applicable(opt.scanned)).toBeFalse();
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.

import type { Scanned } from "../lib/scan";
import replaceCalls from "./v1.16.0-transform";
import replaceCalls from "./v1.6.0-transform";
import type { MigrateError, MigrateSuccess, Migration } from "../migration";
import {
migrateSourceFiles,
Expand All @@ -25,7 +25,7 @@ import * as semver from "semver";
* Migrates code to use new symbols `createClient` and `Client` instead
* of `createPromiseClient` and `PromiseClient`.
*/
export const v1_16_0: Migration = {
export const v1_6_0: Migration = {
applicable(scanned: Scanned) {
return getMatchingPackages(scanned.packageFiles).length > 0;
},
Expand Down
121 changes: 60 additions & 61 deletions packages/connect-migrate/src/migrations/v2.0.0.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ plugins:
expect(bufGenYamlWritten.length).toBe(1);
expect(bufGenYamlWritten[0]?.yaml).toEqual(`version: v2
plugins:
- remote: buf.build/bufbuild/es:v2.0.0
- remote: buf.build/bufbuild/es:v2.1.0
out: src/gen
`);
});
Expand Down Expand Up @@ -193,62 +193,63 @@ plugins:
`);
});
});
describe("for connect-query-es v1", () => {
beforeEach(function () {
opt.scanned.packageFiles = [
{
path: "package.json",
pkg: {
dependencies: {
"@connectrpc/connect-query": "^1.4.1",
"@connectrpc/protoc-gen-connect-query": "^1.4.1",
},
},
},
];
opt.scanned.bufGenYamlFiles = [
{
path: "buf.gen.yaml",
yaml: parseBufGenYaml(
`version: v2
plugins:
- remote: buf.build/connectrpc/query-es:v1.4.1
out: src/gen
`,
),
},
];
});
it("should be applicable", () => {
expect(v2_0_0.applicable(opt.scanned)).toBeTrue();
});
it("should migrate packages", () => {
const result = v2_0_0.migrate(opt);
expect(result).toEqual({
ok: true,
});
expect(packageJsonWritten.length).toBe(1);
expect(packageJsonWritten[0].pkg).toEqual({
dependencies: {
"@connectrpc/connect-query": `^${targetVersionConnectQuery}`,
"@connectrpc/protoc-gen-connect-query": `^${targetVersionConnectQuery}`,
},
});
expect(lockFilesUpdated.length).toBe(1);
});
it("should migrate buf.gen.yaml", () => {
const result = v2_0_0.migrate(opt);
expect(result).toEqual({
ok: true,
});
expect(bufGenYamlWritten.length).toBe(1);
expect(bufGenYamlWritten[0]?.yaml).toEqual(`version: v2
plugins:
- remote: buf.build/connectrpc/query-es:v2.0.0
out: src/gen
`);
});
});
// TODO
// describe("for connect-query-es v1", () => {
// beforeEach(function () {
// opt.scanned.packageFiles = [
// {
// path: "package.json",
// pkg: {
// dependencies: {
// "@connectrpc/connect-query": "^1.4.2",
// "@connectrpc/protoc-gen-connect-query": "^1.4.2",
// },
// },
// },
// ];
// opt.scanned.bufGenYamlFiles = [
// {
// path: "buf.gen.yaml",
// yaml: parseBufGenYaml(
// `version: v2
// plugins:
// - remote: buf.build/connectrpc/query-es:v1.4.1
// out: src/gen
// `,
// ),
// },
// ];
// });
// it("should be applicable", () => {
// expect(v2_0_0.applicable(opt.scanned)).toBeTrue();
// });
// it("should migrate packages", () => {
// const result = v2_0_0.migrate(opt);
// expect(result).toEqual({
// ok: true,
// });
// expect(packageJsonWritten.length).toBe(1);
// expect(packageJsonWritten[0].pkg).toEqual({
// dependencies: {
// "@connectrpc/connect-query": `^${targetVersionConnectQuery}`,
// "@connectrpc/protoc-gen-connect-query": `^${targetVersionConnectQuery}`,
// },
// });
// expect(lockFilesUpdated.length).toBe(1);
// });
// it("should migrate buf.gen.yaml", () => {
// const result = v2_0_0.migrate(opt);
// expect(result).toEqual({
// ok: true,
// });
// expect(bufGenYamlWritten.length).toBe(1);
// expect(bufGenYamlWritten[0]?.yaml).toEqual(`version: v2
// plugins:
// - remote: buf.build/connectrpc/query-es:v1.4.2
// out: src/gen
// `);
// });
// });
describe("for connect-playwright-es v1", () => {
beforeEach(function () {
opt.scanned.packageFiles = [
Expand Down Expand Up @@ -300,7 +301,6 @@ plugins:

"@connectrpc/connect-query": `^${targetVersionConnectQuery}`,
"@connectrpc/protoc-gen-connect-query": `^${targetVersionConnectQuery}`,
"@connectrpc/protoc-gen-connect-query-react": `^${targetVersionConnectQuery}`,

"@connectrpc/connect-playwright": `^${targetVersionConnectPlaywright}`,
},
Expand All @@ -322,7 +322,7 @@ plugins:
out: src/gen
- remote: buf.build/bufbuild/es:v2.0.0
out: src/gen
- remote: buf.build/connectrpc/query-es:v2.0.0
- remote: buf.build/connectrpc/query-es:v1.4.2
out: src/gen
`,
"buf.gen.yaml",
Expand All @@ -342,7 +342,7 @@ plugins:
out: src/gen
- plugin: buf.build/bufbuild/es:v2.0.0
out: src/gen
- plugin: buf.build/connectrpc/query-es:v2.0.0
- plugin: buf.build/connectrpc/query-es:v1.4.2
out: src/gen
`,
),
Expand Down Expand Up @@ -418,7 +418,6 @@ plugins:
dependencies: {
"@bufbuild/connect-query": "*",
"@bufbuild/protoc-gen-connect-query": "*",
"@bufbuild/protoc-gen-connect-query-react": "*",
},
},
},
Expand Down
42 changes: 19 additions & 23 deletions packages/connect-migrate/src/migrations/v2.0.0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ import {
} from "../lib/migrate-bufgenyaml";
import { writeBufGenYamlFile } from "../lib/bufgenyaml";

export const targetVersionProtobufEs = "2.0.0-beta.3";
export const targetVersionConnectEs = "2.0.0-alpha.1";
export const targetVersionConnectQuery = "2.0.0-alpha.1";
export const targetVersionConnectPlaywright = "0.4.0";
export const targetVersionProtobufEs = "2.1.0";
export const targetVersionConnectEs = "2.0.0-alpha.1"; // TODO
export const targetVersionConnectQuery = "2.0.0"; // TODO
export const targetVersionConnectPlaywright = "0.4.0"; // TODO

const dependencyMigrations: DependencyMigration[] = [
// https://github.com/bufbuild/protobuf-es
Expand Down Expand Up @@ -83,15 +83,16 @@ const dependencyMigrations: DependencyMigration[] = [
remove: { name: "@connectrpc/protoc-gen-connect-es", range: "^1.0.0" },
},

// https://github.com/connectrpc/connect-query-es
{
from: { name: "@connectrpc/connect-query", range: "^1.0.0" },
to: { version: targetVersionConnectQuery },
},
{
from: { name: "@connectrpc/protoc-gen-connect-query", range: "^1.0.0" },
to: { version: targetVersionConnectQuery },
},
// TODO
// // https://github.com/connectrpc/connect-query-es
// {
// from: { name: "@connectrpc/connect-query", range: "^1.0.0" },
// to: { version: targetVersionConnectQuery },
// },
// {
// from: { name: "@connectrpc/protoc-gen-connect-query", range: "^1.0.0" },
// to: { version: targetVersionConnectQuery },
// },

// https://github.com/connectrpc/connect-playwright-es
{
Expand All @@ -111,21 +112,14 @@ const bufGenYamlMigrations: BufGenYamlMigration[] = [
updatePlugin: {
remote: "buf.build/bufbuild/es",
from: "^1.0.0",
to: "2.0.0",
},
},
{
updatePlugin: {
remote: "buf.build/connectrpc/es",
from: "^1.0.0",
to: "2.0.0",
to: targetVersionProtobufEs,
},
},
{
updatePlugin: {
remote: "buf.build/connectrpc/query-es",
from: "^1.0.0",
to: "2.0.0",
to: "1.4.2", // TODO
},
},
];
Expand All @@ -140,7 +134,9 @@ export const v2_0_0: Migration = {
({ yaml }) => migrateBufGenYaml(yaml, bufGenYamlMigrations) !== null,
) ||
scanned.packageFiles.some(
({ pkg }) => migrateDependencies(pkg, dependencyMigrations) !== null,
({ pkg }) =>
migrateDependencies(structuredClone(pkg), dependencyMigrations) !==
null,
)
);
},
Expand Down