ForceCLI/force

`force push -f` with path of Lightning component element other than .cmp fails

Closed this issue ยท 3 comments

Given a Lightning component comp, the file structure will include

aura/
    comp/
        comp.cmp
        compController.js
        compHelper.js
        ..

ForceCLI's behavior with the force push -f command is inconsistent when provided with the path of these individual component files.

force push -f aura/comp/comp.cmp works, and pushes changes to the component markup only (any changes to the JavaScript files are not pushed).

However, force push -f aura/comp/compController.js or force push -f aura/comp/compHelper.js fails to deploy and emits the following message:

Successes - 1
        comp: changed

Test Successes - 0

Failures - 2
Main markup cannot be empty. If you are trying to delete the Lightning definition bundle, directly delete the bundle instead.
Main markup cannot be empty. If you are trying to delete the Lightning definition bundle, directly delete the bundle instead.

Test Failures - 0
ERROR: Some components failed deployment

It would be very useful to be able to pass any component element filename to force push -f, particularly for delta-deployment workflows like git diff --name-only ... | force push -f -.

njjc commented

I'm also hitting this issue after integrating the force CLI with VS Code to allow pushing single files. Allowing this would be great for lightning component development.

@njjc The workaround I'm using is

git diff [...] --name-only --diff-filter=ACM | sed -E 's#^src/aura/([^/]+)/.+#src/aura/\1#' | sort -u | force push -f -

sed squelches all of the sub-component filenames to the top-level Aura bundle. That's applicable in a broader deployment scenario; if you're just pushing one file at a time it won't help.

Guys,

I have created a pull request that will allow to push aura files with force push -f -

What it basically do is replace path to aura single file with aura bundle folder