@ck0/pnpm-plugin-config 1.0.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/README.md +58 -0
  2. package/package.json +21 -0
  3. package/pnpmfile.mjs +28 -0
package/README.md ADDED
@@ -0,0 +1,58 @@
1
+ # @ck0/pnpm-plugin-config
2
+
3
+ A pnpm **config dependency** that re-applies the settings pnpm 11 stopped
4
+ reading from a *global* `~/.config/pnpm/config.yaml`. pnpm 11 ignores these in a
5
+ global config file (it warns *"cannot be set in the global config file … move
6
+ them to a project-level pnpm-workspace.yaml … to share across projects use
7
+ config dependencies"*), so the intended strictness silently stopped applying.
8
+
9
+ This package is the "share across projects" path: one pinned source of truth,
10
+ distributed via the npm registry (config dependencies require an integrity hash,
11
+ so a `file:`/`workspace:` spec is rejected).
12
+
13
+ ## Settings it applies
14
+
15
+ Via a `pnpmfile.mjs` `updateConfig` hook:
16
+
17
+ | setting | value | why |
18
+ |---|---|---|
19
+ | `hoistPattern` | `[]` | no hoisting — packages import only what they declare |
20
+ | `dedupePeerDependents` | `true` | single-instance peers across the workspace |
21
+ | `resolvePeersFromWorkspaceRoot` | `true` | one react/etc. for the whole workspace |
22
+ | `dedupePeers` | `true` | version-only peer suffixes, fewer dup instances |
23
+ | `dedupeDirectDeps` | `true` | don't re-symlink root-linked deps into subprojects |
24
+ | `ignorePatchFailures` | `false` | a stale patch is a hard failure, never silent |
25
+ | `enablePrePostScripts` | `false` | `pnpm foo` runs foo only, no pre/post chaining |
26
+
27
+ ## Why the name is `@ck0/pnpm-plugin-config`
28
+
29
+ pnpm **auto-loads** a config dependency's `pnpmfile.mjs` only when the package
30
+ name matches `pnpm-plugin-*`, `@*/pnpm-plugin-*`, or `@pnpm/plugin-*`. With this
31
+ name, consuming repos need **no local `.pnpmfile.mjs`** — just the
32
+ `configDependencies` entry.
33
+
34
+ ## Consuming it (each repo)
35
+
36
+ In `pnpm-workspace.yaml`:
37
+
38
+ ```yaml
39
+ configDependencies:
40
+ "@ck0/pnpm-plugin-config": "1.0.0" # exact version — ranges are rejected
41
+ ```
42
+
43
+ Because config dependencies resolve from the registry, the global
44
+ `minimumReleaseAge` (10-day) cooldown would otherwise block a fresh publish.
45
+ Exempt this package in the global `~/.config/pnpm/config.yaml`:
46
+
47
+ ```yaml
48
+ minimumReleaseAgeExclude:
49
+ - "@ck0/pnpm-plugin-config" # or "@ck0/*"
50
+ ```
51
+
52
+ ## Maintenance
53
+
54
+ This is **not a workspace member** (it's excluded from the `packages:` globs in
55
+ `pnpm-workspace.yaml`): it has no build/deps, is consumed from npm rather than
56
+ via `workspace:`, and lives here only so it's versioned and published from one
57
+ place. To change a setting: edit `pnpmfile.mjs`, bump `version`, `pnpm publish`,
58
+ then bump the `configDependencies` pin in each repo.
package/package.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "@ck0/pnpm-plugin-config",
3
+ "version": "1.0.0",
4
+ "description": "pnpm config-dependency plugin: re-applies the settings pnpm 11 no longer reads from a global ~/.config/pnpm/config.yaml, so they apply per-project from one pinned source. Auto-loaded by pnpm because the name matches @*/pnpm-plugin-*.",
5
+ "keywords": [
6
+ "pnpm",
7
+ "pnpm-plugin",
8
+ "config-dependency",
9
+ "pnpmfile"
10
+ ],
11
+ "license": "MIT",
12
+ "author": "Chirayu Krishnappa",
13
+ "type": "module",
14
+ "files": [
15
+ "pnpmfile.mjs",
16
+ "README.md"
17
+ ],
18
+ "publishConfig": {
19
+ "access": "public"
20
+ }
21
+ }
package/pnpmfile.mjs ADDED
@@ -0,0 +1,28 @@
1
+ // pnpm config-dependency plugin. pnpm auto-loads this file because the package
2
+ // name matches the `@*/pnpm-plugin-*` pattern; consuming repos only need a
3
+ // `configDependencies` entry (no local pnpmfile).
4
+ //
5
+ // Purpose: re-apply the pnpm settings that pnpm 11 refuses to read from a
6
+ // *global* ~/.config/pnpm/config.yaml (it warns "cannot be set in the global
7
+ // config file"). Without this, the intended strictness (no-hoist,
8
+ // patch-failure-is-error, etc.) silently stops applying. The `updateConfig`
9
+ // hook receives pnpm's resolved settings object and returns it mutated; keys
10
+ // are camelCase, matching pnpm's setting names.
11
+ export const hooks = {
12
+ updateConfig(config) {
13
+ return Object.assign(config, {
14
+ // No hoisting: packages may import only what they declare.
15
+ hoistPattern: [],
16
+ // Single-instance peer guarantees across the workspace.
17
+ dedupePeerDependents: true,
18
+ resolvePeersFromWorkspaceRoot: true,
19
+ dedupePeers: true,
20
+ dedupeDirectDeps: true,
21
+ // A patch that no longer applies is a hard failure, never a
22
+ // silent skip.
23
+ ignorePatchFailures: false,
24
+ // `pnpm foo` runs foo only — no implicit pre/post chaining.
25
+ enablePrePostScripts: false,
26
+ });
27
+ },
28
+ };