|
@ -4,6 +4,9 @@ |
|
|
|
|
|
|
|
|
;;; Code: |
|
|
;;; Code: |
|
|
|
|
|
|
|
|
|
|
|
(require 'transient) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defvar sfdx-create-css) |
|
|
(defvar sfdx-create-css) |
|
|
(setq-default sfdx-create-css t) |
|
|
(setq-default sfdx-create-css t) |
|
|
|
|
|
|
|
@ -58,13 +61,31 @@ |
|
|
|
|
|
|
|
|
(defun sfdx--deploy (component comp-name) |
|
|
(defun sfdx--deploy (component comp-name) |
|
|
"Internal function to deploy COMP-NAME asyncronously or project if COMPONENT is nil after validations." |
|
|
"Internal function to deploy COMP-NAME asyncronously or project if COMPONENT is nil after validations." |
|
|
(let ((process "sfdx-deploy-output") |
|
|
|
|
|
(cd-dir (locate-dominating-file buffer-file-name "force-app")) |
|
|
|
|
|
(output-path (concat (locate-dominating-file buffer-file-name "force-app") "force-app/main/default")) |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
(let ((process "sfdx-deploy") |
|
|
|
|
|
(buffer "*sfdx-output*") |
|
|
|
|
|
(cd-dir (expand-file-name (locate-dominating-file buffer-file-name "force-app"))) |
|
|
|
|
|
(output-path (concat (locate-dominating-file buffer-file-name "force-app") "force-app/main/default"))) |
|
|
(if component |
|
|
(if component |
|
|
(async-start-process process "sh" (lambda (result) (message "Deploy Process Finished")) "-c" (concat "cd " cd-dir "; sfdx force:source:deploy --sourcepath force-app/main/default/lwc/" comp-name " --loglevel fatal")) |
|
|
|
|
|
(async-start-process process "sh" (lambda (result) (message "Deploy Process Finished")) "-c" (concat "cd " cd-dir "; sfdx force:source:deploy --sourcepath force-app/main/default/ --loglevel fatal")) |
|
|
|
|
|
|
|
|
(progn |
|
|
|
|
|
(delete-other-windows) |
|
|
|
|
|
(split-window-below 40) |
|
|
|
|
|
(other-window 1) |
|
|
|
|
|
(switch-to-buffer buffer) |
|
|
|
|
|
(erase-buffer) |
|
|
|
|
|
(local-set-key (kbd "q") 'delete-window) |
|
|
|
|
|
(insert (format "Starting deployment of %s...\n" comp-name)) |
|
|
|
|
|
(start-process process buffer "sh" "-c" (concat "cd " cd-dir "; sfdx force:source:deploy --sourcepath ./force-app/main/default/lwc/" comp-name " --loglevel fatal")) |
|
|
|
|
|
) |
|
|
|
|
|
(progn |
|
|
|
|
|
(delete-other-windows) |
|
|
|
|
|
(split-window-below 40) |
|
|
|
|
|
(other-window 1) |
|
|
|
|
|
(switch-to-buffer buffer) |
|
|
|
|
|
(erase-buffer) |
|
|
|
|
|
(local-set-key (kbd "q") 'delete-window) |
|
|
|
|
|
(insert "Starting deployment of project...\n") |
|
|
|
|
|
(start-process process buffer "sh" "-c" (concat "cd " cd-dir "; sfdx force:source:deploy --sourcepath ./force-app/main/default/ --loglevel fatal")) |
|
|
|
|
|
) |
|
|
) |
|
|
) |
|
|
) |
|
|
) |
|
|
) |
|
|
) |
|
@ -81,10 +102,10 @@ |
|
|
(if (string= current-folder "lwc") |
|
|
(if (string= current-folder "lwc") |
|
|
(prog1 |
|
|
(prog1 |
|
|
;; Not in a component, deploy project. |
|
|
;; Not in a component, deploy project. |
|
|
(message "Deploying Project...") |
|
|
|
|
|
(sfdx--deploy nil current-folder)) |
|
|
|
|
|
|
|
|
;; (message "Deploying Project...") |
|
|
|
|
|
(sfdx--deploy nil current-folder)) |
|
|
;; In a component, deploy component. |
|
|
;; In a component, deploy component. |
|
|
(message "Deploying Component...") |
|
|
|
|
|
|
|
|
;; (message "Deploying Component...") |
|
|
(sfdx--deploy t current-folder))) |
|
|
(sfdx--deploy t current-folder))) |
|
|
|
|
|
|
|
|
(prog1 |
|
|
(prog1 |
|
@ -92,8 +113,8 @@ |
|
|
(if (locate-dominating-file buffer-file-name "force-app") |
|
|
(if (locate-dominating-file buffer-file-name "force-app") |
|
|
(prog1 |
|
|
(prog1 |
|
|
;; In project, deploy project. |
|
|
;; In project, deploy project. |
|
|
(message "Deploying Project...") |
|
|
|
|
|
(sfdx--deploy nil current-folder)) |
|
|
|
|
|
|
|
|
;; (message "Deploying Project...") |
|
|
|
|
|
(sfdx--deploy nil current-folder)) |
|
|
(prog1 |
|
|
(prog1 |
|
|
;; Not in an SFDX project. |
|
|
;; Not in an SFDX project. |
|
|
(message "You are not in a component folder or an SFDX project!")) |
|
|
(message "You are not in a component folder or an SFDX project!")) |
|
@ -103,5 +124,19 @@ |
|
|
) |
|
|
) |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
(defun sfdx/retrieve-component () |
|
|
|
|
|
"Retrieve the source for the current component (destructively overwrites)." |
|
|
|
|
|
(interactive) |
|
|
|
|
|
(message "can't do that yet, i'm still learning")) |
|
|
|
|
|
|
|
|
|
|
|
(define-transient-command sfdx/transient-action () |
|
|
|
|
|
"SFDX CLI Actions" |
|
|
|
|
|
["Project Specific" |
|
|
|
|
|
("P" "Create New Project" sfdx/create-project)] |
|
|
|
|
|
["Component Level" |
|
|
|
|
|
("c" "create new" sfdx/create-component) |
|
|
|
|
|
("d" "deploy" sfdx/deploy-component-or-project) |
|
|
|
|
|
("r" "retrieve" sfdx/retrieve-component)]) |
|
|
|
|
|
|
|
|
(provide 'sfdx) |
|
|
(provide 'sfdx) |
|
|
;;; sfdx.el ends here |
|
|
;;; sfdx.el ends here |