Node Setup
Revision as of 02:40, 10 January 2020 by Riley.McCuen (talk | contribs) (Node.js set up guide initial page.)
- If you do not have Node.js installed yet then follow the link and install it before proceeding.
- After installing Node.js and setting up your path variables it may be helpful to run a couple of commands to test your installation.
- Open a terminal window to test the following commands:
- Run the command 'node -v' you should get output similar to 12.14.1, this indicates that your node installation is good to go.
- Run the command 'npm -v' you should get output similar to 6.13.4, this indicates that your npm installation is good to go. npm stands for Node Package Manager and is used to manage dependencies for your projects.
- After installing Node.js and setting up your path variables it may be helpful to run a couple of commands to test your installation.
- At this point you have Node.js and the Node Package Manager (npm). You will use these to install the necessary dependencies as well as transpile and bundle Typescript files into Javascript files that will be used to facilitate dynamic HTML and data collection.
- As is stated in the previous point Typescript will be used to develop dynamic code for this course. In order to run Typescript in the browser it must be transpiled to Javascript and to be efficient it must also be bundled into a single file. To facilitate this a popular tool called Browserify will be used. To make sure that this tool runs smoothly make all dependencies must be installed.
- To install all necessary dependencies do the steps below.
- In a terminal or powershell window navigate to your repository for CSE 256.
- Next navigate to <your-repo-path>/projects/core
- Once here run this command: npm install
- This will install all dependencies locally for the core package which is necessary for your project to run properly.
- Next navigate to <your-repo-path>/projects/information-foraging
- Once here run this command: npm install
- At this point all necessary dependencies have been installed. As more projects are distributed throughout the semester the same steps need to be followed to install dependencies for new projects as well.
- Now that all dependencies have been installed a single build script can be run that will transpile and bundle all Typescript for your projects. The script will watch for changes to Typescript files and recompile when new changes are saved to your filesystem. Every time that a recompilation finishes the time will be printed to the terminal window, therefore if you are ever curious if a recompilation has happened since your most recent changes just check the timestamp.
- To run the build script follow these steps:
- In a terminal or powershell window navigate to your repository for CSE 256.
- Next navigate to <your-repo-path>/projects/<project-you-are-working-on>
- This is the location that you can run the build script from
- There are two build script options:
- To run once run this command: npm run-script build
- To continually watch for changes run this command: npm run-script watch