@devmcee/folder-content-map

1.0.6 • Public • Published

folder-content-map

Scans folder recursivly and generates a map of the inner items.

Install

npm i @devmcee/folder-content-map

Usage example:

const { folderStructureMap } = require('@devmcee/folder-content-map');

const structure = await folderStructureMap('src', ['.js', '.scss']);

console.log(structure)

Example data output:

[
  {
    type: 'directory',
    parent: './src',
    itemPath: '/home/devmcee/dev/folder-content-map/src/components',
    name: 'components',
    innerItems: [
      {
        type: 'file',
        parent: '/home/devmcee/dev/folder-content-map/src/components',
        itemPath: '/home/devmcee/dev/folder-content-map/src/components/index.js',
        name: 'index.js',
        innerItems: []
      }
    ]
  }
]

There is an executable script that can be called with npx:

npx folder-content-map --dir src 
Options:
      --help     Show help                                             [boolean]
      --version  Show version number                                   [boolean]
  -d, --dir      directory name, relative path, default is current (./)
  -e, --ext      extensions separated by coma to be included into the output map

Examples:
  generate.js --dir src/components --ext .js,.css,.scss

Readme

Keywords

Package Sidebar

Install

npm i @devmcee/folder-content-map

Weekly Downloads

0

Version

1.0.6

License

ISC

Unpacked Size

4.71 kB

Total Files

4

Last publish

Collaborators

  • devmcee