Languages

Menu
Sites
Language
Deploying "linked" files

I have developed several watch faces in javascript.  I'm finding that some of the code I've written can be reused.  For example, I have a utility.js with utility-type functions that I wrote and intend to use in many other projects.  Initially, I had utility.js copied to the js folder in each project... but then of course if I ever need to change the code it gets cumbersome changing it in all those projects (or even copying the revised utility.js to each project).

So instead, I've created a "common" folder as a peer to each of my project folders and I put my utility.js file in that common folder.  Then, in Tizen Studio, I just added the common/js/utility.js file as a "Link to file in the file system"  I then had to change my .html file's reference to utility.js from: <script src="js/utility.js"></script> to: <script src="../common/js/utility.js"></script>

But the problem is deployment.  It doesn't work.  I'm guessing that when the package is deployed to the emulator (or device), it doesn't copy the "common" folder and thus my utility.js is not found.

Is there a better way to do this (reuse common js source code) short of just having my utility.js copied to each project folder?  

Responses

1 Replies
André Reus

Hi Alan, 

You can develop and update your lib (utility.js) in a common place. When you need the lib in a new project, just take it from common place. 

If this can't solve your problem, then you should follow practical solution for sharing code  https://hackernoon.com/5-practical-ways-to-share-code-from-npm-to-lerna-and-bit-732f2a4db512