@kitschpatrol/shared-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.
Files changed (3) hide show
  1. package/bin/cli.js +50 -32
  2. package/package.json +12 -11
  3. package/readme.md +6 -4
package/bin/cli.js CHANGED
@@ -6569,6 +6569,7 @@ var source_default = chalk;
6569
6569
 
6570
6570
  // ../../src/command-builder.ts
6571
6571
  import { cosmiconfig } from "cosmiconfig";
6572
+ import { TypeScriptLoader as typeScriptLoader } from "cosmiconfig-typescript-loader";
6572
6573
  import { execa } from "execa";
6573
6574
  import fse2 from "fs-extra";
6574
6575
  import fs3 from "node:fs";
@@ -11493,7 +11494,7 @@ var Yargs = YargsFactory(esm_default);
11493
11494
  var yargs_default = Yargs;
11494
11495
 
11495
11496
  // ../../package.json
11496
- var version = "5.0.8";
11497
+ var version = "5.2.0";
11497
11498
 
11498
11499
  // ../../src/execa-utilities.ts
11499
11500
  function isErrorExecaError(error) {
@@ -12161,6 +12162,14 @@ function getCosmiconfigCommand(configName) {
12161
12162
  }
12162
12163
  async function getCosmiconfigResult(configName) {
12163
12164
  const explorer = cosmiconfig(configName, {
12165
+ loaders: {
12166
+ // Using the alternate typescript loader fixes ERR_MODULE_NOT_FOUND errors
12167
+ // in configuration files that import modules via a path
12168
+ // https://github.com/cosmiconfig/cosmiconfig/issues/345
12169
+ // https://github.com/Codex-/cosmiconfig-typescript-loader
12170
+ // Same approach taken in mdat's implementation...
12171
+ ".ts": typeScriptLoader()
12172
+ },
12164
12173
  searchStrategy: "project"
12165
12174
  // Alt approach?
12166
12175
  // searchStrategy: 'global',
@@ -12451,13 +12460,13 @@ var sharedKnipConfig = {
12451
12460
  "src/{index,cli,main}.{js,mjs,cjs,jsx,ts,tsx,mts,cts}!",
12452
12461
  // Customized entries
12453
12462
  "src/{bin,lib,cli}/{index,cli,main}.{js,mjs,cjs,jsx,ts,tsx,mts,cts}!",
12454
- "scripts/**/*.ts",
12455
- ".remarkrc.js",
12456
- "cspell.config.js",
12457
- "eslint.config.ts",
12458
- "mdat.config.ts",
12459
- "prettier.config.js",
12460
- "stylelint.config.js"
12463
+ "scripts/**/*.{js,mjs,cjs,ts,mts,cts}",
12464
+ ".remarkrc.{js,mjs,cjs,ts,mts,cts}",
12465
+ "cspell.config.{js,mjs,cjs,ts,mts,cts}",
12466
+ "eslint.config.{js,mjs,cjs,ts,mts,cts}",
12467
+ "mdat.config.{js,mjs,cjs,ts,mts,cts}",
12468
+ "prettier.config.{js,mjs,cjs,ts,mts,cts}",
12469
+ "stylelint.config.{js,mjs,cjs,ts,mts,cts}"
12461
12470
  ],
12462
12471
  // Allow calling of individual kpi binaries...
12463
12472
  ignoreBinaries: [
@@ -12478,7 +12487,15 @@ var sharedKnipConfig = {
12478
12487
  "@kitschpatrol/mdat-config",
12479
12488
  "@kitschpatrol/prettier-config",
12480
12489
  "@kitschpatrol/remark-config",
12481
- "@kitschpatrol/stylelint-config"
12490
+ "@kitschpatrol/stylelint-config",
12491
+ "@prettier/plugin-php",
12492
+ "@prettier/plugin-ruby",
12493
+ "@prettier/plugin-xml",
12494
+ "prettier-plugin-packagejson",
12495
+ "prettier-plugin-sh",
12496
+ "prettier-plugin-sql",
12497
+ "prettier-plugin-tailwindcss",
12498
+ "prettier-plugin-toml"
12482
12499
  ]
12483
12500
  };
12484
12501
  var src_default = sharedKnipConfig;
@@ -12504,22 +12521,26 @@ function getKnipPackageJsonObject() {
12504
12521
  }
12505
12522
  var commandDefinition3 = {
12506
12523
  commands: {
12507
- fix: {
12508
- commands: [
12509
- {
12510
- cwdOverride: "workspace-root",
12511
- name: "knip",
12512
- optionFlags: [
12513
- "--fix",
12514
- "--allow-remove-files",
12515
- "--no-config-hints",
12516
- ...getWorkspaceOptionFlags()
12517
- ]
12518
- }
12519
- ],
12520
- description: `Automatically remove unused code and dependencies. ${DESCRIPTION.packageRun} ${DESCRIPTION.monorepoRun}`,
12521
- positionalArgumentMode: "none"
12522
- },
12524
+ // In practice, Knip's auto-fix behavior is too dangerous for most projects.
12525
+ // Since kpi doesn't currently have per-tool configuration options, we'll
12526
+ // just disable `kpi-knip fix` for now.
12527
+ //
12528
+ // fix: {
12529
+ // commands: [
12530
+ // {
12531
+ // cwdOverride: 'workspace-root',
12532
+ // name: 'knip',
12533
+ // optionFlags: [
12534
+ // '--fix',
12535
+ // '--allow-remove-files',
12536
+ // '--no-config-hints',
12537
+ // ...getWorkspaceOptionFlags(),
12538
+ // ],
12539
+ // },
12540
+ // ],
12541
+ // description: `Automatically remove unused code and dependencies. ${DESCRIPTION.packageRun} ${DESCRIPTION.monorepoRun}`,
12542
+ // positionalArgumentMode: 'none',
12543
+ // },
12523
12544
  init: {
12524
12545
  configFile: "knip.config.ts",
12525
12546
  configPackageJson: getKnipPackageJsonObject(),
@@ -13274,15 +13295,12 @@ function updateLicenseContent(content, currentYear) {
13274
13295
  async function copyrightYear(logStream, fix = false) {
13275
13296
  const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
13276
13297
  const licenseFiles = [];
13277
- const patterns = [
13278
- "**/license.txt",
13279
- "**/LICENSE.txt",
13280
- "**/License.txt",
13281
- "**/LICENSE",
13282
- "!node_modules/**"
13283
- ];
13298
+ const patterns = ["**/license.txt", "**/license", "!node_modules/**"];
13284
13299
  const files = await globby(patterns, {
13300
+ caseSensitiveMatch: false,
13285
13301
  cwd: getPackageDirectory(),
13302
+ followSymbolicLinks: false,
13303
+ // Avoid infinite loops
13286
13304
  gitignore: true
13287
13305
  });
13288
13306
  for (const filePath of files) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitschpatrol/shared-config",
3
- "version": "5.0.8",
3
+ "version": "5.2.0",
4
4
  "description": "A collection of shared configurations, linters, and formatting tools for TypeScript projects. All managed as a single dependency, and invoked via a single CLI command.",
5
5
  "keywords": [
6
6
  "shared-config",
@@ -38,19 +38,20 @@
38
38
  "dependencies": {
39
39
  "@pinojs/json-colorizer": "^4.0.0",
40
40
  "cosmiconfig": "^9.0.0",
41
+ "cosmiconfig-typescript-loader": "^6.1.0",
41
42
  "execa": "^9.5.2",
42
43
  "find-workspaces": "^0.3.1",
43
44
  "fs-extra": "^11.3.0",
44
- "prettier": "^3.5.2",
45
- "@kitschpatrol/cspell-config": "5.0.8",
46
- "@kitschpatrol/knip-config": "5.0.8",
47
- "@kitschpatrol/prettier-config": "5.0.8",
48
- "@kitschpatrol/remark-config": "5.0.8",
49
- "@kitschpatrol/eslint-config": "5.0.8",
50
- "@kitschpatrol/stylelint-config": "5.0.8",
51
- "@kitschpatrol/mdat-config": "5.0.8",
52
- "@kitschpatrol/repo-config": "5.0.8",
53
- "@kitschpatrol/typescript-config": "5.0.8"
45
+ "prettier": "^3.5.3",
46
+ "@kitschpatrol/cspell-config": "5.2.0",
47
+ "@kitschpatrol/eslint-config": "5.2.0",
48
+ "@kitschpatrol/knip-config": "5.2.0",
49
+ "@kitschpatrol/prettier-config": "5.2.0",
50
+ "@kitschpatrol/mdat-config": "5.2.0",
51
+ "@kitschpatrol/remark-config": "5.2.0",
52
+ "@kitschpatrol/typescript-config": "5.2.0",
53
+ "@kitschpatrol/repo-config": "5.2.0",
54
+ "@kitschpatrol/stylelint-config": "5.2.0"
54
55
  },
55
56
  "devDependencies": {
56
57
  "chalk": "^5.4.1",
package/readme.md CHANGED
@@ -63,7 +63,7 @@ It takes care of dependencies, configuration, invocation, and reporting for the
63
63
 
64
64
  ### Packages
65
65
 
66
- This particular readme is for the [`@kitschpatrol/shared-config`](https://www.npmjs.com/package/@kitschpatrol/shared-config) package, which depends on a number of tool-specific packages included in the [`kitschpatrol/shared-config`](https://github.com/kitschpatrol/shared-config) monorepo on GitHub, each of which is documented in additional detail its respective readme.
66
+ This particular readme is for the [`@kitschpatrol/shared-config`](https://www.npmjs.com/package/@kitschpatrol/shared-config) package, which depends on a number of tool-specific packages included in the [`kitschpatrol/shared-config`](https://github.com/kitschpatrol/shared-config) monorepo on GitHub, each of which is documented in additional detail in its respective readme.
67
67
 
68
68
  #### Primary package
69
69
 
@@ -126,17 +126,19 @@ The top-level `kpi` command also takes care of some nuances in terms of _which_
126
126
  Bootstrap a new project and open in VS Code:
127
127
 
128
128
  ```sh
129
- git init && pnpm init && pnpm pkg set type="module" && pnpm dlx @kitschpatrol/repo-config init && pnpm add -D @kitschpatrol/shared-config && pnpm kpi init --location package && pnpm i && code .
129
+ git init && pnpm init && pnpm pkg set type="module" && pnpm dlx @kitschpatrol/repo-config init && pnpm add -D @kitschpatrol/shared-config && pnpm kpi init && pnpm i && code .
130
130
  ```
131
131
 
132
- The `--location package` flag will put as much configuration in your `package.json` as possible instead of in discrete files in your project root. This saves some clutter but can make it clunkier to extend or customize configurations. At any point, you can call `kpi init` with or without a `--location package` or `--location file` flag to reinitialize your configuration files in one place or the other.
132
+ Note that `kpi init` takes an optional `--location package` flag will put as much configuration in your `package.json` as possible instead of creating discrete config files in your project root for each tool. Putting config in `package.json` can save some clutter, but can make it clunkier to extend or customize configurations.
133
+
134
+ At any point, you can call `kpi init` again with the `--location package` or `--location file` flag to reinitialize your configuration files in one place or the other and restore the default configurations.
133
135
 
134
136
  #### Quick add to an existing project:
135
137
 
136
138
  This might overwrite certain config files, so commit first:
137
139
 
138
140
  ```sh
139
- pnpm dlx @kitschpatrol/repo-config init && pnpm i && pnpm add -D @kitschpatrol/shared-config && pnpm kpi init --location package
141
+ pnpm dlx @kitschpatrol/repo-config init && pnpm i && pnpm add -D @kitschpatrol/shared-config && pnpm kpi init
140
142
  ```
141
143
 
142
144
  #### Step-by-step: