Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zcong1993/pkg-reflector
Find and install the npm modules your js files used
https://github.com/zcong1993/pkg-reflector
installer node nodejs npm npm-module pkg pkg-reflector yarn
Last synced: about 23 hours ago
JSON representation
Find and install the npm modules your js files used
- Host: GitHub
- URL: https://github.com/zcong1993/pkg-reflector
- Owner: zcong1993
- License: mit
- Created: 2017-01-12T15:38:48.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-02-08T02:25:27.000Z (over 6 years ago)
- Last Synced: 2024-10-14T06:40:17.863Z (25 days ago)
- Topics: installer, node, nodejs, npm, npm-module, pkg, pkg-reflector, yarn
- Language: JavaScript
- Homepage:
- Size: 232 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pkg-reflector
[![Build Status](https://img.shields.io/circleci/project/zcong1993/pkg-reflector/master.svg?style=flat)](https://circleci.com/gh/zcong1993/pkg-reflector) [![NPM version](https://img.shields.io/npm/v/pkg-reflector.svg?style=flat-square)](https://npmjs.com/package/pkg-reflector) [![npm](https://img.shields.io/npm/dm/pkg-reflector.svg)](https://www.npmjs.com/package/pkg-reflector)
[![npm](https://img.shields.io/npm/dt/pkg-reflector.svg)](https://www.npmjs.com/package/pkg-reflector)
[![David](https://img.shields.io/david/zcong1993/pkg-reflector.svg)](https://david-dm.org/zcong1993/pkg-reflector)> Find and install the npm modules your js files used
---
## New
- use flag `--custom-cmds="external install tool"` override the install command, eg: `--custom-cmds="cnpm install"`
- use flag `--dry` to dry run, show the finded npm modules
- use flag `--npm` or `--yarn` choose installing tool (default: prefer `yarn` if available)
- support alias `prf` for `pkg-reflector`
- now support multi files, can be used like `pkg-reflector src/* libs/* *.js`, resolve files using [globby](https://github.com/sindresorhus/globby) and always ignore `**/node_modules/**`
## Install
```sh
$ npm install -g pkg-reflector
# using yarn
$ yarn global add pkg-reflector
```## Feature
Sometimes, we copy some js file from other folder or project, such as `rollup.config.js`,you only want to use it in your current project.
If the js file depends some npm modules, you should install these first by yourself, like this:
```sh
$ yarn add module1 module2 module3...
```we may get some error when add modules cause wrong spelling of the long module name, so use `pkg-reflector`, you can do it like this:
```sh
$ prf foo.js
# then all done
```easy way, isn't it ?
## Usage
```sh
$ prf [options]
# use 'prf -h' for more help
```### simple
```sh
$ prf
```will install the pkgs and save `dependence`.
### multi files
```sh
$ prf file1 file2 ...
```or use `patterns` all [sindresorhus/globby](https://github.com/sindresorhus/globby) support
```sh
$ prf "./**/*.js"
```
*Note:* you should pass args as string `"./**/*.js"`, not `./**/*.js`(this will be executed by terminal, if it contains `node_modules` folder maybe cause error `zsh: argument list too long`)