Skip to content

Commit bb92395

Browse files
committed
style: format with prettier
1 parent bee69fd commit bb92395

File tree

5 files changed

+21
-20
lines changed

5 files changed

+21
-20
lines changed

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
pnpm-lock.yaml
22
.yarn
3+
.pnp.loader.mjs

src/_utils.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { detectPackageManager } from "./package-manager";
88
export async function findup<T>(
99
cwd: string,
1010
match: (path: string) => T | Promise<T>,
11-
options: Pick<DetectPackageManagerOptions, "includeParentDirs"> = {},
11+
options: Pick<DetectPackageManagerOptions, "includeParentDirs"> = {}
1212
): Promise<T | undefined> {
1313
const segments = normalize(cwd).split("/");
1414

@@ -27,7 +27,7 @@ export async function findup<T>(
2727
export async function executeCommand(
2828
command: string,
2929
args: string[],
30-
options: Pick<OperationOptions, "cwd" | "silent"> = {},
30+
options: Pick<OperationOptions, "cwd" | "silent"> = {}
3131
): Promise<void> {
3232
const { execa } = await import("execa");
3333
const { resolve } = await import("pathe");
@@ -49,7 +49,7 @@ export const NO_PACKAGE_MANAGER_DETECTED_ERROR_MSG =
4949
"No package manager auto-detected.";
5050

5151
export async function resolveOperationOptions(
52-
options: OperationOptions = {},
52+
options: OperationOptions = {}
5353
): Promise<
5454
NonPartial<
5555
Pick<OperationOptions, "cwd" | "silent" | "packageManager" | "dev">
@@ -76,7 +76,7 @@ export async function resolveOperationOptions(
7676
}
7777

7878
export function getWorkspaceArgs(
79-
options: Awaited<ReturnType<typeof resolveOperationOptions>>,
79+
options: Awaited<ReturnType<typeof resolveOperationOptions>>
8080
): string[] {
8181
if (!options.workspace) {
8282
if (options.packageManager.name === "pnpm") {
@@ -113,7 +113,7 @@ export function doesDependencyExist(
113113
options: Pick<
114114
Awaited<ReturnType<typeof resolveOperationOptions>>,
115115
"cwd" | "workspace"
116-
>,
116+
>
117117
) {
118118
const require = createRequire(withTrailingSlash(options.cwd));
119119

src/api.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import type { OperationOptions } from "./types";
1515
* @param options.packageManager - The package manager info to use (auto-detected).
1616
*/
1717
export async function installDependencies(
18-
options: Pick<OperationOptions, "cwd" | "silent" | "packageManager"> = {},
18+
options: Pick<OperationOptions, "cwd" | "silent" | "packageManager"> = {}
1919
) {
2020
const resolvedOptions = await resolveOperationOptions(options);
2121

@@ -38,7 +38,7 @@ export async function installDependencies(
3838
*/
3939
export async function addDependency(
4040
name: string,
41-
options: OperationOptions = {},
41+
options: OperationOptions = {}
4242
) {
4343
const resolvedOptions = await resolveOperationOptions(options);
4444

@@ -77,7 +77,7 @@ export async function addDependency(
7777
*/
7878
export async function addDevDependency(
7979
name: string,
80-
options: Omit<OperationOptions, "dev"> = {},
80+
options: Omit<OperationOptions, "dev"> = {}
8181
) {
8282
await addDependency(name, { ...options, dev: true });
8383
}
@@ -95,7 +95,7 @@ export async function addDevDependency(
9595
*/
9696
export async function removeDependency(
9797
name: string,
98-
options: OperationOptions = {},
98+
options: OperationOptions = {}
9999
) {
100100
const resolvedOptions = await resolveOperationOptions(options);
101101

@@ -134,7 +134,7 @@ export async function removeDependency(
134134
*/
135135
export async function ensureDependencyInstalled(
136136
name: string,
137-
options: Pick<OperationOptions, "cwd" | "dev" | "workspace"> = {},
137+
options: Pick<OperationOptions, "cwd" | "dev" | "workspace"> = {}
138138
) {
139139
const resolvedOptions = await resolveOperationOptions(options);
140140

src/package-manager.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const _packageManagers: PackageManager[] = [
5252

5353
export async function detectPackageManager(
5454
cwd: string,
55-
options: DetectPackageManagerOptions = {},
55+
options: DetectPackageManagerOptions = {}
5656
): Promise<PackageManager | undefined> {
5757
const detected = await findup(
5858
cwd,
@@ -62,15 +62,15 @@ export async function detectPackageManager(
6262
const packageJSONPath = join(path, "package.json");
6363
if (existsSync(packageJSONPath)) {
6464
const packageJSON = JSON.parse(
65-
await readFile(packageJSONPath, "utf8"),
65+
await readFile(packageJSONPath, "utf8")
6666
);
6767
if (packageJSON?.packageManager) {
6868
const [name, version = "0.0.0"] =
6969
packageJSON.packageManager.split("@");
7070
const majorVersion = version.split(".")[0];
7171
const packageManager =
7272
_packageManagers.find(
73-
(pm) => pm.name === name && pm.majorVersion === majorVersion,
73+
(pm) => pm.name === name && pm.majorVersion === majorVersion
7474
) || _packageManagers.find((pm) => pm.name === name);
7575
return {
7676
...packageManager,
@@ -102,7 +102,7 @@ export async function detectPackageManager(
102102
},
103103
{
104104
includeParentDirs: options.includeParentDirs,
105-
},
105+
}
106106
);
107107

108108
return detected;

test/index.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ describe("api", () => {
137137

138138
if (fixture.name === "empty") {
139139
expect(
140-
async () => await executeInstallDependenciesSpy(),
140+
async () => await executeInstallDependenciesSpy()
141141
).rejects.toThrowError(NO_PACKAGE_MANAGER_DETECTED_ERROR_MSG);
142142
} else {
143143
await executeInstallDependenciesSpy();
@@ -157,7 +157,7 @@ describe("api", () => {
157157

158158
if (fixture.name === "empty") {
159159
expect(
160-
async () => await executeAddDependencySpy(),
160+
async () => await executeAddDependencySpy()
161161
).rejects.toThrowError(NO_PACKAGE_MANAGER_DETECTED_ERROR_MSG);
162162
} else {
163163
await executeAddDependencySpy();
@@ -176,7 +176,7 @@ describe("api", () => {
176176

177177
if (fixture.name === "empty") {
178178
expect(
179-
async () => await executeEnsureDependencyInstalledSpy(),
179+
async () => await executeEnsureDependencyInstalledSpy()
180180
).rejects.toThrowError(NO_PACKAGE_MANAGER_DETECTED_ERROR_MSG);
181181
} else {
182182
await executeEnsureDependencyInstalledSpy();
@@ -196,7 +196,7 @@ describe("api", () => {
196196

197197
if (fixture.name === "empty") {
198198
expect(
199-
async () => await executeRemoveDependencySpy(),
199+
async () => await executeRemoveDependencySpy()
200200
).rejects.toThrowError(NO_PACKAGE_MANAGER_DETECTED_ERROR_MSG);
201201
} else {
202202
await executeRemoveDependencySpy();
@@ -217,7 +217,7 @@ describe("api", () => {
217217

218218
if (fixture.name === "empty") {
219219
expect(
220-
async () => await executeAddDependencySpy(),
220+
async () => await executeAddDependencySpy()
221221
).rejects.toThrowError(NO_PACKAGE_MANAGER_DETECTED_ERROR_MSG);
222222
} else {
223223
await executeAddDependencySpy();
@@ -238,7 +238,7 @@ describe("api", () => {
238238

239239
if (fixture.name === "empty") {
240240
expect(
241-
async () => await executeRemoveDependencySpy(),
241+
async () => await executeRemoveDependencySpy()
242242
).rejects.toThrowError(NO_PACKAGE_MANAGER_DETECTED_ERROR_MSG);
243243
} else {
244244
await executeRemoveDependencySpy();

0 commit comments

Comments
 (0)