@@ -24,10 +24,54 @@ The global configuration file is located at one of the following locations:
24
24
25
25
Set the config key to the value provided.
26
26
27
+ Without the ` --json ` flag, it parses the value as plain string:
28
+
29
+ ``` sh
30
+ pnpm config set --location=project nodeVersion 22.0.0
31
+ ```
32
+
33
+ With the ` --json ` flag, it parses the value as JSON:
34
+
35
+ ``` sh
36
+ pnpm config set --location=project --json nodeVersion ' "22.0.0"'
37
+ ```
38
+
39
+ The ` --json ` flag also allows ` pnpm config set ` to create arrays and objects:
40
+
41
+ ``` sh
42
+ pnpm config set --location=project --json onlyBuiltDependencies ' ["react", "react-dom"]'
43
+ pnpm config set --location=project --json catalog ' { "react": "19" }'
44
+ ```
45
+
46
+ The ` set ` command does not accept a property path.
47
+
27
48
### get < ; key>
28
49
29
50
Print the config value for the provided key.
30
51
52
+ The ` key ` can be a simple key:
53
+
54
+ ``` sh
55
+ pnpm config get nodeVersion
56
+ pnpm config get --json nodeVersion
57
+ pnpm config get --json packageExtensions
58
+ pnpm config get --json onlyBuiltDependencies
59
+ pnpm config get --json catalog
60
+ ```
61
+
62
+ It can also be a property path:
63
+
64
+ ``` sh
65
+ pnpm config get ' packageExtensions["@babel/parser"].peerDependencies["@babel/types"]'
66
+ pnpm config get --json ' packageExtensions["@babel/parser"].peerDependencies["@babel/types"]'
67
+ pnpm config get ' onlyBuiltDependencies[0]'
68
+ pnpm config get --json ' onlyBuiltDependencies[0]'
69
+ pnpm config get catalog.react
70
+ pnpm config get --json catalog.react
71
+ ```
72
+
73
+ The syntax of the property path emulates JavaScript property paths.
74
+
31
75
### delete < ; key>
32
76
33
77
Remove the config key from the config file.
@@ -50,5 +94,4 @@ When set to `global`, the performance is the same as setting the `--global` opti
50
94
51
95
### --json
52
96
53
- Show all the config settings in JSON format.
54
-
97
+ Make ` get ` and ` list ` show all the config settings in JSON format and make ` set ` parse the value as JSON.
0 commit comments