Skip to content

Commit

Permalink
refactor(httpd): use new architecture for idiomatic calls to httpd (#72)
Browse files Browse the repository at this point in the history
Closes #39
  • Loading branch information
maninak committed Aug 29, 2023
1 parent 91a4ff8 commit 608a715
Show file tree
Hide file tree
Showing 16 changed files with 313 additions and 149 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"ci",
"auth",
"ux",
"contributing"
"contributing",
"httpd"
],
"conventionalCommits.gitmoji": false,
"prettier.enable": false,
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@
- **auth:** ask the user to re-enter their chosen passphrase when creating a new radicle identity to protect agains typos and align with Radicle CLI's UX ([#67](https://github.com/cytechmobile/radicle-vscode-extension/issues/67))
- **auth:** show "created new" instead of "unlocked" in the notification and logs when creating a new radicle identity ([#67](https://github.com/cytechmobile/radicle-vscode-extension/issues/67))
- **auth:** cancel the whole flow, warn and notify user when pressing escape _at any step of the flow_ (previously only applied for the passphrase question) when user is asked for his input in order to create a new radicle identity ([#67](https://github.com/cytechmobile/radicle-vscode-extension/issues/67))
- **httpd:** show buttons opening Output or the related configuration option in Settings in the event of Fetch Error ([#39](https://github.com/cytechmobile/radicle-vscode-extension/issues/39))

### 💅 Refactors

- **ux:** wrap VS Code's lackluster [InputBox API](https://code.visualstudio.com/api/references/vscode-api#InputBox) resulting in procedural, verbose and brittle client code, with a new custom-built sensible wrapper ([#67](https://github.com/cytechmobile/radicle-vscode-extension/issues/67))
- **httpd:** design and implement architecture for idiomatic code interacting with the Radicle HTTP API ([#39](https://github.com/cytechmobile/radicle-vscode-extension/issues/39))

### 📖 Documentation

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@
"*.{vue,ts,tsx,js,jsx}": "eslint --fix --max-warnings 0 --cache --cache-location node_modules/.cache/eslint"
},
"dependencies": {
"undici": "^5.22.1"
"ofetch": "^1.2.1"
},
"devDependencies": {
"@antfu/eslint-config": "^0.39.8",
Expand All @@ -272,6 +272,7 @@
"eslint-plugin-vue-scoped-css": "^2.5.0",
"husky": "^8.0.3",
"lint-staged": "^13.2.3",
"ts-xor": "^1.1.0",
"typescript": "^5.1.6"
},
"private": true
Expand Down
52 changes: 30 additions & 22 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
registerAllFileWatchers,
} from './helpers'
import {
validateHttpApiEndpointConnection,
validateHttpdConnection,
validateRadCliInstallation,
validateRadicleIdentityAuthentication,
} from './ux'
Expand All @@ -22,5 +22,5 @@ export function activate(ctx: ExtensionContext) {
logExtensionActivated()
validateRadCliInstallation({ minimizeUserNotifications: true })
validateRadicleIdentityAuthentication({ minimizeUserNotifications: true })
validateHttpApiEndpointConnection({ minimizeUserNotifications: true })
validateHttpdConnection({ minimizeUserNotifications: true })
}
52 changes: 0 additions & 52 deletions src/helpers/api.ts

This file was deleted.

7 changes: 4 additions & 3 deletions src/helpers/configWatcher.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { workspace } from 'vscode'
import {
validateHttpApiEndpointConnection,
validateHttpdConnection,
validateRadCliInstallation,
validateRadicleIdentityAuthentication,
} from '../ux/'
import { getExtensionContext } from '../store'
import type { ExtensionConfig } from '.'
import { type ExtensionConfig, resetHttpdConnection } from '.'

function onConfigChange(
configKey: keyof ExtensionConfig,
Expand Down Expand Up @@ -43,7 +43,8 @@ const configWatchers = [
{
configKey: 'radicle.advanced.httpApiEndpoint',
onChangeCallback: () => {
validateHttpApiEndpointConnection()
resetHttpdConnection()
validateHttpdConnection()
},
},
] satisfies OnConfigChangeParam[]
Expand Down

0 comments on commit 608a715

Please sign in to comment.