Skip to content

Commit

Permalink
Rewrite: Trello CLI 1.0 (#196)
Browse files Browse the repository at this point in the history
  • Loading branch information
mheap authored Nov 24, 2023
1 parent 29f7c07 commit 3c26457
Show file tree
Hide file tree
Showing 104 changed files with 8,885 additions and 8,972 deletions.
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
13 changes: 0 additions & 13 deletions .eslintrc

This file was deleted.

17 changes: 0 additions & 17 deletions .github/dependabot.yml

This file was deleted.

23 changes: 0 additions & 23 deletions .github/workflows/ci.yml

This file was deleted.

77 changes: 47 additions & 30 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,52 @@
name: NPM Publish
name: Release

on:
release:
types: [published]
push:
branches:
- main

concurrency: ${{ github.workflow }}-${{ github.ref }}

permissions: write-all

jobs:
build:
release:
name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.release.target_commitish }}
- name: Use Node.js 18
uses: actions/setup-node@v1
with:
node-version: 18
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: git config --global user.name "Michael Heap"
- run: git config --global user.email "[email protected]"
- run: npm version ${{ github.event.release.tag_name }}
- run: npm run build --if-present
- run: npm test --if-present
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- run: git push
env:
github-token: ${{ secrets.GITHUB_TOKEN }}
- run: git tag -f ${{ github.event.release.tag_name }} ${{ github.event.release.target_commitish }}
env:
github-token: ${{ secrets.GITHUB_TOKEN }}
- run: git push origin ${{ github.event.release.tag_name }} --force
env:
github-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- uses: pnpm/action-setup@v2
with:
version: 8
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
- name: Build packages
run: pnpm build
- name: Run tests
run: pnpm test

- name: Publish to npm
id: changesets
uses: changesets/action@v1
with:
publish: pnpm changeset publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
50 changes: 50 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Test

on:
push:
branches:
- typescript-v2
pull_request:
types:
- opened
- synchronize

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x]

env:
CI: true

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- uses: pnpm/action-setup@v2
with:
version: 8
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
- name: Build packages
run: pnpm build
- name: Run tests
run: pnpm test
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
.DS_Store
node_modules
config.json
packages/**/dist
packages/**/coverage
2 changes: 0 additions & 2 deletions .npmignore

This file was deleted.

9 changes: 9 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"files.exclude": {
"**/dist": true,
"**/node_modules": true,
"packages/**/jest.config.js": true,
"packages/**/tsconfig.build.json": true,
"packages/**/tsconfig.json": true
}
}
8 changes: 8 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## Running Tests

From the root directory:

```bash
pnpm build
pnpm test
```
21 changes: 0 additions & 21 deletions LICENSE

This file was deleted.

70 changes: 20 additions & 50 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,55 +1,32 @@
trello-cli is a CLI tool for [Trello](http://www.trello.com). Makes sense, right?
# Trello CLI

[![Build Status](https://api.travis-ci.org/mheap/trello-cli.svg?branch=master)](https://travis-ci.org/mheap/trello-cli)
## Installation

`trello-cli` requires a minimum NodeJS version of 14
> Trello CLI requires node 18+
# Installation

You can install this tool by running `npm install -g trello-cli`.
```bash
npm install -g trello-cli
```

If you're an Arch user, it's also available in the [Arch User Repository](https://aur.archlinux.org/packages/trello-cli/)

# Using trello-cli

* Run `npm install` in the same directory as `package.json` to install dependencies
* Run `./bin/trello` to generate basic config in your home directory.
* [Get an API key](https://trello.com/app-key) and put it in `~/.trello-cli/config.json`
* Run `./bin/trello refresh` to refresh the list of Trello boards and lists.
* Run `./bin/trello` + follow the instructions

If you get stuck, you can always run `./bin/trello --help` or `./bin/trello command --help`
## Usage

# If you installed globally
Instead of running `./bin/trello` just run `trello`.
You need to create a configuration file with an API key and token to use this CLI. Ensure that you're logged in to Trello and run `trello auth` to get started.

# Supported API commands
To see a list of available commands, run `trello --help`. Each command contains subcommands e.g.:

trello-cli currently supports the following commands:
- `trello card`
- `trello card:list`
- `trello card:create`
- `trello card:delete`
- And more

add-board Adds a new board with the specified name
add-card Add a card to a board
add-list Adds a new list to the spcified board with the specified name
add-webhook Add a webhook to a board
archive-card Archive a card from a board
assigned-to-me Show cards that are currently assigned to yourself, or any member specified
card-assign Add or remove a member to a card
card-details Show details about a specified card
close-board Closes those board(s) where the specified text occurs in their name
delete-card Remove a card from a board
delete-webhook Remove a webhook by ID
move-all-cards Move all cards from one list to another
move-card Move a card on a board
refresh Refresh all your board/list names
show-boards Show the list of cached boards
show-cards Show the cards on a list
show-labels Show labels defined on a board
show-lists Show the list of cached lists
show-webhooks display webhooks for current user applications
To see all available subcommands, run `trello <command> --help` e.g. `trello card --help`

# On Windows
### On Windows

Depending on how `node.js` is setup, you may not be able to run `trello` straight from the command line as shown above. To remedy that, add the following to your Powershell profile (type `$profile` at the Powershell prompt to find where your profile is stored):
Depending on how `node.js` is setup, you may not be able to run `trello` straight from the command line as shown above. To remedy that, add the following to your Powershell profile (type `$profile` at the Powershell prompt to find where your profile is stored):

function trello { & 'PATH_TO_NODE.EXE' 'PATH_TO_TRELLO_BIN' $args }

Expand All @@ -59,13 +36,6 @@ You will then have the `trello` command available anywhere.

# Examples

# Add card:
$ trello add-card -b "Inbox" -l "Inbox" "Quick card added from command line" -p bottom

# Move all cards:
$ trello move-all-cards -b "GTD" -l "Completed next actions" -c "GTD" -d "Completed next actions (Nov 2-8)"

# FAQ

**Archived lists aren't included when I run `trello refresh`**
By default archived lists are not returned by the API. Set the `TRELLO_CLI_LIST_FILTER` environment variable to `all` to include archived lists.
```bash
$ trello card:create --board "Inbox" --list "Inbox" --name "Quick card added from command line"
```
Loading

0 comments on commit 3c26457

Please sign in to comment.