Whaleshares Logo

Whaleshares Front End on your own computer - Part 1

ijmmaiwitnessPosted for Everyone to comment on, 2 years ago3 min read

image.png

Some users mentioned they were interested in fiddling with the front end code. In a few posts I will try to describe how to set up the needed software, and how to run the code on your own computer. I will assume "everyone" is using a Windows computer, but will add Mac commands if needed.

What is needed?

  1. nvm (node version manager)
  2. nodejs (programming language, very similar to javascript)
  3. git (to communicate with the front end code on gitlab) - part2
  4. yarn (package/project manager) - part2
  5. code editor - see part 3
  6. front end code - see part 3

Part 1

In this post, numbers 1 and 2 will be covered.

Install NVM

  • Go to this Github page
  • Download the nvm-setup.zip file
  • Unzip the nvm-setup.zip file
  • Run nvm-setup.exe
    image.png

Check NVM

To check the installation of NVM we are going to ask the system for the NVM version number. This is done by executing a command in the Terminal (Command Prompt) program.

  • Open the Window start screen (click the flag-icon or use the key on your keyboard)
  • Start typing: prompt
  • Select "Run as Administrator"
    (Accept the changes in case a warning shows up)
    image.png
  • In the Terminal typ: nvm version
    a number should show up on the screen
    image.png

Nodejs and NPM

We are going to tell NVM which version of Nodejs we want to use, the NPM will be set accordingly. The front end code on whaleshares.io uses Nodejs version 8.11, but I use Nodejs version 12.0 for development.

  • In the Terminal typ: nvm install 12.0
    image.png
    To actually use Nodejs 12.0 another command is needed
  • In the Terminal typ: nvm use 12.0
    image.png

Check Nodejs

To check the Nodejs version

  • In the Terminal typ: node -v
    a number should show up on the screen
    image.png

Does it work?

Let's see if things work as expected so far.

  • Open the Notepad program
  • Add this code to the file
    console.log('Hello this is my first Nodejs script');
    image.png
  • Save the file as myfirstscript.js
    (you can create a dedicated folder to keep things organized)

I created a folder on my D: drive and named it "example_scripts". To run a script you will have to execute the command in the same folder the script is in (or add the path to that folder to the filename).

The commands are:
D:
cd example_scripts
(cd means change directory)
image.png

To run a Nodejs script you have to enter the program to run it, and the file to use.

  • In the Terminal typ: node myfirstscript.js
    image.png

That is all for this first part. If things don't work out for you, leave a comment and I will try to help you get rid of the errors.


image source

Sign Up to join this conversation, or to start a topic of your own.
Your opinion is celebrated and welcomed, not banned or censored!