Skip to content

Commit

Permalink
chore: Update @oclif/core dependencies (#2784)
Browse files Browse the repository at this point in the history
* chore: Update @oclif/core dependencies

Signed-off-by: Anatolii Bazko <[email protected]>
  • Loading branch information
tolusha authored Oct 12, 2023
1 parent 1ccd67b commit 4c29629
Show file tree
Hide file tree
Showing 49 changed files with 1,140 additions and 754 deletions.
69 changes: 46 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ USAGE
* [`chectl server:stop`](#chectl-serverstop)
* [`chectl server:update`](#chectl-serverupdate)
* [`chectl update [CHANNEL]`](#chectl-update-channel)
* [`chectl version`](#chectl-version)

## `chectl autocomplete [SHELL]`

Expand All @@ -119,7 +120,7 @@ USAGE
$ chectl autocomplete [SHELL] [-r]
ARGUMENTS
SHELL shell type
SHELL (zsh|bash|powershell) Shell type
FLAGS
-r, --refresh-cache Refresh cache (ignores displaying instructions)
Expand All @@ -134,10 +135,12 @@ EXAMPLES
$ chectl autocomplete zsh
$ chectl autocomplete powershell
$ chectl autocomplete --refresh-cache
```

_See code: [@oclif/plugin-autocomplete](https://github.com/oclif/plugin-autocomplete/blob/v1.3.10/src/commands/autocomplete/index.ts)_
_See code: [@oclif/plugin-autocomplete](https://github.com/oclif/plugin-autocomplete/blob/v2.3.9/src/commands/autocomplete/index.ts)_

## `chectl cacert:export`

Expand All @@ -156,7 +159,7 @@ FLAGS
If this option is omitted, then Eclipse Che certificate will be stored in a user's temporary directory as cheCA.crt.
-h, --help
show CLI help
Show CLI help.
-n, --chenamespace=<value>
Eclipse Che Kubernetes namespace.
Expand All @@ -180,7 +183,7 @@ USAGE
$ chectl dashboard:open [-h] [-n <value>] [--telemetry on|off]
FLAGS
-h, --help show CLI help
-h, --help Show CLI help.
-n, --chenamespace=<value> Eclipse Che Kubernetes namespace.
--telemetry=<option> Enable or disable telemetry. This flag skips a prompt and enable/disable telemetry
<options: on|off>
Expand Down Expand Up @@ -209,7 +212,7 @@ DESCRIPTION
Display help for chectl.
```

_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v5.2.0/src/commands/help.ts)_
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v5.2.20/src/commands/help.ts)_

## `chectl server:debug`

Expand All @@ -221,7 +224,7 @@ USAGE
[--skip-kubernetes-health-check]
FLAGS
-h, --help show CLI help
-h, --help Show CLI help.
-n, --chenamespace=<value> Eclipse Che Kubernetes namespace.
--debug-port=<value> [default: 8000] Eclipse Che server debug port
--skip-kubernetes-health-check Skip Kubernetes health check
Expand All @@ -244,7 +247,7 @@ USAGE
[--skip-kubernetes-health-check] [-y | --batch]
FLAGS
-h, --help show CLI help
-h, --help Show CLI help.
-n, --chenamespace=<value> Eclipse Che Kubernetes namespace.
-y, --yes Automatic yes to prompts; assume "yes" as answer to all prompts and run
non-interactively
Expand All @@ -267,15 +270,15 @@ Deploy Eclipse Che server

```
USAGE
$ chectl server:deploy -p minikube|k8s|openshift|microk8s|docker-desktop|crc [-h] [-n <value>] [--batch] [-i
<value>] [-t <value>] [--devfile-registry-url <value>] [--plugin-registry-url <value>] [--k8spodwaittimeout <value>]
[--k8spodreadytimeout <value>] [--k8spoddownloadimagetimeout <value>] [--k8spoderrorrechecktimeout <value>] [-d
<value>] [-b <value>] [--debug] [--che-operator-image <value>] [--che-operator-cr-yaml <value>]
[--che-operator-cr-patch-yaml <value>] [--workspace-pvc-storage-class-name <value>] [--skip-version-check]
[--skip-cert-manager] [--skip-devworkspace-operator] [--skip-oidc-provider-check] [--auto-update] [--starting-csv
<value>] [--package-manifest-name <value>] [--catalog-source-yaml <value> --olm-channel <value>]
[--catalog-source-name <value> --catalog-source-namespace <value> ] [--catalog-source-image <value> ]
[--cluster-monitoring] [--telemetry on|off] [--skip-kubernetes-health-check]
$ chectl server:deploy [-h] [-n <value>] [--batch] [-i <value>] [-t <value>] [--devfile-registry-url <value>]
[--plugin-registry-url <value>] [--k8spodwaittimeout <value>] [--k8spodreadytimeout <value>]
[--k8spoddownloadimagetimeout <value>] [--k8spoderrorrechecktimeout <value>] [-d <value>] [-p
minikube|k8s|openshift|microk8s|docker-desktop|crc] [-b <value>] [--debug] [--che-operator-image <value>]
[--che-operator-cr-yaml <value>] [--che-operator-cr-patch-yaml <value>] [--workspace-pvc-storage-class-name <value>]
[--skip-version-check] [--skip-cert-manager] [--skip-devworkspace-operator] [--skip-oidc-provider-check]
[--auto-update] [--starting-csv <value>] [--package-manifest-name <value>] [--catalog-source-yaml <value>
--olm-channel <value>] [--catalog-source-name <value> --catalog-source-namespace <value> ] [--catalog-source-image
<value> ] [--cluster-monitoring] [--telemetry on|off] [--skip-kubernetes-health-check]
FLAGS
-b, --domain=<value>
Expand All @@ -291,7 +294,7 @@ FLAGS
Directory to store logs into
-h, --help
show CLI help
Show CLI help.
-i, --cheimage=<value>
Eclipse Che server container image
Expand All @@ -300,7 +303,7 @@ FLAGS
Eclipse Che Kubernetes namespace.
-p, --platform=<option>
(required) Type of Kubernetes platform.
Type of Kubernetes platform.
<options: minikube|k8s|openshift|microk8s|docker-desktop|crc>
-t, --templates=<value>
Expand Down Expand Up @@ -417,7 +420,7 @@ USAGE
FLAGS
-d, --directory=<value> Directory to store logs into
-h, --help show CLI help
-h, --help Show CLI help.
-n, --chenamespace=<value> Eclipse Che Kubernetes namespace.
--skip-kubernetes-health-check Skip Kubernetes health check
--telemetry=<option> Enable or disable telemetry. This flag skips a prompt and enable/disable telemetry
Expand All @@ -441,7 +444,7 @@ USAGE
FLAGS
-d, --directory=<value> Directory to store logs into
-h, --help show CLI help
-h, --help Show CLI help.
-n, --chenamespace=<value> Eclipse Che Kubernetes namespace.
--batch Batch mode. Running a command without end user interaction.
--k8spoddownloadimagetimeout=<value> [default: 1200000] Waiting time for Pod downloading image (in milliseconds)
Expand All @@ -468,7 +471,7 @@ USAGE
$ chectl server:status [-h] [-n <value>] [--telemetry on|off]
FLAGS
-h, --help show CLI help
-h, --help Show CLI help.
-n, --chenamespace=<value> Eclipse Che Kubernetes namespace.
--telemetry=<option> Enable or disable telemetry. This flag skips a prompt and enable/disable telemetry
<options: on|off>
Expand All @@ -488,7 +491,7 @@ USAGE
$ chectl server:stop [-h] [-n <value>] [--telemetry on|off] [--skip-kubernetes-health-check]
FLAGS
-h, --help show CLI help
-h, --help Show CLI help.
-n, --chenamespace=<value> Eclipse Che Kubernetes namespace.
--skip-kubernetes-health-check Skip Kubernetes health check
--telemetry=<option> Enable or disable telemetry. This flag skips a prompt and enable/disable telemetry
Expand All @@ -514,7 +517,7 @@ USAGE
FLAGS
-h, --help
show CLI help
Show CLI help.
-n, --chenamespace=<value>
Eclipse Che Kubernetes namespace.
Expand Down Expand Up @@ -634,6 +637,26 @@ DESCRIPTION
```

_See code: [@oclif/plugin-update](https://github.com/oclif/plugin-update/blob/v1.5.0/src/commands/update.ts)_

## `chectl version`

```
USAGE
$ chectl version [--json] [--verbose]
FLAGS
--verbose Show additional information about the CLI.
GLOBAL FLAGS
--json Format output as json.
FLAG DESCRIPTIONS
--verbose Show additional information about the CLI.
Additionally shows the architecture, node version, operating system, and versions of plugins that the CLI is using.
```

_See code: [@oclif/plugin-version](https://github.com/oclif/plugin-version/blob/v1.3.10/src/commands/version.ts)_
<!-- commandsstop -->


Expand Down
2 changes: 1 addition & 1 deletion bin/debug
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
#!/usr/bin/env bash

#!/usr/bin/env bash
#
Expand Down
10 changes: 7 additions & 3 deletions bin/run
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/usr/bin/env node

require('@oclif/command').run()
.then(require('@oclif/command/flush'))
.catch(require('@oclif/errors/handle'))
// eslint-disable-next-line unicorn/prefer-top-level-await
(async () => {
const oclif = await import('@oclif/core')
await oclif.execute({development: true, dir: __dirname})
})()


33 changes: 20 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,16 @@
"bugs": "https://github.com/che-incubator/chectl/issues",
"dependencies": {
"@kubernetes/client-node": "0.14.3",
"@oclif/command": "^1",
"@oclif/config": "^1",
"@oclif/parser": "^3.8.10",
"@oclif/plugin-autocomplete": "^1.3.10",
"@oclif/plugin-help": "^5",
"@oclif/plugin-update": "^1.5.0",
"@oclif/core": "^3.0.4",
"@oclif/parser": "^3.8.17",
"@oclif/plugin-autocomplete": "^2.3.9",
"@oclif/plugin-help": "^5.2.20",
"@oclif/plugin-update": "^1",
"@oclif/plugin-version": "^1.3.10",
"@octokit/rest": "^19.0.5",
"analytics-node": "^6.2.0",
"ansi-colors": "4.1.3",
"axios": "^0.21.1",
"cli-ux": "^6.0.9",
"command-exists": "^1.2.9",
"countries-and-timezones": "^3.4.1",
"devworkspace-operator": "https://github.com/devfile/devworkspace-operator#main",
Expand Down Expand Up @@ -58,8 +57,8 @@
"@types/semver": "^7.3.13",
"@types/unzipper": "^0.10.5",
"@types/uuid": "^9.0.2",
"@typescript-eslint/eslint-plugin": "^4.33.0",
"@typescript-eslint/parser": "^4.33.0",
"@typescript-eslint/eslint-plugin": "^6.7.5",
"@typescript-eslint/parser": "^6.7.5",
"chai": "^4.3.7",
"eslint": "^7.32.0",
"eslint-config-oclif": "^3.1.0",
Expand All @@ -68,9 +67,8 @@
"eslint-plugin-no-null": "^1.0.2",
"jest": "^29.4.2",
"oclif": "^3",
"ts-jest": "^29.0.5",
"ts-node": "^10",
"typescript": "^4.3",
"ts-jest": "^29.1.1",
"typescript": "^5",
"typescript-formatter": "7.2.2"
},
"engines": {
Expand All @@ -91,6 +89,14 @@
"license": "EPL-2.0",
"main": "lib/index.js",
"oclif": {
"additionalHelpFlags": [
"-h"
],
"additionalVersionFlags": [
"-v"
],
"topicSeparator": ":",
"default": ".",
"commands": "./lib/commands",
"hooks": {
"prerun": "./lib/hooks/prerun/new-version-warning",
Expand All @@ -103,7 +109,8 @@
"plugins": [
"@oclif/plugin-autocomplete",
"@oclif/plugin-help",
"@oclif/plugin-update"
"@oclif/plugin-update",
"@oclif/plugin-version"
],
"topics": {
"server": {
Expand Down
45 changes: 20 additions & 25 deletions src/api/che-logs-reader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
*/

import { V1Pod, Watch } from '@kubernetes/client-node'
import * as cp from 'child_process'
import * as cp from 'node:child_process'
import * as fs from 'fs-extra'
import * as path from 'path'
import * as path from 'node:path'
import { KubeClient } from './kube-client'
import {isCommandExists} from '../utils/utls'

Expand All @@ -28,11 +28,7 @@ export class CheLogsReader {
* Reads logs from pods that match a given selector.
*/
async readPodLog(namespace: string, podLabelSelector: string | undefined, directory: string, follow: boolean): Promise<void> {
if (follow) {
await this.watchNamespacedPods(namespace, podLabelSelector, directory)
} else {
await this.readNamespacedPodLog(namespace, podLabelSelector, directory)
}
await (follow ? this.watchNamespacedPods(namespace, podLabelSelector, directory) : this.readNamespacedPodLog(namespace, podLabelSelector, directory))
}

/**
Expand Down Expand Up @@ -77,32 +73,30 @@ export class CheLogsReader {
const processedContainers = new Map<string, Set<string>>()

const watcher = new Watch(this.kubeHelper.getKubeConfig())
return watcher.watch(`/api/v1/namespaces/${namespace}/pods`, {},
async (_phase: string, obj: any) => {
const pod = obj as V1Pod
if (!pod || !pod.metadata || !pod.metadata.name) {
return
}
const podName = pod.metadata.name!
return watcher.watch(`/api/v1/namespaces/${namespace}/pods`, {}, async (_phase: string, obj: any) => {
const pod = obj as V1Pod
if (!pod || !pod.metadata || !pod.metadata.name) {
return
}

if (!processedContainers.has(podName)) {
processedContainers.set(podName, new Set<string>())
}
const podName = pod.metadata.name!

if (!processedContainers.has(podName)) {
processedContainers.set(podName, new Set<string>())
}

if (!podLabelSelector || this.matchLabels(pod.metadata!.labels || {}, podLabelSelector)) {
for (const containerName of this.getContainers(pod)) {
// not to read logs from the same containers twice
if (!processedContainers.get(podName)!.has(containerName)) {
if (!podLabelSelector || this.matchLabels(pod.metadata!.labels || {}, podLabelSelector)) {
for (const containerName of this.getContainers(pod)) {
// not to read logs from the same containers twice
if (!processedContainers.get(podName)!.has(containerName)) {
processedContainers.get(podName)!.add(containerName)

const fileName = this.doCreateLogFile(namespace, podName, containerName, directory)
await this.doReadNamespacedPodLog(namespace, pod.metadata!.name!, containerName, fileName, true)
}
}
}
},
// ignore errors
() => { })
}
}, () => {})
}

/**
Expand All @@ -129,6 +123,7 @@ export class CheLogsReader {
if (!pod.status || !pod.status.containerStatuses) {
return []
}

return pod.status.containerStatuses.map(containerStatus => containerStatus.name)
}

Expand Down
2 changes: 1 addition & 1 deletion src/api/config-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import * as fs from 'fs-extra'
import { merge } from 'lodash'
import * as path from 'path'
import * as path from 'node:path'

import {CheCtlContext, CliContext} from '../context'

Expand Down
Loading

0 comments on commit 4c29629

Please sign in to comment.