Skip to content

Commit

Permalink
Merge pull request #45 from hutte-io/refactor/sf-plugin
Browse files Browse the repository at this point in the history
refactor to sf plugin style [HUT-1374]
  • Loading branch information
amtrack authored Nov 7, 2023
2 parents 13282fd + ff0ab80 commit c1442cd
Show file tree
Hide file tree
Showing 29 changed files with 4,639 additions and 2,851 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Install dependencies
run: |
yarn install
yarn global add sfdx-cli
yarn global add @salesforce/cli
- name: Run Unit Tests
run: yarn test
- name: Release package
Expand Down
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18
6 changes: 0 additions & 6 deletions .prettierrc

This file was deleted.

48 changes: 24 additions & 24 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@
"request": "launch",
"program": "${workspaceRoot}/node_modules/.bin/_mocha",
"args": [
"--require",
"ts-node/register",
"--require",
"mocha",
"--timeout",
"0",
"--colors",
"--recursive",
"--reporter",
"spec",
"test/**/*.test.ts"
"--require",
"ts-node/register",
"--require",
"mocha",
"--timeout",
"0",
"--colors",
"--recursive",
"--reporter",
"spec",
"test/**/*.test.ts"
],
"cwd": "${workspaceRoot}",
"preLaunchTask": "Compile",
Expand All @@ -43,22 +43,22 @@
"protocol": "inspector",
"program": "${workspaceRoot}/node_modules/.bin/_mocha",
"args": [
"--require",
"ts-node/register",
"--require",
"mocha",
"--timeout",
"0",
"--colors",
"--recursive",
"--reporter",
"spec",
"--inspect",
"${file}"
"--require",
"ts-node/register",
"--require",
"mocha",
"--timeout",
"0",
"--colors",
"--recursive",
"--reporter",
"spec",
"--inspect",
"${file}"
],
"cwd": "${workspaceRoot}",
"preLaunchTask": "Compile",
"internalConsoleOptions": "openOnSessionStart"
}
]
}
}
174 changes: 56 additions & 118 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
hutte
=====
# hutte

CLI for [hutte.io](https://hutte.io)
CLI for [Hutte](https://hutte.io)

[![Version](https://img.shields.io/npm/v/hutte.svg)](https://npmjs.org/package/hutte)
[![Downloads/week](https://img.shields.io/npm/dw/hutte.svg)](https://npmjs.org/package/hutte)
Expand All @@ -10,174 +9,113 @@ CLI for [hutte.io](https://hutte.io)
## Installation

```sh-session
$ sfdx plugins:install hutte
$ sf plugins install hutte
```

## Commands

<!-- commands -->
- [hutte](#hutte)
- [Installation](#installation)
- [Commands](#commands)
- [`sfdx hutte:auth:login [-e <string>] [-p <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-hutteauthlogin--e-string--p-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
- [`sfdx hutte:org:authorize [--no-git] [--no-pull] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-hutteorgauthorize---no-git---no-pull---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
- [`sfdx hutte:org:list [--verbose] [--json] [--all] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-hutteorglist---verbose---json---all---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
- [`sfdx hutte:org:terminate [-t <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-hutteorgterminate--t-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
- [`sfdx hutte:pool:take [-t <string>] [-n <string>] [-p <string>] [--timeout <integer>] [-w] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-huttepooltake--t-string--n-string--p-string---timeout-integer--w---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
- [Debugging your plugin](#debugging-your-plugin)

## `sfdx hutte:auth:login [-e <string>] [-p <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`
* [`sf hutte auth login`](#sf-hutte-auth-login)
* [`sf hutte org authorize`](#sf-hutte-org-authorize)
* [`sf hutte org list`](#sf-hutte-org-list)
* [`sf hutte org terminate`](#sf-hutte-org-terminate)
* [`sf hutte pool take`](#sf-hutte-pool-take)

## `sf hutte auth login`

authorize your hutte-io account

```
USAGE
$ sfdx hutte:auth:login [-e <string>] [-p <string>] [--json] [--loglevel
trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
OPTIONS
-e, --email=email the email address of your account on
hutte.io
-p, --password=password the password of your account on
hutte.io
$ sf hutte auth login [--json] [-e <value>] [-p <value>]
--json format output as json
FLAGS
-e, --email=<value> the email address of your account on hutte.io
-p, --password=<value> the password of your account on hutte.io
--loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL) [default: warn] logging level for
this command invocation
GLOBAL FLAGS
--json Format output as json.
EXAMPLE
$ sfdx hutte:auth:login --email myEmail@example.com
Hello world! This is org: MyOrg and I will be around until Tue Mar 20 2018!
My hub org id is: 00Dxx000000001234
EXAMPLES
$ sf hutte auth login --email john.doe@example.org
```

_See code: [lib/commands/hutte/auth/login.js](https://github.com/hutte-io/cli/blob/master/src/commands/hutte/auth/login.ts)_
_See code: [src/commands/hutte/auth/login.ts](https://github.com/hutte-io/cli/blob/master/src/commands/hutte/auth/login.ts)_

## `sfdx hutte:org:authorize [--no-git] [--no-pull] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`
## `sf hutte org authorize`

authorize a scratch org from hutte.io

```
USAGE
$ sfdx hutte:org:authorize [--no-git] [--no-pull] [--json] [--loglevel
trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
OPTIONS
--json format output as json
--loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL) [default: warn] logging level for
this command invocation
$ sf hutte org authorize [--json] [-t <value>] [--no-git] [--no-pull]
--no-git doesn't checkout the scratch org's
git branch
FLAGS
-t, --api-token=<value> the api token. Only needed if you have not previously logged in using `sf hutte auth login`
--no-git doesn't checkout the scratch org's git branch
--no-pull doesn't pull the source code from the scratch org
--no-pull doesn't pull the source code from
the scratch org
GLOBAL FLAGS
--json Format output as json.
```

_See code: [lib/commands/hutte/org/authorize.js](https://github.com/hutte-io/cli/blob/master/src/commands/hutte/org/authorize.ts)_
_See code: [src/commands/hutte/org/authorize.ts](https://github.com/hutte-io/cli/blob/master/src/commands/hutte/org/authorize.ts)_

## `sfdx hutte:org:list [--verbose] [--json] [--all] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`
## `sf hutte org list`

list hutte scratch orgs from current repository

```
USAGE
$ sfdx hutte:org:list [--verbose] [--json] [--all] [--loglevel
trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
$ sf hutte org list [--json] [-t <value>] [--verbose] [--all]
OPTIONS
--verbose includes all information of scratch
org, such as auth url
FLAGS
-t, --api-token=<value> the api token. Only needed if you have not previously logged in using `sf hutte auth login`
--all when provided, the output includes all orgs from hutte project, otherwise (by default) only
active orgs will be returned
--verbose includes all information of scratch org, such as auth url
--json format output as json
--all when provided, the output includes all orgs from hutte
project, otherwise (by default) only active orgs will be returned
--loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL) [default: warn] logging level for
this command invocation
GLOBAL FLAGS
--json Format output as json.
```

_See code: [lib/commands/hutte/org/list.js](https://github.com/hutte-io/cli/blob/master/src/commands/hutte/org/list.ts)_
_See code: [src/commands/hutte/org/list.ts](https://github.com/hutte-io/cli/blob/master/src/commands/hutte/org/list.ts)_

## `sfdx hutte:org:terminate [-t <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`
## `sf hutte org terminate`

terminates the default org on Hutte.io and logs out locally

```
USAGE
$ sfdx hutte:org:terminate [-t <string>] [--json] [--loglevel
trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
$ sf hutte org terminate [--json] [-t <value>]
OPTIONS
-t, --api-token=api-token the api token. Only needed if you
have not previously logged in using
`sfdx hutte:auth:login`
FLAGS
-t, --api-token=<value> the api token. Only needed if you have not previously logged in using `sf hutte auth login`
--json format output as json
--loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL) [default: warn] logging level for
this command invocation
GLOBAL FLAGS
--json Format output as json.
```

_See code: [lib/commands/hutte/org/terminate.js](https://github.com/hutte-io/cli/blob/master/src/commands/hutte/org/terminate.ts)_
_See code: [src/commands/hutte/org/terminate.ts](https://github.com/hutte-io/cli/blob/master/src/commands/hutte/org/terminate.ts)_

## `sfdx hutte:pool:take [-t <string>] [-n <string>] [-p <string>] [--timeout <integer>] [-w] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`
## `sf hutte pool take`

take a scratch org from the pool

```
USAGE
$ sfdx hutte:pool:take [-t <string>] [-n <string>] [-p <string>] [--timeout <integer>] [-w] [--json] [--loglevel
trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
OPTIONS
-n, --name=name the name of the org
$ sf hutte pool take [--json] [-t <value>] [-n <value>] [-p <value>] [--timeout <value>] [-w]
-p, --project-id=project-id the id of the project. Useful when
multiple projects use the same git
repository.
FLAGS
-n, --name=<value> the name of the org
-p, --project-id=<value> the id of the project. Useful when multiple projects use the same git repository.
-t, --api-token=<value> the api token. Only needed if you have not previously logged in using `sf hutte auth login`
-w, --wait waits until an org becomes available
--timeout=<value> the timeout period in seconds.
-t, --api-token=api-token the api token. Only needed if you
have not previously logged in using
`sfdx hutte:auth:login`
-w, --wait waits until an org becomes available
--json format output as json
--loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL) [default: warn] logging level for
this command invocation
--timeout=timeout the timeout period in seconds.
GLOBAL FLAGS
--json Format output as json.
```

_See code: [lib/commands/hutte/pool/take.js](https://github.com/hutte-io/cli/blob/master/src/commands/hutte/pool/take.ts)_
_See code: [src/commands/hutte/pool/take.ts](https://github.com/hutte-io/cli/blob/master/src/commands/hutte/pool/take.ts)_
<!-- commandsstop -->
<!-- debugging-your-plugin -->
# Debugging your plugin
We recommend using the Visual Studio Code (VS Code) IDE for your plugin development. Included in the `.vscode` directory of this plugin is a `launch.json` config file, which allows you to attach a debugger to the node process when running your commands.

To debug the `hello:org` command:
1. Start the inspector

If you linked your plugin to the sfdx cli, call your command with the `dev-suspend` switch:
```sh-session
$ sfdx hello:org -u myOrg@example.com --dev-suspend
```

Alternatively, to call your command using the `bin/run` script, set the `NODE_OPTIONS` environment variable to `--inspect-brk` when starting the debugger:
```sh-session
$ NODE_OPTIONS=--inspect-brk bin/run hello:org -u myOrg@example.com
```

2. Set some breakpoints in your command code
3. Click on the Debug icon in the Activity Bar on the side of VS Code to open up the Debug view.
4. In the upper left hand corner of VS Code, verify that the "Attach to Remote" launch configuration has been chosen.
5. Hit the green play button to the left of the "Attach to Remote" launch configuration window. The debugger should now be suspended on the first line of the program.
6. Hit the green play button at the top middle of VS Code (this play button will be to the right of the play button that you clicked in step #5).
<br><img src=".images/vscodeScreenshot.png" width="480" height="278"><br>
Congrats, you are debugging!
3 changes: 1 addition & 2 deletions bin/run
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env node

require('@oclif/command').run()
.catch(require('@oclif/errors/handle'))
require('@oclif/core').run().then(require('@oclif/core/flush')).catch(require('@oclif/core/handle'));
Loading

0 comments on commit c1442cd

Please sign in to comment.