Skip to content

Commit

Permalink
change: update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
iwilltry42 committed Feb 15, 2023
1 parent 8956b7d commit 8104f6a
Show file tree
Hide file tree
Showing 21 changed files with 6,775 additions and 7,672 deletions.
6 changes: 6 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
root: true,
};
8 changes: 4 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ jobs:
- name: Setup GIT
run: |
git switch -c main
git config --global user.email "alvaro.saurin@gmail.com"
git config --global user.name "Alvaro Saurin"
git config --global user.email "ghactions@k3d.io"
git config --global user.name "k3d-io"
- name: Set release version
run: npm version --no-git-tag-version --allow-same-version ${{ steps.info.outputs.SOURCE_TAG }}
Expand Down Expand Up @@ -69,7 +69,7 @@ jobs:
draft: false
prerelease: false

- name: Upload VXIS to GitHub release
- name: Upload VSIX to GitHub release
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
Expand All @@ -81,4 +81,4 @@ jobs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./vscode-k3d-${{ steps.info.outputs.SOURCE_TAG }}.vsix
asset_name: vscode-k3d.vsix
asset_content_type: application/zip
asset_content_type: application/zip
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Kubernetes [k3d](https://github.com/rancher/k3d) extension for Visual Studio Code
# Kubernetes [k3d](https://github.com/k3d-io/k3d) extension for Visual Studio Code

[![Version](https://vsmarketplacebadge.apphb.com/version/inercia.vscode-k3d.svg)](https://marketplace.visualstudio.com/items?itemName=inercia.vscode-k3d)
[![Installs](https://vsmarketplacebadge.apphb.com/installs/inercia.vscode-k3d.svg)](https://marketplace.visualstudio.com/items?itemName=inercia.vscode-k3d)
[![Ratings](https://vsmarketplacebadge.apphb.com/rating/inercia.vscode-k3d.svg)](https://vsmarketplacebadge.apphb.com/rating/inercia.vscode-k3d.svg)

## Overview

This extension displays your [k3d](https://github.com/rancher/k3d) local clusters
This extension displays your [k3d](https://github.com/k3d-io/k3d) local clusters
in the Kubernetes extension's Cloud Explorer. You can use this to create and
delete clusters, and to merge them into your `kubeconfig`.

Expand Down Expand Up @@ -75,7 +75,7 @@ You can find this plugin in the
You will find detailed installation instructions there.

This extension will download the latest, stable version of `k3d` automatically, although you can
force a specific instalation _channel_ of `k3d` with some settings (see [bellow](#Settings)).
force a specific instalation _channel_ of `k3d` with some settings (see [bellow](#settings)).

## Settings

Expand Down Expand Up @@ -136,7 +136,7 @@ the [official documentation](https://code.visualstudio.com/docs/getstarted/keybi

The easiest way to start coding on the extension is by following these steps:

* `git clone https://github.com/inercia/vscode-k3d.git`
* `git clone https://github.com/k3d-io/vscode-k3d.git`
* `code vscode-k3d`
* `npm install` in the terminal for installing all the dependencies,
* Press `F5` for starting a new VSCode window with the extension running in it.
Expand Down
14,212 changes: 6,683 additions & 7,529 deletions package-lock.json

Large diffs are not rendered by default.

76 changes: 35 additions & 41 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"description": "Work with local Kubernetes clusters with K3D provider in Visual Studio Code",
"version": "0.0.1",
"preview": true,
"publisher": "inercia",
"publisher": "k3d-io",
"engines": {
"vscode": "^1.44.0"
"vscode": "^1.75.1"
},
"license": "MIT",
"categories": [
Expand All @@ -21,20 +21,11 @@
"galleryBanner": {
"theme": "light"
},
"homepage": "https://github.com/inercia/vscode-k3d/blob/master/README.md",
"homepage": "https://github.com/k3d-io/vscode-k3d/blob/master/README.md",
"activationEvents": [
"onCommand:extension.vsKubernetesConfigureFromCluster",
"onCommand:extension.vsKubernetesCreateCluster",
"onView:kubernetes.cloudExplorer",
"onCommand:extension.vsKubernetesK3DCreate",
"onCommand:extension.vsKubernetesK3DCreateLast",
"onCommand:extension.vsKubernetesK3DDelete",
"onCommand:extension.vsKubernetesK3DReplace",
"onCommand:extension.vsKubernetesK3DReplaceLast",
"onCommand:extension.vsKubernetesK3DAddAgent",
"onCommand:extension.vsKubernetesK3DDeleteAgent",
"onCommand:extension.vsKubernetesK3DAddServer",
"onCommand:extension.vsKubernetesK3DDeleteServer"
"onView:kubernetes.cloudExplorer"
],
"main": "./dist/extension",
"contributes": {
Expand Down Expand Up @@ -313,8 +304,8 @@
"watch": "webpack --mode none --watch",
"test": "npm run compile",
"test-compile": "tsc -p ./",
"lint": "./node_modules/tslint/bin/tslint -p tsconfig.json -c tslint.json src/**/*.ts",
"lint:fix": "./node_modules/tslint/bin/tslint -p tsconfig.json -c tslint.json --fix src/**/*.ts",
"lint": "npx eslint . --ext .ts",
"lint:fix": "npx eslint . --ext .ts --fix",
"vscode:prepublish": "webpack --mode production",
"dist": "vsce package",
"dist-tools": "npm install -g vsce"
Expand All @@ -324,43 +315,46 @@
],
"devDependencies": {
"@types/dedent": "^0.7.0",
"@types/mocha": "^2.2.42",
"@types/node": "^8.10.25",
"@types/request-promise-native": "^1.0.17",
"@types/shelljs": "^0.8.3",
"@types/tmp": "0.0.33",
"@types/url-join": "^4.0.0",
"@types/vscode": "^1.44.0",
"ts-loader": "^6.0.4",
"tslint": "^5.8.0",
"typescript": "^3.5.2",
"webpack": "^4.36.1",
"webpack-cli": "^3.3.6"
"@types/mocha": "^10.0.1",
"@types/node": "^18.13.0",
"@types/request-promise-native": "^1.0.18",
"@types/shelljs": "^0.8.11",
"@types/tmp": "0.2.3",
"@types/url-join": "^4.0.1",
"@types/vscode": "^1.75.1",
"@typescript-eslint/eslint-plugin": "^5.52.0",
"@typescript-eslint/parser": "^5.52.0",
"@vscode/test-electron": "^2.2.3",
"eslint": "^8.34.0",
"ts-loader": "^9.4.2",
"typescript": "^4.9.5",
"vsce": "^2.15.0",
"webpack": "^5.75.0",
"webpack-cli": "^5.0.1"
},
"dependencies": {
"@octokit/rest": "^18.0.9",
"@types/mkdirp": "^0.5.2",
"@octokit/rest": "^19.0.7",
"dedent": "^0.7.0",
"docker-cli-js": "^2.8.0",
"docker-cli-js": "^2.10.0",
"docker-client": "^1.38.1",
"download": "^7.1.0",
"mkdirp": "^0.5.1",
"replace-string": "^3.0.0",
"download": "^8.0.0",
"mkdirp": "^2.1.3",
"replace-string": "^4.0.0",
"request": "^2.88.2",
"request-promise-native": "^1.0.9",
"rxjs": "^6.4.0",
"shelljs": "^0.8.3",
"rxjs": "^7.8.0",
"shelljs": "^0.8.5",
"spawn-rx": "^3.0.0",
"tmp": "^0.0.33",
"url-join": "^4.0.1",
"vscode-azureextensionui": "^0.38.2",
"vscode-kubernetes-tools-api": "^1.0.0"
"tmp": "^0.2.1",
"url-join": "^5.0.0",
"vscode-azureextensionui": "^0.50.0",
"vscode-kubernetes-tools-api": "^1.3.0"
},
"repository": {
"type": "git",
"url": "https://github.com/inercia/vscode-k3d"
"url": "https://github.com/k3d-io/vscode-k3d"
},
"bugs": {
"url": "https://github.com/inercia/vscode-k3d/issues"
"url": "https://github.com/k3d-io/vscode-k3d/issues"
}
}
2 changes: 1 addition & 1 deletion src/commands/createCluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export async function createCluster(createSettings: settings.ClusterCreateSettin

export async function createClusterInteractive(
clusterSettings: settings.ClusterCreateSettings,
switchContext: boolean = true): Promise<void> {
switchContext = true): Promise<void> {

const kubeconfig = await kubectl.getKubeconfigPath();

Expand Down
5 changes: 3 additions & 2 deletions src/commands/createClusterForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export function getCreateClusterFormStyle(): string {
[vscode.ColorThemeKind.Light]: "light",
[vscode.ColorThemeKind.Dark]: "dark",
[vscode.ColorThemeKind.HighContrast]: "dark",
[vscode.ColorThemeKind.HighContrastLight]: "light",
}[vscode.window.activeColorTheme.kind];

// TODO: there must be a better way to do this...
Expand Down Expand Up @@ -215,7 +216,7 @@ export async function getCreateClusterForm(defaults: ClusterCreateSettings): Pro
The image used for creating all the nodes in the cluster.
<ul>
<li> Leave empty for using the default image.</li>
<li> You can also provide your own image name (ie, "rancher/k3d:v1.18")</li>
<li> You can also provide your own image name (ie, "k3d-io/k3d:v1.18")</li>
${datalistExplain}
</ul>
</h6>
Expand Down Expand Up @@ -439,6 +440,6 @@ async function getProposedImages(): Promise<Errorable<string[]>> {
}
} catch (error) {
logChannel.showOutput(`[images proposals] error: ${error}`);
return { succeeded: false, error: error };
return { succeeded: false, error: error as string[]};
}
}
2 changes: 1 addition & 1 deletion src/commands/createClusterSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export interface ClusterCreateSettings {

// createClusterArgsFromSettings returns a list of arguments for `k3d cluster create`
// for some cluster creation settings
export function createClusterArgsFromSettings(settings: ClusterCreateSettings, switchContext: boolean = true): string[] {
export function createClusterArgsFromSettings(settings: ClusterCreateSettings, switchContext = true): string[] {
const args: string[] = [];

if (settings.numServers) {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/deleteCluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ async function deleteClusterInteractive(): Promise<void> {
}

// deleteClusterByName will be invoked when users click on "Delete cluster"
export async function deleteClusterByName(clusterName: string, askUser: boolean = true): Promise<void> {
export async function deleteClusterByName(clusterName: string, askUser = true): Promise<void> {
if (askUser) {
const confirmed = await confirm(`This will delete "${clusterName}". You will not be able to undo this.`, 'Delete cluster');
if (!confirmed) {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/replaceCluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export async function onReplaceClusterLast(target?: any): Promise<void> {
//////////////////////////////////////////////////////////////////////////////////////////////

export async function replaceCluster(createSettings: settings.ClusterCreateSettings, target?: any): Promise<void> {
let actions: Promise<void>[] = [];
const actions: Promise<void>[] = [];

const promisedClusters = await k3d.getClusters(shell);
let clustersByCreation: model.K3dClusterInfo[] = [];
Expand Down
4 changes: 2 additions & 2 deletions src/installer/downloads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as path from 'path';
import * as stream from 'stream';
import * as tmp from 'tmp';

import { succeeded, Errorable } from '../utils/errorable';
import { Errorable, succeeded } from '../utils/errorable';

type DownloadFunc =
(url: string, destination?: string, options?: any)
Expand Down Expand Up @@ -38,6 +38,6 @@ export async function to(sourceUrl: string, destinationFile: string): Promise<Er
await download!(sourceUrl, path.dirname(destinationFile), { filename: path.basename(destinationFile) }); // safe because we ensured it
return { succeeded: true, result: null };
} catch (e) {
return { succeeded: false, error: [e.message] };
return { succeeded: false, error: [(e as Error).message] };
}
}
20 changes: 10 additions & 10 deletions src/installer/installer.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
'use strict';

import * as vscode from 'vscode';
import * as download from './downloads';
import { Octokit } from "@octokit/rest";
import * as fs from 'fs';
import { mkdirp } from 'mkdirp';
import * as path from 'path';
import mkdirp = require('mkdirp');
import { Octokit } from "@octokit/rest";
import * as vscode from 'vscode';
import * as download from './downloads';

import { platformUrlString, getInstallFolder } from './installationlayout';
import { getInstallFolder, platformUrlString } from './installationlayout';

import * as shell from '../utils/shell';
import { logChannel } from '../utils/log';
import { Errorable, failed } from '../utils/errorable';
import * as config from '../utils/config';
import { Errorable, failed } from '../utils/errorable';
import { refreshKubernetesToolsViews } from '../utils/host';
import { logChannel } from '../utils/log';
import * as shell from '../utils/shell';

const octokit = new Octokit();

// the base URL for downloading the executable
const updateExeURLBase = "https://github.com/rancher/k3d/releases/download";
const updateExeURLBase = "https://github.com/k3d-io/k3d/releases/download";

export enum EnsureMode {
Alert,
Expand Down Expand Up @@ -136,4 +136,4 @@ async function getLatestK3DVersionAvailable(): Promise<Errorable<string>> {

logChannel.appendLine(`[installer] found latest version ${latestVersion} from GitHub relases`);
return { succeeded: true, result: latestVersion };
}
}
6 changes: 3 additions & 3 deletions src/k3d/k3d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ async function invokeK3DCommandObj<T>(

const kubeconfig = await kubectl.getKubeconfigPath();

let opts = shell.defExecOpts();
const opts = shell.defExecOpts();
opts.env["KUBECONFIG"] = kubeconfig;

const cmd = `${exe} ${command} ${args}`;
Expand Down Expand Up @@ -56,7 +56,7 @@ function invokeK3DCommandTracking(
}
const exe = k3dExe.result;

let opts = shell.defExecOpts();
const opts = shell.defExecOpts();
if (kubeconfig) {
opts.env["KUBECONFIG"] = kubeconfig;
}
Expand All @@ -73,7 +73,7 @@ function invokeK3DCommandTracking(
export function createCluster(sh: shell.Shell,
settings: ClusterCreateSettings,
kubeconfig: string,
switchContext: boolean = true): Observable<shell.ProcessTrackingEvent> {
switchContext = true): Observable<shell.ProcessTrackingEvent> {

const args: string[] = createClusterArgsFromSettings(settings, switchContext);
if (settings.name) {
Expand Down
9 changes: 5 additions & 4 deletions src/providers/cloudProvider.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import * as k8s from 'vscode-kubernetes-tools-api';
import * as vscode from 'vscode';

import * as dedent from 'dedent';
import * as vscode from 'vscode';
import * as k8s from 'vscode-kubernetes-tools-api';

import * as k3d from '../k3d/k3d';
import { shell } from '../utils/shell';
import { failed } from '../utils/errorable';
import { shell } from '../utils/shell';
import '../utils/string';


Expand Down Expand Up @@ -41,6 +42,7 @@ class K3dCloudProvider implements k8s.CloudExplorerV1.CloudProvider {
}
}


class K3dTreeDataProvider implements vscode.TreeDataProvider<K3dCloudProviderTreeNode> {

private onDidChangeTreeDataEmitter: vscode.EventEmitter<K3dCloudProviderTreeNode | undefined> =
Expand Down Expand Up @@ -158,7 +160,6 @@ class K3dTreeDataProvider implements vscode.TreeDataProvider<K3dCloudProviderTre
switch (element.nodeType) {
case 'cluster':
return getNodesForCluster(element.clusterName);
break;
}

return [];
Expand Down
2 changes: 1 addition & 1 deletion src/utils/dictionary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export type Dictionary<T> = {
[key: string]: T;
};

export module Dictionary {
export namespace Dictionary {
export function of<T>(): Dictionary<T> {
return {};
}
Expand Down
4 changes: 2 additions & 2 deletions src/utils/docker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ export async function getDockerInfo(dockerHost?: string): Promise<any> {
const options = new Options();

if (dockerHost) {
let localEnv = process.env;
const localEnv = process.env;
localEnv["DOCKER_HOST"] = dockerHost;
options.env = localEnv;
}

let docker = new Docker(options);
const docker = new Docker(options);
return docker.command('info').then(function (data) {
return data.object;
});
Expand Down
Loading

0 comments on commit 8104f6a

Please sign in to comment.