Add add-node-modules-path package to lang/javascript
And use it on json-mode.
This commit is contained in:
parent
346a90c95d
commit
17dd1c6527
3 changed files with 3 additions and 13 deletions
|
@ -83,18 +83,6 @@ Run this for any buffer you want to skewer."
|
||||||
;;
|
;;
|
||||||
;; Hooks
|
;; Hooks
|
||||||
|
|
||||||
;;;###autoload
|
|
||||||
(defun +javascript-add-node-modules-path-h ()
|
|
||||||
"Add current project's `node_modules/.bin` to `exec-path', so js tools
|
|
||||||
prioritize project-local packages over global ones."
|
|
||||||
(make-local-variable 'exec-path)
|
|
||||||
(cl-pushnew (expand-file-name "node_modules/.bin/"
|
|
||||||
(or (locate-dominating-file
|
|
||||||
(or (buffer-file-name) default-directory)
|
|
||||||
"node_modules")
|
|
||||||
(doom-project-root)))
|
|
||||||
exec-path :test #'string=))
|
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun +javascript-cleanup-tide-processes-h ()
|
(defun +javascript-cleanup-tide-processes-h ()
|
||||||
"Clean up dangling tsserver processes if there are no more buffers with
|
"Clean up dangling tsserver processes if there are no more buffers with
|
||||||
|
|
|
@ -292,10 +292,11 @@ to tide."
|
||||||
web-mode
|
web-mode
|
||||||
markdown-mode
|
markdown-mode
|
||||||
js-mode
|
js-mode
|
||||||
|
json-mode
|
||||||
typescript-mode
|
typescript-mode
|
||||||
solidity-mode)
|
solidity-mode)
|
||||||
:when (locate-dominating-file default-directory "package.json")
|
:when (locate-dominating-file default-directory "package.json")
|
||||||
:add-hooks '(+javascript-add-node-modules-path-h npm-mode))
|
:add-hooks '(add-node-modules-path npm-mode))
|
||||||
|
|
||||||
(def-project-mode! +javascript-gulp-mode
|
(def-project-mode! +javascript-gulp-mode
|
||||||
:when (locate-dominating-file default-directory "gulpfile.js"))
|
:when (locate-dominating-file default-directory "gulpfile.js"))
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
(package! eslintd-fix :pin "0c431141be")
|
(package! eslintd-fix :pin "0c431141be")
|
||||||
(package! js2-refactor :pin "d4c40b5fc8")
|
(package! js2-refactor :pin "d4c40b5fc8")
|
||||||
(package! npm-mode :pin "3ee7c0bad5")
|
(package! npm-mode :pin "3ee7c0bad5")
|
||||||
|
(package! add-node-modules-path :pin "f31e69ccb6")
|
||||||
|
|
||||||
;; Eval
|
;; Eval
|
||||||
(package! nodejs-repl :pin "6fad7d764f")
|
(package! nodejs-repl :pin "6fad7d764f")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue