Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor!: migrate plugin to oclif/core v2 #85

Merged
merged 11 commits into from
Jan 31, 2025
43 changes: 43 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"extends": [
"oclif",
"oclif-typescript",
"plugin:mocha/recommended"
],
"ignorePatterns": ["**/test/**/*.js", "**/lib/"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"modules": true
}
},
"plugins": [
"import",
"mocha"
],
"rules": {
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-empty-function": "off",
"camelcase":"off",
"indent": ["error", 2, {"MemberExpression": 1}],
"mocha/no-mocha-arrows": "warn",
"mocha/no-exports": "warn",
"mocha/no-setup-in-describe": "warn",
"no-await-in-loop": "off", // Perfect legit to use await in loops, we should leave it off
"no-constant-condition": ["error", {"checkLoops": false }],
"node/no-missing-import": "off",
"unicorn/filename-case": "off",
"unicorn/import-style": "off",
"unicorn/no-abusive-eslint-disable": "off",
"unicorn/no-array-callback-reference": "off",
"unicorn/no-array-for-each": "off",
"unicorn/no-lonely-if":"off",
"unicorn/no-process-exit": "off",
"unicorn/numeric-separators-style":"off",
"unicorn/prefer-module": "off",
"unicorn/prefer-node-protocol": "off",
"unicorn/prefer-regexp-test": "off"
}
}
23 changes: 0 additions & 23 deletions .eslintrc.json

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ jobs:
os: [ubuntu-latest, macos-latest, windows-latest]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: yarn --frozen-lockfile --ignore-engines
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ lib
node_modules
.idea
oclif.manifest.json
.DS_STORE
.nyc_output
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nodejs 16.20.0
nodejs 20.18.2
24 changes: 16 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ make a manual API request

```
USAGE
$ heroku api METHOD [PATH] [-v <value>] [-a <value>] [-b <value>]
$ heroku api METHOD [PATH] [-a <value>] [-b <value>] [-v <value>]

ARGUMENTS
METHOD GET, POST, PUT, PATCH, or DELETE
Expand Down Expand Up @@ -53,18 +53,26 @@ EXAMPLES
name: "myapp",
}

$ heroku api PATCH /apps/myapp/config-vars --body '{"FOO": "bar"}'
{
FOO: "bar"
}
$ export HEROKU_HEADERS
$ HEROKU_HEADERS='{
"Content-Type": "application/x-www-form-urlencoded",
"Accept": "application/json"
}'
$ printf 'type=web&qty=2' | heroku api POST /apps/myapp/ps/scale
2

$ printf '{"updates":[{"type":"web", "quantity":2}]}' | heroku api POST /apps/myapp/formation
[
{
"app": {
"name": "myapp",
"id": "01234567-89ab-cdef-0123-456789abcdef"
},
"quantity": 2,
"type": "web",
"updated_at": "2012-01-01T12:00:00Z"
...
}
]
```

_See code: [src/commands/api.ts](https://github.com/heroku/heroku-api-plugin/blob/v2.3.0/src/commands/api.ts)_
Expand Down
3 changes: 3 additions & 0 deletions bin/dev.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@echo off

node --loader ts-node/esm --no-warnings=ExperimentalWarning "%~dp0\dev" %*
6 changes: 6 additions & 0 deletions bin/dev.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env -S node --loader ts-node/esm --disable-warning=ExperimentalWarning

// eslint-disable-next-line n/shebang
import {execute} from '@oclif/core'

await execute({development: true, dir: import.meta.url})
6 changes: 6 additions & 0 deletions bin/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env node

const oclif = require('@oclif/core')
oclif.run().catch(async error => {
return require('@oclif/core/handle')(error)
})
3 changes: 3 additions & 0 deletions bin/run.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@echo off

node "%~dp0\run" %*
43 changes: 22 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,37 @@
"url": "https://github.com/heroku/heroku-api-plugin/issues"
},
"engines": {
"node": ">= 16.0"
"node": ">=20"
},
"dependencies": {
"@heroku/http-call": "^5.4.0",
"@heroku-cli/color": "^1.1.14",
"@heroku-cli/command": "^8.4.0",
"@oclif/command": "^1.8.0",
"@oclif/config": "^1.17.0",
"@oclif/errors": "^1.3.4",
"cli-ux": "^4.6.1",
"edit-string": "1.1.6",
"@heroku-cli/command": "^11.4.0",
"@oclif/core": "^2.16.0",
"edit-string": "^1.1.6",
"fs-extra": "^9.0.1",
"get-stdin": "8.0.0",
"tsheredoc": "^1.0.1",
"http-call": "^5.3.0"
},
"devDependencies": {
"@oclif/test": "^2.5.6",
"@types/chai": "^4.3.14",
"@oclif/test": "^2.3.28",
"@types/chai": "^5.0.1",
"@types/mocha": "^10.0.6",
"@types/node": "16.11.7",
"@types/supports-color": "^5.3.0",
"@types/node": "^20.14.8",
"@types/supports-color": "^8.1.3",
"chai": "^4.4.1",
"eslint": "^7.32.0",
"eslint-config-oclif": "^4.0.0",
"eslint-config-oclif-typescript": "^1.0.3",
"eslint": "^8.57.1",
"eslint-config-oclif": "^5.2.2",
"eslint-config-oclif-typescript": "^3.1.13",
"eslint-plugin-oclif": "^0.1.0",
"globby": "^13.2.2",
"mocha": "^10.4.0",
"nock": "^13.5.1",
"oclif": "3.17.2",
"nyc": "^15.1.0",
"oclif": "^4.17.13",
"ts-node": "^10.9.2",
"typescript": "5.5.4"
"typescript": "4.8.4"
},
"files": [
"oclif.manifest.json",
Expand Down Expand Up @@ -67,13 +67,14 @@
"isbinaryfile": "4.0.10"
},
"scripts": {
"lint": "eslint . --ext .ts",
"build": "rm -rf lib && tsc",
"lint": "eslint . --ext .ts --config=.eslintrc",
"postpublish": "rm oclif.manifest.json",
"posttest": "yarn lint && tsc --noEmit -p test",
"prepare": "rm -rf lib && tsc",
"prepack": "tsc && oclif manifest",
"pretest": "tsc && oclif manifest",
"test": "mocha test/**/*.test.ts",
"prepare": "yarn build",
"prepack": "yarn build && oclif manifest",
"pretest": "yarn build && oclif manifest",
"test": "nyc mocha test/**/*.test.ts",
"version": "oclif readme && git add README.md"
}
}
Loading