Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ivteplo/get-project-tree
Get the tree structure of a directory
https://github.com/ivteplo/get-project-tree
cli javascript nodejs npm tree tree-structure yarn
Last synced: about 1 month ago
JSON representation
Get the tree structure of a directory
- Host: GitHub
- URL: https://github.com/ivteplo/get-project-tree
- Owner: ivteplo
- License: apache-2.0
- Created: 2020-07-20T10:11:25.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2020-07-20T10:23:42.000Z (over 4 years ago)
- Last Synced: 2024-10-16T17:05:29.083Z (3 months ago)
- Topics: cli, javascript, nodejs, npm, tree, tree-structure, yarn
- Language: JavaScript
- Homepage:
- Size: 7.81 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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:
```bash
npm install get-project-tree --save
# or:
yarn add get-project-tree
```Usage:
```javascript
import { getTree } from 'get-project-tree'const treeInfo = getTree('', {
// 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:
```bash
npm install -g get-project-tree
# or:
yarn global add get-project-tree
```Then you can call `project-tree` like this:
```bash
project-tree --ignore node_modules --ignore .git --indent 4
```More information about CLI usage:
```bash
project-tree --help
```