RutgersGRID / hubs

Duck-themed multi-user virtual spaces in WebVR. Built with A-Frame.
https://hubs.mozilla.com
Mozilla Public License 2.0
0 stars 0 forks source link

Have the ability for Hubs to be run/deployed to different environments (package.json) #49

Open Voxelghiest opened 1 year ago

Voxelghiest commented 1 year ago

The Hubs Client (and Hubs Admin, since it uses the same infrastructure) is managed using NPM, a build management tool for NodeJS. Using the npm command-line tool, the Hubs Client server can install dependencies, run tests, and spin itself up.

The configuration file for NPM is package.json, located in the root of the Hubs Client directory. package.json contains a section called scripts that can be used to create various NodeJS commands. For example, look at the following excerpt from Mozilla's own package.json file:

"scripts": {
    "start": "webpack serve --mode=development --env loadAppConfig=1",
    "dev": "webpack serve --mode=development --env remoteDev=1 --progress",
    "local": "webpack serve --mode=development --env localDev=1",
    //...more similar JSON attributes
}

Each of these JSON attributes--start, dev, and local--defines a command for starting the Hubs Client server with different parameters. You can run these commands from your shell by running npm run <command-name>.

By modifying our own package.json file, we could create our own commands for different environments. Perhaps we could have a "prod" command for the production server and a "dev" command for running locally on our development virtual machine.