UNPKG

scaffdir

Version:

Generate folders and files from a simple tree

91 lines (63 loc) โ€ข 2.33 kB
# scaffdir ๐Ÿ“ **scaffdir** is a command-line tool that generates folders and files from a simple text-based tree structure. It's perfect for scaffolding project directories or quickly mocking up file structures. --- ## โœจ Features - ๐Ÿ“‚ Create nested folders and files from a `.txt` file - ๐Ÿ’ก Supports dry-run mode to preview what will be created - ๐Ÿ’ฌ Friendly output with emoji and color (uses `chalk`) - ๐Ÿง  Smart parsing of indentation-based tree structures - ๐Ÿ”— Easily installable as a global CLI tool --- ## ๐Ÿš€ Installation You can install `scaffdir` globally using npm: ```bash npm install -g scaffdir ``` ## ๐Ÿ› ๏ธ Usage The tool accepts the following flags - ๐Ÿ“„ `-f --file <file>` (Required) Path to the input file describing the folder/file tree structure. - ๐Ÿ“‚ `-o --output <dir>` Output directory where structure should be created (defaults to current dir) - ๐Ÿงช `-d, --dry-run` Show what would be created without making any changes on disk. - `-V, --version` Display the current version - `-h, --help` Show help message Use the flags together like below: ```bash scaffdir -f <structure.txt> [-o <output-directory>] [--dry-run] ``` ## ๐Ÿ“„ Example Input File Here's an example of what the input text file might look like ```bash my-app/ index.html src/ main.js utils.js styles/ main.css README.md ``` Use 2 spaces for indentation. Folder names should end with a `/` ## โœ… Example Usage ### ๐Ÿงช Dry Run ```bash scaffdir -f structure.txt --dry-run ``` ### Output ```bash ๐Ÿ“‚ Reading structure from: structure.txt... ๐Ÿ“‚ Output directory: /your/current/dir ๐Ÿ“ Would create folder: /your/current/dir/my-app ๐Ÿ“„ Would create file: /your/current/dir/my-app/index.html ๐Ÿ“ Would create folder: /your/current/dir/my-app/src ๐Ÿ“„ Would create file: /your/current/dir/my-app/src/main.js ๐Ÿ“„ Would create file: /your/current/dir/my-app/src/utils.js ๐Ÿ“ Would create folder: /your/current/dir/my-app/styles ๐Ÿ“„ Would create file: /your/current/dir/my-app/styles/main.css ๐Ÿ“„ Would create file: /your/current/dir/my-app/README.md ``` ## ๐Ÿ›  Create Structure ```bash scaffdir -f structure.txt -o ./generated-project ``` ## ๐Ÿ“ License MIT License ยฉ Damain Gabriel