---
name: "pkgjs-utils"
section: "1p"
platform: "linux"
package: "dh-nodejs"
version: "0.15.23"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/pkgjs-utils"
---

# pkgjs-utils(1p)

Nodejs package utilities

## NAME

pkgjs-utils - Nodejs package utilities

## SYNOPSIS

```
  $ cd node-glob
  $ pkgjs-utils main
    # prints: glob
  $ pkgjs-main
    # alias for pkgjs-utils main
  $ pkgjs-utils components_list
    # prints:
    #  globalyzer
    #  globrex
    #  tiny-glob
    #  types-glob
  $ pkgjs-utils modules_list
    # prints:
    #  globalyzer
    #  globrex
    #  tiny-glob
    #  @types/glob
  $ pkgjs-utils pjson .
    # prints: { <package.json content, serialized> }
  $ pkgjs-pjson .
    # alias for pkgjs-utils pjson .
  $ cd ../node-jest
  $ pkgjs-pjson packages/jest-diff
    # prints: { <packages/jest-diff/package.json content, serialized> }
  $ pkgjs-pjson packages/jest-diff version
    # prints: 27.2.5
  $ pkgjs-utils pjson . scripts test
    # prints: jest
  $ pkgjs-utils pjson packages/jest-diff scripts test
  $ pkgjs-utils ln webpack
    # prints: 'webpack linked into node_modules
  $ pkgjs-utils ln @types/node
    # prints: '@types/node' linked into node_modules
  $ pkgjs-ln @types/node
    # same as pkgjs-utils ln @types/node
  $ pkgjs-utils normalize_name @types/node
    # prints: types-node
  $ pkgjs-utils root_components_list (only components installed in nodejs dir)
  $ pkgjs-utils root_modules_list (same with module names)
  $ pkgjs-utils ordered_components_list (components in build order)
```

## DESCRIPTION

Collection of little commands to read \<component\>/package.json overridden by debian/nodejs/\<component\>/\* files.

### Available commands

- **link\_test\_modules**

  Link modules that are in the **debian/tests/test\_modules** directory into "node\_modules".

- **link\_external\_modules**

  Link Debian modules listed into **debian/nodejs/extlinks** into "node\_modules" and copy modules listed into **debian/nodejs/extcopies** into "node\_modules".

- **link\_internal\_modules**

  In multi-modules package *(with* ***uscan*** *components and/or lerna/workspace)*, link these modules into "node\_modules", except the "main" module.

- **link\_build\_modules**

  Link modules that are in the **debian/build\_modules** directory into "node\_modules".

- **clean\_test\_modules**

  Drop links created by **link\_test\_modules**.

- **clean\_external\_modules**

  Drop links/copies created by **link\_external\_modules**.

- **clean\_internal\_modules**

  Drop links created by **link\_internal\_modules**.

- **clean\_build\_modules**

  Drop links created by **link\_build\_modules**.

- **ln**

  Link the given Debian module into "node\_modules".

  If "-t" option is set, try to link the corresponding typescript declarations. For example:

  ```
      $ pkgjs-ln -t glob; pkgjs-ln -t abab
  ```

  creates "node\_modules/@types/glob" and "node\_modules/abab".

- **components\_list**

  Print the list of components (directories) without the "main" module.

- **modules\_list**

  Print the NPM names of components without the "main" module.

- **pjson**

  Reads the package.json *or package.yaml* of the given directory. If no arguments are given, it prints the serialized JSON content. If arguments are given, it tries to follow keys. For example:

  ```
      $ pkgjs-pjson packages/foo scripts run
  ```

  write the content of the subkey "run" of the key "scripts".

- **main**

  Print the NPM name of the "main" module.

- **packages\_list**

  Print the list of binary packages from "debian/control".

- **normalize\_name**

  Convert a NPM module name into a Debian compatible name. Examples:

  ```
      $ pkgjs-utils normalize_name @types/glob
      type-glob
      $ pkgjs-utils normalize_name @types/babel__type
      types-babel-type
      $ pkgjs-utils normalize_name require_optional
      require-optional
  ```

- **-h** **--help**

  - **-v** **--version**

  ## AUTHOR

Yadd \<yadd@debian.org\>

## COPYRIGHT AND LICENSE

Copyright (C) Yadd \<yadd@debian.org\>

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. . On Debian systems, the complete text of version 2 of the GNU General Public License can be found in \`/usr/share/common-licenses/GPL-2'
