Node.js
Node.js is a platform built on Chrome's JavaScript runtime for easy building of fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.
Packaging modules
On Debian systems up to and including Stretch (Debian 9), Node.js modules are located in:
/usr/lib/nodejs/<module_name>
For Debian Buster (to become Debian 10), Node.js modules are now located in:
/usr/lib/node/<module_name>
For more information about packaging a node module for Debian (and the reasons for the change of location for nodejs modules) please take a look at these pages:
npm2deb: an automatic tool to easily and quickly deploy debian packages starting from npm information
manual: an overview about best practice and policies in packaging nodejs modules in debian systems
Complex modules
For complex modules, which have many dependencies to be satisfied, you may want to track your work in this wiki in order to keep javascript team updated about.
For more information, please take a look at Tasks page.
Using build tools like grunt
grunt package has a patch to load global modules. Just call grunt in override_dh_auto_build in debian/rules.
gulp package has a patch to load global modules by default. Just call gulp in override_dh_auto_build in debian/rules.
babeljs command is provided by babeljs. See node-d3-color for an example of using babel. Just call babeljs in override_dh_auto_build in debian/rules.
webpack package needs using a webpack.config.js to resolve global modules, see gitlab and node-mocha for config files.
Use this as debian/webpack.config.js
1 'use strict';
2
3 var fs = require('fs');
4 var path = require('path');
5 var webpack = require('webpack');
6
7 var config = {
8
9 target: 'web',
10 resolve: {
11 modules: ['/usr/lib/nodejs', '.'],
12 },
13 resolveLoader: {
14 modules: ['/usr/lib/nodejs'],
15 },
16 node: {
17 fs: 'empty'
18 },
19 output: {
20 libraryTarget: 'umd'
21 },
22 module: { rules: [ { use: [ 'babel-loader' ] } ] }
23 }
24
25 module.exports = config;
and call webpack from debian/rules
browserify and rollup can be replaced by webpack. rollup -g equivalent.
use cake.coffeescript command if you have Cakefile. Just call cake.coffeescript in override_dh_auto_build in debian/rules.