Best way of working on code for extension

In a few days I will start updating my BLoP extension to Snap5.1. I already did an update in the past by using 1) a visual diff program (Tk Diff), 2) a simple text editor and 3) the Chrome Debugger.

Is there, for your experience, a better way by using free/open source tools?

Thanks in advance for your help

That depends on how you've done your extension :slight_smile:

I always use decorators to modify Snap!, making sure not to touch the original source at all, then updating is (should be) just a matter of git pull-ing the latest changes and reviewing that nothing has been broken.

If you've been modifying the original source files I guess diffing is your only possible path.

Yes, this time I'm planning to have my extension in separate files, so using decorators is certainly the way I want to follow.

My question is now, when there is a new release I have to:

  • Look in github which files have been updated

  • Have a look at the diff page for those files in githib

  • Try to import the updated code in my own version by solving incompatibilities (if any)

Is this correct? Do you think there is a easier way?

I'd probably just git merge into a separate branch and then resolve the conflicts locally.

Not easy either way, though :slight_smile:

My thoughts...

  • Of course, separate files is the right way. You can decorate or overwrite functions in separate files (js loaded after the original source files).Then, you can use git submodules using always the original source unchanged (and updated). You don't need to merge anything.
  • Decorators are better (minor maintenance) but maybe you must overwrite some functions. Anyway, you must take care of all that "hacked" functions.
  • The idea is to track only changes in that functions. For decorated functions you only have to check if there is any inconsistency. For overwritten functions you have to update your code.
  • So, use git log or git diff (gitk GUI is useful) to check your "hacked" functions.

That's all