json5-manifest-sync 0.3.3 → 0.3.5

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/CHANGELOG.md +13 -0
  2. package/README.md +35 -78
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,19 @@
2
2
 
3
3
  All notable changes to this project are documented in this file.
4
4
 
5
+ ## [0.3.5] - 2026-11-09
6
+
7
+ ### Changed
8
+
9
+ - Clarified the README's pnpm workflow for projects that start with only `package.json5`.
10
+ - Marked pnpm manifest-precedence claims that still need a citation.
11
+
12
+ ## [0.3.4] - 2026-11-09
13
+
14
+ ### Changed
15
+
16
+ - Simplified README installation guidance and removed repeated usage examples.
17
+
5
18
  ## [0.3.3] - 2026-11-09
6
19
 
7
20
  ### Changed
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # json5-manifest-sync
2
2
 
3
- Add comments to your npm package manifest in `package.json5`, then sync it with the standard `package.json` expected by npm and other tools. Choose either file as the source of truth for manifest values; `package.json` always remains valid strict JSON.
3
+ Document your npm package manifest with comments in a companion `package.json5`, then sync it with the standard `package.json` expected by npm and other tools. Choose either file as the source of truth for manifest values; `package.json` always remains valid strict JSON.
4
4
 
5
5
  For example, document dependencies in `package.json5` and generate `package.json` from it:
6
6
 
@@ -21,7 +21,7 @@ npx json5-manifest-sync --source=package.json5
21
21
  The tool can also work in the other direction: by default, it updates `package.json5` from `package.json`, preserving mapped `//` comments where possible.
22
22
 
23
23
  > [!NOTE]
24
- > pnpm supports `package.json5` natively, but when both files exist it prefers `package.json`. Keeping the manifests synchronized makes this trivial: pnpm reads `package.json`, whose values match `package.json5`. Other tools in your scripts, CI/CD, publishing, or deployment workflows may also expect `package.json`.
24
+ > pnpm supports `package.json5` natively, but when both files exist it prefers `package.json` (citation needed). Keeping the manifests synchronized makes this trivial: pnpm reads `package.json`, whose values match `package.json5`. Other tools in your scripts, CI/CD, publishing, or deployment workflows may also expect `package.json`.
25
25
 
26
26
  ## Quick Start
27
27
 
@@ -51,6 +51,28 @@ Run it:
51
51
  npm run sync:json5
52
52
  ```
53
53
 
54
+ ## Alternative installation methods
55
+
56
+ Global install (optional):
57
+
58
+ ```bash
59
+ npm install -g json5-manifest-sync
60
+ ```
61
+
62
+ Or with pnpm:
63
+
64
+ ```bash
65
+ pnpm add --global json5-manifest-sync
66
+ ```
67
+
68
+ ### Install from GitHub (alternative)
69
+
70
+ Use this if you want an unreleased branch or tag:
71
+
72
+ ```bash
73
+ npm install github:BBaysinger/json5-manifest-sync#main
74
+ ```
75
+
54
76
  ## Why this exists
55
77
 
56
78
  `package.json` must be strict JSON, which means comments are invalid. That makes it hard to document complex scripts, dependency choices, or workspace settings directly in the manifest.
@@ -61,9 +83,6 @@ Some tooling does not treat `package.json5` as a package manifest source. While
61
83
 
62
84
  This is also why the long-running Yarn Berry discussion about comment-friendly manifests is relevant here: [yarnpkg/berry#241](https://github.com/yarnpkg/berry/issues/241) describes the same underlying need, along with the ecosystem compatibility constraints that make a companion `package.json5` approach useful today.
63
85
 
64
- > [!NOTE]
65
- > pnpm's native `package.json5` support is useful when pnpm controls the workflow, but it does not make `package.json5` universally recognized across npm, CI/CD, deployment, release, and other JavaScript tooling. This project keeps `package.json` available for compatibility while providing a documented companion file.
66
-
67
86
  The source of truth for this tool is configurable. By default:
68
87
 
69
88
  - `package.json` is authoritative for manifest values.
@@ -71,7 +90,7 @@ The source of truth for this tool is configurable. By default:
71
90
 
72
91
  Alternatively, make `package.json5` authoritative for values and generate a strict `package.json` for tools that need it. In this direction, comments remain in `package.json5`; they are not copied to `package.json`.
73
92
 
74
- **pnpm consideration:** pnpm has no setting or environment variable to prefer `package.json5` when both files exist. The `--source` option and `JSON5_MANIFEST_SYNC_SOURCE_OF_TRUTH` variable configure only this tool; they do not change pnpm's selection. When the two manifests are synchronized, this is straightforward: pnpm reads `package.json`, whose values match `package.json5`. If JSON5 is your source of truth, run this tool with `--source=package.json5` before pnpm operations that need the latest values. Pnpm commands may update `package.json`, so reconcile those changes into `package.json5` before syncing from JSON5 again, or they may be overwritten. Removing `package.json` lets pnpm read `package.json5` directly, but may break Node, npm, or other tools that require `package.json`.
93
+ **pnpm consideration:** pnpm has no setting or environment variable to prefer `package.json5` when both files exist (citation needed). The `--source` option and `JSON5_MANIFEST_SYNC_SOURCE_OF_TRUTH` variable configure only this tool; they do not change pnpm's selection. When the two manifests are synchronized, this is straightforward: pnpm reads `package.json`, whose values match `package.json5`. If JSON5 is your source of truth, run this tool with `--source=package.json5` before pnpm operations that need the latest values. Pnpm commands may update `package.json`, so reconcile those changes into `package.json5` before syncing from JSON5 again, or they may be overwritten. Removing `package.json` lets pnpm read `package.json5` directly, but may break Node, npm, or other tools that require `package.json`.
75
94
 
76
95
  For CI or other automated workflows where `package.json5` is authoritative, run the sync as a separate step before pnpm reads the manifest. A lifecycle hook such as `preinstall` may run too late, after pnpm has already selected `package.json`:
77
96
 
@@ -101,65 +120,7 @@ Repository: https://github.com/BBaysinger/json5-manifest-sync
101
120
 
102
121
  Package: https://www.npmjs.com/package/json5-manifest-sync
103
122
 
104
- ## Author
105
-
106
- Bradley Baysinger ([@BBaysinger](https://github.com/BBaysinger))
107
-
108
- ## Install from the npm registry (recommended)
109
-
110
- Use the package manager already used by your project so its lockfile stays consistent.
111
-
112
- With npm:
113
-
114
- ```bash
115
- npm install --save-dev json5-manifest-sync
116
- ```
117
-
118
- With pnpm:
119
-
120
- ```bash
121
- pnpm add --save-dev json5-manifest-sync
122
- ```
123
-
124
- Global install (optional):
125
-
126
- ```bash
127
- npm install -g json5-manifest-sync
128
- ```
129
-
130
- Or with pnpm:
131
-
132
- ```bash
133
- pnpm add --global json5-manifest-sync
134
- ```
135
-
136
- ## Install from GitHub (alternative)
137
-
138
- Use this if you want an unreleased branch or tag:
139
-
140
- ```bash
141
- npm install github:BBaysinger/json5-manifest-sync#main
142
- ```
143
-
144
- ## Use in a project
145
-
146
- Add a script in your consuming project's `package.json`:
147
-
148
- ```json
149
- {
150
- "scripts": {
151
- "sync:json5": "json5-manifest-sync"
152
- }
153
- }
154
- ```
155
-
156
- Run it:
157
-
158
- ```bash
159
- npm run sync:json5
160
- ```
161
-
162
- ### Options
123
+ ## Options
163
124
 
164
125
  By default, the tool runs with `--blank-comments=preserve`.
165
126
 
@@ -176,15 +137,17 @@ JSON5_MANIFEST_SYNC_SOURCE_OF_TRUTH=package.json5
176
137
 
177
138
  An existing shell environment variable takes precedence over `.env`, and `--source=...` takes precedence over both. If the setting is omitted, the default remains `package.json`.
178
139
 
179
- For a project that has only `package.json5`, run the tool through `npx` (or install it globally) to generate the initial `package.json`—no pnpm installation is needed:
140
+ If you use npm in a project that has only `package.json5`, run the tool through `npx` (or install it globally) to generate the initial `package.json`:
180
141
 
181
142
  ```bash
182
143
  npx --yes --package=json5-manifest-sync json5-manifest-sync --source=package.json5
183
144
  ```
184
145
 
185
- You cannot use a local `npm run` script or install this tool as a local dev dependency until `package.json` exists. Once generated, npm and other strict-JSON tools can use it. Note that commands such as `npm install` update `package.json`; reconcile those changes back into `package.json5` with the default `--source=package.json` mode before regenerating JSON from the JSON5 source, or those updates could be overwritten.
146
+ Without `package.json`, npm cannot run project scripts or install local dev dependencies. pnpm supports `package.json5` directly, so you can install the tool with `pnpm add --save-dev json5-manifest-sync` and run `pnpm exec json5-manifest-sync --source=package.json5`. If you define a script in `package.json5`, include `--source=package.json5` in its command; the default direction reads `package.json`. Once generated, `package.json` is available to npm and other tools that require strict JSON.
147
+
148
+ Commands such as `npm install` update `package.json`; reconcile those changes back into `package.json5` with the default `--source=package.json` mode before regenerating JSON from the JSON5 source, or those updates could be overwritten.
186
149
 
187
- Because pnpm prefers `package.json` when both files exist, it will read the generated JSON copy in that setup; it reads `package.json5` directly only when `package.json` is absent.
150
+ In this setup, pnpm reads the generated `package.json`; it reads `package.json5` directly only when `package.json` is absent (citation needed).
188
151
 
189
152
  Choose a blank-comment mode with one of the following:
190
153
 
@@ -217,16 +180,10 @@ Example prompt:
217
180
 
218
181
  > "Complete empty `//` comment lines in `package.json5` with concise, field-specific comments."
219
182
 
220
- ## Example dependency block in consumer
221
-
222
- ```json
223
- {
224
- "dependencies": {
225
- "json5-manifest-sync": "^0.3.0"
226
- }
227
- }
228
- ```
229
-
230
183
  ## Changelog
231
184
 
232
185
  See `CHANGELOG.md` for full release history.
186
+
187
+ ## Author
188
+
189
+ Bradley Baysinger ([@BBaysinger](https://github.com/BBaysinger))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "json5-manifest-sync",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
4
4
  "description": "Sync package.json and package.json5 manifests in either direction, preserving JSON5 comments where possible.",
5
5
  "author": {
6
6
  "name": "Bradley Baysinger",