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

V2: Fix Connect-Query v2.0.0-beta.1 in connect-migrate #1266

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
117 changes: 58 additions & 59 deletions packages/connect-migrate/src/migrations/v2.0.0.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,63 +193,62 @@ plugins:
`);
});
});
// 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-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:v2.0.0-beta.1
out: src/gen
`);
});
});
describe("for connect-playwright-es v1", () => {
beforeEach(function () {
opt.scanned.packageFiles = [
Expand Down Expand Up @@ -322,7 +321,7 @@ plugins:
out: src/gen
- remote: buf.build/bufbuild/es:v2.0.0
out: src/gen
- remote: buf.build/connectrpc/query-es:v1.4.2
- remote: buf.build/connectrpc/query-es:v${targetVersionConnectQuery}
out: src/gen
`,
"buf.gen.yaml",
Expand All @@ -342,7 +341,7 @@ plugins:
out: src/gen
- plugin: buf.build/bufbuild/es:v2.0.0
out: src/gen
- plugin: buf.build/connectrpc/query-es:v1.4.2
- plugin: buf.build/connectrpc/query-es:v${targetVersionConnectQuery}
out: src/gen
`,
),
Expand Down
21 changes: 10 additions & 11 deletions packages/connect-migrate/src/migrations/v2.0.0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,15 @@ const dependencyMigrations: DependencyMigration[] = [
remove: { name: "@connectrpc/protoc-gen-connect-es", range: "^1.0.0" },
},

// TODO
// // https:/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:/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:/connectrpc/connect-playwright-es
{
Expand All @@ -119,7 +118,7 @@ const bufGenYamlMigrations: BufGenYamlMigration[] = [
updatePlugin: {
remote: "buf.build/connectrpc/query-es",
from: "^1.0.0",
to: "1.4.2", // TODO
to: targetVersionConnectQuery,
Copy link
Member Author

@timostamm timostamm Oct 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will update the remote plugin in buf.gen.yaml to the beta version, which will not be available as a pre-release (only stable versions are). I think that's acceptable, since the migration is also beta.

},
},
];
Expand Down
Loading