Skip to content

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
hajekj committed Sep 21, 2022
0 parents commit 6941212
Show file tree
Hide file tree
Showing 13 changed files with 7,443 additions and 0 deletions.
480 changes: 480 additions & 0 deletions .gitignore

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright (c) 2022 NETWORG

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3 changes: 3 additions & 0 deletions PRIVACY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Privacy Policy

We don't collect any personal or organizational data with this extension.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This extension allows you to open repository (and also a file or branch) from Azure DevOps directly in [VSCode.dev](https://code.visualstudio.com/blogs/2021/10/20/vscode-dev).

![](static/screenshots/screenshot.png)
6,727 changes: 6,727 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "azdo-open-in-vscodedev",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"build": "webpack",
"pack": "tfx extension create --rev-version"
},
"keywords": [],
"author": "NETWORG",
"license": "MIT",
"devDependencies": {
"tfx-cli": "^0.12.0",
"ts-loader": "^9.4.1",
"typescript": "^4.8.3",
"webpack": "^5.74.0",
"webpack-cli": "^4.10.0"
},
"dependencies": {
"vss-web-extension-sdk": "^5.141.0"
}
}
46 changes: 46 additions & 0 deletions src/open-in-vscodedev.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import { SourceItemContext } from "TFS/VersionControl/UIContracts";

class OpenInVsCodeDev {
public static execute(actionContext: SourceItemContext) {
if (actionContext.item.sourceProvider !== "Git") {
alert(`Unsupported sourceProvider: ${actionContext.item.sourceProvider}!`);
}

const vssContext = VSS.getWebContext();
const organization = vssContext.collection.name;
const project = vssContext.project.name;
const repo = actionContext.gitRepository.name;

const path = actionContext.item.isFolder ? null : actionContext.item.path;

let url = `https://vscode.dev/azurerepos/${organization}/${project}/${repo}`;
const urlParams = new URLSearchParams();
// @ts-ignore - This bears the version of the specific item (branch, commit)
urlParams.set("version", actionContext.item.item.version);
if (path) {
urlParams.set("path", path);
}
if ([...urlParams.entries()].length > 0) {
url += `?${urlParams.toString()}`;
}

window.open(url, '_blank');
}
}

VSS.init({});

var openInVsCodeDevHandler = (function () {
"use strict";
return {
// This is a callback that gets invoked when a user selects the newly contributed menu item
// The actionContext parameter contains context data surrounding the circumstances of this
// action getting invoked.
execute: function (actionContext: SourceItemContext) {
return OpenInVsCodeDev.execute(actionContext);
}
};
}());

VSS.register("open-in-vscodedev", openInVsCodeDevHandler);
// VSS.notifyLoadSucceeded();
12 changes: 12 additions & 0 deletions static/open-in-vscodedev.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<script src="../lib/VSS.SDK.js"></script>
<script src="../dist/open-in-vscodedev.js"></script>
</head>

<body>
</body>

</html>
Binary file added static/open-in-vscodedev.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/screenshots/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"compilerOptions": {
"module": "UMD",
"moduleResolution": "node",
"target": "ES6",
"rootDir": "src/",
"outDir": "dist/",
"sourceMap": true,
"types": [
"vss-web-extension-sdk"
],
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
},
"exclude": [
"node_modules"
]
}
82 changes: 82 additions & 0 deletions vss-extension.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{
"manifestVersion": 1,
"id": "open-in-vscodedev",
"publisher": "NETWORG",
"version": "0.0.27",
"name": "Open in VSCode.dev",
"description": "Adds a handy button to open your Azure Repo in VSCode.dev",
"public": true,
"categories": [
"Azure Repos"
],
"content": {
"details": {
"path": "README.md"
},
"license": {
"path": "LICENSE.md"
},
"privacy": {
"path": "PRIVACY.md"
}
},
"links": {
"support": {
"uri": "https://github.com/NETWORG/azdo-open-in-vscodedev/issues"
}
},
"tags": [
"vscode.dev",
"VSCode",
"Visual Studio Code"
],
"icons": {
"default": "static/open-in-vscodedev.png"
},
"repository": {
"type": "git",
"uri": "https://github.com/NETWORG/azdo-open-in-vscodedev"
},
"targets": [
{
"id": "Microsoft.VisualStudio.Services"
}
],
"galleryFlags": [
"Public",
"Preview"
],
"contributions": [
{
"id": "open-in-vscodedev",
"type": "ms.vss-web.action",
"targets": [
"ms.vss-code-web.source-item-menu"
],
"properties": {
"uri": "static/open-in-vscodedev.html",
"text": "Open in VSCode.dev",
"icon": {
"light": "static/open-in-vscodedev.png",
"dark": "static/open-in-vscodedev.png"
},
"registeredObjectId": "open-in-vscodedev"
}
}
],
"files": [
{
"path": "node_modules/vss-web-extension-sdk/lib",
"addressable": true,
"packagePath": "lib"
},
{
"path": "static",
"addressable": true
},
{
"path": "dist",
"addressable": true
}
]
}
29 changes: 29 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
const path = require("path");

module.exports = {
entry: [
"./src/open-in-vscodedev.ts"
],
output: {
filename: "open-in-vscodedev.js"
},
resolve: {
extensions: [".ts"],
alias: {
"azure-devops-extension-sdk": path.resolve("node_modules/azure-devops-extension-sdk")
},
},
stats: {
warnings: false
},
module: {
rules: [
{
test: /\.ts?$/,
loader: "ts-loader"
},
]
},
plugins: [
]
};

0 comments on commit 6941212

Please sign in to comment.