Coder Social home page Coder Social logo

callawaycloud / force-source-clean Goto Github PK

View Code? Open in Web Editor NEW
8.0 3.0 3.0 454 KB

SFDX plugin which performs the 'force:source:retrieve --manifest' command but removes stale files

JavaScript 9.64% Batchfile 0.69% TypeScript 89.67%
salesforce sfdx-plugin

force-source-clean's People

Contributors

chuckjonas avatar ralphcallaway avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

force-source-clean's Issues

Non SFDX File in Package Directory Breaks Clean

โžœ  project git:(XXX.1/master) sfdx force:source:clean -x manifest/package.xml 
(node:22917) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 exit listeners added. Use emitter.setMaxListeners() to increase limit
WARNING: This command can be dangerous! It is intended to be used along side source control.  IT WILL REMOVE ALL FILES FROM 'packageDirectories' WHICH ARE NOT FOUND IN THE TARGET ORG.  They will not be recoverable unless tracked in source control!
Do you wish to continue? (y): y
WARNING: Failed to retrieve! All files are "marked" and will need to be manually reset!
ERROR running force:source:retrieve:  Unexpected file found in package directory: /Users/ralphcallaway/Development/project/src/classes/SomeClass.cls.orig

In this case, a git merge conflict artifact broke down the process and left everything deleted (will post some thoughts on that in another ticket)

Not totally sure this is really an issue with this command, more an issue with the sfdx command not being smart enough to tell the difference between sfdx and non-sfdx files in package directories.

-f insted of -n for skip prompt?

more consistent with -f as a "force" action for CLIs when you want to ignore warnings

my $.02, obviously a subjective opinion

Emails Incorrectly Cleaned

Email templates included in package folder are deleted even if they are included in the project manifest file.

Incorrectly Deletes Text Static Resources

Ran to sync up a production org which had 3 static resources

  • application/zip static resource folder kept
  • text/csv static resource folder removed
  • test/plain static resource folder removed
  • static resource meta files retained for all three

Running a retrieve brings them right back. Long shot, but maybe simple text static resources have a slightly different structure gumming things up.

Spinner During Clean

After clicking yes, you're waiting for a pretty good while.

Would be a nice place for a super styling spinner or other pacifier

https://github.com/clj-commons/spinner has a lot of options, these two options in the demo seemed perfect

  • pointing-fingers (finger rolls across screen)
  • some kind of long running processing happens here (randomly uses all the spinners)

Pre-Clean Backup and Maybye Restore on Error

Seems inevitable that there be a fair amount of stuff like #4 where it doesn't complete and all the files are "DELETED"

Recoverying with source control is a snap, but it's easy to mess something up and forget some of your stuff wasn't committed.

A small protective measure would be to save a backup of the folder being cleaned, say .cleanbk that could make clean up a quick move folder. Or even better just magically bring it back. If it worked well the warning prompt might not be as critical

Basic Test Suite

Now that it's starting to feel like it's close to a v1 seems like a good time to add a basic test suite

Dont Change File Permissions on Clean

Noticed when I run clean I'll often see files listed as modified even though there is no content changes. Dug a bit deeper and ran a patch and can see lines like this

mode change 100755 => 100644 src/main/default/classes/SomeClass.cls-meta.xml

Would be nice if we could avoid this, although this could just be an issue on the first sync after which everything ends up with the default file permissions sfdx retrieve gives them.

default -x

this is pretty much alway manifest so just default it

Improvement: Respect .forceIgnore

if someone wanted to store something else in a force.com package folder (i.e. selenium tests) that isn't subject to the compile on save, pull/push commands, seems like it would be expected this command would respect .forceIgnore

Do not work with sfdx-cli/7.123.1

Got the following error after run the sfdx force:source:clean -n command:

ERROR running force:source:retrieve:  XXX.cls-meta.xml: Expected source files for type 'ApexClass'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.