dspot-trello-gantt 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +128 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# dspot-trello-gantt
|
|
2
|
+
|
|
3
|
+
Generate Gantt chart HTML from a Trello board. Fetches cards via the Trello API, converts them to [Mermaid](https://mermaid.js.org/) Gantt syntax, and produces a standalone interactive HTML file.
|
|
4
|
+
|
|
5
|
+
Optionally publishes the result directly to a [Google Apps Script](https://script.google.com) web app so clients can access it via a stable URL.
|
|
6
|
+
|
|
7
|
+
## Quick Start
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g dspot-trello-gantt
|
|
11
|
+
trello-gantt-js init # creates a .env template in the current directory
|
|
12
|
+
# fill in .env with your credentials
|
|
13
|
+
trello-gantt-js generate # generates gantt.html
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install -g dspot-trello-gantt
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Requires Node.js 18 or later.
|
|
23
|
+
|
|
24
|
+
## Commands
|
|
25
|
+
|
|
26
|
+
### `generate` (default)
|
|
27
|
+
|
|
28
|
+
Fetches Trello data and generates a standalone HTML file.
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
trello-gantt-js generate [options]
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
| Option | Env variable | Description |
|
|
35
|
+
|---|---|---|
|
|
36
|
+
| `--board-id <id>` | `GANTT_BOARD_ID` | Trello board ID or URL |
|
|
37
|
+
| `--title <title>` | `GANTT_TITLE` | Chart title (default: `Project Gantt Chart`) |
|
|
38
|
+
| `--lists <names>` | `GANTT_LISTS` | Comma-separated list names to include. Empty = all lists |
|
|
39
|
+
| `--milestone-list <names>` | `GANTT_MILESTONE_LISTS` | Lists to group as milestones |
|
|
40
|
+
| `--output <path>` | `GANTT_OUTPUT` | Output file path (default: `gantt.html`) |
|
|
41
|
+
|
|
42
|
+
### `publish`
|
|
43
|
+
|
|
44
|
+
Generates the HTML and uploads it to a Google Apps Script web app. Clients access a stable URL that always shows the latest version.
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
trello-gantt-js publish [options]
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Accepts the same options as `generate` (except `--output`). Requires additional environment variables:
|
|
51
|
+
|
|
52
|
+
| Env variable | Description |
|
|
53
|
+
|---|---|
|
|
54
|
+
| `GAPPS_SCRIPT_ID` | Apps Script project ID |
|
|
55
|
+
| `GAPPS_DEPLOYMENT_ID` | Deployment ID (stable URL) |
|
|
56
|
+
| `GAPPS_ALLOWED_EMAILS` | Comma-separated email allowlist. Empty = public access |
|
|
57
|
+
|
|
58
|
+
On first run, a browser window opens for Google OAuth authorization. The token is cached in `credentials/token.json` for subsequent runs.
|
|
59
|
+
|
|
60
|
+
### `init`
|
|
61
|
+
|
|
62
|
+
Creates a `.env` template in the current directory.
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
trello-gantt-js init
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Configuration
|
|
69
|
+
|
|
70
|
+
All options can be set via a `.env` file in the working directory:
|
|
71
|
+
|
|
72
|
+
```env
|
|
73
|
+
# Trello
|
|
74
|
+
TRELLO_API_KEY=your_api_key
|
|
75
|
+
TRELLO_API_TOKEN=your_api_token
|
|
76
|
+
GANTT_BOARD_ID=https://trello.com/b/abc123/board-name
|
|
77
|
+
GANTT_LISTS=Backlog,To Do,Doing,Done
|
|
78
|
+
GANTT_OUTPUT=output/gantt.html
|
|
79
|
+
GANTT_TITLE=Project Gantt Chart
|
|
80
|
+
GANTT_MILESTONE_LISTS=Milestone 1,Milestone 2
|
|
81
|
+
|
|
82
|
+
# Google Apps Script (only needed for publish)
|
|
83
|
+
GAPPS_SCRIPT_ID=
|
|
84
|
+
GAPPS_DEPLOYMENT_ID=
|
|
85
|
+
GAPPS_ALLOWED_EMAILS=
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**Trello credentials:** get your API key and token at [trello.com/app-key](https://trello.com/app-key).
|
|
89
|
+
|
|
90
|
+
**Google credentials:** download an OAuth 2.0 client JSON from [Google Cloud Console](https://console.cloud.google.com) and save it as `credentials/google_oauth_client.json`.
|
|
91
|
+
|
|
92
|
+
> **Important:** the `credentials/` folder is listed in `.gitignore` and must never be committed. It contains OAuth secrets and cached tokens.
|
|
93
|
+
|
|
94
|
+
## Progress percentage
|
|
95
|
+
|
|
96
|
+
Add a `## Progress` section to a card's description to set completion:
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
## Progress
|
|
100
|
+
72
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Values 0–100. The `%` symbol is optional. No section = 0%.
|
|
104
|
+
|
|
105
|
+
## Programmatic usage
|
|
106
|
+
|
|
107
|
+
```typescript
|
|
108
|
+
import {
|
|
109
|
+
parseBoardId,
|
|
110
|
+
getCardsForLists,
|
|
111
|
+
mapCardsToGanttTasks,
|
|
112
|
+
validateTasks,
|
|
113
|
+
generateMermaidGantt,
|
|
114
|
+
renderHtml,
|
|
115
|
+
publishToAppsScript,
|
|
116
|
+
} from 'dspot-trello-gantt';
|
|
117
|
+
|
|
118
|
+
const boardId = parseBoardId('https://trello.com/b/abc123/my-board');
|
|
119
|
+
const fetchResult = await getCardsForLists(boardId);
|
|
120
|
+
const { tasks, warnings, stats, assigneeLegend } = mapCardsToGanttTasks(fetchResult.cardsByList);
|
|
121
|
+
const report = validateTasks(tasks, warnings, stats);
|
|
122
|
+
const mermaid = generateMermaidGantt(tasks, 'My Project');
|
|
123
|
+
const html = renderHtml(mermaid, report, { title: 'My Project', assigneeLegend });
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## License
|
|
127
|
+
|
|
128
|
+
MIT
|