Skip to content

Node.js notes

November 22, 2023
December 11, 2014

NodeJS Basics: An Introductory Training - YouTube

maxogden/art-of-node: a short introduction to node.js
sindresorhus/awesome-nodejs
bcomnes/node-learnbook
felixge/node-style-guide

Modern Modules – Mikeal – Medium
goldbergyoni/nodebestpractices: The Node.js best practices list (September 2020)
Node.js Best Practices - How to become a better Node.js developer in 2018
The Node Way
Node Labs
Node v4.0.0 History
The definitive Node.js handbook
nodejs/Release: Node.js Foundation Release Working Group release cadence

Node Hero - Getting Started With Node.js | @RisingStack ❗!important
A Node.JS Holiday Season Articles ★ Mozilla Hacks – the Web developer blog (2012)
JavaScript 中的同步與非同步(上):先成為 callback 大師吧! | TechBridge 技術共筆部落格
Heroku | 10 Habits of a Happy Node Hacker (2016)
Node.js and Express.js - Full Course - YouTube
Beginner's Series to: Node.js - YouTube Microsoft

How to get A+ on the SSL Labs test in node.js

Introduction to the Node.js reference architecture, Part 1: Overview | Red Hat Developer
IBM and Red Hat’s recommendations for logging in Node.js applications – IBM Developer
Introduction to the Node.js reference architecture, Part 3: Code consistency | Red Hat Developer
Introduction to the Node.js reference architecture, Part 4: GraphQL in Node.js | Red Hat Developer
Introduction to the Node.js reference architecture, Part 5: Building good containers | Red Hat Developer

ES6

ECMAScript 2015 (ES6) and beyond | Node.js
Node.js ES2015/ES6 support

Video

Node Tuts
Learn All The Nodes
NodeJS Fan - YouTube

Debugging

Presentations: Debugging JavaScript · Mark's Dev Blog
Blogged Answers: Debugging Tips · Mark's Dev Blog

Debugger | Node.js Documentation
Debugging - Getting Started | Node.js
Debugging Node.js with Chrome DevTools – Paul Irish – Medium

node --inspect-brk app.js
# enable inspector, break on app start
# https://github.com/nodejs/node/pull/6792

GoogleChromeLabs/ndb: ndb is an improved debugging experience for Node.js, enabled by Chrome DevTools a standalone Chromium instance as debugger

Chrome DevTools - Debugging Node.js Application Using ndb

Easily identify problems in Node.js applications with Diagnostic Report

Supercharge your debugging experience for Node.js – Indrek Lasn – Medium
Debugging Node.js applications using core dumps - Reaktor
How to Debug a Node.js app in a Docker Container | @RisingStack

joyent/node-stackvis: Stacktrace visualization tools
defunctzombie/node-superstack: long stack traces for node.js
mattinsler/longjohn: Long stack traces for node.js inspired
davidmarkclements/cute-stack: Cute up your stack traces in Node
stacktracejs/stacktrace.js: Framework-agnostic, micro-library for getting stack traces in all web browsers

An Introduction to the AsyncListener API
Lessons learned from async listener · Issue #28 · node-forward/discussions
othiym23/node-continuation-local-storage: implementation of https://github.com/joyent/node/issues/5243
othiym23/async-listener: polyfill version of the 0.11 version of the asyncListener API
Node.js: Continuation-Local-Storage and the Magic of AsyncListener
Conquering Asynchronous Context with CLS

Obsoleted:
[node-inspector/node-inspector](https:// github.com/node-inspector/node-inspector) debugger on Blink Developer Tools, deprecates since Node.js included the built-in --inspect in 6.3
Debugging node.js in Docker using Node Inspector
s-a/iron-node: Debug Node.js code with Chrome Developer Tools. debugger on Electron

Worker Threads

Worker Threads | Node.js Documentation

A complete guide to threads in Node.js – LogRocket
Node.js multithreading: What are Worker threads, and why do they matter? - LogRocket Blog
Use cases for Node workers - LogRocket Blog
How to work with worker threads in NodeJS
Understanding Worker Threads in Node.js - NodeSource

node.js - Nodejs worker threads shared object/store - Stack Overflow
Limiting concurrent operations in JavaScript

SUCHMOKUO/node-worker-threads-pool: Simple worker threads pool using node's worker_threads module.

piscinajs/piscina: A fast, efficient Node.js Worker Thread Pool implementation

only half of the cores can be made busy on MacOS, ever · Issue #38629 · nodejs/node

async_hook

Async Hooks | Node.js Documentation
A Pragmatic Overview of Async Hooks API in Node.js – ITNEXT

OS

Node OS

NodeOS

Runtime.js

😴inactive

runtime.js – JavaScript library operating system for the cloud
runtime.js — JavaScript library OS — Medium
Unikernels: Rise of the Virtual Library Operating System - ACM Queue

An Introduction to Runtime.JS - PubNub
Sergii Iefremov: Runtime.JS: V8 JavaScript Kernel | JSConf EU 2014 - YouTube

Writing CLI apps

nodejs-settings#CLI

Shell scripting with Node.js

Unix and Node: Command-line Arguments
Unix and Node: Pipes and Streams
Unix and Node: Signals

Command Line Utilities with Node.js | Shape Shed
Writing Command Line Tools with Node

Popular cli modules - Node.JS Modules

amwmedia-plop file template generator, lighter then yeoman

vercel/pkg: Package your Node.js project into an executable
vercel/ncc: Compile a Node.js project into a single file. Supports TypeScript, binary addons, dynamic requires.

Accept pipe

You can use process.stdin as input stream to accept pipe input:

/* choose input stream */
const inputStream =
  process.args.length > 2
    ? Fs.createReadStream(process.args[2])
    : process.stdin;

See leesei/openslide-prop2json.

Event Emitter

Events | Node.js Documentation

nlf/spit async
xat/hoook async and priority

Eavesdrop Events

(function patchEmitter(emitter) {
  var oldEmit = emitter.emit;

  emitter.emit = function () {
    var args = arguments;
    console.log(args[0], [].slice.call(args, 1));
    oldEmit.apply(emitter, args);
  };
})(emitter);

Stream

Node.js Streams: Everything you need to know
Stream Node.js v5.10.0 Manual & Documentation
StrongLoop | What’s New in io.js 1.0 Beta? – Streams3
stream - What is Streams3 in Node.js and how does it differ from Streams2? - Stack Overflow

"Classic" streams are available since v0.4.
Classic readable streams are just EventEmitter with 'data' and 'end' events and a boolean writable member. They can optionally provides .pause() and .resume() to control buffering.
Classic writable streams are defined by the interface .write(buf), .end(buf) and .destroy().
Classic streams are considered legacy so avoid registering 'data' and 'end' listeners (with stream libraries such as through, concat-stream).

Streams2 (paused streams/pull streams) was added to Node v0.10.
To consume a Readable stream, call .read() on 'readable'. To create a Readable stream, inherits stream.Readable and implement ._read() to .push() to the Readable stream. .push(null) to signal end of stream. You can also peek buf and unshift()
To write to a Writable stream, call .write() and .end(). To create a Writable stream, inherits stream.Writable and implement _write() to consume the chunks, call next() to trigger the Readable stream to provide more data.

Streams3 (combined streams) was added to iojs and Node v0.11+.

substack/stream-handbook
Node.js Stream Playground
workshopper/stream-adventure: go on an educational stream adventure!

The Basics of Node.js Streams
Readable, Writable, and Transform Streams in Node.js | Sanders DeNardi
thlorenz.com The Power of NodeJS Streams and the event-stream Module
Thorsten Lorenz - LXJS 2013 - Node.js streams for the utterly confused - YouTube
Streams2 actually on Streams3
Creating Duplex streams in Node.js - LogRocket Blog

[r.va.gg] Why I don't use Node's core 'stream' module
dominictarr/stream-spec: executable specification for Stream (make testing streams easy)
nodejs/readable-stream Streams3 for non-Node environment
mcollina/split2: Split Streams3 style
mcollina/reduplexer: reduplexer(writable, readable, options)
mafintosh/pump
maxogden/concat-stream: writable stream that concatenates strings or data and calls a callback with the result
mcollina/callback-stream: A pipeable stream that calls your callback
mcollina/never-ending-stream: Automatically restarts your stream for you when it ends
mcollina/end-of-stream: Call a callback when a readable/writable/duplex stream has completed or failed.
rvagg/through2: Tiny wrapper around Node streams2 Transform to avoid explicit subclassing noise
maxogden/mississippi

Video Stream With Node.js and HTML5 - Better Programming - Medium

javascript-notes Bacon.js and Highland.js

2016 - the year of web streams - JakeArchibald.com on browser

Bind Your Error Handler Before Your Readable Handler When Using Node.js Streams
Node.js Streams Inherit Error-Handling Behavior From EventEmitter
Error Events Don't Inherently Stop Streams In Node.js
How Error Events Affect Piped Streams In Node.js
You Have To Explicitly End Streams After Pipes Break In Node.js
Does The HTTP Response Stream Need Error Event Handlers In Node.js?

An Overview of Buffers in Node.js | www.thecodebarbarian.com

Appending Buffers

Combining stream to a single output ref:

var bufs = [];
stream.on("data", function (d) {
  bufs.push(d);
});
stream.on("end", function () {
  var buf = Buffer.concat(bufs);
});

However this put the stream in "classic" mode, use stream libraries instead.

rvagg/bl: Buffer List: collect buffers and access with a standard readable Buffer interface, streamable too!

concat-stream

ES Modules

Modules: ECMAScript modules | Node.js Documentation
Pure ESM package
Node.JS (New) Package.json Exports Field | by Thomas Juster | The Startup | Medium

Modules: Packages - Writing dual packages while avoiding or minimizing hazards Node 15+

{
  "name": "my-awesome-lib",

  "exports": {
    ".": {
      "browser": {
        "default": "./lib/whole-lib.browser.js"
      }
    },
    "module-a": {
      "import": "./lib/public-module-a.mjs",
      "require": "./lib/public-module-a.cjs"
    },
    "module-b": {
      "import": "./lib/public-module-b.mjs",
      "require": "./lib/public-module-b.cjs"
    }
  }
}

ES2015 module detection in Node.js (June 2016) archived
defense-of-dot-js/proposal.md at master · dherman/defense-of-dot-js

ES Modules and Node.js: Hard Choices — Medium
Understanding the hard choice. — Medium
CommonJS is hurting JavaScript
CommonJS is not going away | Bun Blog

wessberg/cjstoesm: A tool that can transform CommonJS to ESM

Native Module

C++ Addons | Node.js Documentation
N-API | Node.js Documentation
nodejs/abi-stable-node: NAPI — Node with PoC ABI stable API for native modules.
nodejs/nan: Native Abstractions for Node.js
nodejs/node-addon-api: Module for using N-API from C++
nodejs/node-addon-examples: Node.js C++ addon examples from http://nodejs.org/docs/latest/api/addons.html

fcanas/node-native-boilerplate: A very small, understandable node native extension with reasonable project structure
vshymanskyy/node-inline-cpp: Inline C++ with Node.js
charto/nbind: Magical headers that make your C++ library accessible from JavaScript

Chrome V8 — Google Developers
Create Wiki — V8 Cookbook
v8- V8 API Reference Guide

How NodeJS requires native shared objects
Native Extensions for Node.js – Node.js Collection – Medium
N-API: Next generation Node.js APIs for native modules
N-API: Next generation APIs for Node.js native addons available across all LTS release lines

C++ and Node.js Integration
Scott Frees - Getting your C++ to the Web with Node.js
Scott Frees - C++ processing from Node.js
Scott Frees - C++ processing from Node.js - Part 2
Scott Frees - C++ processing from Node.js - Part 3 - Arrays
Scott Frees - C++ processing from Node.js - Part 4 - Asynchronous addons
Scott Frees - Building an Asynchronous C++ Addon for Node.js using Nan

Creating Multiplatform Precompiled Binaries for Node.js Modules
mapbox/node-pre-gyp: Node.js tool for easy binary deployment of C++ addons
mafintosh/node-gyp-build: Build tool and bindings loader for node-gyp that supports prebuilds

Neon · Fast and Safe Native Node.js Modules
Neon: Node + Rust = 💖
Rust Bridge
RisingStack/node-with-rust

Native JavaScript modules - YouTube

Isomorphism

Isomorphic JavaScript - The future of web app development

Universal JavaScript — Medium
Is “Isomorphic JavaScript” a good term?
Universal vs Isomorphic — Medium
Capital One Engineering - Why Everyone is Talking About Isomorphic / Universal JavaScript and Why it Matters

Lazymorphic Apps: Bringing back the static web serving an index.html for landing/login and 200.html for anything else

Isomorphic JavaScript: The Future of Web Apps - Airbnb Engineering
Why and How Coursera Does Isomorphic Javascript: A Fast and Snappy Quiz - Coursera Technology
How to Migrate React to Isomorphic Rendering - Coursera Technology

spikebrehm/isomorphic-examples
spikebrehm/isomorphic-tutorial

RickWong/react-isomorphic-starterkit
tildeio/ember-cli-fastboot
trueadm/inferno: An extremely fast, React-like JavaScript library for building modern user interfaces

V8 Internals

Philip Roberts: What the heck is the event loop anyway? | JSConf EU 2014 - YouTube ❗!important
latentflip.com/loupe/
Morning Keynote- Everything You Need to Know About Node.js Event Loop - Bert Belder, IBM - YouTube 2016

Five Misconceptions on How NodeJS Works - Deepal’s Blog

Understanding the Node.js Event Loop
The JavaScript Event Loop: Explained
Event loop from 10,000ft - core concept behind Node.js
Why the New V8 is so Damn Fast - NodeSource
JavaScript V8 Engine Explained – Hacker Noon
Making the Switch from Node.js to Golang | via @codeship
HTML Standard Event loops
The Main Event… Loop – Codezillas – Medium

Be the Master of the Event Loop in JavaScript (Part 1)
Be the Master of the Event Loop in JavaScript (Part 2)
Be the Master of the Event Loop in JavaScript (Part 3)

How Node.js Works: A Look Behind The Scenes | by Calvin Puram | Jan, 2022 | Level Up Coding
Nodejs Event Loop Architecture. This is the second part of this series… | by Calvin Puram | Jan, 2022 | Level Up Coding
Events and Event-Driven Architecture in Nodejs | by Calvin Puram | Jan, 2022 | Level Up Coding
Demystifying Streams in Nodejs. This is the fourth part of the series… | by Calvin Puram | Level Up Coding
Difference between the Event Loop in Browser and Node Js? - DEV Community

JavaScript Visualized Series' Articles - DEV Community 👩‍💻👨‍💻

Event Loop and the Big Picture — NodeJS Event Loop Part 1
Timers, Immediates and Process.nextTick— NodeJS Event Loop Part 2
Promises, Next-Ticks and Immediates— NodeJS Event Loop Part 3
Handling IO — NodeJS Event Loop Part 4 – The JS Blog
Event Loop Best Practices — NodeJS Event Loop Part 5
New Changes to the Timers and Microtasks in Node v11.0.0 ( and above)

How JavaScript works – SessionStack Blog
How JavaScript works: an overview of the engine, the runtime, and the call stack
How JavaScript works: inside the V8 engine + 5 tips on how to write optimized code

Mathias B, Benedikt M - JS Engine fundamentals [AgentConf] - YouTube
Super fast super property access · V8
JavaScript engine fundamentals: Shapes and Inline Caches · Mathias Bynens
JavaScript engine fundamentals: optimizing prototypes · Mathias Bynens
The story of a V8 performance cliff in React · V8 shapes, Object.seal(), Object.freeze()
Faster and more feature-rich internationalization APIs · V8

mö.js - explaining js vm in js - YouTube
StrongLoop | What’s New in Node.js v0.12 – Running Multiple Instances in a Single Process
A Guide to JavaScript Engines for Idiots -Telerik Developer Network
Writing Fast, Memory-Efficient JavaScript – Smashing Magazine
How to Compile Node.js Code Using Bytenode? – Hacker Noon

JavaScript engine fundamentals: Shapes and Inline Caches · Mathias Bynens
JavaScript Engines: The Good Parts™ - Mathias Bynens & Benedikt Meurer - JSConf EU 2018 - YouTube

JavaScript essentials: why you should know how the engine works hidden class/object shapes, inline caching
JavaScript Engines Hidden Classes (and Why You Should Keep Them in Mind) | concise notes
JavaScript engine fundamentals: Shapes and Inline Caches · Mathias Bynens

Crossing the JS/C++ Boundary — Advanced NodeJS Internals — Part 1

A Quick Guide To Reading Node.js Core Source — Medium
Architecture of Node.js’ Internal Codebase — Yet Another Node.js Blog — Medium
How does NodeJS work? — Eugene Obrezkov

Garbage Collection

High-performance garbage collection for C++ · V8
Trash talk: the Orinoco garbage collector · V8
Getting garbage collection for free · V8

A tour of V8: Garbage Collection
Memory Management in V8, garbage collection and improvements - DEV Community
Forcing Garbage Collection in node.js and JavaScript • Open Source is Everything
A tour of V8: Garbage Collection — jayconrod.com
Understanding Garbage Collection and Hunting Memory Leaks in Node.js | Cloudbees Blog

Is the COST of JavaScript’s GC REALLY that high? - YouTube

Understanding Garbage Collection and hunting Memory Leaks in Node.js | Dynatrace blog
How to Self Detect a Memory Leak in Node - nearForm
Avoiding Memory Leaks in Node.js: Best Practices for Performance | AppSignal Blog
A surprising JavaScript memory leak found at Meteor accidental capturing of lexical environment

Tips and Tricks

i0natan/nodebestpractices: The largest Node.js best practices list (April 2019)

cjihrig/toolbag: preloaded Node.js tooling enhancements exposes reporting and command interface for analytics
continuationlabs/borland: hapi plugin for working with toolbag

Error Handling

Errors | Node.js Manual & Documentation
Checklist: Best Practices of Node.JS Error Handling – Yoni Goldberg
Joyent | Error Handling
Joyent | Debug

Absolute import

No More ../../../ Import in React - DEV Community

jsconfig.json:

{
  "compilerOptions": {
    "baseUrl": "src"
  },
  "include": ["src"]
}

#perfmatters

Benchmark.js
jonschlinkert/benchmarked: Easily generate benchmarks from a glob of files. Wrapper for Benchmark.js.

isaacs/node-bench
pierrec/node-visualbench
mcollina/fastbench: the simplest benchmark you can run on node
mcollina/loopbench: Benchmark your event loop
bench vs benchmark | Wyatt
davidmarkclements/0x: 🔥 single-command flamegraph profiling 🔥
ValYouW/njsTrace: A Node.js tracing and instrumentation utility

V8 JavaScript Engine: Concurrent marking in V8
How to track down CPU issues in Node.js - about:performance

Clinic.js - An Open Source Node.js performance profiling suite by NearForm
Keeping Node.js Fast: Tools, Techniques, And Tips For Making High-Performance Node.js Servers

jsPerf: JavaScript performance playground

Optimization killers · petkaantonov/bluebird Wiki

Performance: reaching ludicrous speed - nearForm Reaching Ludicrous Speed - YouTube
CPU Profiling in Production Node.js Applications - StackImpact

npm

npm Documentation
npm: A Free Guide for Beginners | CSS-Tricks - CSS-Tricks
A Beginner's Guide to npm — the Node Package Manager
9 Quick Tips About npm
10 Tips and Tricks That Will Make You an npm Ninja — SitePoint
The npm Blog — npm and front-end packaging
Tour of npm
npm forum

unpkg get file from package
10 Node Frameworks to Use in 2019 ― Scotch

# return the current `node_modules` folder
npm root
# prune modules
npm dedupe && npm prune

Module discovery

Search and Discover Great Node Modules - CenturyLink Cloud Developer Center
finding modules by substack

npm
npms
Openbase: choose the right package every time
npm - Libraries
npmsearch - node.js Package Search Utility
Scout JS
JS.coach
Better search for Node.js modules
Nipster! npm search tool for Node.js

Private registry

rlidwka/sinopia
Using private npm on Heroku | Nodejitsu Inc.
An Alternative to npm Private Modules host on GitHub/Bitbucket

require() algorithm

Modules Node.js Manual & Documentation
substack/node-resolve

Where Does Node.js And Require() Look For Modules?
The Node Way - How require() Actually Works

Git URL as dependencies

Git URLs as Dependencies | npm Documentation

git://github.com/user/project.git#commit-ish
git+ssh://user@hostname:project.git#commit-ish
git+ssh://user@hostname/project.git#commit-ish
git+http://user@hostname/project/blah.git#commit-ish
git+https://user@hostname/project/blah.git#commit-ish

GitHub repo can be simplified as user/repo:

{
  "name": "foo",
  "version": "0.0.0",
  "dependencies": {
    "express": "visionmedia/express",
    "mocha": "visionmedia/mocha#4727d357ea"
  }
}

System service

NicolaOrritos/probiotic: The simplified multi-workers daemon
NicolaOrritos/progenic: Multi-workers daemon module

Node Project

npm module maintainer must-haves
mattdesl/module-best-practices: some best practices for JS modules
Choosing and making quality npm modules | Yannick Croissant
Checklist for your new Open Source JavaScript Project

maxogden/maintenance-modules: a list of modules that are useful for maintaining or developing modules
HenrikJoreteg/fixpack: A package.json file scrubber for the truly insane. standard for package.json
feross/standard: JavaScript Standard Style

Semantic Versioning: Why You Should Be Using it — SitePoint
Design and Build Your Own JavaScript Library: Tips & Tricks
Advanced Node.js Project Structure Tutorial - via @codeship | via @codeship
Fractal — Nodejs app structure – codeburst

sindresorhus/node-module-boilerplate: Boilerplate to kickstart creating a Node.js module
sindresorhus/node-cli-boilerplate: Boilerplate to kickstart creating a Node.js command-line tool

Modern Modules – Mikeal – Medium
semantic-release/semantic-release: fully automated package publishing

Package Management

developers | npm Documentation
These 6 essential tools will release, version, and maintain your NPM modules for you
How to Upgrade Dependencies in Your package.json - Better Programming - Medium

dep bots:
Greenkeeper | Automate your npm dependency management bot to check if dependency update breaks your module
Dependabot
Depfu: Continuous automated dependency updates for Ruby and JavaScript bot that creates PR for updated dependency
dylang/npm-check: Check for outdated, incorrect, and unused dependencies.
tjunnone/npm-check-updates: Find newer versions of package dependencies than what your package.json or bower.json allows
Rever: Releaser of Versions!

FOSSA - Open Source Management for Modern Development multi-lingual, free-tier
Renovate | Automated Dependency Updates multi-lingual, no free-tier

nlf/git-validate
nlf/precommit-hook
observing/pre-commit: Automatically installs a git pre-commit script in your git repository which runs your npm test on pre-commit

mattdesl/module-best-practices: some best practices for JS modules
Command-line tips for effective release announcements | codeinthehole.com by David Winterbottom

nexe by jaredallard

Package Size

Package Phobia
styfle/packagephobia: ⚖️ Find the cost of adding a new dependency to your project

Import Cost - Visual Studio Marketplace

Publishing

see #es-modules

Blogged Answers: My Experience Modernizing Packages to ESM · Mark's Dev Blog ❗!important, 2023-08

{
  // NOT using `"type": "module"`
  // NOT using `"exports"`
  "main": "lib/redux.js", // CommonJS
  "unpkg": "dist/redux.js", // UMD
  "module": "es/redux.js", // ESM
  "files": ["dist", "lib", "es", "src", "index.d.ts"]
}

frehner/modern-guide-to-packaging-js-library: A guide to help ensure your JavaScript library is the most compatible, fast, and efficient library you can make.
Publish, ship, and install modern JavaScript for faster applications  |  Articles  |  web.dev

publint
Are The Types Wrong? - Tool for analyzing TypeScript types of npm packages
arethetypeswrong.github.io/packages/cli at main · arethetypeswrong/arethetypeswrong.github.io · GitHub

sindresorhus/np: A better npm publish
fastify/releasify: A tool to release in a simpler way your module
inikulin/publish-please: Safe and highly functional replacement for npm publish.
release-it/release-it: 🚀 Automate versioning and package publishing
wclr/yalc: Work with yarn/npm packages locally like a boss. local publish, batter than npm link

Publishing Node modules with TypeScript and ES modules - LogRocket Blog 2023-05, ESM/CJS chanllenges, RSC challenges
egoist/tsup: The simplest and fastest way to bundle your TypeScript libraries.

How to Build and Publish ES6 Modules Today, with Babel and Rollup — Medium 2016-05
What is npm’s prepublish, and why is it so confusing? — Greenkeeper Blog 2015-07
Publishing flat npm packages for easier import paths & smaller consumer bundle sizes - David Wells publish lib/ or dist/

# updates `package.json` and creates an commit
npm version patch
npm version premajor --preid alpha

# pack locally to verify what will be published
npm pack

# creates a tagged release
npm publish --tag next

# scoped package have private access (paid feature)
npm publish --access public
# or set .nvmrc
npm config set access public

prezto/zshrc at master · feross/prezto

alias patch='preversion && npm version patch && postversion'
alias minor='preversion && npm version minor && postversion'
alias major='preversion && npm version major && postversion'
alias preversion='git pull && git diff --exit-code && git diff --staged --exit-code && npm pack --dry-run --ignore-scripts && rm -rf node_modules/ && npm install && npm test'
alias postversion='git diff --exit-code && git diff --staged --exit-code && npm run --if-present update-authors && (git diff --exit-code || git commit -am "update authors") && npm run --if-present build && (git diff --exit-code || git commit -am "build") && git push --follow-tags && npm publish'

mikeal/merge-release: Automatically release all merges to master on npm.

package.json

package.json | npm Documentation
package.json: an interactive guide - browsenpm.org

Use ^ to lock to major version, ~ to lock to minor version. (npm help update)

You, me and package.json - DEV Community 👩‍💻👨‍💻

An In-Depth Explanation of package.json’s Dependencies
package.json 中 你还不清楚的 browser,module,main 字段优先级 - 个人文章 - SegmentFault 思否

Files in package

files in package.json
Keeping files out of your package

By default all files under the package tree will be published, with predefined blacklist and whitelist, and respects .npmignore (or .gitignore if .npmignore is absent).
You can specify files in package.json to define your own file list, this will also respects .npmignore (or .gitignore if .npmignore is absent).

shrinkwrap

obsolete by lock file

lockdown
shrinkwrap | npm Documentation

NPM - An intervention » Debuggable - Node.js Consulting
Managing Node.js Dependencies with Shrinkwrap | Node.js

Local Dev Dependency

Lerna · A tool for managing JavaScript projects with multiple packages.
Dombo/node-lerna-monorepo
Quramy/lerna-yarn-workspaces-example: How to build TypeScript mono-repo project with yarn and lerna
Solve code sharing and setup project with Lerna and monorepo - Michal Zalecki
Moving from multiple repositories to a lerna-js mono-repo | by Rohan Prabhu | Mitter.io Blog | Medium

Bit - Share and build with code components
Monorepos Made Simpler with Bit - Bits and Pieces

Yarn Workspaces: Organize Your Project’s Codebase Like A Pro — Smashing Magazine
Workspaces in Yarn | Yarn Blog
Workspaces | Yarn
Support Multiple Frameworks in a Monorepo - CSS-Tricks

guigrpa/oao: A Yarn-based, opinionated monorepo management tool

wclr/yalc: Work with yarn/npm packages locally like a boss.

boltpkg/bolt: ⚡️ Super-powered JavaScript project management

feross/zelda: Automatically npm link all your packages together! cannot get it work

Linters

Enforcing Code Quality for Node.js – Hacker Noon
Compare the Top 3 Style Guides and Set Them Up With ESLint

CI and Testing

Most Continuous Integration service provide badges.

see dev-testing.md#continuous-integration

Check-in dependencies?

Why we stopped vendoring our npm dependencies
shrinkwrap | npm Documentation

Visualize dependencies

pahen/madge - JavaScript
auchenberg/dependo

CryogenicPlanet/depp: ⚡ Check your npm modules for unused and duplicate dependencies fast

Node REPL

$ node
> console.log('Node is running');
Node is running
> .help
.break Sometimes you get stuck, this gets you out
.clear Alias for .break
.exit  Exit the repl
.help  Show repl options
.load  Load JS from a file into the REPL session
.save  Save all evaluated commands in this REPL session to a file
> .exit

node -i -e "$(< script.js)" to save the .load in REPL.

Try Nesh by danielgtaylor.

nesh> .help
.cls    Clear the screen
.history    Show command history
.versions   Show Node version information
break   Sometimes you get stuck, this gets you out
clear   Alias for .break
doc Shows documentation for an expression; you can also type Ctrl-Q in-line
exit    Exit the repl
help    Show repl options
load    Load JS from a file into the REPL session
require Require a module and assign it to a variable with the same name
save    Save all evaluated commands in this REPL session to a file
nesh> .exit

In the Wild

What are the biggest websites built with Node.js on the server side? - Quora
Why Walmart is using Node.js | VentureBeat | Dev | by J. O'Dell
Node at scale: What Google, Mozilla, & Yahoo are doing with Node.js | VentureBeat | Dev | by J. O'Dell
Projects, Applications, and Companies Using Node · nodejs/node-v0.x-archive Wiki