pnpm-config.json 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  1. /**
  2. * This configuration file provides settings specific to the PNPM package manager.
  3. * More documentation is available on the Rush website: https://rushjs.io
  4. */
  5. {
  6. "$schema": "https://developer.microsoft.com/json-schemas/rush/v5/pnpm-config.schema.json",
  7. /**
  8. * If true, then `rush install` and `rush update` will use the PNPM workspaces feature
  9. * to perform the install, instead of the old model where Rush generated the symlinks
  10. * for each projects's node_modules folder.
  11. *
  12. * When using workspaces, Rush will generate a `common/temp/pnpm-workspace.yaml` file referencing
  13. * all local projects to install. Rush will also generate a `.pnpmfile.cjs` shim which implements
  14. * Rush-specific features such as preferred versions. The user's `common/config/rush/.pnpmfile.cjs`
  15. * is invoked by the shim.
  16. *
  17. * This option is strongly recommended. The default value is false.
  18. */
  19. "useWorkspaces": true,
  20. /**
  21. * This setting determines how PNPM chooses version numbers during `rush update`.
  22. * For example, suppose `lib-x@3.0.0` depends on `"lib-y": "^1.2.3"` whose latest major
  23. * releases are `1.8.9` and `2.3.4`. The resolution mode `lowest-direct` might choose
  24. * `lib-y@1.2.3`, wheres `highest` will choose 1.8.9, and `time-based` will pick the
  25. * highest compatible version at the time when `lib-x@3.0.0` itself was published (ensuring
  26. * that the version could have been tested by the maintainer of "lib-x"). For local workspace
  27. * projects, `time-based` instead works like `lowest-direct`, avoiding upgrades unless
  28. * they are explicitly requested. Although `time-based` is the most robust option, it may be
  29. * slightly slower with registries such as npmjs.com that have not implemented an optimization.
  30. *
  31. * IMPORTANT: Be aware that PNPM 8.0.0 initially defaulted to `lowest-direct` instead of
  32. * `highest`, but PNPM reverted this decision in 8.6.12 because it caused confusion for users.
  33. * Rush version 5.106.0 and newer avoids this confusion by consistently defaulting to
  34. * `highest` when `resolutionMode` is not explicitly set in pnpm-config.json or .npmrc,
  35. * regardless of your PNPM version.
  36. *
  37. * PNPM documentation: https://pnpm.io/npmrc#resolution-mode
  38. *
  39. * Possible values are: `highest`, `time-based`, and `lowest-direct`.
  40. * The default is `highest`.
  41. */
  42. // "resolutionMode": "time-based",
  43. /**
  44. * This setting determines whether PNPM will automatically install (non-optional)
  45. * missing peer dependencies instead of reporting an error. Doing so conveniently
  46. * avoids the need to specify peer versions in package.json, but in a large monorepo
  47. * this often creates worse problems. The reason is that peer dependency behavior
  48. * is inherently complicated, and it is easier to troubleshoot consequences of an explicit
  49. * version than an invisible heuristic. The original NPM RFC discussion pointed out
  50. * some other problems with this feature: https://github.com/npm/rfcs/pull/43
  51. * IMPORTANT: Without Rush, the setting defaults to true for PNPM 8 and newer; however,
  52. * as of Rush version 5.109.0 the default is always false unless `autoInstallPeers`
  53. * is specified in pnpm-config.json or .npmrc, regardless of your PNPM version.
  54. * PNPM documentation: https://pnpm.io/npmrc#auto-install-peers
  55. * The default value is false.
  56. */
  57. "autoInstallPeers": true,
  58. /**
  59. * If true, then Rush will add the `--strict-peer-dependencies` command-line parameter when
  60. * invoking PNPM. This causes `rush update` to fail if there are unsatisfied peer dependencies,
  61. * which is an invalid state that can cause build failures or incompatible dependency versions.
  62. * (For historical reasons, JavaScript package managers generally do not treat this invalid
  63. * state as an error.)
  64. *
  65. * PNPM documentation: https://pnpm.io/npmrc#strict-peer-dependencies
  66. *
  67. * The default value is false to avoid legacy compatibility issues.
  68. * It is strongly recommended to set `strictPeerDependencies=true`.
  69. */
  70. // "strictPeerDependencies": true,
  71. /**
  72. * Environment variables that will be provided to PNPM.
  73. */
  74. // "environmentVariables": {
  75. // "NODE_OPTIONS": {
  76. // "value": "--max-old-space-size=4096",
  77. // "override": false
  78. // }
  79. // },
  80. /**
  81. * Specifies the location of the PNPM store. There are two possible values:
  82. *
  83. * - `local` - use the `pnpm-store` folder in the current configured temp folder:
  84. * `common/temp/pnpm-store` by default.
  85. * - `global` - use PNPM's global store, which has the benefit of being shared
  86. * across multiple repo folders, but the disadvantage of less isolation for builds
  87. * (for example, bugs or incompatibilities when two repos use different releases of PNPM)
  88. *
  89. * In both cases, the store path can be overridden by the environment variable `RUSH_PNPM_STORE_PATH`.
  90. *
  91. * The default value is `local`.
  92. */
  93. // "pnpmStore": "global",
  94. /**
  95. * If true, then `rush install` will report an error if manual modifications
  96. * were made to the PNPM shrinkwrap file without running `rush update` afterwards.
  97. *
  98. * This feature protects against accidental inconsistencies that may be introduced
  99. * if the PNPM shrinkwrap file (`pnpm-lock.yaml`) is manually edited. When this
  100. * feature is enabled, `rush update` will append a hash to the file as a YAML comment,
  101. * and then `rush update` and `rush install` will validate the hash. Note that this
  102. * does not prohibit manual modifications, but merely requires `rush update` be run
  103. * afterwards, ensuring that PNPM can report or repair any potential inconsistencies.
  104. *
  105. * To temporarily disable this validation when invoking `rush install`, use the
  106. * `--bypass-policy` command-line parameter.
  107. *
  108. * The default value is false.
  109. */
  110. // "preventManualShrinkwrapChanges": true,
  111. /**
  112. * When a project uses `workspace:` to depend on another Rush project, PNPM normally installs
  113. * it by creating a symlink under `node_modules`. This generally works well, but in certain
  114. * cases such as differing `peerDependencies` versions, symlinking may cause trouble
  115. * such as incorrectly satisfied versions. For such cases, the dependency can be declared
  116. * as "injected", causing PNPM to copy its built output into `node_modules` like a real
  117. * install from a registry. Details here: https://rushjs.io/pages/advanced/injected_deps/
  118. *
  119. * When using Rush subspaces, these sorts of versioning problems are much more likely if
  120. * `workspace:` refers to a project from a different subspace. This is because the symlink
  121. * would point to a separate `node_modules` tree installed by a different PNPM lockfile.
  122. * A comprehensive solution is to enable `alwaysInjectDependenciesFromOtherSubspaces`,
  123. * which automatically treats all projects from other subspaces as injected dependencies
  124. * without having to manually configure them.
  125. *
  126. * NOTE: Use carefully -- excessive file copying can slow down the `rush install` and
  127. * `pnpm-sync` operations if too many dependencies become injected.
  128. *
  129. * The default value is false.
  130. */
  131. // "alwaysInjectDependenciesFromOtherSubspaces": false,
  132. /**
  133. * Defines the policies to be checked for the `pnpm-lock.yaml` file.
  134. */
  135. "pnpmLockfilePolicies": {
  136. /**
  137. * This policy will cause "rush update" to report an error if `pnpm-lock.yaml` contains
  138. * any SHA1 integrity hashes.
  139. *
  140. * For each NPM dependency, `pnpm-lock.yaml` normally stores an `integrity` hash. Although
  141. * its main purpose is to detect corrupted or truncated network requests, this hash can also
  142. * serve as a security fingerprint to protect against attacks that would substitute a
  143. * malicious tarball, for example if a misconfigured .npmrc caused a machine to accidentally
  144. * download a matching package name+version from npmjs.com instead of the private NPM registry.
  145. * NPM originally used a SHA1 hash; this was insecure because an attacker can too easily craft
  146. * a tarball with a matching fingerprint. For this reason, NPM later deprecated SHA1 and
  147. * instead adopted a cryptographically strong SHA512 hash. Nonetheless, SHA1 hashes can
  148. * occasionally reappear during "rush update", for example due to missing metadata fallbacks
  149. * (https://github.com/orgs/pnpm/discussions/6194) or an incompletely migrated private registry.
  150. * The `disallowInsecureSha1` policy prevents this, avoiding potential security/compliance alerts.
  151. */
  152. // "disallowInsecureSha1": {
  153. // /**
  154. // * Enables the "disallowInsecureSha1" policy. The default value is false.
  155. // */
  156. // "enabled": true,
  157. //
  158. // /**
  159. // * In rare cases, a private NPM registry may continue to serve SHA1 hashes for very old
  160. // * package versions, perhaps due to a caching issue or database migration glitch. To avoid
  161. // * having to disable the "disallowInsecureSha1" policy for the entire monorepo, the problematic
  162. // * package versions can be individually ignored. The "exemptPackageVersions" key is the
  163. // * package name, and the array value lists exact version numbers to be ignored.
  164. // */
  165. // "exemptPackageVersions": {
  166. // "example1": ["1.0.0"],
  167. // "example2": ["2.0.0", "2.0.1"]
  168. // }
  169. // }
  170. },
  171. /**
  172. * The "globalOverrides" setting provides a simple mechanism for overriding version selections
  173. * for all dependencies of all projects in the monorepo workspace. The settings are copied
  174. * into the `pnpm.overrides` field of the `common/temp/package.json` file that is generated
  175. * by Rush during installation.
  176. *
  177. * Order of precedence: `.pnpmfile.cjs` has the highest precedence, followed by
  178. * `unsupportedPackageJsonSettings`, `globalPeerDependencyRules`, `globalPackageExtensions`,
  179. * and `globalOverrides` has lowest precedence.
  180. *
  181. * PNPM documentation: https://pnpm.io/package_json#pnpmoverrides
  182. */
  183. "globalOverrides": {
  184. // "example1": "^1.0.0",
  185. // "example2": "npm:@company/example2@^1.0.0"
  186. },
  187. /**
  188. * The `globalPeerDependencyRules` setting provides various settings for suppressing validation errors
  189. * that are reported during installation with `strictPeerDependencies=true`. The settings are copied
  190. * into the `pnpm.peerDependencyRules` field of the `common/temp/package.json` file that is generated
  191. * by Rush during installation.
  192. *
  193. * Order of precedence: `.pnpmfile.cjs` has the highest precedence, followed by
  194. * `unsupportedPackageJsonSettings`, `globalPeerDependencyRules`, `globalPackageExtensions`,
  195. * and `globalOverrides` has lowest precedence.
  196. *
  197. * https://pnpm.io/package_json#pnpmpeerdependencyrules
  198. */
  199. "globalPeerDependencyRules": {
  200. // "ignoreMissing": ["@eslint/*"],
  201. // "allowedVersions": { "react": "17" },
  202. // "allowAny": ["@babel/*"]
  203. },
  204. /**
  205. * The `globalPackageExtension` setting provides a way to patch arbitrary package.json fields
  206. * for any PNPM dependency of the monorepo. The settings are copied into the `pnpm.packageExtensions`
  207. * field of the `common/temp/package.json` file that is generated by Rush during installation.
  208. * The `globalPackageExtension` setting has similar capabilities as `.pnpmfile.cjs` but without
  209. * the downsides of an executable script (nondeterminism, unreliable caching, performance concerns).
  210. *
  211. * Order of precedence: `.pnpmfile.cjs` has the highest precedence, followed by
  212. * `unsupportedPackageJsonSettings`, `globalPeerDependencyRules`, `globalPackageExtensions`,
  213. * and `globalOverrides` has lowest precedence.
  214. *
  215. * PNPM documentation: https://pnpm.io/package_json#pnpmpackageextensions
  216. */
  217. "globalPackageExtensions": {
  218. // "fork-ts-checker-webpack-plugin": {
  219. // "dependencies": {
  220. // "@babel/core": "1"
  221. // },
  222. // "peerDependencies": {
  223. // "eslint": ">= 6"
  224. // },
  225. // "peerDependenciesMeta": {
  226. // "eslint": {
  227. // "optional": true
  228. // }
  229. // }
  230. // }
  231. },
  232. /**
  233. * The `globalNeverBuiltDependencies` setting suppresses the `preinstall`, `install`, and `postinstall`
  234. * lifecycle events for the specified NPM dependencies. This is useful for scripts with poor practices
  235. * such as downloading large binaries without retries or attempting to invoke OS tools such as
  236. * a C++ compiler. (PNPM's terminology refers to these lifecycle events as "building" a package;
  237. * it has nothing to do with build system operations such as `rush build` or `rushx build`.)
  238. * The settings are copied into the `pnpm.neverBuiltDependencies` field of the `common/temp/package.json`
  239. * file that is generated by Rush during installation.
  240. *
  241. * PNPM documentation: https://pnpm.io/package_json#pnpmneverbuiltdependencies
  242. */
  243. "globalNeverBuiltDependencies": [
  244. // "fsevents"
  245. ],
  246. /**
  247. * The `globalIgnoredOptionalDependencies` setting suppresses the installation of optional NPM
  248. * dependencies specified in the list. This is useful when certain optional dependencies are
  249. * not needed in your environment, such as platform-specific packages or dependencies that
  250. * fail during installation but are not critical to your project.
  251. * These settings are copied into the `pnpm.overrides` field of the `common/temp/package.json`
  252. * file that is generated by Rush during installation, instructing PNPM to ignore the specified
  253. * optional dependencies.
  254. *
  255. * PNPM documentation: https://pnpm.io/package_json#pnpmignoredoptionaldependencies
  256. */
  257. "globalIgnoredOptionalDependencies": [
  258. // "fsevents"
  259. ],
  260. /**
  261. * The `globalAllowedDeprecatedVersions` setting suppresses installation warnings for package
  262. * versions that the NPM registry reports as being deprecated. This is useful if the
  263. * deprecated package is an indirect dependency of an external package that has not released a fix.
  264. * The settings are copied into the `pnpm.allowedDeprecatedVersions` field of the `common/temp/package.json`
  265. * file that is generated by Rush during installation.
  266. *
  267. * PNPM documentation: https://pnpm.io/package_json#pnpmalloweddeprecatedversions
  268. *
  269. * If you are working to eliminate a deprecated version, it's better to specify `allowedDeprecatedVersions`
  270. * in the package.json file for individual Rush projects.
  271. */
  272. "globalAllowedDeprecatedVersions": {
  273. // "request": "*"
  274. },
  275. /**
  276. * (THIS FIELD IS MACHINE GENERATED) The "globalPatchedDependencies" field is updated automatically
  277. * by the `rush-pnpm patch-commit` command. It is a dictionary, where the key is an NPM package name
  278. * and exact version, and the value is a relative path to the associated patch file.
  279. *
  280. * PNPM documentation: https://pnpm.io/package_json#pnpmpatcheddependencies
  281. */
  282. "globalPatchedDependencies": { },
  283. /**
  284. * (USE AT YOUR OWN RISK) This is a free-form property bag that will be copied into
  285. * the `common/temp/package.json` file that is generated by Rush during installation.
  286. * This provides a way to experiment with new PNPM features. These settings will override
  287. * any other Rush configuration associated with a given JSON field except for `.pnpmfile.cjs`.
  288. *
  289. * USAGE OF THIS SETTING IS NOT SUPPORTED BY THE RUSH MAINTAINERS AND MAY CAUSE RUSH
  290. * TO MALFUNCTION. If you encounter a missing PNPM setting that you believe should
  291. * be supported, please create a GitHub issue or PR. Note that Rush does not aim to
  292. * support every possible PNPM setting, but rather to promote a battle-tested installation
  293. * strategy that is known to provide a good experience for large teams with lots of projects.
  294. */
  295. "unsupportedPackageJsonSettings": {
  296. // "dependencies": {
  297. // "not-a-good-practice": "*"
  298. // },
  299. // "scripts": {
  300. // "do-something": "echo Also not a good practice"
  301. // },
  302. // "pnpm": { "futurePnpmFeature": true }
  303. }
  304. }