From 80646ed033799d1dfb1bf71d78abd2c94fe0f791 Mon Sep 17 00:00:00 2001 From: Marcel Kloubert Date: Fri, 13 Apr 2018 10:17:45 +0200 Subject: [PATCH] fixes and improvements --- CHANGELOG.md | 6 +++ package-lock.json | 2 +- package.json | 112 +++++++++++++++++++++++++++++++++++++++++++++- src/contracts.ts | 10 +++++ src/http.ts | 23 ++++------ src/packages.ts | 5 ++- src/targets.ts | 5 ++- 7 files changed, 145 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 398a459..f0bd38d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ [![Share via Facebook](https://raw.githubusercontent.com/mkloubert/vscode-deploy-reloaded/master/img/share/Facebook.png)](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fmarketplace.visualstudio.com%2Fitems%3FitemName%3Dmkloubert.vscode-deploy-reloaded"e=vscode-deploy-reloaded) [![Share via Twitter](https://raw.githubusercontent.com/mkloubert/vscode-deploy-reloaded/master/img/share/Twitter.png)](https://twitter.com/intent/tweet?source=https%3A%2F%2Fmarketplace.visualstudio.com%2Fitems%3FitemName%3Dmkloubert.vscode-deploy-reloaded&text=vscode-deploy-reloaded:%20https%3A%2F%2Fmarketplace.visualstudio.com%2Fitems%3FitemName%3Dmkloubert.vscode-deploy-reloaded&via=mjkloubert) [![Share via Google+](https://raw.githubusercontent.com/mkloubert/vscode-deploy-reloaded/master/img/share/Google+.png)](https://plus.google.com/share?url=https%3A%2F%2Fmarketplace.visualstudio.com%2Fitems%3FitemName%3Dmkloubert.vscode-deploy-reloaded) [![Share via Pinterest](https://raw.githubusercontent.com/mkloubert/vscode-deploy-reloaded/master/img/share/Pinterest.png)](https://pinterest.com/pin/create/button/?url=https%3A%2F%2Fmarketplace.visualstudio.com%2Fitems%3FitemName%3Dmkloubert.vscode-deploy-reloaded&media=https://raw.githubusercontent.com/mkloubert/vscode-deploy-reloaded/master/img/demo1.gif&description=Recoded%20version%20of%20Visual%20Studio%20Code%20extension%20%27vs-deploy%27%2C%20which%20provides%20commands%20to%20deploy%20files%20to%20one%20or%20more%20destinations.) [![Share via Reddit](https://raw.githubusercontent.com/mkloubert/vscode-deploy-reloaded/master/img/share/Reddit.png)](https://www.reddit.com/submit?url=https%3A%2F%2Fmarketplace.visualstudio.com%2Fitems%3FitemName%3Dmkloubert.vscode-deploy-reloaded&title=vscode-deploy-reloaded) [![Share via LinkedIn](https://raw.githubusercontent.com/mkloubert/vscode-deploy-reloaded/master/img/share/LinkedIn.png)](https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fmarketplace.visualstudio.com%2Fitems%3FitemName%3Dmkloubert.vscode-deploy-reloaded&title=vscode-deploy-reloaded&summary=Recoded%20version%20of%20Visual%20Studio%20Code%20extension%20%27vs-deploy%27%2C%20which%20provides%20commands%20to%20deploy%20files%20to%20one%20or%20more%20destinations.&source=https%3A%2F%2Fmarketplace.visualstudio.com%2Fitems%3FitemName%3Dmkloubert.vscode-deploy-reloaded) [![Share via Wordpress](https://raw.githubusercontent.com/mkloubert/vscode-deploy-reloaded/master/img/share/Wordpress.png)](https://wordpress.com/press-this.php?u=https%3A%2F%2Fmarketplace.visualstudio.com%2Fitems%3FitemName%3Dmkloubert.vscode-deploy-reloaded"e=vscode-deploy-reloaded&s=Recoded%20version%20of%20Visual%20Studio%20Code%20extension%20%27vs-deploy%27%2C%20which%20provides%20commands%20to%20deploy%20files%20to%20one%20or%20more%20destinations.&i=https://raw.githubusercontent.com/mkloubert/vscode-deploy-reloaded/master/img/demo1.gif) [![Share via Email](https://raw.githubusercontent.com/mkloubert/vscode-deploy-reloaded/master/img/share/Email.png)](mailto:?subject=vscode-deploy-reloaded&body=Recoded%20version%20of%20Visual%20Studio%20Code%20extension%20'vs-deploy'%2C%20which%20provides%20commands%20to%20deploy%20files%20to%20one%20or%20more%20destinations.:%20https%3A%2F%2Fmarketplace.visualstudio.com%2Fitems%3FitemName%3Dmkloubert.vscode-deploy-reloaded) +## 0.73.0 (April 13th, 2018; fixes and improvements) + +* bugfixes +* code cleanups and improvements +* added `isHidden` settings for [packages](https://github.com/mkloubert/vscode-deploy-reloaded/wiki#packages-) and [targets](https://github.com/mkloubert/vscode-deploy-reloaded/wiki#targets-) + ## 0.72.1 (April 13th, 2018; file explorer operations) * can list or remove directories on [targets](https://github.com/mkloubert/vscode-deploy-reloaded/wiki#targets-), from file explorer now diff --git a/package-lock.json b/package-lock.json index 0363de0..39e3987 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "vscode-deploy-reloaded", - "version": "0.72.1", + "version": "0.73.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index f9169e4..c36399a 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "vscode-deploy-reloaded", "displayName": "Deploy (Reloaded)", "description": "Deploys files of a workspace to a destination.", - "version": "0.72.1", + "version": "0.73.0", "publisher": "mkloubert", "engines": { "vscode": "^1.22.0" @@ -1070,6 +1070,11 @@ "description": "(JavaScript) Code, which indicates, if entry is available or not.", "type": "string" }, + "isHidden": { + "description": "Hide package in the GUI or not.", + "type": "boolean", + "default": false + }, "name": { "description": "A (display) name for that package.", "type": "string" @@ -4035,6 +4040,11 @@ "inputScriptOptions": { "description": "Options for the input script." }, + "isHidden": { + "description": "Hide target in the GUI or not.", + "type": "boolean", + "default": false + }, "mappings": { "description": "Defines one or more folder mappings by minimatch patterns.", "type": "object", @@ -7718,6 +7728,11 @@ "description": "(JavaScript) Code, which indicates, if entry is available or not.", "type": "string" }, + "isHidden": { + "description": "Hide target in the GUI or not.", + "type": "boolean", + "default": false + }, "mappings": { "description": "Defines one or more folder mappings by minimatch patterns.", "type": "object", @@ -11332,6 +11347,11 @@ "description": "(JavaScript) Code, which indicates, if entry is available or not.", "type": "string" }, + "isHidden": { + "description": "Hide target in the GUI or not.", + "type": "boolean", + "default": false + }, "mappings": { "description": "Defines one or more folder mappings by minimatch patterns.", "type": "object", @@ -14973,6 +14993,11 @@ "description": "(JavaScript) Code, which indicates, if entry is available or not.", "type": "string" }, + "isHidden": { + "description": "Hide target in the GUI or not.", + "type": "boolean", + "default": false + }, "mappings": { "description": "Defines one or more folder mappings by minimatch patterns.", "type": "object", @@ -18594,6 +18619,11 @@ "description": "(JavaScript) Code, which indicates, if entry is available or not.", "type": "string" }, + "isHidden": { + "description": "Hide target in the GUI or not.", + "type": "boolean", + "default": false + }, "mappings": { "description": "Defines one or more folder mappings by minimatch patterns.", "type": "object", @@ -22226,6 +22256,11 @@ "description": "(JavaScript) Code, which indicates, if entry is available or not.", "type": "string" }, + "isHidden": { + "description": "Hide target in the GUI or not.", + "type": "boolean", + "default": false + }, "mappings": { "description": "Defines one or more folder mappings by minimatch patterns.", "type": "object", @@ -26118,6 +26153,11 @@ "description": "(JavaScript) Code, which indicates, if entry is available or not.", "type": "string" }, + "isHidden": { + "description": "Hide target in the GUI or not.", + "type": "boolean", + "default": false + }, "mappings": { "description": "Defines one or more folder mappings by minimatch patterns.", "type": "object", @@ -27315,6 +27355,11 @@ "type": "string" } }, + "supportsDeepDirectoryCreation": { + "type": "boolean", + "description": "Server supports deep directory creation or not.", + "default": false + }, "transformer": { "description": "The path (or URI) to the data transformer script.", "type": "string" @@ -29791,6 +29836,11 @@ "description": "(JavaScript) Code, which indicates, if entry is available or not.", "type": "string" }, + "isHidden": { + "description": "Hide target in the GUI or not.", + "type": "boolean", + "default": false + }, "mappings": { "description": "Defines one or more folder mappings by minimatch patterns.", "type": "object", @@ -33422,6 +33472,11 @@ "description": "(JavaScript) Code, which indicates, if entry is available or not.", "type": "string" }, + "isHidden": { + "description": "Hide target in the GUI or not.", + "type": "boolean", + "default": false + }, "mappings": { "description": "Defines one or more folder mappings by minimatch patterns.", "type": "object", @@ -37047,6 +37102,11 @@ "description": "Ignore TLS or not.", "default": false }, + "isHidden": { + "description": "Hide target in the GUI or not.", + "type": "boolean", + "default": false + }, "mappings": { "description": "Defines one or more folder mappings by minimatch patterns.", "type": "object", @@ -40723,6 +40783,11 @@ "description": "(JavaScript) Code, which indicates, if entry is available or not.", "type": "string" }, + "isHidden": { + "description": "Hide target in the GUI or not.", + "type": "boolean", + "default": false + }, "mappings": { "description": "Defines one or more folder mappings by minimatch patterns.", "type": "object", @@ -44344,6 +44409,11 @@ "description": "(JavaScript) Code, which indicates, if entry is available or not.", "type": "string" }, + "isHidden": { + "description": "Hide target in the GUI or not.", + "type": "boolean", + "default": false + }, "mappings": { "description": "Defines one or more folder mappings by minimatch patterns.", "type": "object", @@ -48111,6 +48181,11 @@ "description": "(JavaScript) Code, which indicates, if entry is available or not.", "type": "string" }, + "isHidden": { + "description": "Hide target in the GUI or not.", + "type": "boolean", + "default": false + }, "mappings": { "description": "Defines one or more folder mappings by minimatch patterns.", "type": "object", @@ -51728,6 +51803,11 @@ "description": "(JavaScript) Code, which indicates, if entry is available or not.", "type": "string" }, + "isHidden": { + "description": "Hide target in the GUI or not.", + "type": "boolean", + "default": false + }, "mappings": { "description": "Defines one or more folder mappings by minimatch patterns.", "type": "object", @@ -55628,6 +55708,11 @@ "description": "(JavaScript) Code, which indicates, if entry is available or not.", "type": "string" }, + "isHidden": { + "description": "Hide target in the GUI or not.", + "type": "boolean", + "default": false + }, "mappings": { "description": "Defines one or more folder mappings by minimatch patterns.", "type": "object", @@ -56858,6 +56943,11 @@ "type": "string" } }, + "supportsDeepDirectoryCreation": { + "type": "boolean", + "description": "Server supports deep directory creation or not.", + "default": false + }, "transformer": { "description": "The path (or URI) to the data transformer script.", "type": "string" @@ -59306,6 +59396,11 @@ "description": "(JavaScript) Code, which indicates, if entry is available or not.", "type": "string" }, + "isHidden": { + "description": "Hide target in the GUI or not.", + "type": "boolean", + "default": false + }, "mappings": { "description": "Defines one or more folder mappings by minimatch patterns.", "type": "object", @@ -62971,6 +63066,11 @@ "description": "(JavaScript) Code, which indicates, if entry is available or not.", "type": "string" }, + "isHidden": { + "description": "Hide target in the GUI or not.", + "type": "boolean", + "default": false + }, "mappings": { "description": "Defines one or more folder mappings by minimatch patterns.", "type": "object", @@ -66643,6 +66743,11 @@ "description": "(JavaScript) Code, which indicates, if entry is available or not.", "type": "string" }, + "isHidden": { + "description": "Hide target in the GUI or not.", + "type": "boolean", + "default": false + }, "mappings": { "description": "Defines one or more folder mappings by minimatch patterns.", "type": "object", @@ -70261,6 +70366,11 @@ "description": "(JavaScript) Code, which indicates, if entry is available or not.", "type": "string" }, + "isHidden": { + "description": "Hide target in the GUI or not.", + "type": "boolean", + "default": false + }, "mappings": { "description": "Defines one or more folder mappings by minimatch patterns.", "type": "object", diff --git a/src/contracts.ts b/src/contracts.ts index 20e6a63..d816197 100644 --- a/src/contracts.ts +++ b/src/contracts.ts @@ -95,6 +95,16 @@ export interface Cancelable { readonly isCancelling: boolean; } +/** + * An object that can be hidden. + */ +export interface CanHide { + /** + * Is hidden or not. + */ + readonly isHidden?: boolean; +} + /** * Possible values for a 'checkForRequirements' setting. */ diff --git a/src/http.ts b/src/http.ts index b1c6441..c8995dd 100644 --- a/src/http.ts +++ b/src/http.ts @@ -15,6 +15,7 @@ * along with this program. If not, see . */ +import * as deploy_contracts from './contracts'; import * as deploy_helpers from './helpers'; import * as HTTP from 'http'; import * as HTTPs from 'https'; @@ -30,36 +31,30 @@ export interface RequestOptions extends HTTP.RequestOptions { /** * The maximum number of redirections. */ - maximumRedirections?: number; + readonly maximumRedirections?: number; /** * Do not redirect automatically. */ - noRedirect?: boolean; + readonly noRedirect?: boolean; /** * Raise error on 4xx status code or not. */ - raiseOnClientError?: boolean; + readonly raiseOnClientError?: boolean; /** * Raise error on 5xx status code or not. */ - raiseOnServerError?: boolean; + readonly raiseOnServerError?: boolean; /** * Raise error on status code that is greater than 599 or less than 200. Default: (true) */ - raiseOnUnsupportedResponse?: boolean; + readonly raiseOnUnsupportedResponse?: boolean; /** * Function or data for setting up the request. */ - setup?: any; + readonly setup?: any; } -/** - * Stores the address of the default host. - */ -export const DEFAULT_HOST = '127.0.0.1'; - - /** * Reads the content of a HTTP request body. * @@ -106,7 +101,7 @@ function requestInner(url: string | URL.Url, opts: RequestOptions, if (!deploy_helpers.isObject(url)) { url = deploy_helpers.toStringSafe(url); if (deploy_helpers.isEmptyString(url)) { - url = `http://${DEFAULT_HOST}/`; + url = `http://${deploy_contracts.DEFAULT_HOST}/`; } url = URL.parse(url); @@ -150,7 +145,7 @@ function requestInner(url: string | URL.Url, opts: RequestOptions, DEFAULT_OPTS.port = port; if (deploy_helpers.isEmptyString(DEFAULT_OPTS.hostname)) { - DEFAULT_OPTS.hostname = DEFAULT_HOST; + DEFAULT_OPTS.hostname = deploy_contracts.DEFAULT_HOST; } const FINAL_REQUEST_OPTS: RequestOptions = MergeDeep(DEFAULT_OPTS, opts); diff --git a/src/packages.ts b/src/packages.ts index f1a6846..82024c2 100644 --- a/src/packages.ts +++ b/src/packages.ts @@ -64,6 +64,7 @@ export interface AutoDeployFileOptions { * A package. */ export interface Package extends deploy_values.Applyable, + deploy_contracts.CanHide, deploy_contracts.ConditionalItem, deploy_contracts.FileFilter, deploy_contracts.PlatformItem, @@ -1138,7 +1139,9 @@ export function resetPackageUsage(context: vscode.ExtensionContext) { export async function showPackageQuickPick(context: vscode.ExtensionContext, packages: Package | Package[], opts?: vscode.QuickPickOptions): Promise { - const QUICK_PICKS: deploy_contracts.ActionQuickPick[] = deploy_helpers.asArray(packages).map(pkg => { + const QUICK_PICKS: deploy_contracts.ActionQuickPick[] = deploy_helpers.asArray(packages).filter(pkg => { + return !deploy_helpers.toBooleanSafe(pkg.isHidden); + }).map(pkg => { const WORKSPACE = pkg.__workspace; return { diff --git a/src/targets.ts b/src/targets.ts index 6a19d8a..2611ac8 100644 --- a/src/targets.ts +++ b/src/targets.ts @@ -137,6 +137,7 @@ export type PrepareTargetOperationValue = PrepareTargetOperation | string; * A target. */ export interface Target extends deploy_values.Applyable, + deploy_contracts.CanHide, deploy_transformers.CanTransformData, deploy_contracts.ConditionalItem, deploy_contracts.Encryptable, @@ -1272,7 +1273,9 @@ export function resetTargetUsage(context: vscode.ExtensionContext) { export async function showTargetQuickPick(context: vscode.ExtensionContext, targets: Target | Target[], opts?: vscode.QuickPickOptions): Promise { - const QUICK_PICKS: deploy_contracts.ActionQuickPick[] = deploy_helpers.asArray(targets).map(t => { + const QUICK_PICKS: deploy_contracts.ActionQuickPick[] = deploy_helpers.asArray(targets).filter(f => { + return !deploy_helpers.toBooleanSafe(f.isHidden); + }).map(t => { const WORKSPACE = t.__workspace; return {