Skip to content

Commit 014d25c

Browse files
author
Ramon Brullo
committed
rename type
1 parent f5e953e commit 014d25c

File tree

6 files changed

+20
-18
lines changed

6 files changed

+20
-18
lines changed

src/domain/upm-config.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@ import { NpmAuth } from "another-npm-registry-client";
44
/**
55
* Abstraction of an upmconfig.toml file.
66
*/
7-
export type UPMConfig = Readonly<Record<RegistryUrl, NpmAuth>>;
7+
export type UpmConfig = Readonly<Record<RegistryUrl, NpmAuth>>;
88

9-
export const emptyUpmConfig: UPMConfig = {};
9+
export const emptyUpmConfig: UpmConfig = {};
1010

1111
/**
1212
* Attempts to get the {@link NpmAuth} information for a specific registry
13-
* from a {@link UPMConfig} object.
13+
* from a {@link UpmConfig} object.
1414
* @param upmConfig The config.
1515
* @param registry The registry.
1616
* @returns The auth information or null if the registry does not exist
1717
* in the config.
1818
*/
1919
export function tryGetAuthForRegistry(
20-
upmConfig: UPMConfig,
20+
upmConfig: UpmConfig,
2121
registry: RegistryUrl
2222
): NpmAuth | null {
2323
return upmConfig[registry] ?? null;
@@ -31,9 +31,9 @@ export function tryGetAuthForRegistry(
3131
* @returns A new config with the entry added.
3232
*/
3333
export function addAuth(
34-
upmConfig: UPMConfig,
34+
upmConfig: UpmConfig,
3535
registry: RegistryUrl,
3636
auth: NpmAuth
37-
): UPMConfig {
37+
): UpmConfig {
3838
return { ...upmConfig, [registry]: auth };
3939
}

src/io/upm-config-io.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
removeExplicitUndefined,
1212
RemoveExplicitUndefined,
1313
} from "../utils/zod-utils";
14-
import { UPMConfig } from "../domain/upm-config";
14+
import { UpmConfig } from "../domain/upm-config";
1515
import { Base64 } from "../domain/base64";
1616

1717
const configFileName = ".upmconfig.toml";

src/services/load-registry-auth.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { addAuth, emptyUpmConfig, UPMConfig } from "../domain/upm-config";
1+
import { addAuth, emptyUpmConfig, UpmConfig } from "../domain/upm-config";
22
import { LoadUpmConfig, UpmAuth, UpmConfigContent } from "../io/upm-config-io";
33
import { NpmAuth } from "another-npm-registry-client";
44
import { decodeBase64 } from "../domain/base64";
@@ -12,12 +12,14 @@ import { coerceRegistryUrl } from "../domain/registry-url";
1212
* will load it from the upmconfig.toml.
1313
* @param upmConfigPath The path to the upmconfig.toml file.
1414
*/
15-
export type LoadRegistryAuth = (upmConfigPath: string) => Promise<UPMConfig>;
15+
export type LoadRegistryAuth = (upmConfigPath: string) => Promise<UpmConfig>;
1616

1717
/**
1818
* Makes a {@link LoadRegistryAuth} function.
1919
*/
20-
export function makeLoadRegistryAuth(loadUpmConfig: LoadUpmConfig): LoadRegistryAuth {
20+
export function makeLoadRegistryAuth(
21+
loadUpmConfig: LoadUpmConfig
22+
): LoadRegistryAuth {
2123
return async (upmConfigPath) => {
2224
function importNpmAuth(input: UpmAuth): NpmAuth {
2325
// Basic auth
@@ -43,7 +45,7 @@ export function makeLoadRegistryAuth(loadUpmConfig: LoadUpmConfig): LoadRegistry
4345
});
4446
}
4547

46-
function importUpmConfig(input: UpmConfigContent): UPMConfig {
48+
function importUpmConfig(input: UpmConfigContent): UpmConfig {
4749
if (input.npmAuth === undefined) return {};
4850
return recordEntries(input.npmAuth)
4951
.map(

src/services/parse-env.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import chalk from "chalk";
22
import { GetUpmConfigPath } from "../io/upm-config-io";
33
import path from "path";
44
import { coerceRegistryUrl, RegistryUrl } from "../domain/registry-url";
5-
import { tryGetAuthForRegistry, UPMConfig } from "../domain/upm-config";
5+
import { tryGetAuthForRegistry, UpmConfig } from "../domain/upm-config";
66
import { CmdOptions } from "../cli/options";
77
import { tryGetEnv } from "../utils/env-util";
88
import { Registry } from "../domain/registry";
@@ -80,7 +80,7 @@ export function makeParseEnv(
8080

8181
function determinePrimaryRegistry(
8282
options: CmdOptions,
83-
upmConfig: UPMConfig
83+
upmConfig: UpmConfig
8484
): Registry {
8585
const url =
8686
options._global.registry !== undefined

test/domain/upm-config.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { tryGetAuthForRegistry, UPMConfig } from "../../src/domain/upm-config";
1+
import { tryGetAuthForRegistry, UpmConfig } from "../../src/domain/upm-config";
22
import { NpmAuth } from "another-npm-registry-client";
33

44
import { exampleRegistryUrl } from "./data-registry";
@@ -12,7 +12,7 @@ describe("upm-config", () => {
1212

1313
describe("get auth for registry", () => {
1414
it("should find auth that was added", () => {
15-
const config: UPMConfig = {
15+
const config: UpmConfig = {
1616
[exampleRegistryUrl]: someAuth,
1717
};
1818

@@ -22,7 +22,7 @@ describe("upm-config", () => {
2222
});
2323

2424
it("should not find auth for url that does not exist", () => {
25-
const config: UPMConfig = {};
25+
const config: UpmConfig = {};
2626

2727
const actual = tryGetAuthForRegistry(config, exampleRegistryUrl);
2828

test/services/parse-env.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { emptyUpmConfig, UPMConfig } from "../../src/domain/upm-config";
1+
import { emptyUpmConfig, UpmConfig } from "../../src/domain/upm-config";
22
import { NpmAuth } from "another-npm-registry-client";
33
import { makeParseEnv } from "../../src/services/parse-env";
44
import { GetUpmConfigPath } from "../../src/io/upm-config-io";
@@ -17,7 +17,7 @@ const testNpmAuth: NpmAuth = {
1717
alwaysAuth: false,
1818
};
1919

20-
const testUpmConfig: UPMConfig = {
20+
const testUpmConfig: UpmConfig = {
2121
[exampleRegistryUrl]: testNpmAuth,
2222
};
2323

0 commit comments

Comments
 (0)