S&T What I know about Node 110817

16
What I know about

Transcript of S&T What I know about Node 110817

What I know about

I have Node installed (7.7.3). I couldn’t tell you exactly when I installed it

I know I’ve used NPM (Node Package Manager) before

The default Foundation 6 build process requires Node

Node is built with JavaScript? Or *on* JavaScript? Or *is* JavaScript?

TL;DRI don’t know enough

What do I know about Node?

“Node is a JavaScript runtime environment that achieves low latency and high throughput by taking a “non-blocking” approach to serving requests.”

“Node is a platform built on Chrome's JavaScript runtime for easily building fast and scalable network applications.”

Um, OK. The non-blocking thing sounds cool. Next!

Cheers. That kinda makes sense. Break it down for me…

“Node is an open source server framework. It allows you to run JavaScript on the server.”

Node in layman’s terms

“In short, NodeJs uses Google’s V8 Javascript compiler engine to run JavaScript through the command line. You can modify files on your system, create servers,

and do just about anything while writing only JavaScript.”

(Thank you Alexander Sage)

Node is JavaScript out of the browser

Node in layman’s terms

WOAH!Free-range JavaScript

Old news

This is nothing new. Your ancient ancestors were using Node back in 2009.

I’ve always treated JavaScript as something that makes stuff on a webpage fade in and out or zip across the page. I was happy concentrating on the HTML/CSS.

But JavaScript’s role in web development is changing.

The holy trinity of web dev

Write JavaScript using the Node.js libraries then use NPM to distribute or share your code as a module.

JAVASCRIPT NODE.JS NODE PACKAGE MANAGER

> >

The Node process

+

Installing Node *also* installs a version of NPM. They are made by the same company. They are not the same thing.

Node ❤ NPM

The majority of my interactions with Node are via NPM. I’ve been installing dependencies with NPM for a while and just getting on with it.

$ npm install $ npm install -g

// This is a documented part of the // set up process for the Content // Publisher.

Node Package Manager (NPM)

dandineen$ npm -v 4.1.2 dandineen$ node -v v7.7.3 dandineen$ npm list /Users/dandineen ├── @allmarkedup/[email protected] ├─┬ @frctl/[email protected] │ ├─┬ @frctl/[email protected] │ │ └─┬ [email protected] │ │ └── [email protected] │ ├─┬ @frctl/[email protected] │ │ └─┬ [email protected] │ │ ├─┬ [email protected] │ │ │ ├── [email protected] │ │ │ └── [email protected] │ │ ├─┬ [email protected] │ │ │ ├─┬ [email protected] │ │ │ │ └── [email protected] │ │ │ ├─┬ [email protected] │ │ │ │ └── [email protected] │ │ │ └── [email protected] │ │ ├─┬ [email protected] │ │ │ └── [email protected] │ │ └─┬ [email protected] │ │ └── [email protected] │ ├─┬ [email protected]

What’s already there?

├─┬ [email protected] │ ├─┬ [email protected] │ │ └── [email protected] │ └─┬ [email protected] │ └── [email protected] └─┬ [email protected] ├── [email protected] ├─┬ [email protected] │ └── [email protected] ├─┬ [email protected] │ └── [email protected] └── [email protected]

Nine hundred or so lines later…

I have all of these modules installed globally. They are available to use in any project. At least a few of them are familiar - Foundation, Fractal, Gulp, Grunt

What’s already there?

Modules can have their own dependencies. Downloading a few modules could leave you with many, many sub-dependencies.

How do I know what to install?

// I know what I want to install $ npm install <package name>

// OR ——————————————————

// Check package.json and then install // everything I need for this project $ npm install

What do we use it for?

During set up, we install Grunt via NPM. Grunt is a JavaScript task runner we use to compile our Sass into CSS.

The new UoB blog theme uses a different task runner called Gulp to compile Sass and JavaScript.

PUBLISHER APPS BLOGS.BATH

The combination of Node and NPM underpin a heck of a lot of modern web development processes

Although just a small part of the Content Publisher toolset, Node plays a vital role in building Lens and Origins

I probably should think about pruning out the unused modulesI have globally installed

I need to keep learning. Node is here to stay

So, what do I know about Node now?

https://nodejs.org/en/

http://www.javascript.com

https://www.npmjs.com

Node = Free-range JavaScript

I’m starting with these basic resources and going from there.