Skip to content

Commit

Permalink
Avoid overwriting apheleia-formatters for npx commands (#152)
Browse files Browse the repository at this point in the history
When the formatter is an npx command, setcar is used to expand the
binary file path to node_modules/.bin. But setcar overwrites the
underlying list, so the expanded path is set into
apheleia-formatters. (The list was processed by remq before setcar,
but remq seems to return the cdr if only the first element is
removed.) This is undesirable because when working on multiple NPM
packages, each package may have a formatter of different version.
  • Loading branch information
stonekyx authored Feb 4, 2023
1 parent 2520f14 commit a74cd99
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ The format is based on [Keep a Changelog].
succession, its contents could be erased and replaced with an error
message from the formatter. This has been fixed. See [#131] for more
details.
* Npx commands in apheleia-formatters are not overwritten when
expanding binary path to node_modules directory ([#152]).

### Formatters
* [`crystal tool
Expand All @@ -47,6 +49,7 @@ The format is based on [Keep a Changelog].
[#145]: https://github.com/radian-software/apheleia/pull/145
[#147]: https://github.com/radian-software/apheleia/pull/147
[#148]: https://github.com/radian-software/apheleia/pull/148
[#152]: https://github.com/radian-software/apheleia/pull/152

## 3.1 (released 2022-11-11)
### Enhancements
Expand Down
3 changes: 2 additions & 1 deletion apheleia.el
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,8 @@ cmd is to be run."
;; remote.
(remote-match (equal run-on-remote remote))
(stdin (or stdin-buffer (current-buffer)))
(npx nil))
(npx nil)
(command (apply #'list command)))
;; TODO: Support arbitrary package managers, not just NPM.
(when (memq 'npx command)
(setq npx t)
Expand Down

0 comments on commit a74cd99

Please sign in to comment.