node package manager

tradeship

tradeship

TODO: logo TODO: badges

tradeship statically analyzes your code for identifiers that aren't defined and finds the appropriate dependencies to import. It also removes imports that aren't used. tradeship is meant to be used as an editor plugin that manages your imports.

TODO: screenshot

Features

  • Imports dependencies from node.js standard libraries, npm packages listed in package.json, and other files within your project directory.
  • Determines properties that are exported by dependencies and imports them using destructuring syntax (e.g. const { readFile } = require("fs");).
  • Automatically identifies the style of your code and makes the imports match (e.g. single vs. double quotes, semicolons vs. no semicolons, var vs. let vs. const, etc.)
  • Statically analyzes files within your project directory to determine their exports.
  • Supports both CommonJS and ES6 modules. Can output require() or import syntax.

Installation

Install tradeship using npm or yarn. It's recommended to either install tradeship globally or make the local installation available on your path (e.g. by adding export PATH=node_modules/.bin:$PATH to your shell configuration), since editor plugins make use of the tradeship executable.

$ npm install -g tradeship
# or use yarn: 
$ yarn global add tradeship

Then, install the editor plugin of your choice:

Each editor plugin has instructions on how to run tradeship on the current file being edited. You can also configure each plugin to run tradeship on save. See the respective links above for more information.

The first time tradeship runs in a project directory with many JavaScript files, it'll take some time to parse and cache dependencies. Future runs will be much faster.

Command Line Interface (CLI)

TODO: cli docs

Configuration

TODO: configuration

How it works

TODO: how it works

License

TODO: license LICENSE