json5-manifest-sync 0.1.3 → 0.1.4

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 CHANGED
@@ -2,6 +2,25 @@
2
2
 
3
3
  All notable changes to this project are documented in this file.
4
4
 
5
+ ## [0.1.4] - 2026-05-05
6
+
7
+ ### Changed
8
+
9
+ - Renamed the CLI option for suppressing generated blank `//` spacer comments to clearer `--remove-empty-comments` and `--remove-blank-comments` forms.
10
+ - Kept legacy `--no-empty-comment` and `--no-empty-comments` aliases working for compatibility.
11
+
12
+ ## [0.1.3] - 2026-02-27
13
+
14
+ ### Added
15
+
16
+ - Published `json5-manifest-sync` to the npm registry for direct install and global CLI usage.
17
+ - Added npm-first installation guidance in the README, including optional global install instructions.
18
+
19
+ ### Changed
20
+
21
+ - Updated README examples to use npm semver dependency references instead of GitHub-only install URLs.
22
+ - Kept GitHub install instructions as an alternative path for unreleased branch/tag consumption.
23
+
5
24
  ## [0.1.2] - 2026-02-25
6
25
 
7
26
  ### Fixed
package/README.md CHANGED
@@ -1,11 +1,11 @@
1
1
  # json5-manifest-sync
2
2
 
3
- Keep a documented `package.json5` in sync with the real `package.json` used by Node and package managers.
3
+ Keep a documented `package.json5` in sync with the real `package.json` used by Node and package managers, including `version` updates.
4
4
 
5
5
  ## Quick Start
6
6
 
7
7
  ```bash
8
- npm install github:BBaysinger/json5-manifest-sync#v0.1.3
8
+ npm install --save-dev json5-manifest-sync
9
9
  ```
10
10
 
11
11
  Add a script in your project's `package.json`:
@@ -41,37 +41,49 @@ This tool solves that gap by letting you maintain both:
41
41
  - `package.json5` as the human-documented companion file
42
42
 
43
43
  Then it synchronizes `package.json5` from `package.json` while preserving mapped `//` comments where possible.
44
+ When values like `version`, `scripts`, or dependency versions change in `package.json`, those updates are propagated into `package.json5`.
44
45
 
45
46
  ## What it does
46
47
 
47
48
  - Finds `package.json` files recursively (excluding `node_modules`)
48
49
  - Skips paths ignored by your root `.gitignore`
49
- - For each matching `package.json5`, rewrites values from canonical `package.json`
50
+ - For each matching `package.json5`, rewrites values from canonical `package.json` (including `version`, scripts, dependencies, and other manifest fields)
50
51
  - Preserves/migrates mapped `//` comments for keys and supported array items
52
+ - Inserts a blank `//` comment line before keys with no mapped comment (enabled by default)
51
53
  - Writes stable JSON5 formatting with trailing commas for cleaner diffs
52
54
 
55
+ ### Current limitations
56
+
57
+ - Per-item comment preservation is most reliable for arrays of strings.
58
+ - Arrays of objects or numbers still serialize correctly, but item-level comments may be dropped or replaced by an empty `//` spacer on sync.
59
+ - If you prefer to avoid regenerated blank spacer comments in those cases, run the CLI with `--remove-empty-comments`.
60
+
53
61
  Repository: https://github.com/BBaysinger/json5-manifest-sync
54
62
 
55
63
  ## Author
56
64
 
57
65
  Bradley Baysinger ([@BBaysinger](https://github.com/BBaysinger))
58
66
 
59
- ## Install from GitHub
67
+ ## Install from npm (recommended)
60
68
 
61
- Install from a tag (recommended):
69
+ ```bash
70
+ npm install --save-dev json5-manifest-sync
71
+ ```
72
+
73
+ Global install (optional):
62
74
 
63
75
  ```bash
64
- npm install github:BBaysinger/json5-manifest-sync#v0.1.3
76
+ npm install -g json5-manifest-sync
65
77
  ```
66
78
 
67
- Or from a branch during iteration:
79
+ ## Install from GitHub (alternative)
80
+
81
+ Use this if you want an unreleased branch or tag:
68
82
 
69
83
  ```bash
70
84
  npm install github:BBaysinger/json5-manifest-sync#main
71
85
  ```
72
86
 
73
- Because this repo defines a `prepare` script, npm will build TypeScript during git-based install.
74
-
75
87
  ## Use in a project
76
88
 
77
89
  Add a script in your consuming project's `package.json`:
@@ -113,10 +125,14 @@ For the current full output style, see this repo's live example: [`package.json5
113
125
 
114
126
  ### Options
115
127
 
116
- - `--no-empty-comment` or `--no-empty-comments`
128
+ By default, the tool inserts an empty `//` line before keys that do not already have a mapped comment. Disable that behavior with one of the following:
129
+
130
+ - `--remove-empty-comments` or `--remove-blank-comments`
117
131
  - `--empty-comment=false`
118
132
  - env var: `SYNC_JSON5_ADD_EMPTY_COMMENT=false`
119
133
 
134
+ Legacy aliases `--no-empty-comment` and `--no-empty-comments` are still accepted for compatibility.
135
+
120
136
  ### Formatting note
121
137
 
122
138
  Recommended: exclude `package.json5` from Prettier (for example via `.prettierignore`).
@@ -126,12 +142,22 @@ Prettier's JSON5 formatter can remove quotes from valid keys, which makes `packa
126
142
  > [!NOTE]
127
143
  > It would be nice if Prettier provided an option to preserve quoted keys in JSON5.
128
144
 
145
+ ### AI assist tip
146
+
147
+ After running `sync:json5`, you can ask an AI coding assistant to fill placeholder comment lines.
148
+
149
+ If you use this repo's `precommit` workflow, it warns when `package.json5` still contains blank `//` placeholder comments. Suppress just that warning for a given run with `npm run precommit -- --suppress-blank-comment-warning`.
150
+
151
+ Example prompt:
152
+
153
+ > "Complete empty `//` comment lines in `package.json5` with concise, field-specific comments."
154
+
129
155
  ## Example dependency block in consumer
130
156
 
131
157
  ```json
132
158
  {
133
159
  "dependencies": {
134
- "json5-manifest-sync": "github:BBaysinger/json5-manifest-sync#v0.1.3"
160
+ "json5-manifest-sync": "^0.1.3"
135
161
  }
136
162
  }
137
163
  ```
@@ -36,8 +36,9 @@ export type SyncOptions = {
36
36
  * //
37
37
  * "type": "module",
38
38
  *
39
- * Defaults to true. Can be disabled via CLI flag `--no-empty-comment` or the
40
- * environment variable `SYNC_JSON5_ADD_EMPTY_COMMENT=false`.
39
+ * Defaults to true. Can be disabled via CLI flags like
40
+ * `--remove-empty-comments` or the environment variable
41
+ * `SYNC_JSON5_ADD_EMPTY_COMMENT=false`.
41
42
  */
42
43
  addEmptyCommentIfMissing?: boolean;
43
44
  };
@@ -336,9 +336,14 @@ export function runCli(args = process.argv.slice(2)) {
336
336
  process.env.SYNC_JSON5_ADD_EMPTY_COMMENT.toLowerCase() === "false") {
337
337
  addEmptyCommentIfMissing = false;
338
338
  }
339
- // CLI toggles: --no-empty-comment, --empty-comment=false
339
+ // CLI toggles: --remove-empty-comments, --remove-blank-comments
340
340
  for (const arg of args) {
341
- if (arg === "--no-empty-comment" || arg === "--no-empty-comments") {
341
+ if (arg === "--remove-empty-comment" ||
342
+ arg === "--remove-empty-comments" ||
343
+ arg === "--remove-blank-comment" ||
344
+ arg === "--remove-blank-comments" ||
345
+ arg === "--no-empty-comment" ||
346
+ arg === "--no-empty-comments") {
342
347
  addEmptyCommentIfMissing = false;
343
348
  }
344
349
  else if (arg.startsWith("--empty-comment=")) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "json5-manifest-sync",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Sync package.json5 files from canonical package.json while preserving key comments.",
5
5
  "author": {
6
6
  "name": "Bradley Baysinger",
@@ -16,7 +16,7 @@
16
16
  }
17
17
  },
18
18
  "bin": {
19
- "json5-manifest-sync": "./dist/json5-manifest-sync.js"
19
+ "json5-manifest-sync": "dist/json5-manifest-sync.js"
20
20
  },
21
21
  "files": [
22
22
  "dist",
@@ -25,8 +25,11 @@
25
25
  ],
26
26
  "scripts": {
27
27
  "build": "tsc -p tsconfig.json",
28
+ "sync:json5": "node ./dist/json5-manifest-sync.js",
29
+ "warn:blank-comments": "node ./scripts/warn-blank-comments.mjs",
28
30
  "format": "prettier . --write",
29
31
  "format:check": "prettier . --check",
32
+ "precommit": "node ./scripts/precommit.mjs",
30
33
  "test": "vitest run",
31
34
  "test:watch": "vitest",
32
35
  "prepare": "npm run build"
@@ -35,13 +38,13 @@
35
38
  "node": ">=18"
36
39
  },
37
40
  "dependencies": {
38
- "glob": "^11.0.1",
39
- "ignore": "^7.0.4"
41
+ "glob": "^13.0.6",
42
+ "ignore": "^7.0.5"
40
43
  },
41
44
  "devDependencies": {
42
- "@types/node": "^22.13.10",
43
- "prettier": "^3.8.1",
44
- "typescript": "^5.8.2",
45
- "vitest": "^2.1.9"
45
+ "@types/node": "^25.6.0",
46
+ "prettier": "^3.8.3",
47
+ "typescript": "^6.0.3",
48
+ "vitest": "^4.1.5"
46
49
  }
47
50
  }