Skip to content

Commit

Permalink
refactor: remove property from env
Browse files Browse the repository at this point in the history
region is only used inside the parse-env function and can be made local
  • Loading branch information
ComradeVanti committed Dec 14, 2023
1 parent 36acaa5 commit 0d3390f
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 7 deletions.
5 changes: 0 additions & 5 deletions src/utils/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ import { manifestPathFor } from "../types/pkg-manifest";
import { Registry } from "../registry-client";
import { NpmAuth } from "another-npm-registry-client";

type Region = "us" | "cn";

export type Env = {
cwd: string;
systemUser: boolean;
Expand All @@ -40,7 +38,6 @@ export type Env = {
registry: Registry;
namespace: DomainName | IpAddress;
editorVersion: string | null;
region: Region;
};

// Parse env
Expand All @@ -64,7 +61,6 @@ export const parseEnv = async function (
env.systemUser = false;
env.wsl = false;
env.editorVersion = null;
env.region = "us";
// log level
log.level = options._global.verbose ? "verbose" : "notice";
// color
Expand All @@ -86,7 +82,6 @@ export const parseEnv = async function (
url: registryUrl("https://packages.unity.cn"),
auth: null,
};
env.region = "cn";
log.notice("region", "cn");
}
// registry
Expand Down
2 changes: 0 additions & 2 deletions test/test-env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ describe("env", function () {
should(env).not.be.null();
env!.registry.url.should.be.equal("https://package.openupm.cn");
env!.upstreamRegistry.url.should.be.equal("https://packages.unity.cn");
env!.region.should.be.equal("cn");
});
it("region cn with a custom registry", async function () {
const env = await parseEnv(
Expand All @@ -173,7 +172,6 @@ describe("env", function () {
should(env).not.be.null();
env!.registry.url.should.be.equal("https://reg.custom-package.com");
env!.upstreamRegistry.url.should.be.equal("https://packages.unity.cn");
env!.region.should.be.equal("cn");
});
});
});

0 comments on commit 0d3390f

Please sign in to comment.