Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,24 @@ updates:
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "npm"
directory: "/"
open-pull-requests-limit: 5
schedule:
interval: "weekly"
time: "12:00"
day: "sunday"
timezone: "America/Los_Angeles"
commit-message:
prefix: "fix"
prefix-development: "chore"
include: "scope"
groups:
dev-patch-minor-dependencies:
dependency-type: "development"
update-types:
- "patch"
- "minor"
ignore:
- dependency-name: "typescript"
update-types: ["version-update:semver-major"]
26 changes: 26 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: CI Test Suite

on:
push:
pull_request:
workflow_dispatch:

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node_version: ['22.x', '24.x']
os: [ubuntu-latest, macos-latest, windows-latest]
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node_version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node_version }}
cache: npm
- name: Install dependencies
run: npm ci
- name: Unit tests and lint
run: npm test
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,8 @@ spec/reports
test/tmp
test/version_tmp
tmp
.DS_Store
.DS_Store
node_modules/
dist/
*.tsbuildinfo
oclif.manifest.json
11 changes: 11 additions & 0 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"require": [
"./test/init.mjs",
"tsx"
],
Comment thread
k80bowman marked this conversation as resolved.
"watch-extensions": ["ts"],
"recursive": true,
"reporter": "spec",
"timeout": 15000,
"node-option": ["import=tsx/esm"]
}
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ We welcome contributions!
* Check for unnecessary whitespace with `git --diff` before commiting.
* Push your changes to a topic branch in the GitHub repository.
* Submit a pull request to the base branch.
* If you change TypeScript under `src/` or `test/`, run `npm install` and `npm test` (Node 22+).
96 changes: 70 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,57 +1,101 @@
# Dev Center CLI
# @heroku-cli/heroku-cli-plugin-devcenter

CLI to interact with Heroku's Dev Center
Heroku CLI plugin to interact with Heroku Dev Center

[![Version](https://img.shields.io/npm/v/@heroku-cli/heroku-cli-plugin-devcenter.svg)](https://npmjs.org/package/@heroku-cli/heroku-cli-plugin-devcenter)
[![License](https://img.shields.io/npm/l/@heroku-cli/heroku-cli-plugin-devcenter.svg)](https://github.com/heroku/devcenter-cli/blob/main/LICENSE.txt)

## Installation

$ gem install devcenter
```bash
heroku plugins:install @heroku-cli/heroku-cli-plugin-devcenter
```

<!-- usage -->
Comment thread
michaelmalave marked this conversation as resolved.
```sh-session
$ npm install -g @heroku-cli/heroku-cli-plugin-devcenter
$ heroku COMMAND
running command...
$ heroku (--version)
@heroku-cli/heroku-cli-plugin-devcenter/1.3.1 darwin-arm64 node-v24.14.0
$ heroku --help [COMMAND]
USAGE
$ heroku COMMAND
...
```
<!-- usagestop -->

## Commands

## Usage
<!-- commands -->
* [`heroku devcenter:open SLUG`](#heroku-devcenteropen-slug)
* [`heroku devcenter:preview SLUG`](#heroku-devcenterpreview-slug)

### Open a published article
## `heroku devcenter:open SLUG`

$ devcenter open error-pages
open a published Dev Center article in your browser

### Save a local copy of an article
```
USAGE
$ heroku devcenter:open SLUG [--prompt]

You can pull an article from its slug
ARGUMENTS
SLUG article slug (e.g. ps for https://devcenter.heroku.com/articles/ps)

$ devcenter pull article-slug
GLOBAL FLAGS
--prompt interactively prompt for command arguments and flags

or from its URL:
DESCRIPTION
open a published Dev Center article in your browser
```

$ devcenter pull https://devcenter.heroku.com/articles/article-slug
_See code: [src/commands/devcenter/open.ts](https://github.com/heroku/devcenter-cli/blob/v1.3.1/src/commands/devcenter/open.ts)_

This will save an `article-slug.md` text file in your local directory. The file includes some metadata (article title and id) followed by the article content in markdown format. You can edit both the title and the content, but **never overwrite the article id**.
## `heroku devcenter:preview SLUG`

### Preview a local copy of an article
preview a local Dev Center article in the browser with live reload

$ devcenter preview dynos
```
USAGE
$ heroku devcenter:preview SLUG [--prompt] [--host <value>] [--port <value>]

This will open a preview in your default browser and get it refreshed when you save the file. You can specify `--port` and `--host` options to customize the preview web server.
ARGUMENTS
SLUG article slug (local <slug>.md file)

### Update an article in Dev Center from a local file
FLAGS
--host=<value> [default: 127.0.0.1] bind host for the preview server
--port=<value> [default: 3000] port for the preview server

$ devcenter push dynos
GLOBAL FLAGS
--prompt interactively prompt for command arguments and flags

This will save the title and content from your local article in Dev Center, using your Heroku credentials from `~/.netrc`, which you can set by doing `heroku auth:login`.
DESCRIPTION
preview a local Dev Center article in the browser with live reload
```

### Help
_See code: [src/commands/devcenter/preview.ts](https://github.com/heroku/devcenter-cli/blob/v1.3.1/src/commands/devcenter/preview.ts)_
<!-- commandsstop -->

Get available commands
## Development

$ devcenter help
TypeScript code lives under `src/` with tests under `test/`. With Node 22+, run `npm install` and `npm test`.

Get help about a specific command
If you have a Dev Center instance, you can point your CLI to it by setting the `DEVCENTER_BASE_URL` environment variable:

$ devcenter help pull
```bash
export DEVCENTER_BASE_URL=http://localhost:3000
```

### Development
Verbose logging uses the [`debug`](https://www.npmjs.com/package/debug) package:

If you have a Dev Center instance, you can point your CLI to it by setting the `DEVCENTER_BASE_URL` env. var (e.g: `export DEVCENTER_BASE_URL=http://localhost:3000`).
```bash
DEBUG=devcenter:open heroku devcenter:open my-article
DEBUG=devcenter:preview heroku devcenter:preview my-article
DEBUG=devcenter:* heroku devcenter:open my-article
```

## License

See LICENSE.txt file.
See [LICENSE.txt](LICENSE.txt) file.

The `preview` command uses the [Font Awesome](http://fontawesome.io/) vector icons, which have their own [License](https://github.com/FortAwesome/Font-Awesome#license).
5 changes: 5 additions & 0 deletions bin/dev.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env -S node --loader ts-node/esm --disable-warning=ExperimentalWarning

import {execute} from '@oclif/core'

await execute({development: true, dir: import.meta.url})
7 changes: 0 additions & 7 deletions bin/devcenter

This file was deleted.

2 changes: 2 additions & 0 deletions bin/run.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@echo off
node "%~dp0\run.js" %*
5 changes: 5 additions & 0 deletions bin/run.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env node

import {execute} from '@oclif/core'

await execute({dir: import.meta.url})
3 changes: 3 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import herokuEslintConfig from '@heroku-cli/test-utils/eslint-config'

export default [...herokuEslintConfig]
Comment thread
michaelmalave marked this conversation as resolved.
Loading
Loading