Emacs: Support nodeJS projects in projectile
Alan Pearce alan@alanpearce.eu
Sun, 18 Jun 2017 22:53:42 +0200
1 files changed, 11 insertions(+), 1 deletions(-)
jump to
M emacs/.emacs.d/init.org → emacs/.emacs.d/init.org
@@ -570,7 +570,17 @@ (projectile-switch-project-by-name (expand-file-name project-dir (ghq--find-root)) arg))) (setq projectile-switch-project-action #'projectile-commander - projectile-completion-system 'ivy))) + projectile-completion-system 'ivy + projectile-create-missing-test-files t) + + (defun ap/projectile-test-suffix (project-type) + (cond + ((member project-type '(node-yarn node-npm)) ".test") + (t (projectile-test-suffix project-type)))) + (setq projectile-test-suffix-function #'ap/projectile-test-suffix) + + (projectile-register-project-type 'node-yarn '("yarn.lock") "yarn start" "yarn test") + (projectile-register-project-type 'node '("package.json") "npm start" "npm test"))) (use-package counsel-projectile :after (counsel projectile)