1.0.6 • Published 1 year ago

@devmcee/folder-content-map v1.0.6

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

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
1.0.6

1 year ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago