1.0.0 • Published 4 years ago

get-project-tree v1.0.0

Weekly downloads
2
License
Apache-2.0
Repository
github
Last release
4 years ago

get-project-tree

Get the tree structure of a directory

Getting started

To use the get-project-tree as a dependency, install it to your project using:

npm install get-project-tree --save
# or:
yarn add get-project-tree

Usage:

import { getTree } from 'get-project-tree'

const treeInfo = getTree('<path-to-the-folder>', {
  // current working directory (process.cwd() is set by default)
  cwd: process.cwd(),
  // list of file/folder names to ignore
  ignore: ['node_modules', '.git'],
})

const treeString = treeInfo.toString(2) // here 2 is the indent size
console.log(treeString)

CLI usage

get-project-tree has a CLI command called project-tree. If you don't need to use the get-project-tree in your project, but just want to get the project tree, you can install it globally:

npm install -g get-project-tree
# or:
yarn global add get-project-tree

Then you can call project-tree like this:

project-tree --ignore node_modules --ignore .git --indent 4

More information about CLI usage:

project-tree --help
1.0.0

4 years ago