From e7c51e858b4c2c5c00de76636eaee0e6b94c8482 Mon Sep 17 00:00:00 2001 From: Matt Lavery Date: Fri, 20 Apr 2018 13:08:31 +1000 Subject: [PATCH 1/3] Initial migration of code from original repo --- .gitignore | 2 + .vscode/launch.json | 24 ++++ .vscodeignore | 4 + CHANGELOG.md | 7 ++ README.md | 13 ++ src/README.md | 60 +++++++++ src/package.json | 159 ++++++++++++++++++++++++ src/package.orig.json | 144 +++++++++++++++++++++ src/sql/mssql-db-spaceused-detail.sql | 18 +++ src/sql/mssql-db-spaceused-filetype.sql | 16 +++ src/sql/mssql-db-spaceused.sql | 14 +++ vsc-extension-quickstart.md | 22 ++++ 12 files changed, 483 insertions(+) create mode 100644 .gitignore create mode 100644 .vscode/launch.json create mode 100644 .vscodeignore create mode 100644 CHANGELOG.md create mode 100644 README.md create mode 100644 src/README.md create mode 100644 src/package.json create mode 100644 src/package.orig.json create mode 100644 src/sql/mssql-db-spaceused-detail.sql create mode 100644 src/sql/mssql-db-spaceused-filetype.sql create mode 100644 src/sql/mssql-db-spaceused.sql create mode 100644 vsc-extension-quickstart.md diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..aeee732 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +node_modules +*.vsix diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..849b816 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,24 @@ +// A launch configuration that launches the extension inside a new window +// Use IntelliSense to learn about possible attributes. +// Hover to view descriptions of existing attributes. +// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + +// To debug the extension: +// 1. please install the "SQL Operations Studio Debug" extension into VSCode +// 2. Ensure sqlops is added to your path: +// - open SQL Operations Studio +// - run the command "Install 'sqlops' command in PATH" +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Extension", + "type": "sqlopsExtensionHost", + "request": "launch", + "runtimeExecutable": "sqlops", + "args": [ + "--extensionDevelopmentPath=${workspaceFolder}\\src" + ] + } + ] +} \ No newline at end of file diff --git a/.vscodeignore b/.vscodeignore new file mode 100644 index 0000000..f369b5e --- /dev/null +++ b/.vscodeignore @@ -0,0 +1,4 @@ +.vscode/** +.vscode-test/** +.gitignore +vsc-extension-quickstart.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..2a7c9d7 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,7 @@ +# Change Log +All notable changes to the "alwayson-insights" extension will be documented in this file. + +Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file. + +## [Unreleased] +- Initial release diff --git a/README.md b/README.md new file mode 100644 index 0000000..44ad3a2 --- /dev/null +++ b/README.md @@ -0,0 +1,13 @@ +# README +## This is the README for your extension "alwayson-insights" +You can author your README using Visual Studio Code. Here are some useful editor keyboard shortcuts: + +* Split the editor (`Cmd+\` on macOS or `Ctrl+\` on Windows and Linux) +* Toggle preview (`Shift+CMD+V` on macOS or `Shift+Ctrl+V` on Windows and Linux) +* Press `Ctrl+Space` (Windows, Linux) or `Cmd+Space` (macOS) to see a list of Markdown snippets + +### For more information +* [Visual Studio Code's Markdown Support](http://code.visualstudio.com/docs/languages/markdown) +* [Markdown Syntax Reference](https://help.github.com/articles/markdown-basics/) + +**Enjoy!** diff --git a/src/README.md b/src/README.md new file mode 100644 index 0000000..e21d9a1 --- /dev/null +++ b/src/README.md @@ -0,0 +1,60 @@ +# MSSQL-Database-Insights widget + +This collection of widgets are designed to provide insights into MSSQL Database to further extend the built-in default widgets. + +Where possible all of these widgets will include more detail when you click *_Show Details_* from the widget menu. + +![Show details](../docs/images/show-detail.png) + +## Supported SQL Server Versions + +These widgets have been tested against the following SQL Server versions: + +* SQL Server 2016 +* SQL Server 2017 (Windows & linux) + +If you find any issues using these widgets on these supported SQL Server versions, or any other versions please create an issue as we would like to make these available for as many releases as possible. + +***We are looking for testers to confirm other environments.*** So if you find they do work on other releases let me know, and credit will be given. + +## mssql-db-spaceused + +This Database Dashboard widget includes information on the current used space within a Database. Information will be shown in the form of a pie chart displaying the percentage of used space verses free space. + +![mssql-db-spaceused.png](../docs/images/mssql-database-insights/mssql-db-spaceused.png) + +You can access more information about the space usaged in the detailed fly-out displayed when you select "..." on the widget. + +![mssql-db-spaceused-details.png](../docs/images/mssql-database-insights/mssql-db-spaceused-details.png) + +To enable this widget add the following json to either your user or workspace settings in the *dashboard.database.widgets* section. + +```json +{ + "name": "DB Space Used", + "widget": { + "mssql-db-spaceused": null + } +} +``` + +## mssql-db-spaceused-filetype + +This Database Dashboard widget includes information on the current used space within a Database broken down by the various file types (ROWS, LOG). Information will be shown in the form of a bar chart displaying the percentage of used space verses free space for each file type. + +![mssql-db-spaceused-filetype.png](../docs/images/mssql-database-insights/mssql-db-spaceused-filetype.png) + +You can access more information about the space usaged in the detailed fly-out displayed when you select "..." on the widget. + +![mssql-db-spaceused-details.png](../docs/images/mssql-database-insights/mssql-db-spaceused-details.png) + +To enable this widget add the following json to either your user or workspace settings in the *dashboard.database.widgets* section. + +```json +{ + "name": "DB Space Used (by filetype)", + "widget": { + "mssql-db-spaceused-filetype": null + } +} +``` \ No newline at end of file diff --git a/src/package.json b/src/package.json new file mode 100644 index 0000000..7643b84 --- /dev/null +++ b/src/package.json @@ -0,0 +1,159 @@ +{ + "name": "mssql-db-insights", + "displayName": "MSSQL Db Insights", + "description": "Sql Server Database insights", + "version": "0.2.0", + "publisher": "matticusau", + "license": "MIT", + "author": { + "email": "matt.lavery@outlook.com", + "name": "Matt Lavery", + "url": "http://www.matticus.net" + }, + "repository": { + "type": "git", + "url": "https://github.com/matticusau/sqlops-mssql-db-insights" + }, + "bugs": { + "url": "https://github.com/matticusau/sqlops-mssql-db-insights/issues", + "email": "matt.lavery@outlook.com" + }, + "engines": { + "vscode": "^1.22.0", + "sqlops": "*" + }, + "categories": [ + "Other" + ], + "homepage": "https://github.com/matticusau/sqlops-mssql-db-insights", + "contributes": { + "dashboard.insights": [ + { + "id": "mssql-db-spaceused.insight", + "contrib": { + "queryFile": "./sql/mssql-db-spaceused.sql", + "type": { + "pie": { + "dataDirection": "horizontal", + "dataType": "number", + "legendPosition": "bottom", + "labelFirstColumn": false, + "columnsAsLabels": false + } + }, + "details": { + "queryFile": "./sql/mssql-db-spaceused-detail.sql", + "label": { + "icon": "database", + "column": "file_name", + "state": [ + { + "condition": { + "if": "greaterthan", + "greaterthan": "95" + }, + "color": "red" + }, + { + "condition": { + "if": "greaterthan", + "greaterthan": "85" + }, + "color": "orange" + }, + { + "condition": { + "if": "lessthan", + "lessthan": "86" + }, + "color": "green" + } + ] + }, + "value": "used_space_percent", + "actions": null + } + } + }, + { + "id": "mssql-db-spaceused-filetype.insight", + "contrib": { + "queryFile": "./sql/mssql-db-spaceused-filetype.sql", + "type": { + "horizontalBar": { + "dataDirection": "vertical", + "dataType": "number", + "legendPosition": "bottom", + "labelFirstColumn": true, + "columnsAsLabels": true + } + }, + "details": { + "queryFile": "./sql/mssql-db-spaceused-detail.sql", + "label": { + "icon": "database", + "column": "file_name", + "state": [ + { + "condition": { + "if": "greaterthan", + "greaterthan": "95" + }, + "color": "red" + }, + { + "condition": { + "if": "greaterthan", + "greaterthan": "85" + }, + "color": "orange" + }, + { + "condition": { + "if": "lessthan", + "lessthan": "86" + }, + "color": "green" + } + ] + }, + "value": "used_space_percent", + "actions": null + } + } + } + ] + , + "dashboard.tabs": [ + { + "id": "mssql-db-insights.tab", + "title": "MSSQL Db Insights", + "description": "SQL Server Database insights and widgets", + "container": { + "widgets-container": [ + { + "name": "Database Space Used", + "gridItemConfig": { + "sizex": 1, + "sizey": 1 + }, + "widget": { + "mssql-db-spaceused.insight": {} + } + }, + { + "name": "Database Space Used (File Type)", + "gridItemConfig": { + "sizex": 1, + "sizey": 1 + }, + "widget": { + "mssql-db-spaceused-filetype.insight": {} + } + } + ] + } + } + ] + } +} \ No newline at end of file diff --git a/src/package.orig.json b/src/package.orig.json new file mode 100644 index 0000000..dcddda9 --- /dev/null +++ b/src/package.orig.json @@ -0,0 +1,144 @@ +{ + "name": "mssql-database-insights", + "version": "0.1.0", + "publisher": "matticusau", + "license": "MIT", + "author": { + "email": "matt.lavery@outlook.com", + "name": "Matt Lavery", + "url": "http://www.matticusau.net" + }, + "repository": { + "type": "git", + "url": "https://github.com/matticusau/sqlops-widgets" + }, + "bugs": { + "url": "https://github.com/matticusau/sqlops-widgets/issues", + "email": "matt.lavery@outlook.com" + }, + "engines": { + "vscode": "*" + }, + "categories": [ + "Other" + ], + "keywords": [ + "sqlops", + "sql", + "sqlops-studio", + "studio" + ], + "homepage": "https://github.com/matticusau/sqlops-widgets", + "contributes": { + "insights": [ + { + "id": "mssql-db-spaceused", + "contrib": { + "name": "Database Space Used", + "provider": "MSSQL", + "edition": [0,1,2,3,4], + "gridItemConfig": { + "x": 1, + "y": 1 + }, + "type": { + "pie": { + "dataDirection": "horizontal", + "dataType": "number", + "legendPosition": "bottom", + "labelFirstColumn": false, + "columnsAsLabels": false + } + }, + "queryFile": "./sql/mssql-db-spaceused.sql", + "details": { + "queryFile": "./sql/mssql-db-spaceused-detail.sql", + "label": { + "icon": "database", + "column": "file_name", + "state": [ + { + "condition": { + "if": "greaterthan", + "greaterthan": "95" + }, + "color": "red" + }, + { + "condition": { + "if": "greaterthan", + "greaterthan": "85" + }, + "color": "orange" + }, + { + "condition": { + "if": "lessthan", + "lessthan": "86" + }, + "color": "green" + } + ] + }, + "value": "used_space_percent", + "actions": null + } + } + }, + { + "id": "mssql-db-spaceused-filetype", + "contrib": { + "name": "Database Space Used (File Type)", + "provider": "MSSQL", + "edition": [0,1,2,3,4], + "gridItemConfig": { + "x": 1, + "y": 1 + }, + "type": { + "horizontalBar": { + "dataDirection": "vertical", + "dataType": "number", + "legendPosition": "bottom", + "labelFirstColumn": true, + "columnsAsLabels": true + } + }, + "queryFile": "./sql/mssql-db-spaceused-filetype.sql", + "details": { + "queryFile": "./sql/mssql-db-spaceused-detail.sql", + "label": { + "icon": "database", + "column": "file_name", + "state": [ + { + "condition": { + "if": "greaterthan", + "greaterthan": "95" + }, + "color": "red" + }, + { + "condition": { + "if": "greaterthan", + "greaterthan": "85" + }, + "color": "orange" + }, + { + "condition": { + "if": "lessthan", + "lessthan": "86" + }, + "color": "green" + } + ] + }, + "value": "used_space_percent", + "actions": null + } + } + } + ] + } +} \ No newline at end of file diff --git a/src/sql/mssql-db-spaceused-detail.sql b/src/sql/mssql-db-spaceused-detail.sql new file mode 100644 index 0000000..f748a01 --- /dev/null +++ b/src/sql/mssql-db-spaceused-detail.sql @@ -0,0 +1,18 @@ +-- +-- Author: Matticusau +-- Purpose: Provides detailed data for the DB Space Used Insights Widget +-- License: https://github.com/Matticusau/sqlops-widgets/blob/master/LICENSE +-- +SELECT file_id + , name [file_name] + , type_desc + , physical_name + , CONVERT(decimal(18,2), size/128.0) [file_size_mb] + , CONVERT(decimal(18,2), max_size/128.0) [max_growth_size_mb] + , CONVERT(decimal(18,2), FILEPROPERTY(name, 'SpaceUsed')/128.0) [used_space_mb] + , CONVERT(decimal(18,2), size/128.0) - CONVERT(decimal(18,2), FILEPROPERTY(name,'SpaceUsed')/128.0) AS [free_space_mb] + , CONVERT(decimal(18,2), (FILEPROPERTY(name, 'SpaceUsed')/128.0) / (size/128.0) * 100) [used_space_percent] + , 100 - CONVERT(decimal(18,2), (FILEPROPERTY(name, 'SpaceUsed')/128.0) / (size/128.0) * 100) AS [free_space_percent] +FROM sys.database_files +ORDER BY type_desc + , file_id \ No newline at end of file diff --git a/src/sql/mssql-db-spaceused-filetype.sql b/src/sql/mssql-db-spaceused-filetype.sql new file mode 100644 index 0000000..8dc6ff7 --- /dev/null +++ b/src/sql/mssql-db-spaceused-filetype.sql @@ -0,0 +1,16 @@ +-- +-- Author: Matticusau +-- Purpose: Provides summary data for the DB Space Used Insights Widget +-- License: https://github.com/Matticusau/sqlops-widgets/blob/master/LICENSE +-- +SELECT type_desc + -- , CONVERT(decimal(18,2), SUM(size)/128.0) [file_size_mb] + -- , CONVERT(decimal(18,2), SUM(max_size)/128.0) [max_growth_size_mb] + -- , CONVERT(decimal(18,2), SUM(FILEPROPERTY(name, 'SpaceUsed'))/128.0) [used_space_mb] + -- , CONVERT(decimal(18,2), SUM(size)/128.0) - CONVERT(decimal(18,2), SUM(FILEPROPERTY(name,'SpaceUsed'))/128.0) AS [free_space_mb] + , CONVERT(decimal(18,2), (SUM(FILEPROPERTY(name, 'SpaceUsed'))/128.0) / (SUM(size)/128.0) * 100) [used_space_percent] + , 100 - CONVERT(decimal(18,2), (SUM(FILEPROPERTY(name, 'SpaceUsed'))/128.0) / (SUM(size)/128.0) * 100) AS [free_space_percent] +FROM sys.database_files +WHERE type_desc IN ('ROWS','LOG') +GROUP BY type_desc +ORDER BY type_desc \ No newline at end of file diff --git a/src/sql/mssql-db-spaceused.sql b/src/sql/mssql-db-spaceused.sql new file mode 100644 index 0000000..3535a8c --- /dev/null +++ b/src/sql/mssql-db-spaceused.sql @@ -0,0 +1,14 @@ +-- +-- Author: Matticusau +-- Purpose: Provides summary data for the DB Space Used Insights Widget +-- License: https://github.com/Matticusau/sqlops-widgets/blob/master/LICENSE +-- +SELECT + -- CONVERT(decimal(18,2), SUM(size)/128.0) [file_size_mb] , + -- CONVERT(decimal(18,2), SUM(max_size)/128.0) [max_growth_size_mb] , + -- CONVERT(decimal(18,2), SUM(FILEPROPERTY(name, 'SpaceUsed'))/128.0) [used_space_mb] , + -- CONVERT(decimal(18,2), SUM(size)/128.0) - CONVERT(decimal(18,2), SUM(FILEPROPERTY(name,'SpaceUsed'))/128.0) AS [free_space_mb] , + CONVERT(decimal(18,2), (SUM(FILEPROPERTY(name, 'SpaceUsed'))/128.0) / (SUM(size)/128.0) * 100) [used_space_percent], + 100 - CONVERT(decimal(18,2), (SUM(FILEPROPERTY(name, 'SpaceUsed'))/128.0) / (SUM(size)/128.0) * 100) AS [free_space_percent] +FROM sys.database_files +WHERE type_desc IN ('ROWS','LOG') \ No newline at end of file diff --git a/vsc-extension-quickstart.md b/vsc-extension-quickstart.md new file mode 100644 index 0000000..02b9609 --- /dev/null +++ b/vsc-extension-quickstart.md @@ -0,0 +1,22 @@ +# Welcome to your SQL Operations Studio Extension + +## What's in the folder +* This folder contains all of the files necessary for your dashboard insight extension. +* `package.json` - this is the manifest file that defines the list of insights and new dashboard tabs for the extension. Open this in SQL Operations Studio and edit the `contributes` section to add new features. + * `dashboard.insights` section is where your insight definition is added. This is a bar chart insight by default. You can add additional insights here + * `dashboard.tabs` section is where you register a new "tab" or area in the dashboard for your extension, and include your new insight. If you select `No` for the `Add a full dashboard tab?` question this will not be added, and instead you can use the insight in other tabs / in the home tab. +* `sql/query.sql` - this is the file your first insight widget query should be added to. + + +## Get up and running straight away +* Press `F5` to open a new window with your extension loaded. +* Press `Ctrl + .` instead of `Ctrl + Shift + P` +* Verify that it will launch the Command Palette listing all available commands. The `Ctrl + .` keyboard shortcut was added as an example to you. + +## Make changes +* You can relaunch the extension from the debug toolbar after making changes to the files listed above. +* You can also reload (`Ctrl+R` or `Cmd+R` on Mac) the SQL Operations Studio window with your extension to load your changes. + +## Install your extension +* To start using your extension with SQL Operations Studio copy it into the `/.sqlops/extensions` folder and restart SqlOps. +* To share your extension with the world, read on https://github.com/microsoft/sqlopsstudio/wiki/Getting-started-with-Extensibility about publishing an extension. From 9374f64664aa572d9a850fcd3435c616008f0544 Mon Sep 17 00:00:00 2001 From: Matt Lavery Date: Fri, 20 Apr 2018 14:45:41 +1000 Subject: [PATCH 2/3] 0.2.0-beta1 release --- CHANGELOG.md | 12 +++- README.md | 26 +++++--- src/package.json | 2 +- src/package.orig.json | 144 ------------------------------------------ 4 files changed, 27 insertions(+), 157 deletions(-) delete mode 100644 src/package.orig.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a7c9d7..2ce0554 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,15 @@ # Change Log -All notable changes to the "alwayson-insights" extension will be documented in this file. + +All notable changes to the "sqlops-mssql-instance-insights" extension will be documented in this file. Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file. ## [Unreleased] -- Initial release + +- None + +## [0.2.0-beta1] + +### Added + +- Migration of code from [https://github.com/Matticusau/sqlops-widgets](https://github.com/Matticusau/sqlops-widgets) \ No newline at end of file diff --git a/README.md b/README.md index 44ad3a2..a588042 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,19 @@ -# README -## This is the README for your extension "alwayson-insights" -You can author your README using Visual Studio Code. Here are some useful editor keyboard shortcuts: +# MSSQL-Database-Insights widget -* Split the editor (`Cmd+\` on macOS or `Ctrl+\` on Windows and Linux) -* Toggle preview (`Shift+CMD+V` on macOS or `Shift+Ctrl+V` on Windows and Linux) -* Press `Ctrl+Space` (Windows, Linux) or `Cmd+Space` (macOS) to see a list of Markdown snippets +This collection of widgets are designed to provide insights into MSSQL Database to further extend the built-in default widgets. -### For more information -* [Visual Studio Code's Markdown Support](http://code.visualstudio.com/docs/languages/markdown) -* [Markdown Syntax Reference](https://help.github.com/articles/markdown-basics/) +Where possible all of these widgets will include more detail when you click *_Show Details_* from the widget menu. -**Enjoy!** +See the [package README](./src/README.md) for more information. + +## Change Log + +See the [Change Log](./CHANGELOG.md) for the full changes. + +## License + +This project is released under the [MIT License](./LICENSE) + +## Contributors + +* Matticusau [GitHub](https://github.com/Matticusau) | [twitter](https://twitter.com/matticusau) diff --git a/src/package.json b/src/package.json index 7643b84..73bc6ae 100644 --- a/src/package.json +++ b/src/package.json @@ -2,7 +2,7 @@ "name": "mssql-db-insights", "displayName": "MSSQL Db Insights", "description": "Sql Server Database insights", - "version": "0.2.0", + "version": "0.2.0-beta1", "publisher": "matticusau", "license": "MIT", "author": { diff --git a/src/package.orig.json b/src/package.orig.json deleted file mode 100644 index dcddda9..0000000 --- a/src/package.orig.json +++ /dev/null @@ -1,144 +0,0 @@ -{ - "name": "mssql-database-insights", - "version": "0.1.0", - "publisher": "matticusau", - "license": "MIT", - "author": { - "email": "matt.lavery@outlook.com", - "name": "Matt Lavery", - "url": "http://www.matticusau.net" - }, - "repository": { - "type": "git", - "url": "https://github.com/matticusau/sqlops-widgets" - }, - "bugs": { - "url": "https://github.com/matticusau/sqlops-widgets/issues", - "email": "matt.lavery@outlook.com" - }, - "engines": { - "vscode": "*" - }, - "categories": [ - "Other" - ], - "keywords": [ - "sqlops", - "sql", - "sqlops-studio", - "studio" - ], - "homepage": "https://github.com/matticusau/sqlops-widgets", - "contributes": { - "insights": [ - { - "id": "mssql-db-spaceused", - "contrib": { - "name": "Database Space Used", - "provider": "MSSQL", - "edition": [0,1,2,3,4], - "gridItemConfig": { - "x": 1, - "y": 1 - }, - "type": { - "pie": { - "dataDirection": "horizontal", - "dataType": "number", - "legendPosition": "bottom", - "labelFirstColumn": false, - "columnsAsLabels": false - } - }, - "queryFile": "./sql/mssql-db-spaceused.sql", - "details": { - "queryFile": "./sql/mssql-db-spaceused-detail.sql", - "label": { - "icon": "database", - "column": "file_name", - "state": [ - { - "condition": { - "if": "greaterthan", - "greaterthan": "95" - }, - "color": "red" - }, - { - "condition": { - "if": "greaterthan", - "greaterthan": "85" - }, - "color": "orange" - }, - { - "condition": { - "if": "lessthan", - "lessthan": "86" - }, - "color": "green" - } - ] - }, - "value": "used_space_percent", - "actions": null - } - } - }, - { - "id": "mssql-db-spaceused-filetype", - "contrib": { - "name": "Database Space Used (File Type)", - "provider": "MSSQL", - "edition": [0,1,2,3,4], - "gridItemConfig": { - "x": 1, - "y": 1 - }, - "type": { - "horizontalBar": { - "dataDirection": "vertical", - "dataType": "number", - "legendPosition": "bottom", - "labelFirstColumn": true, - "columnsAsLabels": true - } - }, - "queryFile": "./sql/mssql-db-spaceused-filetype.sql", - "details": { - "queryFile": "./sql/mssql-db-spaceused-detail.sql", - "label": { - "icon": "database", - "column": "file_name", - "state": [ - { - "condition": { - "if": "greaterthan", - "greaterthan": "95" - }, - "color": "red" - }, - { - "condition": { - "if": "greaterthan", - "greaterthan": "85" - }, - "color": "orange" - }, - { - "condition": { - "if": "lessthan", - "lessthan": "86" - }, - "color": "green" - } - ] - }, - "value": "used_space_percent", - "actions": null - } - } - } - ] - } -} \ No newline at end of file From 9fa090f8bb5f5386b8987d75f7986a2960cf8326 Mon Sep 17 00:00:00 2001 From: Matt Lavery Date: Fri, 20 Apr 2018 14:54:02 +1000 Subject: [PATCH 3/3] Added build script --- Build.ps1 | 57 ++++++++++++++++++++++++++++++++++++++++++++++++ src/package.json | 3 +-- 2 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 Build.ps1 diff --git a/Build.ps1 b/Build.ps1 new file mode 100644 index 0000000..5af0628 --- /dev/null +++ b/Build.ps1 @@ -0,0 +1,57 @@ +[CmdLetBinding()] +Param ( + [Parameter()] + [string]$BuildDir +) + +[string]$scriptPath = $PSScriptRoot; + +# set the location history +Push-Location; + +# make sure the releases folder exists +if ($null -eq $BuildDir -or $BuildDir.Length -eq 0) +{ + $BuildDir = Join-Path -Path $scriptPath -ChildPath 'Build'; +} +if (-not(Test-Path -Path $BuildDir)) +{ + New-Item -Path $BuildDir -ItemType Directory -Force | Out-Null; +} + +# Get the packages to build in this repo +$packageFiles = Get-ChildItem -Path $scriptPath -Recurse -Filter 'package.json' + +if ($packageFiles.Count -eq 0) +{ + Write-Error -Message 'No Extensions found to package' + Exit +} + +# set our working location to the build folder +Set-Location -Path $BuildDir; + +# process each package found +foreach ($package in $packageFiles) +{ + Write-Verbose -Message "Processing $($package.fullname)"; + + # try + # { + Set-Location -Path $package.DirectoryName; + vsce.cmd package; + Get-ChildItem -Path $package.DirectoryName -Filter '*.vsix' | Move-Item -Destination $BuildDir -Force; + # } + # catch + # { + + # } + + Write-Verbose -Message ('Finished processing package {0}' -f $packageJson.name); + +} + +# return to the previous user location +Pop-Location; + +Write-Verbose -Message 'Extension Packaging Complete'; \ No newline at end of file diff --git a/src/package.json b/src/package.json index 73bc6ae..2ad1685 100644 --- a/src/package.json +++ b/src/package.json @@ -15,8 +15,7 @@ "url": "https://github.com/matticusau/sqlops-mssql-db-insights" }, "bugs": { - "url": "https://github.com/matticusau/sqlops-mssql-db-insights/issues", - "email": "matt.lavery@outlook.com" + "url": "https://github.com/matticusau/sqlops-mssql-db-insights/issues" }, "engines": { "vscode": "^1.22.0",