Skip to content

Commit 598c37d

Browse files
k80bowmansbosio
andauthored
refactor!: migrate plugin to oclif/core v2 (#132)
* chore: update package.json and dependencies * chore: add tsconfig * refactor: migrate lib commands to TS * refactor: migrate clone command to oclif/core * refactor: migrate download command to oclif/core * refactor: migrate reset command to oclif/core * refactor: add dyno lib functions * refactor: migrate the gc command to oclif/core * refactor: migrate purge_cache command to oclif/core * test: set up for unit tests * refactor: move commands to repo directory * feat: add bin files for running commands locally * chore: add .mocharc and .tool_versions and update .gitignore * refactor: remove commands from wrong location * refactor: remove mocha config from package.json * test: add tests for repo:clone * test: add tests for repo:download * test: clean up repo:download tests * test: remove nock from repo:download test * test: add tests for repo:gc * refactor: rename repo:purge_cache, add alias and tests * test: add tests for repo:reset * refactor: udpdate getRelease function to call 3.sdk * test: add tests for repo lib functions and remove unneeded functions * test: add tests for download lib function and cleanup * refactor: remove js files and clean up deps and repo * chore: add ci workflow * refactor: delete index.js * chore: set up linting and fix linting errors * refactor: fixes * test: fix repo:reset test * fix: add auth for repo:reset command * refactor: update scripts and package readme * refactor: update files to refer to /dist Co-authored-by: Santiago Bosio <[email protected]> * chore: update and remove unneeded dependencies --------- Co-authored-by: Santiago Bosio <[email protected]>
1 parent c7b0f2d commit 598c37d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+7474
-1646
lines changed

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
coverage
2+
dist

.eslintrc

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"extends": [
3+
"oclif",
4+
"oclif-typescript",
5+
"plugin:mocha/recommended"
6+
],
7+
"ignorePatterns": ["**/test/**/*.js"],
8+
"parser": "@typescript-eslint/parser",
9+
"parserOptions": {
10+
"ecmaVersion": 6,
11+
"sourceType": "module",
12+
"ecmaFeatures": {
13+
"modules": true
14+
}
15+
},
16+
"plugins": [
17+
"import",
18+
"mocha"
19+
],
20+
"rules": {
21+
"@typescript-eslint/ban-ts-comment": "warn",
22+
"@typescript-eslint/explicit-module-boundary-types": "off",
23+
"@typescript-eslint/no-empty-function": "off",
24+
"camelcase":"off",
25+
"indent": ["error", 2, {"MemberExpression": 1}],
26+
"import/no-named-as-default": "warn", // TODO: fix issues and turn this back on
27+
"mocha/no-mocha-arrows": "warn",
28+
"mocha/no-exports": "warn",
29+
"mocha/no-setup-in-describe": "warn",
30+
"no-await-in-loop": "off", // Perfect legit to use await in loops, we should leave it off
31+
"no-constant-condition": ["error", {"checkLoops": false }],
32+
"no-promise-executor-return": "warn", // TODO: fix issues and turn this back on
33+
"node/no-deprecated-api": "warn", // TODO: fix issues and turn this back on
34+
"node/no-missing-import": "off",
35+
"unicorn/filename-case": "off",
36+
"unicorn/import-style": "off",
37+
"unicorn/no-abusive-eslint-disable": "off",
38+
"unicorn/no-array-callback-reference": "off",
39+
"unicorn/no-array-for-each": "off",
40+
"unicorn/no-lonely-if":"off",
41+
"unicorn/no-process-exit": "off",
42+
"unicorn/numeric-separators-style":"off",
43+
"unicorn/prefer-module": "off",
44+
"unicorn/prefer-node-protocol": "off",
45+
"unicorn/prefer-regexp-test": "off"
46+
}
47+
}

.github/workflows/ci.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Node CI Suite
2+
3+
on:
4+
push
5+
6+
jobs:
7+
test:
8+
9+
runs-on: ${{ matrix.os }}
10+
11+
strategy:
12+
matrix:
13+
node-version: [20.x, 22.x]
14+
os: [ubuntu-latest, macos-latest, windows-latest]
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Use Node.js ${{ matrix.node-version }}
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: ${{ matrix.node-version }}
22+
- run: yarn --frozen-lockfile --ignore-engines
23+
- run: yarn test

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
11
node_modules
2+
.DS_Store
3+
.idea/
4+
dist/
5+
oclif.manifest.json
6+
.nyc_output

.mocharc.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"extension": ["ts"],
3+
"spec": "test/**/*.test.ts",
4+
"require": ["ts-node/register", "test/helpers.mjs"],
5+
"package": "../package.json",
6+
"reporter": "spec",
7+
"timeout": 5000,
8+
"recursive": true,
9+
"watchExtension": "ts"
10+
}

.tool-versions

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodejs 20.18.2

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2024, Heroku <>
3+
Copyright (c) 2025, Heroku <>
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 125 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,145 @@
1-
# Heroku Repo plugin
1+
@heroku-cli/plugin-heroku-repo
2+
==============================
23

3-
This plugin adds some commands to the heroku gem to interact with the app's repo
4+
Heroku Repo CLI Plugin
45

5-
## Installation
6+
<!-- toc -->
7+
* [Usage](#usage)
8+
* [Commands](#commands)
9+
<!-- tocstop -->
610

7-
To install:
11+
# Usage
12+
```sh-session
13+
$ heroku plugins:install @heroku-cli/plugin-heroku-repo
14+
$ heroku repo:COMMAND
15+
running command...
16+
$ heroku repo --help [COMMAND]
17+
USAGE
18+
$ heroku repo:COMMAND
19+
...
20+
```
821

9-
$ heroku plugins:install heroku-repo
22+
# Commands
23+
<!-- commands -->
24+
* [`heroku repo:clone`](#heroku-repoclone)
25+
* [`heroku repo:download [FILENAME]`](#heroku-repodownload-filename)
26+
* [`heroku repo:gc`](#heroku-repogc)
27+
* [`heroku repo:purge_cache`](#heroku-repopurge_cache)
28+
* [`heroku repo:purge-cache`](#heroku-repopurge-cache)
29+
* [`heroku repo:reset`](#heroku-reporeset)
1030

11-
## Commands
31+
## `heroku repo:clone`
1232

13-
### clone
33+
clone the application repo to your local filesystem
1434

15-
$ heroku repo:clone -a appname
35+
```
36+
USAGE
37+
$ heroku repo:clone -a <value> [-r <value>]
1638
17-
This will clone the applications repo to your local filesystem. No collaboration necessary!
39+
FLAGS
40+
-a, --app=<value> (required) app to run command against
41+
-r, --remote=<value> the git remote to use
1842
19-
### download
43+
DESCRIPTION
44+
clone the application repo to your local filesystem
45+
```
2046

21-
$ heroku repo:download -a appname
47+
_See code: [src/commands/repo/clone.ts](https://github.com/heroku/heroku-repo/blob/v1.0.14/src/commands/repo/clone.ts)_
2248

23-
This will download the applications repo as a tarball.
49+
## `heroku repo:download [FILENAME]`
2450

25-
### gc
51+
download the application repo as a tarball
2652

27-
$ heroku repo:gc -a appname
53+
```
54+
USAGE
55+
$ heroku repo:download [FILENAME] -a <value> [-r <value>]
2856
29-
This will run a `git gc --aggressive` against the applications repo. This is done inside a run process on the application.
57+
ARGUMENTS
58+
FILENAME a filename for the tarball
3059
31-
### purge-cache
60+
FLAGS
61+
-a, --app=<value> (required) app to run command against
62+
-r, --remote=<value> the git remote to use
3263
33-
$ heroku repo:purge_cache -a appname
64+
DESCRIPTION
65+
download the application repo as a tarball
66+
```
3467

35-
This will delete the contents of the build cache stored in the repository. This is done inside a run process on the application.
68+
_See code: [src/commands/repo/download.ts](https://github.com/heroku/heroku-repo/blob/v1.0.14/src/commands/repo/download.ts)_
3669

37-
### reset
70+
## `heroku repo:gc`
3871

39-
$ heroku repo:reset -a appname
72+
run a git gc --aggressive on an application's repository
4073

41-
This will empty the remote repository.
74+
```
75+
USAGE
76+
$ heroku repo:gc -a <value> [-r <value>]
77+
78+
FLAGS
79+
-a, --app=<value> (required) app to run command against
80+
-r, --remote=<value> the git remote to use
81+
82+
DESCRIPTION
83+
run a git gc --aggressive on an application's repository
84+
```
85+
86+
_See code: [src/commands/repo/gc.ts](https://github.com/heroku/heroku-repo/blob/v1.0.14/src/commands/repo/gc.ts)_
87+
88+
## `heroku repo:purge_cache`
89+
90+
delete the contents of the build cache in the repository
91+
92+
```
93+
USAGE
94+
$ heroku repo:purge_cache -a <value> [-r <value>]
95+
96+
FLAGS
97+
-a, --app=<value> (required) app to run command against
98+
-r, --remote=<value> the git remote to use
99+
100+
DESCRIPTION
101+
delete the contents of the build cache in the repository
102+
103+
ALIASES
104+
$ heroku repo:purge_cache
105+
```
106+
107+
## `heroku repo:purge-cache`
108+
109+
delete the contents of the build cache in the repository
110+
111+
```
112+
USAGE
113+
$ heroku repo:purge-cache -a <value> [-r <value>]
114+
115+
FLAGS
116+
-a, --app=<value> (required) app to run command against
117+
-r, --remote=<value> the git remote to use
118+
119+
DESCRIPTION
120+
delete the contents of the build cache in the repository
121+
122+
ALIASES
123+
$ heroku repo:purge_cache
124+
```
125+
126+
_See code: [src/commands/repo/purge-cache.ts](https://github.com/heroku/heroku-repo/blob/v1.0.14/src/commands/repo/purge-cache.ts)_
127+
128+
## `heroku repo:reset`
129+
130+
reset the repo
131+
132+
```
133+
USAGE
134+
$ heroku repo:reset -a <value> [-r <value>]
135+
136+
FLAGS
137+
-a, --app=<value> (required) app to run command against
138+
-r, --remote=<value> the git remote to use
139+
140+
DESCRIPTION
141+
reset the repo
142+
```
143+
144+
_See code: [src/commands/repo/reset.ts](https://github.com/heroku/heroku-repo/blob/v1.0.14/src/commands/repo/reset.ts)_
145+
<!-- commandsstop -->

bin/dev.cmd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@echo off
2+
3+
node --loader ts-node/esm --no-warnings=ExperimentalWarning "%~dp0\dev" %*

bin/dev.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env -S node --loader ts-node/esm --disable-warning=ExperimentalWarning
2+
3+
// eslint-disable-next-line n/shebang
4+
import {execute} from '@oclif/core'
5+
6+
await execute({development: true, dir: import.meta.url})

0 commit comments

Comments
 (0)