Skip to content

Commit 16dee1e

Browse files
committed
fix: test coverage reports
1 parent 52bde64 commit 16dee1e

File tree

8 files changed

+37
-26
lines changed

8 files changed

+37
-26
lines changed

dist/npm-to-yarn.mjs.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/npm-to-yarn.umd.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/types/lib.d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/**
2+
* Returns the current package manager
3+
*/
4+
export declare function getManager(command: string): 'npm' | 'yarn' | 'pnpm' | 'bun';
5+
/**
6+
* Checks whether the command is other than npm command
7+
*/
8+
export declare function isOtherManagerCommand(command: string): boolean;

dist/types/utils.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,13 @@ export declare const yarnCLICommands: string[];
33
export declare const npmCLICommands: string[];
44
/**
55
* Returns the current package manager
6+
* @param command The command to get the package manager from
7+
* @returns The package manager
68
*/
79
export declare function getManager(command: string): 'npm' | 'yarn' | 'pnpm' | 'bun';
810
/**
911
* Checks whether the command is other than npm command
12+
* @param command The command to check
13+
* @returns Whether the command is other than npm command
1014
*/
1115
export declare function isOtherManagerCommand(command: string): boolean;

jest.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module.exports = {
99
testEnvironment: 'node',
1010
testRegex: '(/test/.*|\\.(test|spec))\\.(ts|js)$',
1111
moduleFileExtensions: ['ts', 'js'],
12-
coveragePathIgnorePatterns: ['/node_modules/', '/test/'],
12+
coveragePathIgnorePatterns: ['/node_modules/', '/test/', 'src/lib.ts'],
1313
coverageThreshold: {
1414
global: {
1515
branches: 80,

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { npmToYarn } from './npmToYarn'
33
import { npmToPnpm } from './npmToPnpm'
44
import { npmToBun } from './npmToBun'
55

6-
import { getManager, isOtherManagerCommand } from './utils'
6+
import { getManager, isOtherManagerCommand } from './lib'
77

88
/**
99
* Converts between npm and yarn command

src/lib.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/**
2+
* Returns the current package manager
3+
*/
4+
export function getManager(command: string): 'npm' | 'yarn' | 'pnpm' | 'bun' {
5+
if (command.startsWith('yarn')) {
6+
return 'yarn'
7+
} else if (command.startsWith('pnpm')) {
8+
return 'pnpm'
9+
} else if (command.startsWith('bun')) {
10+
return 'bun'
11+
}
12+
return 'npm'
13+
}
14+
15+
/**
16+
* Checks whether the command is other than npm command
17+
*/
18+
export function isOtherManagerCommand(command: string): boolean {
19+
const currentManager = getManager(command)
20+
return currentManager !== 'npm'
21+
}

src/utils.ts

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -108,25 +108,3 @@ export const npmCLICommands = [
108108
'view',
109109
'whoami'
110110
]
111-
112-
/**
113-
* Returns the current package manager
114-
*/
115-
export function getManager(command: string): 'npm' | 'yarn' | 'pnpm' | 'bun' {
116-
if (command.startsWith('yarn')) {
117-
return 'yarn'
118-
} else if (command.startsWith('pnpm')) {
119-
return 'pnpm'
120-
} else if (command.startsWith('bun')) {
121-
return 'bun'
122-
}
123-
return 'npm'
124-
}
125-
126-
/**
127-
* Checks whether the command is other than npm command
128-
*/
129-
export function isOtherManagerCommand(command: string): boolean {
130-
const currentManager = getManager(command)
131-
return currentManager !== 'npm'
132-
}

0 commit comments

Comments
 (0)