Reputation: 10833
I'm making a js library and using git for version control. Say it's located at mylib/lib.js
. Inside my library directory, I have a submodule for an example program that I'm developing alongside that library, say mylib/example/example.js
. Now, the question is: how should the example program access the library?
If I use a relative path to go up and grab the js file (like ../lib.js
), that means that the example isn't standalone; the only way to run it would be to clone the library. Then there's really no point to have it be a submodule at all.
If I copy lib.js
into the example directory, then I'm violating DRY and I'd have to copy it every time it gets updated (which is going to be a lot).
Is there a better solution to this problem?
Upvotes: 2
Views: 2824
Reputation: 20601
I think you should have the library as a submodule of the example instead, or a plain exported version. That's what it will look like for your users as well.
If it's to annoying to update all of the time, write a local* build/makefile/git hook that makes sure (all of) your example program(s) receive the latest version of your lib.js.
*Local as inside .gitignore because that exact setup is only interesting to you as a developer, on your machine
Upvotes: 4