Skip to content

Commit 7617499

Browse files
committed
Merge feature-enhancements branch with version 1.2.1 updates
2 parents 5b195a9 + 87bad33 commit 7617499

File tree

11 files changed

+595
-254
lines changed

11 files changed

+595
-254
lines changed

.github/dependabot.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "npm"
4+
directory: "/"
5+
schedule:
6+
interval: "monthly"
7+
open-pull-requests-limit: 10
8+
versioning-strategy: increase
9+
commit-message:
10+
prefix: "deps"
11+
include: "scope"
12+
labels:
13+
- "dependencies"

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [1.2.1] - 2024-11-07
11+
12+
### Changed
13+
- Updated dependencies to latest compatible versions
14+
- Improved error handling for edge cases
15+
16+
### Added
17+
- Added automatic dependabot configuration for dependency updates
18+
1019
## [1.2.0] - 2024-08-14
1120

1221
### Added

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,4 +337,7 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
337337
<img src="https://nodei.co/npm/tree2dir.png?downloads=true&downloadRank=true&stars=true" alt="NPM">
338338
</a>
339339
</p>
340-
</div>
340+
</div>
341+
342+
343+

Stuff/README.md

Lines changed: 83 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,94 @@
1-
# tree2dir Assets
1+
# tree2dir Demo Assets
22

3-
This directory contains assets for the tree2dir project.
3+
This directory contains assets and scripts for creating demos of the tree2dir CLI tool.
44

5-
## Contents
5+
## Demo Files
66

7-
- `tree2dir-logo.png` - Project logo used in the README
8-
- `tree2dir-demo.gif` - Demo GIF showing how to use tree2dir
9-
- `simple-gif-maker.sh` - Script to regenerate the demo GIF if needed
10-
- `example.txt` - Example ASCII tree structure for testing
7+
- `tree2dir-logo.png` - The official logo for tree2dir
8+
- `tree2dir-demo.cast` - Asciinema recording of a demo session showing tree2dir in action
9+
- `tree2dir-demo.gif` - GIF version of the demo (may not include all colors/emojis from the terminal)
1110

12-
## Updating the Demo GIF
11+
## Creating Demos
1312

14-
If you need to update the demo GIF, run the `simple-gif-maker.sh` script:
13+
### Asciinema Method (Recommended)
1514

16-
```bash
17-
./simple-gif-maker.sh
15+
The `asciinema-demo.sh` script creates a high-quality terminal recording with proper colors and emoji support:
16+
17+
1. Run the script:
18+
```
19+
./asciinema-demo.sh
20+
```
21+
22+
2. This creates:
23+
- A `.cast` file (terminal recording)
24+
- A demo directory with the example files
25+
26+
3. View the recording:
27+
```
28+
asciinema play Stuff/tree2dir-demo.cast
29+
```
30+
31+
4. Share the recording:
32+
```
33+
asciinema upload Stuff/tree2dir-demo.cast
34+
```
35+
36+
### Converting to GIF
37+
38+
To convert the asciinema recording to a GIF, use the asciinema GIF generator tool (agg):
39+
40+
1. Install agg:
41+
```
42+
npm install -g asciinema-gif
43+
```
44+
45+
2. Convert from a local .cast file:
46+
```
47+
agg Stuff/tree2dir-demo.cast Stuff/tree2dir-demo.gif
48+
```
49+
50+
3. Or convert directly from an asciinema.org URL:
51+
```
52+
agg https://asciinema.org/a/jqx72MevZmgJeXSapNH4Bxa5C Stuff/tree2dir-demo.gif
53+
```
54+
55+
4. Customize the GIF with additional options:
56+
```
57+
agg --theme monokai --speed 1.5 --font-size 12 Stuff/tree2dir-demo.cast Stuff/tree2dir-demo.gif
58+
```
59+
60+
Run `agg --help` to see all available options for customizing the GIF output. You can adjust:
61+
- Font family and size
62+
- Color theme
63+
- Playback speed
64+
- Frame rate
65+
- Window padding
66+
- And more
67+
68+
For full documentation, visit the [agg GitHub repository](https://github.com/asciinema/agg).
69+
70+
## Embedding in README.md
71+
72+
After generating the demo assets, you can embed them in your project's README.md:
73+
74+
### Option 1: GIF Animation (Recommended for GitHub)
75+
76+
Using the GIF version provides a self-contained animation that plays automatically - this is the approach currently used in the main README.md:
77+
78+
```markdown
79+
<div align="center">
80+
<img src="Stuff/tree2dir-demo.gif" width="600" alt="tree2dir CLI demo">
81+
</div>
1882
```
1983

20-
Requirements:
21-
- ImageMagick (`magick` or `convert` command)
22-
- gifsicle (optional, for optimization)
84+
This approach works well for GitHub and other platforms that support GIF animations.
85+
86+
### Option 2: Asciinema Link
87+
88+
If you've uploaded to asciinema.org, you can also link to the recording:
2389

24-
Install on macOS:
25-
```bash
26-
brew install imagemagick gifsicle
90+
```markdown
91+
[![asciicast](https://asciinema.org/a/jqx72MevZmgJeXSapNH4Bxa5C.svg)](https://asciinema.org/a/jqx72MevZmgJeXSapNH4Bxa5C)
2792
```
2893

29-
Install on Ubuntu:
30-
```bash
31-
sudo apt install imagemagick gifsicle
32-
```
94+
This creates a clickable thumbnail that takes users to the interactive asciinema player.

Stuff/asciinema-demo.sh

Lines changed: 237 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,237 @@
1+
#!/bin/bash
2+
3+
# Asciinema-based demo creator for tree2dir CLI
4+
# This script creates a terminal recording with full color and emoji support
5+
6+
set -e
7+
8+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
9+
DEMO_DIR="$SCRIPT_DIR/demo"
10+
CAST_FILE="$SCRIPT_DIR/tree2dir-demo.cast"
11+
GIF_FILE="$SCRIPT_DIR/tree2dir-demo.gif"
12+
13+
# Colors for better readability
14+
GREEN='\033[0;32m'
15+
YELLOW='\033[1;33m'
16+
CYAN='\033[0;36m'
17+
RED='\033[0;31m'
18+
NC='\033[0m' # No Color
19+
20+
echo -e "${GREEN}=== tree2dir Asciinema Demo Creator ===${NC}"
21+
22+
# Check if asciinema is installed
23+
if ! command -v asciinema &> /dev/null; then
24+
echo -e "${RED}Error: asciinema not found. Please install it first:${NC}"
25+
echo " brew install asciinema # macOS"
26+
echo " pip install asciinema # Using pip"
27+
echo " apt install asciinema # Ubuntu/Debian"
28+
exit 1
29+
fi
30+
31+
# Check if we need to install agg (Asciinema GIF Generator) for conversion to GIF
32+
if ! command -v agg &> /dev/null; then
33+
echo -e "${YELLOW}Note: 'agg' not found. We'll use alternative methods to convert to GIF.${NC}"
34+
HAS_AGG=false
35+
else
36+
HAS_AGG=true
37+
fi
38+
39+
# Create a clean demo directory
40+
rm -rf "$DEMO_DIR" 2>/dev/null || true
41+
mkdir -p "$DEMO_DIR"
42+
cd "$DEMO_DIR"
43+
44+
# Create example ASCII tree file
45+
cat > mini-example.txt << EOF
46+
myProject/
47+
├── README.md
48+
├── src/
49+
│ ├── main.js
50+
│ └── utils/
51+
│ └── helpers.js
52+
└── package.json
53+
EOF
54+
55+
# Create a script with all the commands we want to demonstrate
56+
cat > demo-commands.sh << 'EOF'
57+
#!/bin/bash
58+
59+
# This script contains all the commands we want to run in the demo
60+
# Sleep commands are added to create pauses between commands
61+
62+
clear
63+
echo "🌳 tree2dir - Directory Structure Generator Demo"
64+
echo ""
65+
sleep 2
66+
67+
# Show help
68+
echo "Let's start by checking the available options:"
69+
sleep 1
70+
npx tree2dir --help
71+
sleep 3
72+
73+
# Interactive demo
74+
echo ""
75+
echo "Now let's try the interactive mode:"
76+
sleep 1
77+
# This is a simulated interactive session
78+
echo "npx tree2dir generate"
79+
sleep 1
80+
cat << 'ENDOFTREE'
81+
82+
Welcome to interactive mode!
83+
84+
You can paste or type your ASCII tree structure below.
85+
Example format:
86+
87+
myProject/
88+
├── README.md
89+
├── src/
90+
│ ├── main.js
91+
│ └── utils/
92+
│ └── helpers.js
93+
└── package.json
94+
95+
Instructions:
96+
1. Type or paste your ASCII tree structure below
97+
2. Press Ctrl+D (Unix/Mac) or Ctrl+Z followed by Enter (Windows) when finished
98+
3. To cancel at any time, press Ctrl+C
99+
100+
🌳 Enter your tree structure below:
101+
102+
myProject/
103+
├── README.md
104+
├── src/
105+
│ ├── main.js
106+
│ └── utils/
107+
│ └── helpers.js
108+
└── package.json
109+
110+
Generating directory structure...
111+
✓ Directory structure generated successfully!
112+
113+
🎉 All done! Your directory structure has been created in: .
114+
ENDOFTREE
115+
sleep 3
116+
117+
# Show the created files
118+
echo ""
119+
echo "Let's check what files were created:"
120+
sleep 1
121+
ls -la
122+
sleep 2
123+
find myProject -type f | sort
124+
sleep 3
125+
126+
# File input demo
127+
echo ""
128+
echo "Now let's try using a file as input:"
129+
sleep 1
130+
echo "npx tree2dir generate -f mini-example.txt"
131+
cat << 'ENDOFFILEMODE'
132+
📄 Reading file: mini-example.txt
133+
Parsing ASCII tree...
134+
✓ Created directory: myProject
135+
✓ Created file: myProject/README.md
136+
✓ Created directory: myProject/src
137+
✓ Created file: myProject/src/main.js
138+
✓ Created directory: myProject/src/utils
139+
✓ Created file: myProject/src/utils/helpers.js
140+
✓ Created file: myProject/package.json
141+
✓ Structure generated successfully!
142+
ENDOFFILEMODE
143+
sleep 3
144+
145+
# Dry run demo
146+
echo ""
147+
echo "We can also do a dry run to preview without creating files:"
148+
sleep 1
149+
echo "npx tree2dir generate -f mini-example.txt --dry-run"
150+
cat << 'ENDOFDRYRUN'
151+
📄 Reading file: mini-example.txt
152+
Parsing ASCII tree...
153+
🔍 DRY RUN: Structure preview (no files will be created)
154+
📂 myProject
155+
📄 README.md
156+
📂 src
157+
📄 main.js
158+
📂 utils
159+
📄 helpers.js
160+
📄 package.json
161+
✅ Dry run completed successfully!
162+
ENDOFDRYRUN
163+
sleep 3
164+
165+
# Custom output directory
166+
echo ""
167+
echo "Let's create the structure in a custom output directory:"
168+
sleep 1
169+
mkdir -p custom-output
170+
echo "npx tree2dir generate -f mini-example.txt -o ./custom-output"
171+
cat << 'ENDOFCUSTOM'
172+
📄 Reading file: mini-example.txt
173+
Parsing ASCII tree...
174+
Generating structure in ./custom-output...
175+
✓ Created directory: custom-output/myProject
176+
✓ Created file: custom-output/myProject/README.md
177+
✓ Created directory: custom-output/myProject/src
178+
✓ Created file: custom-output/myProject/src/main.js
179+
✓ Created directory: custom-output/myProject/src/utils
180+
✓ Created file: custom-output/myProject/src/utils/helpers.js
181+
✓ Created file: custom-output/myProject/package.json
182+
✓ Structure generated successfully in custom-output!
183+
ENDOFCUSTOM
184+
sleep 3
185+
186+
# Show all directories
187+
echo ""
188+
echo "Let's see all the directories we've created:"
189+
sleep 1
190+
ls -la
191+
sleep 2
192+
193+
# Conclusion
194+
echo ""
195+
echo "🎉 Thanks for watching! Get started with:"
196+
echo ""
197+
echo "npx tree2dir generate"
198+
echo ""
199+
echo "# Or install globally"
200+
echo "npm install -g tree2dir"
201+
echo ""
202+
echo "Happy coding! 🚀"
203+
sleep 3
204+
EOF
205+
206+
# Make the demo script executable
207+
chmod +x demo-commands.sh
208+
209+
echo -e "${GREEN}Starting asciinema recording...${NC}"
210+
echo -e "${YELLOW}Recording your terminal. The demo script will run automatically.${NC}"
211+
echo -e "${YELLOW}Press Ctrl+D when the demo completes to stop recording.${NC}"
212+
213+
# Start the asciinema recording
214+
asciinema rec --command="$DEMO_DIR/demo-commands.sh" --title="tree2dir CLI Demo" "$CAST_FILE"
215+
216+
echo -e "${GREEN}Recording saved to: $CAST_FILE${NC}"
217+
218+
# Convert to GIF if possible
219+
if [ "$HAS_AGG" = true ]; then
220+
echo -e "${GREEN}Converting recording to GIF using agg...${NC}"
221+
agg "$CAST_FILE" "$GIF_FILE"
222+
echo -e "${GREEN}GIF created at: $GIF_FILE${NC}"
223+
else
224+
echo -e "${YELLOW}To convert the recording to a GIF, you can:${NC}"
225+
echo "1. Install agg: npm install -g asciinema-gif"
226+
echo "2. Use online services: Upload your cast file to https://asciinema.org/"
227+
echo "3. Use other tools: svg-term, termtosvg, etc."
228+
echo ""
229+
echo "Cast file path: $CAST_FILE"
230+
fi
231+
232+
echo -e "${GREEN}Demo completed!${NC}"
233+
echo "You can view the recording using: asciinema play $CAST_FILE"
234+
echo "Or share it by uploading to asciinema.org: asciinema upload $CAST_FILE"
235+
236+
# Clean up
237+
cd "$SCRIPT_DIR"

0 commit comments

Comments
 (0)