Difference between revisions of "Node Setup"

From CSE256A Wiki
Jump to navigation Jump to search
(Node.js set up guide initial page.)
 
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
−
# If you do not have [https://nodejs.org/en/download/ Node.js] installed yet then follow the link and install it before proceeding.
+
# If you have not already, follow the link to install [https://nodejs.org/en/download/ Node.js]
−
## After installing Node.js and setting up your path variables it may be helpful to run a couple of commands to test your installation.
+
## After installing Node.js and setting up your path variables, run the following commands via a terminal window to test that your installation version is up-to-date
−
### Open a terminal window to test the following commands:
+
### Run the command 'node -v', which displays the node version, and you should get output similar to 12.14.1
−
### 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', which displays the npm version, and you should get output similar to 6.13.4. npm stands for Node Package Manager and is used to manage dependencies for your projects.
−
### 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.
+
# At this point your machine has 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. 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 Browserify runs smoothly, all dependencies must be installed. To install all necessary dependencies:
−
# 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.
+
## In a terminal or powershell window, navigate to your assignment repository for CSE 256
−
# 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.
+
## Once here, run this command that installs all needed dependences:  
−
# To install all necessary dependencies do the steps below.
+
<pre> npm install </pre>
−
## In a terminal or powershell window navigate to your repository for CSE 256.
+
# At this point, all necessary dependencies have been installed, but as more projects are distributed throughout the semester, the same steps need to be followed to install dependencies for new projects  
−
## Next navigate to <your-repo-path>/projects/core
+
# Now that all dependencies have been installed you should be able to run various other scripts. The main one you will be using is:
−
## Once here run this command: npm install
+
<pre>npm run dev</pre>
−
### This will install all dependencies locally for the core package which is necessary for your project to run properly.
+
# This command opens your website in the browser, watches for file changes, recompiles your code for you, and pushed the updated version to your browser.
−
## Next navigate to <your-repo-path>/projects/information-foraging
+
# If you just want to make sure that your app is up to date with changes then feel free to just run:
−
## Once here run this command: npm install
+
<pre>npm run build</pre>
−
## 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.
+
# This will build your application in its current state and then stop without serving your website to your browser or watching for file updates.
−
# 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
 

Latest revision as of 04:14, 14 January 2021

  1. If you have not already, follow the link to install Node.js
    1. After installing Node.js and setting up your path variables, run the following commands via a terminal window to test that your installation version is up-to-date
      1. Run the command 'node -v', which displays the node version, and you should get output similar to 12.14.1
      2. Run the command 'npm -v', which displays the npm version, and you should get output similar to 6.13.4. npm stands for Node Package Manager and is used to manage dependencies for your projects.
  2. At this point your machine has 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. 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 Browserify runs smoothly, all dependencies must be installed. To install all necessary dependencies:
    1. In a terminal or powershell window, navigate to your assignment repository for CSE 256
    2. Once here, run this command that installs all needed dependences:
 npm install 
  1. At this point, all necessary dependencies have been installed, but as more projects are distributed throughout the semester, the same steps need to be followed to install dependencies for new projects
  2. Now that all dependencies have been installed you should be able to run various other scripts. The main one you will be using is:
npm run dev
  1. This command opens your website in the browser, watches for file changes, recompiles your code for you, and pushed the updated version to your browser.
  2. If you just want to make sure that your app is up to date with changes then feel free to just run:
npm run build
  1. This will build your application in its current state and then stop without serving your website to your browser or watching for file updates.