diff --git a/packages/connect-migrate/src/migrations/v2.0.0.spec.ts b/packages/connect-migrate/src/migrations/v2.0.0.spec.ts index 629a94f0..79c76d2a 100644 --- a/packages/connect-migrate/src/migrations/v2.0.0.spec.ts +++ b/packages/connect-migrate/src/migrations/v2.0.0.spec.ts @@ -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 `); }); @@ -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 = [ @@ -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}`, }, @@ -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", @@ -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 `, ), @@ -418,7 +418,6 @@ plugins: dependencies: { "@bufbuild/connect-query": "*", "@bufbuild/protoc-gen-connect-query": "*", - "@bufbuild/protoc-gen-connect-query-react": "*", }, }, }, diff --git a/packages/connect-migrate/src/migrations/v2.0.0.ts b/packages/connect-migrate/src/migrations/v2.0.0.ts index c9cad19a..8b53ecf2 100644 --- a/packages/connect-migrate/src/migrations/v2.0.0.ts +++ b/packages/connect-migrate/src/migrations/v2.0.0.ts @@ -36,8 +36,8 @@ import { writeBufGenYamlFile } from "../lib/bufgenyaml"; export const targetVersionProtobufEs = "2.1.0"; export const targetVersionConnectEs = "2.0.0-alpha.1"; // TODO -export const targetVersionConnectQuery = "1.4.2"; // TODO -export const targetVersionConnectPlaywright = "0.3.2"; // TODO +export const targetVersionConnectQuery = "2.0.0"; // TODO +export const targetVersionConnectPlaywright = "0.4.0"; // TODO const dependencyMigrations: DependencyMigration[] = [ // https://github.com/bufbuild/protobuf-es @@ -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 { @@ -133,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, ) ); },