There is no rename directory command in CVS, as CVS doesn't know about directories, only about files.
You have several options, and what you do depends on how you want to handle "old" checkouts of revisions from before you make this change.
If you want "old" checkouts to get the old library in the ../../js/library position then you should just make a copy of the old library to the new location, followed by overwriting the current location with the new library and a commit of all that.
If you want the old library in the new position and have the full history there, you need to copy the directory contents in the repository from js/library to js/library_legacy. After that check in the new library on the new position. If you checkout an older revision, you will get the old library in both checke dout to 'js/library' and 'js/library_legacy'. Depending on your build system this may or may not be a problem
Similar to 2, but move the directory in the repository. This will make it impossible to checkout an old revision as the old library will no longer show up in the old position where your build system probably expects it.