= Embedding some modules = {{{#!wiki red/solid This page is deprecated. Please use [[https://wiki.debian.org/Javascript/GroupSourcesTutorial]] }}} When we have modules that are unlikely to be needed by other modules we can include it inside another module. Later if other modules also need the embedded module, it can be packaged separately. See [[https://salsa.debian.org/js-team/node-tar|node-tar]] and [[https://salsa.debian.org/js-team/node-babel|node-babel]] source packages for using `pkg-components` tool and multiple tarballs. `node-tar` needs modules only during runtime (it uses `debian/components/install` script) and `node-babel` needs them during build (it uses `debian/components/build` script). Your package must use debhelper >= 11. 1. Create the directory `debian/components` and one sub directory for each component 1. The directory `debian/components` must be populated with the following files with their content: `build` `config` `copyright.in` `install` `test` 1. Each sub directory for each component must be populated with the following files with their content: `control` `copyright` `install` `version` `watch` 1. You can copy the files from the packages examples and adapt the content to your package 1. Declare build dependency on `pkg-components` 1. Call `dh_components` from `debian/rules` 1. Add `node_modules` directory to `debian/install` file and install your components in this directory. 1. Run `uscan-components --verbose` to download all orig.tar files or create it in manually (for example node-tar_4.4.6.orig-minizlib.tar.gz) 1. Add `debian/gbp.conf` with components info under `[DEFAULT]`. `component = ['serialize-javascript']` (See [[https://salsa.debian.org/js-team/node-copy-webpack-plugin/blob/master/debian/gbp.conf|node-copy-webpack-plugin]] as example) 1. Run `dpkg-source -b .` to generate .dsc file with the component tarball included. 1. Import the component tarball using `gbp import-dsc` and `pristine-tar commit` 1. Build the package with usual tools (`dpkg-buildpackage`). '''Deprecated method''' - Use pkg-components and multiple tarballs described above instead. See [[https://salsa.debian.org/js-team/node-clone-deep|node-clone-deep]] for an example. 1. Download the module from npmjs.com as given in [[Javascript/Nodejs/Npm2Deb#Option_1:_Download_via_npmjs.org_.28npm2deb_does_this_by_default.29]] 1. Extract and copy it to debian/node_modules 1. Add `debian/.gitignore` with this line: `!node_modules` 1. export NODE_PATH=debian/node_modules in debian/rules and debian/tests 1. Install the modules if it is a runtime dependency using `debian/install` file