find-node-modules-assets

v0.0.5arrow_drop_down
v0.0.5
v0.0.4
v0.0.3
v0.0.2
v0.0.1
STATUS
Passing
DOWNLOADS
372
VISIBILITY
Public
PUBLISHED
5 years ago
SIZE
35 KB
find nested bins and install scripts in a node_modules folder
1 contributor
Install find-node-modules-assets as a package?
Copied
npm i @bit/bit.packages.find-node-modules-assets
Set Bit as a scoped registryLearn more
npm config set '@bit:registry' https://node.bit.cloud
Component Example
React
React
Vue
Angular
React Native
Add dependency... help_outline
Just
import
any of the 1 million components
and packages in Bit or NPM to the example.
import Button from '@bit/grommet.grommet.button';
import Lodash from 'lodash';
toggle layout
chevron_left
chevron_right

find-node-modules-assets

Traverses a node_modules folder, finding all install scripts and bins in it

Usage

const {
  findNodeModulesAssets
} = require('@bit/bit.packages.find-node-modules-assets')

async function main () {
  let assets = {}
  const nmFolder = '/path/to/node_modules'
  await findNodeModulesAssets(nmFolder, assets)
  console.log(assets)
  // output:
  //
  // {
  //   bins: {
  //     '/path/to/node_modules/package1': {
  //       bin: 'foo.js'
  //     }
  //   },
  //   installScripts: {
  //     '/path/to/node_modules/package1': {
  //       postinstall: 'echo "I was installed!"'
  //     }
  //   }
  // }

main()
Help and resources