Size: 2351
Comment:
|
Size: 741
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
= NodeJS = | = Node = |
Line 3: | Line 3: |
The '''NodeJS''' ecosystem is a hot fucking mess. This set of documents is designed to help the uninitiated understand how to hack [[NodeJS/NPM|npm]], [[NodeJS/Electron|electron]], [[NodeJS/Webpack|webpack]], and much more. | '''`node(1)`''' is a [[JavaScript]] interpretter. It comes with a standard library and a package manager. An extensive set of third-party modules are built upon this foundation. |
Line 11: | Line 11: |
== Node == | == Example == |
Line 13: | Line 13: |
'''`node(1)`''' is a JavaScript runtime, much like those built into (most) web browsers. It enables the use of JavaScript throughout the web development stack. It also enables web developers to employ their skills and tooling to conventional programming. | {{{ console.log("Hello, world!"); }}} This can be executed like: {{{ node example.js }}} |
Line 19: | Line 27: |
== NPM == '''`npm(1)`''' is the package manager for the NodeJS ecosystem. `npm(1)` is bundled with `node(1)`. Much like `pip(1)`, it offers 'global' installation and 'local' installation. Local installation, the default, uses `./node_modules` for packages and `./node_modules/bin` for binaries. Global installation, toggled on with the `-g` or `--global` options, uses `$NPM_CONFIG_PREFIX/lib/node_modules` for packages and `$NPM_CONFIG_PREFIX/bin` for binaries. If `$NPM_CONFIG_PREFIX` is unset, most Linux distributions default to `/usr` or `/usr/local`. You can check using `NPM_CONFIG_PREFIX= npm prefix -g`. For more details, see [[NodeJS/NPM|here]]. |
== Installation == |
Line 32: | Line 32: |
== Tool Chain == | |
Line 33: | Line 34: |
== yarn == '''`yarn(1)`''' is a higher-level package manager for the NodeJS ecosystem. While there are significant benefits, note that `yarn(1)` uses a completely different command line syntax. `yarn(1)` should be installed through your distribution's package manager, not through `npm(1)`. ---- |
* [[Node/Electon|Electron]] * [[Node/Gyp|node-gyp]] * [[Node/Npm|npm]] * [[Node/Npx|npx]] * [[Node/WebPack|WebPack]] * [[Node/Yarn|yarn]] |
Line 43: | Line 43: |
== node-gyp == | == Standard Library == |
Line 45: | Line 45: |
'''`node-gyp`''' is an addon to `npm(1)` for building native (C++) addons. It can be installed with: {{{ npm install --global node-gyp }}} Note that it depends on Python and the appropriate compiler for your platform. See [[https://www.npmjs.com/package/node-gyp#installation|here]] for help. ---- == Electron == ---- == webpack == '''`webpack`''' is a bundler, meant for converting JavaScript (and more: see below) files into a module for deployment. It can be installed with: {{{ npm install --save-dev webpack }}} or {{{ yarn add webpack --dev }}} webpack is also an ecosystem unto itself, with additional loaders, plugins, and optimizers. These enable the bundling of alternate types of assets. |
* [[Node/Console|console]] * [[Node/Crypto|crypto]] * [[Node/FS|fs]] * [[Node/OS|os]] * [[Node/Path|path]] |
Node
node(1) is a JavaScript interpretter. It comes with a standard library and a package manager. An extensive set of third-party modules are built upon this foundation.
Contents
Example
console.log("Hello, world!");
This can be executed like:
node example.js
Installation
Tool Chain