json5-manifest-sync 0.3.4 → 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.
- package/CHANGELOG.md +7 -0
- package/README.md +8 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
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
|
+
|
|
5
12
|
## [0.3.4] - 2026-11-09
|
|
6
13
|
|
|
7
14
|
### Changed
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# json5-manifest-sync
|
|
2
2
|
|
|
3
|
-
|
|
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
|
|
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
|
|
|
@@ -90,7 +90,7 @@ The source of truth for this tool is configurable. By default:
|
|
|
90
90
|
|
|
91
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`.
|
|
92
92
|
|
|
93
|
-
**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`.
|
|
94
94
|
|
|
95
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`:
|
|
96
96
|
|
|
@@ -137,15 +137,17 @@ JSON5_MANIFEST_SYNC_SOURCE_OF_TRUTH=package.json5
|
|
|
137
137
|
|
|
138
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`.
|
|
139
139
|
|
|
140
|
-
|
|
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`:
|
|
141
141
|
|
|
142
142
|
```bash
|
|
143
143
|
npx --yes --package=json5-manifest-sync json5-manifest-sync --source=package.json5
|
|
144
144
|
```
|
|
145
145
|
|
|
146
|
-
|
|
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
147
|
|
|
148
|
-
|
|
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.
|
|
149
|
+
|
|
150
|
+
In this setup, pnpm reads the generated `package.json`; it reads `package.json5` directly only when `package.json` is absent (citation needed).
|
|
149
151
|
|
|
150
152
|
Choose a blank-comment mode with one of the following:
|
|
151
153
|
|
package/package.json
CHANGED