Example node.js server that makes use of js-spice javascript wrapper for the NASA SPICE library.
Server can be viewed here: https://earth-moon-sun.gamedevtricks.com/
This example includes the js-spice module as a git submodule, since the package is not available in the npm registry.
Adding the js-spice module to a host application using Git submodules involves a series of steps. Here's a guide to help you through the process:
- If your host application isn't already a Git repository, initialize it with
git init
.
- Navigate to the root directory of your host application.
- Use the command
git submodule add https://github.com/gamergenic/js-spice.git
to add your module as a submodule.
- While adding the submodule, you can also specify a path where you want the submodule to be placed. For instance:
git submodule add https://github.com/gamergenic/js-spice.git <desired path>
. - If you don't specify a path, the submodule will be placed in a directory with the same name as the repository by default.
- Run
git submodule init
to initialize your submodule. - Then, run
git submodule update
to fetch all the data from the submodule project and check out the specified commit in your submodule.
- After adding the submodule, you will see changes in your host application's repository. These changes include the addition of the
.gitmodules
file and the submodule's directory. - Commit these changes with
git add .
andgit commit -m "Add js-spice as a submodule"
.
- If you need to clone the host application repository along with its submodules, use the command
git clone --recurse-submodules <repository URL of host application>
.
- To update the js-spice module to the latest commit available in its repository, navigate to the submodule's directory and run
git pull origin master
(or the branch you wish to pull from). - Then, go back to your host application's root directory and commit the changes.
- After committing the changes, push them to the host application repository with
git push
. Remember, each submodule is essentially a separate Git repository, so you need to commit and push changes within each submodule separately, as well as in the host repository.
cd modules/js-spice
git pull origin main
npm install
MIT License.