Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dir2pkg

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dir2pkg

dir2pkg

  • 1.0.0-beta.2
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

dir2pkg

Small CLI to help to split big JS codebases into packages.

Moves dirs, creates boilerplate and creates the "dependencies" field of the new package with these benefits:

  • 🧹 dependencies used in the code but missing from the package.json are added.
  • ➕ only dependencies used in the code are listed.
  • ➖ dependencies not used in the code are removed.

demo of dir2pkg

Install

Node.js v16.13 or newer is required.

Via the yarn client:

$ yarn global add dir2pkg

Via the npm client:

$ npm install -g dir2pkg

Usage

$ dir2pkg --in-dir some-dir --out-dir packages/some-dir --pkg-json-name "@org/new-pkg" --pkg-json-path ./package.json
--in-dir, -i
$ dir2pkg --in-dir some-dir

In directory

--out-dir, -o
$ dir2pkg --out-dir packages/some-dir

Out directory

--pkg-json-name, -n
$ dir2pkg --pkg-json-name "@org/new-pkg"

Package name

--pkg-json-path, -j
$ dir2pkg --pkg-json-path ./package.json

Host package.json path

--ignore, -d
$ dir2pkg --ignore "shared" --ignore "@org/internal-alias"

List of dependencies to ignore. Useful for ignoring internal alias that can't be resolved to one node_modules dep.

--force-peer-dep, -f
$ dir2pkg --force-peer-dep react --force-peer-dep react-dom

List of dependencies to force as peer dependencies. Useful for libraries like react.

Development

# install deps
$ yarn
# build and watch for changes
$ yarn build --watch
# link dir2pkg globally
$ yarn link
# enjoy!
$ dir2pkg --help

FAQs

Package last updated on 03 May 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc