File tree Expand file tree Collapse file tree 9 files changed +47
-0
lines changed Expand file tree Collapse file tree 9 files changed +47
-0
lines changed Original file line number Diff line number Diff line change
1
+ {
2
+ "packageManager" :
" [email protected] "
3
+ }
Original file line number Diff line number Diff line change 547
547
"title" : " playwright-test plugin configuration (https://knip.dev/reference/plugins/playwright-test)" ,
548
548
"$ref" : " #/definitions/plugin"
549
549
},
550
+ "pnpm" : {
551
+ "title" : " pnpm plugin configuration (https://knip.dev/reference/plugins/pnpm)" ,
552
+ "$ref" : " #/definitions/plugin"
553
+ },
550
554
"postcss" : {
551
555
"title" : " PostCSS plugin configuration (https://knip.dev/reference/plugins/postcss)" ,
552
556
"$ref" : " #/definitions/plugin"
Original file line number Diff line number Diff line change @@ -62,6 +62,7 @@ import { default as playwrightCt } from './playwright-ct/index.js';
62
62
import { default as playwrightTest } from './playwright-test/index.js' ;
63
63
import { default as playwright } from './playwright/index.js' ;
64
64
import { default as plop } from './plop/index.js' ;
65
+ import { default as pnpm } from './pnpm/index.js' ;
65
66
import { default as postcss } from './postcss/index.js' ;
66
67
import { default as preconstruct } from './preconstruct/index.js' ;
67
68
import { default as prettier } from './prettier/index.js' ;
@@ -175,6 +176,7 @@ export const Plugins = {
175
176
'playwright-ct' : playwrightCt ,
176
177
'playwright-test' : playwrightTest ,
177
178
plop,
179
+ pnpm,
178
180
postcss,
179
181
preconstruct,
180
182
prettier,
Original file line number Diff line number Diff line change
1
+ import type { IsPluginEnabled , Plugin } from '../../types/config.js' ;
2
+
3
+ // https://pnpm.io/pnpmfile
4
+
5
+ const title = 'pnpm' ;
6
+
7
+ const isEnabled : IsPluginEnabled = ( { manifest } ) => Boolean ( manifest . packageManager ?. startsWith ( 'pnpm@' ) ) ;
8
+
9
+ const config : string [ ] = [ '.pnpmfile.cjs' ] ;
10
+
11
+ export default {
12
+ title,
13
+ isEnabled,
14
+ config,
15
+ } satisfies Plugin ;
Original file line number Diff line number Diff line change @@ -76,6 +76,7 @@ export const pluginsSchema = z.object({
76
76
'playwright-ct' : pluginSchema ,
77
77
'playwright-test' : pluginSchema ,
78
78
plop : pluginSchema ,
79
+ pnpm : pluginSchema ,
79
80
postcss : pluginSchema ,
80
81
preconstruct : pluginSchema ,
81
82
prettier : pluginSchema ,
Original file line number Diff line number Diff line change @@ -63,6 +63,7 @@ export type PluginName =
63
63
| 'playwright-ct'
64
64
| 'playwright-test'
65
65
| 'plop'
66
+ | 'pnpm'
66
67
| 'postcss'
67
68
| 'preconstruct'
68
69
| 'prettier'
@@ -176,6 +177,7 @@ export const pluginNames = [
176
177
'playwright-ct' ,
177
178
'playwright-test' ,
178
179
'plop' ,
180
+ 'pnpm' ,
179
181
'postcss' ,
180
182
'preconstruct' ,
181
183
'prettier' ,
Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ export type PackageJson = {
46
46
browser ?: string ;
47
47
types ?: string ;
48
48
typings ?: string ;
49
+ packageManager ?: string ;
49
50
} & Plugins ;
50
51
51
52
export type WorkspacePackage = {
Original file line number Diff line number Diff line change
1
+ import { test } from 'bun:test' ;
2
+ import assert from 'node:assert/strict' ;
3
+ import { main } from '../../src/index.js' ;
4
+ import { createOptions } from '../../src/util/create-options.js' ;
5
+ import baseCounters from '../helpers/baseCounters.js' ;
6
+ import { resolve } from '../helpers/resolve.js' ;
7
+
8
+ const cwd = resolve ( 'fixtures/plugins/pnpm' ) ;
9
+
10
+ test ( 'Find dependencies with the pnpm plugin' , async ( ) => {
11
+ const options = await createOptions ( { cwd } ) ;
12
+ const { counters } = await main ( options ) ;
13
+
14
+ assert . deepEqual ( counters , {
15
+ ...baseCounters ,
16
+ processed : 1 ,
17
+ total : 1 ,
18
+ } ) ;
19
+ } ) ;
You can’t perform that action at this time.
0 commit comments