Skip to content

Commit

Permalink
initial implementation (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
rossknudsen authored Mar 31, 2024
1 parent 24f2cb7 commit 90f5f65
Show file tree
Hide file tree
Showing 5 changed files with 162 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
out/
node_modules/
36 changes: 36 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "vscode-nuget-installer-api",
"version": "0.0.0",
"description": "Contracts for VS Code Nuget Installer",
"main": "out/index.js",
"types": "out/index.d.ts",
"scripts": {
"build": "tsc"
},
"repository": {
"type": "git",
"url": "git+https://github.com/kavod-io/vscode-nuget-installer-api.git"
},
"author": "Ross Knudsen",
"license": "MIT",
"bugs": {
"url": "https://github.com/kavod-io/vscode-nuget-installer-api/issues"
},
"homepage": "https://github.com/kavod-io/vscode-nuget-installer-api#readme",
"devDependencies": {
"@types/vscode": "^1.75.0",
"typescript": "^5.4.3"
}
}
89 changes: 89 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/**
* This is a definition for a Nuget source. These are defined in the extension settings.
*/
export interface PackageSource {
name: string;

/**
* Service Index URL e.g. https://api.nuget.org/v3/index.json
*/
url: string;

credentials: Credentials | null;
}

export interface Credentials {
username: string;
password: string;
}

export type Message =
| SetProjectsMessage
| SetSourcesMessage
| AddCompleteMessage
| RemoveCompleteMessage;

export interface SetProjectsMessage {
command: "setProjects";
payload: Project[];
commandId: string;
}

export interface SetSourcesMessage {
command: "setSources";
payload: PackageSource[];
commandId: string;
}

export interface AddCompleteMessage {
command: "addCompleted";
commandId: string;
}

export interface RemoveCompleteMessage {
command: "removeCompleted";
commandId: string;
}

export interface Project {
path: string;
projectName: string;
packages: ProjectPackage[];
}

export interface ProjectPackage {
id: string;
version: string;
}

export type Command =
| GetProjectCommand
| GetSourcesCommand
| AddPackagesCommand
| RemovePackagesCommand;

export interface GetProjectCommand {
command: "getProjects";
commandId: string;
}

export interface GetSourcesCommand {
command: "getSources";
commandId: string;
}

export interface AddPackagesCommand {
command: "add";
commandId: string;
source: string;
projects: Project[];
packageId: string;
version: string;
}

export interface RemovePackagesCommand {
command: "remove";
commandId: string;
projects: Project[];
packageId: string;
}
11 changes: 11 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"compilerOptions": {
"target": "es2015",
"module": "commonjs",
"outDir": "out",
"declaration": true
},
"include": [
"src/index.ts"
]
}

0 comments on commit 90f5f65

Please sign in to comment.