Skip to content

Commit

Permalink
Update migration versions (#1244)
Browse files Browse the repository at this point in the history
  • Loading branch information
timostamm committed Sep 20, 2024
1 parent f074ab1 commit b735d79
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions packages/connect-migrate/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { parseCommandLineArgs } from "./arguments";
import { scan } from "./lib/scan";
import { Logger } from "./lib/logger";
import { v0_13_1 } from "./migrations/v0.13.1";
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 @@ -34,7 +34,7 @@ Flags:
`;

const logger = new Logger();
const migrations = [v0_13_1, v1_16_0];
const migrations = [v0_13_1, v1_6_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 @@ -178,7 +178,7 @@ describe("migration", 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 @@ -26,8 +26,8 @@ import { migrateSourceFiles } from "../lib/migrate-source-files";
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 @@ -54,20 +54,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 @@ -78,22 +78,22 @@ describe("migration", function () {
},
},
];
expect(v1_16_0.applicable(opt.scanned)).toBeTrue();
expect(v1_6_0.applicable(opt.scanned)).toBeTrue();
});
});
describe("should not be applicable", function () {
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)).toBeFalse();
expect(v1_6_0.applicable(opt.scanned)).toBeFalse();
});
it("from 2.0.0", () => {
opt.scanned.packageFiles = [
Expand All @@ -106,7 +106,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 { updateSourceFile } from "../lib/update-source-file";
import { migrateSourceFiles } from "../lib/migrate-source-files";
Expand All @@ -23,7 +23,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 Expand Up @@ -77,7 +77,7 @@ function getMatchingPackages(packageFiles: Scanned["packageFiles"]) {
if (minVersion === null) {
return false;
}
return semver.satisfies(minVersion, "^1.16.0");
return semver.satisfies(minVersion, "^1.6.0");
})
) {
matched.push(packageFile);
Expand Down

0 comments on commit b735d79

Please sign in to comment.