@kitschpatrol/knip-config 5.0.8 → 5.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.js +46 -25
- package/dist/index.js +15 -7
- package/package.json +3 -2
- package/readme.md +5 -21
package/bin/cli.js
CHANGED
|
@@ -627,6 +627,7 @@ var source_default = chalk;
|
|
|
627
627
|
|
|
628
628
|
// ../../src/command-builder.ts
|
|
629
629
|
import { cosmiconfig } from "cosmiconfig";
|
|
630
|
+
import { TypeScriptLoader as typeScriptLoader } from "cosmiconfig-typescript-loader";
|
|
630
631
|
import { execa } from "execa";
|
|
631
632
|
import fse2 from "fs-extra";
|
|
632
633
|
import fs3 from "node:fs";
|
|
@@ -5551,7 +5552,7 @@ var Yargs = YargsFactory(esm_default);
|
|
|
5551
5552
|
var yargs_default = Yargs;
|
|
5552
5553
|
|
|
5553
5554
|
// ../../package.json
|
|
5554
|
-
var version = "5.0
|
|
5555
|
+
var version = "5.2.0";
|
|
5555
5556
|
|
|
5556
5557
|
// ../../src/execa-utilities.ts
|
|
5557
5558
|
function isErrorExecaError(error) {
|
|
@@ -6183,6 +6184,14 @@ function getCosmiconfigCommand(configName) {
|
|
|
6183
6184
|
}
|
|
6184
6185
|
async function getCosmiconfigResult(configName) {
|
|
6185
6186
|
const explorer = cosmiconfig(configName, {
|
|
6187
|
+
loaders: {
|
|
6188
|
+
// Using the alternate typescript loader fixes ERR_MODULE_NOT_FOUND errors
|
|
6189
|
+
// in configuration files that import modules via a path
|
|
6190
|
+
// https://github.com/cosmiconfig/cosmiconfig/issues/345
|
|
6191
|
+
// https://github.com/Codex-/cosmiconfig-typescript-loader
|
|
6192
|
+
// Same approach taken in mdat's implementation...
|
|
6193
|
+
".ts": typeScriptLoader()
|
|
6194
|
+
},
|
|
6186
6195
|
searchStrategy: "project"
|
|
6187
6196
|
// Alt approach?
|
|
6188
6197
|
// searchStrategy: 'global',
|
|
@@ -6222,13 +6231,13 @@ var sharedKnipConfig = {
|
|
|
6222
6231
|
"src/{index,cli,main}.{js,mjs,cjs,jsx,ts,tsx,mts,cts}!",
|
|
6223
6232
|
// Customized entries
|
|
6224
6233
|
"src/{bin,lib,cli}/{index,cli,main}.{js,mjs,cjs,jsx,ts,tsx,mts,cts}!",
|
|
6225
|
-
"scripts/**/*.ts",
|
|
6226
|
-
".remarkrc.js",
|
|
6227
|
-
"cspell.config.js",
|
|
6228
|
-
"eslint.config.ts",
|
|
6229
|
-
"mdat.config.ts",
|
|
6230
|
-
"prettier.config.js",
|
|
6231
|
-
"stylelint.config.js"
|
|
6234
|
+
"scripts/**/*.{js,mjs,cjs,ts,mts,cts}",
|
|
6235
|
+
".remarkrc.{js,mjs,cjs,ts,mts,cts}",
|
|
6236
|
+
"cspell.config.{js,mjs,cjs,ts,mts,cts}",
|
|
6237
|
+
"eslint.config.{js,mjs,cjs,ts,mts,cts}",
|
|
6238
|
+
"mdat.config.{js,mjs,cjs,ts,mts,cts}",
|
|
6239
|
+
"prettier.config.{js,mjs,cjs,ts,mts,cts}",
|
|
6240
|
+
"stylelint.config.{js,mjs,cjs,ts,mts,cts}"
|
|
6232
6241
|
],
|
|
6233
6242
|
// Allow calling of individual kpi binaries...
|
|
6234
6243
|
ignoreBinaries: [
|
|
@@ -6249,7 +6258,15 @@ var sharedKnipConfig = {
|
|
|
6249
6258
|
"@kitschpatrol/mdat-config",
|
|
6250
6259
|
"@kitschpatrol/prettier-config",
|
|
6251
6260
|
"@kitschpatrol/remark-config",
|
|
6252
|
-
"@kitschpatrol/stylelint-config"
|
|
6261
|
+
"@kitschpatrol/stylelint-config",
|
|
6262
|
+
"@prettier/plugin-php",
|
|
6263
|
+
"@prettier/plugin-ruby",
|
|
6264
|
+
"@prettier/plugin-xml",
|
|
6265
|
+
"prettier-plugin-packagejson",
|
|
6266
|
+
"prettier-plugin-sh",
|
|
6267
|
+
"prettier-plugin-sql",
|
|
6268
|
+
"prettier-plugin-tailwindcss",
|
|
6269
|
+
"prettier-plugin-toml"
|
|
6253
6270
|
]
|
|
6254
6271
|
};
|
|
6255
6272
|
var index_default = sharedKnipConfig;
|
|
@@ -6275,22 +6292,26 @@ function getKnipPackageJsonObject() {
|
|
|
6275
6292
|
}
|
|
6276
6293
|
var commandDefinition = {
|
|
6277
6294
|
commands: {
|
|
6278
|
-
fix
|
|
6279
|
-
|
|
6280
|
-
|
|
6281
|
-
|
|
6282
|
-
|
|
6283
|
-
|
|
6284
|
-
|
|
6285
|
-
|
|
6286
|
-
|
|
6287
|
-
|
|
6288
|
-
|
|
6289
|
-
|
|
6290
|
-
|
|
6291
|
-
|
|
6292
|
-
|
|
6293
|
-
},
|
|
6295
|
+
// In practice, Knip's auto-fix behavior is too dangerous for most projects.
|
|
6296
|
+
// Since kpi doesn't currently have per-tool configuration options, we'll
|
|
6297
|
+
// just disable `kpi-knip fix` for now.
|
|
6298
|
+
//
|
|
6299
|
+
// fix: {
|
|
6300
|
+
// commands: [
|
|
6301
|
+
// {
|
|
6302
|
+
// cwdOverride: 'workspace-root',
|
|
6303
|
+
// name: 'knip',
|
|
6304
|
+
// optionFlags: [
|
|
6305
|
+
// '--fix',
|
|
6306
|
+
// '--allow-remove-files',
|
|
6307
|
+
// '--no-config-hints',
|
|
6308
|
+
// ...getWorkspaceOptionFlags(),
|
|
6309
|
+
// ],
|
|
6310
|
+
// },
|
|
6311
|
+
// ],
|
|
6312
|
+
// description: `Automatically remove unused code and dependencies. ${DESCRIPTION.packageRun} ${DESCRIPTION.monorepoRun}`,
|
|
6313
|
+
// positionalArgumentMode: 'none',
|
|
6314
|
+
// },
|
|
6294
6315
|
init: {
|
|
6295
6316
|
configFile: "knip.config.ts",
|
|
6296
6317
|
configPackageJson: getKnipPackageJsonObject(),
|
package/dist/index.js
CHANGED
|
@@ -10,13 +10,13 @@ const sharedKnipConfig = {
|
|
|
10
10
|
'src/{index,cli,main}.{js,mjs,cjs,jsx,ts,tsx,mts,cts}!',
|
|
11
11
|
// Customized entries
|
|
12
12
|
'src/{bin,lib,cli}/{index,cli,main}.{js,mjs,cjs,jsx,ts,tsx,mts,cts}!',
|
|
13
|
-
'scripts/**/*.ts',
|
|
14
|
-
'.remarkrc.js',
|
|
15
|
-
'cspell.config.js',
|
|
16
|
-
'eslint.config.ts',
|
|
17
|
-
'mdat.config.ts',
|
|
18
|
-
'prettier.config.js',
|
|
19
|
-
'stylelint.config.js',
|
|
13
|
+
'scripts/**/*.{js,mjs,cjs,ts,mts,cts}',
|
|
14
|
+
'.remarkrc.{js,mjs,cjs,ts,mts,cts}',
|
|
15
|
+
'cspell.config.{js,mjs,cjs,ts,mts,cts}',
|
|
16
|
+
'eslint.config.{js,mjs,cjs,ts,mts,cts}',
|
|
17
|
+
'mdat.config.{js,mjs,cjs,ts,mts,cts}',
|
|
18
|
+
'prettier.config.{js,mjs,cjs,ts,mts,cts}',
|
|
19
|
+
'stylelint.config.{js,mjs,cjs,ts,mts,cts}',
|
|
20
20
|
],
|
|
21
21
|
// Allow calling of individual kpi binaries...
|
|
22
22
|
ignoreBinaries: [
|
|
@@ -38,6 +38,14 @@ const sharedKnipConfig = {
|
|
|
38
38
|
'@kitschpatrol/prettier-config',
|
|
39
39
|
'@kitschpatrol/remark-config',
|
|
40
40
|
'@kitschpatrol/stylelint-config',
|
|
41
|
+
'@prettier/plugin-php',
|
|
42
|
+
'@prettier/plugin-ruby',
|
|
43
|
+
'@prettier/plugin-xml',
|
|
44
|
+
'prettier-plugin-packagejson',
|
|
45
|
+
'prettier-plugin-sh',
|
|
46
|
+
'prettier-plugin-sql',
|
|
47
|
+
'prettier-plugin-tailwindcss',
|
|
48
|
+
'prettier-plugin-toml',
|
|
41
49
|
],
|
|
42
50
|
};
|
|
43
51
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kitschpatrol/knip-config",
|
|
3
|
-
"version": "5.0
|
|
3
|
+
"version": "5.2.0",
|
|
4
4
|
"description": "Knip configuration for @kitschpatrol/shared-config.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"shared-config",
|
|
@@ -43,12 +43,13 @@
|
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@pinojs/json-colorizer": "^4.0.0",
|
|
45
45
|
"cosmiconfig": "^9.0.0",
|
|
46
|
+
"cosmiconfig-typescript-loader": "^6.1.0",
|
|
46
47
|
"deepmerge-ts": "^7.1.5",
|
|
47
48
|
"execa": "^9.5.2",
|
|
48
49
|
"find-workspaces": "^0.3.1",
|
|
49
50
|
"fs-extra": "^11.3.0",
|
|
50
51
|
"knip": "^5.45.0",
|
|
51
|
-
"prettier": "^3.5.
|
|
52
|
+
"prettier": "^3.5.3"
|
|
52
53
|
},
|
|
53
54
|
"engines": {
|
|
54
55
|
"node": ">=20.9.0"
|
package/readme.md
CHANGED
|
@@ -103,12 +103,11 @@ Usage:
|
|
|
103
103
|
kpi-knip <command>
|
|
104
104
|
```
|
|
105
105
|
|
|
106
|
-
| Command | Description
|
|
107
|
-
| -------------- |
|
|
108
|
-
| `init` | Initialize by copying starter config files to your project root or to your package.json file.
|
|
109
|
-
| `lint` | Check for unused code and dependencies. Package-scoped. In a monorepo, it will also run in all packages below the current working directory.
|
|
110
|
-
| `
|
|
111
|
-
| `print-config` | Print the effective Knip configuration. Package-scoped. Searches up to the root of a monorepo if necessary. |
|
|
106
|
+
| Command | Description |
|
|
107
|
+
| -------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
108
|
+
| `init` | Initialize by copying starter config files to your project root or to your package.json file. |
|
|
109
|
+
| `lint` | Check for unused code and dependencies. Package-scoped. In a monorepo, it will also run in all packages below the current working directory. |
|
|
110
|
+
| `print-config` | Print the effective Knip configuration. Package-scoped. Searches up to the root of a monorepo if necessary. |
|
|
112
111
|
|
|
113
112
|
| Option | Description | Type |
|
|
114
113
|
| ------------------- | ------------------- | --------- |
|
|
@@ -148,21 +147,6 @@ kpi-knip lint
|
|
|
148
147
|
| `--help`<br>`-h` | Show help | `boolean` |
|
|
149
148
|
| `--version`<br>`-v` | Show version number | `boolean` |
|
|
150
149
|
|
|
151
|
-
#### Subcommand: `kpi-knip fix`
|
|
152
|
-
|
|
153
|
-
Automatically remove unused code and dependencies. Package-scoped. In a monorepo, it will also run in all packages below the current working directory.
|
|
154
|
-
|
|
155
|
-
Usage:
|
|
156
|
-
|
|
157
|
-
```txt
|
|
158
|
-
kpi-knip fix
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
| Option | Description | Type |
|
|
162
|
-
| ------------------- | ------------------- | --------- |
|
|
163
|
-
| `--help`<br>`-h` | Show help | `boolean` |
|
|
164
|
-
| `--version`<br>`-v` | Show version number | `boolean` |
|
|
165
|
-
|
|
166
150
|
#### Subcommand: `kpi-knip print-config`
|
|
167
151
|
|
|
168
152
|
Print the effective Knip configuration. Package-scoped. Searches up to the root of a monorepo if necessary.
|