Deploying Node.js projects
To be able to deploy a Node.js web app, you'll need to use a tool to compile any assets that have been prepared, so that they can be understood by web servers and client browsers. A very popular technology for doing so, is NPM.
NPM allows developers to not only compile prepared assets, but also fetch external dependencies that might be required. Generally a simple process of
build to gather the appropriate dependencies before building. This is normally defined in a package.json file.
Using the Build Pipeline to build your project
When creating a build command, if you select the NPM option, the most commonly commands will be entered for you, these are:
npm install --quiet npm run build
However, if you use different commands to run your project locally, you can edit/update these using the textbox provided.
Configuring the build languages for specific Node versions
By default, your build commands will run using the latest supported version of Node, however, if your project requires a specific version, you can configure this under “Build Pipeline > Build Configuration”.
Using the Build Cache to speed up the build
Build commands may include fetching dependencies using NPM, which can take some time to complete. Caching these files would allow for them to not need to be downloaded during every deployment. Within “Cached Build Files” you can add an entry for each group of files/folders that you’d like to cache. The most common rules for
Adding Excluded Files to stop unwanted dependencies from being uploaded
Files generated within a build pipeline but not required to be uploaded to your server, can be excluded with excluded file rules. To add an excluded file, head to your project's Settings dropdown, then the Excluded Files option. Click to add a new excluded file, entering the full path of the file as the name. This will likely be the same entries as used for build cache rules.
A number of frameworks that use NPM/Node.js
We have a list of guides for a number of technologies that can utilise Node.js and NPM within the build pipeline: