-
Notifications
You must be signed in to change notification settings - Fork 9
feat: add jsonc-parser for surgical package.json edits #46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 7 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
1c851c0
feat: add jsonc-parser for surgical package.json edits
harlan-zw b8b0078
fix: restore writeFileSync import in publish.ts
harlan-zw 129acb0
fix: add jsonc-parser to pnpm catalog and sync lockfile
harlan-zw 375eacf
feat: prompt to add skilld prepare hook to package.json
harlan-zw 2679fb0
Merge branch 'main' of github.com:harlan-zw/skilld into feat/jsonc-paβ¦
harlan-zw 05f882a
refactor: use jsonc-parser in author.ts, remove stale publish.ts
harlan-zw 95b10aa
Merge branch 'main' of github.com:harlan-zw/skilld into feat/jsonc-paβ¦
harlan-zw f578864
fix: address CodeRabbit review feedback
harlan-zw 1d1bbc2
fix: log warning on prepare hook failure instead of swallowing errors
harlan-zw 13d8dca
fix: guard scripts.prepare type before string operations
harlan-zw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,76 +1,62 @@ | ||
| --- | ||
| name: sindresorhus-log-update | ||
| description: "ALWAYS use when writing code importing \"log-update\". Consult for debugging, best practices, or modifying log-update, log update." | ||
| description: "Log by overwriting the previous output in the terminal. Useful for rendering progress bars, animations, etc. ALWAYS use when writing code importing \"log-update\". Consult for debugging, best practices, or modifying log-update, log update." | ||
| metadata: | ||
| version: 7.1.0 | ||
| version: 7.2.0 | ||
| generated_by: cached | ||
| generated_at: 2026-03-24 | ||
| --- | ||
|
|
||
| # sindresorhus/log-update `log-update` | ||
|
|
||
| **Version:** 7.1.0 (1 week ago) | ||
| **Deps:** ansi-escapes@^7.1.0, cli-cursor@^5.0.0, slice-ansi@^7.1.2, strip-ansi@^7.1.2, wrap-ansi@^9.0.2 | ||
| **Tags:** latest: 7.1.0 (1 week ago) | ||
| > Log by overwriting the previous output in the terminal. Useful for rendering progress bars, animations, etc. | ||
|
|
||
| **References:** [package.json](./.skilld/pkg/package.json) β’ [GitHub Issues](./.skilld/issues/_INDEX.md) β’ [Releases](./.skilld/releases/_INDEX.md) | ||
| **Version:** 7.2.0 | ||
| **Deps:** ansi-escapes@^7.3.0, cli-cursor@^5.0.0, slice-ansi@^8.0.0, strip-ansi@^7.2.0, wrap-ansi@^10.0.0 | ||
| **Tags:** latest: 7.2.0 | ||
|
|
||
| ## Search | ||
|
|
||
| Use `npx -y skilld search` instead of grepping `.skilld/` directories β hybrid semantic + keyword search across all indexed docs, issues, and releases. | ||
| **References:** [package.json](./.skilld/pkg/package.json) β exports, entry points β’ [GitHub Issues](./.skilld/issues/_INDEX.md) β bugs, workarounds, edge cases β’ [Releases](./.skilld/releases/_INDEX.md) β changelog, breaking changes, new APIs | ||
|
|
||
| ```bash | ||
| npx -y skilld search "query" -p log-update | ||
| npx -y skilld search "issues:error handling" -p log-update | ||
| npx -y skilld search "releases:deprecated" -p log-update | ||
| ``` | ||
| ## Search | ||
|
|
||
| Filters: `docs:`, `issues:`, `releases:` prefix narrows by source type. | ||
| Use `skilld search "query" -p log-update` instead of grepping `.skilld/` directories. Run `skilld search --guide -p log-update` for full syntax, filters, and operators. | ||
|
|
||
| <!-- skilld:api-changes --> | ||
| ## API Changes | ||
|
|
||
| β¨ `.persist(...text)` β new in v7.0, writes text that stays in scrollback (like `console.log`) without clearing the update area [source](./.skilld/releases/v7.0.0.md) | ||
|
|
||
| β¨ `defaultWidth` / `defaultHeight` options β new in v7.0 for `createLogUpdate()`, controls fallback dimensions when stream lacks `columns`/`rows` (default: 80Γ24) [source](./.skilld/releases/v7.0.0.md) | ||
| This section documents version-specific API changes β prioritize recent major/minor releases. | ||
|
|
||
| β¨ Partial diff rendering β v7.0 only redraws changed lines instead of erasing all, reduces flicker [source](./.skilld/releases/v7.0.0.md) | ||
| - BREAKING: Node.js requirement updated from 18 to 20 in v7.0.0 β code targeting earlier Node.js versions will fail at runtime [source](./.skilld/releases/v7.0.0.md#breaking) | ||
|
|
||
| β¨ Synchronized output (`?2026h`/`?2026l`) β v7.1 wraps writes in DEC synchronized output sequences on TTYs, eliminates tearing [source](./.skilld/releases/v7.1.0.md) | ||
| - NEW: `persist(...text)` method added in v7.0.0 β writes output that persists in terminal scrollback, unlike the main `logUpdate()` which updates in place [source](./.skilld/releases/v7.0.0.md#improvements) | ||
|
|
||
| β οΈ Node.js 20+ required β v7.0 dropped Node 18 support [source](./.skilld/releases/v7.0.0.md) | ||
| - NEW: `defaultWidth` option added in v7.0.0 β allows specifying terminal width (default: 80) when the stream doesn't provide `columns` property, useful for piped or redirected output [source](./.skilld/releases/v7.0.0.md#improvements) | ||
|
|
||
| β οΈ `logUpdate.create()` removed in v5 β use named export `createLogUpdate` instead [source](./.skilld/releases/v5.0.0.md) | ||
| - NEW: `defaultHeight` option added in v7.0.0 β allows specifying terminal height (default: 24) when the stream doesn't provide `rows` property, useful for piped or redirected output [source](./.skilld/releases/v7.0.0.md#improvements) | ||
|
|
||
| β οΈ `logUpdate.stderr` removed in v5 β use named export `logUpdateStderr` instead [source](./.skilld/releases/v5.0.0.md) | ||
|
|
||
| β οΈ Pure ESM since v5 β no `require()`, use `import logUpdate from 'log-update'` [source](./.skilld/releases/v5.0.0.md) | ||
| **Also changed:** Partial update rendering optimization v7.0.0 Β· Trailing newline handling fixes v7.0.1βv7.0.2 | ||
| <!-- /skilld:api-changes --> | ||
|
|
||
| <!-- skilld:best-practices --> | ||
| ## Best Practices | ||
|
|
||
| β Use `.persist()` for permanent output between updating sections β it writes to scrollback history then resets the update region, unlike `.done()` which just freezes the current frame [source](./.skilld/pkg/readme.md) | ||
|
|
||
| ```ts | ||
| logUpdate('Downloading...') | ||
| logUpdate.persist('β Download complete') // stays in scrollback | ||
| logUpdate('Installing...') // new update region starts | ||
|
|
||
| ``` | ||
| β Call `.done()` when finished to restore the cursor β the default export hides the cursor on first call and only restores it on `.done()` [source](./.skilld/pkg/index.js) | ||
| - Use `.persist()` for permanent terminal output that should remain in scrollback history β it writes like `console.log()` instead of updating in-place, ideal for results or status messages that users need to scroll back to review [source](./.skilld/pkg/index.d.ts:L45:66) | ||
|
|
||
| β Set `showCursor: true` via `createLogUpdate` when your CLI also accepts user input β the default singleton hides the cursor which breaks interactive prompts [source](./.skilld/pkg/readme.md) | ||
| - Call `.done()` before starting a new log session to persist the current output and prepare for fresh updates below β prevents scrollback contamination [source](./.skilld/pkg/readme.md#logUpdateDone) | ||
|
|
||
| ```ts | ||
| const log = createLogUpdate(process.stdout, { showCursor: true }) | ||
| ``` | ||
| - Enable `showCursor: true` when your CLI accepts user input or displays a prompt β otherwise the hidden cursor creates a poor UX for interactive interfaces [source](./.skilld/pkg/readme.md#showCursor) | ||
|
|
||
| β Set `defaultWidth`/`defaultHeight` when output may be piped or redirected β `stream.columns`/`stream.rows` are undefined in non-TTY contexts, defaults are 80Γ24 [source](./.skilld/pkg/readme.md) | ||
| - Set `defaultWidth` and `defaultHeight` options when output is piped, redirected, or running in non-TTY environments β without this, the library assumes 80x24 which causes incorrect line wrapping and erasure [source](./.skilld/releases/v7.0.0.md#improvements) | ||
|
|
||
| β Output is automatically clipped to terminal height (bottom lines kept, top removed) β cannot be disabled, design your output with the most important info at the bottom [source](./.skilld/issues/issue-51.md) | ||
| - Create separate `logUpdate` instances via `createLogUpdate(stream)` for each independent update context instead of reusing the default export β prevents one instance's updates from clobbering another's [source](./.skilld/pkg/index.d.ts:L74:87) | ||
|
|
||
| β Content exceeding terminal width is hard-wrapped per-character (not word-wrapped) β ANSI-colored strings are handled correctly but long unbroken lines will split mid-word [source](./.skilld/pkg/index.js) | ||
| - Understand that log-update can only erase and rewrite lines currently visible in the terminal viewport β content already in scrollback cannot be manipulated, so extremely long outputs will overflow and "leak" [source](./.skilld/issues/issue-10.md) | ||
|
|
||
| β Multiple string arguments are joined with spaces, not newlines β `logUpdate('a', 'b')` produces `"a b"`, use template literals or `\n` for multiline [source](./.skilld/pkg/index.js) | ||
| - Account for ANSI escape sequences in output width calculations β the library properly handles colorized text with tools like chalk/yoctocolors and accounts for their escape codes when calculating line wrapping [source](./.skilld/issues/issue-12.md) | ||
|
|
||
| β Use `createLogUpdate` for multiple independent update regions β the default export is a singleton; two modules sharing it will clobber each other's output. Each `createLogUpdate` call tracks its own state [source](./.skilld/issues/issue-48.md) | ||
| - Use `logUpdateStderr` for error messages and warnings instead of `logUpdate` β maintains separation between stdout and stderr streams [source](./.skilld/pkg/index.d.ts:L69:81) | ||
|
|
||
| β v7.1.0 uses synchronized output (`\x1b[?2026h/l`) on TTYs to eliminate flicker β no action needed, but be aware this wraps every write in DEC private mode sequences that some non-standard terminals may not support [source](./.skilld/releases/v7.1.0.md) | ||
| - Leverage partial/synchronized rendering in v7.1.0+ for reduced flicker when updating large outputs β the library now intelligently redraws only changed lines instead of erasing everything [source](./.skilld/releases/v7.1.0.md) | ||
|
|
||
| β Identical consecutive frames are skipped (no-op) β safe to call `logUpdate()` at high frequency without performance concern, the library diffs and only writes changed lines [source](./.skilld/pkg/index.js) | ||
| - Be aware that multiple consecutive blank lines at the end of output may collapse to a single blank line during rendering optimization β design output that doesn't rely on exact blank line preservation [source](./.skilld/issues/issue-62.md) | ||
| <!-- /skilld:best-practices --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
existing?.includes('skilld')is not safe ifscripts.prepareexists but is not a string (e.g. misconfigured package.json). Optional chaining here only guardsexistingbeing null/undefined; if it's a number/object, this will throw at runtime and can break the CLI. Consider normalizing withtypeof existing === 'string'(and passing only a string/undefined intobuildPrepareScript).