8000 Add package scripts and cli library, enable integration testing by jaggederest · Pull Request #536 · coder/vscode-coder · GitHub
[go: up one dir, main page]

Skip to content

Add package scripts and cli library, enable integration testing #536

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Jun 20, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update configurations and remove pointless Promise.all
  • Loading branch information
jaggederest committed Jun 18, 2025
commit 32dfda48b878d1ee81b726eec9113de01ab1aa59
17 changes: 16 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,21 @@
"rules": {
"@typescript-eslint/require-await": "off"
}
},
{
"files": ["*.json"],
"parser": "jsonc-eslint-parser",
"rules": {
"@typescript-eslint/require-await": "off"
}
},
{
"extends": ["plugin:package-json/legacy-recommended"],
"files": ["package.json"],
"parser": "jsonc-eslint-parser",
"rules": {
"@typescript-eslint/require-await": "off"
}
}
],
"rules": {
Expand Down Expand Up @@ -60,7 +75,7 @@
}
],
"require-await": "off",
"@typescript-eslint/require-await": "error"
"@typescript-eslint/require-await": "error"
},
"ignorePatterns": ["out", "dist", "**/*.d.ts"]
}
133 changes: 69 additions & 64 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,38 +1,37 @@
{
"name": "coder-remote",
"publisher": "coder",
"displayName": "Coder",
"description": "Open any workspace with a single click.",
"repository": "https://github.com/coder/vscode-coder",
"version": "1.9.1",
"engines": {
"vscode": "^1.73.0"
},
"license": "MIT",
"description": "Open any workspace with a single click.",
"categories": [
"Other"
],
"bugs": {
"url": "https://github.com/coder/vscode-coder/issues"
},
"icon": "media/logo.png",
"extensionKind": [
"ui"
],
"capabilities": {
"untrustedWorkspaces": {
"supported": true
}
"repository": {
"type": "git",
"url": "https://github.com/coder/vscode-coder"
},
"categories": [
"Other"
],
"extensionPack": [
"ms-vscode-remote.remote-ssh"
],
"activationEvents": [
"onResolveRemoteAuthority:ssh-remote",
"onCommand:coder.connect",
"onUri"
],
"license": "MIT",
"publisher": "coder",
"type": "commonjs",
"main": "./dist/extension.js",
"scripts": {
"build": "webpack",
"compile-tests": "tsc -p . --outDir out",
"fmt": "prettier --write .",
"lint": "eslint . --ext ts,md,json",
"lint:fix": "yarn lint --fix",
"package": "webpack --mode production --devtool hidden-source-map",
"package:prerelease": "npx vsce package --pre-release",
"pretest": "yarn run compile-tests && yarn run build && yarn run lint",
"test": "vitest",
"test:ci": "CI=true yarn test",
"test:integration": "vscode-test",
"vscode:prepublish": "yarn package",
"watch": "webpack --watch"
},
"contributes": {
"configuration": {
"title": "Coder",
Expand All @@ -45,8 +44,7 @@
"type": "string",
"pattern": "^[a-zA-Z0-9-]+[=\\s].*$"
},
"scope": "machine",
"default": []
"scope": "machine"
},
"coder.insecure": {
"markdownDescription": "If true, the extension will not verify the authenticity of the remote host. This is useful for self-signed certificates.",
Expand Down Expand Up @@ -269,20 +267,30 @@
]
}
},
"scripts": {
"vscode:prepublish": "yarn package",
"build": "webpack",
"watch": "webpack --watch",
"fmt": "prettier --write .",
"package": "webpack --mode production --devtool hidden-source-map",
"package:prerelease": "npx vsce package --pre-release",
"lint": "eslint . --ext ts,md",
"lint:fix": "yarn lint --fix",
"test": "vitest",
"test:ci": "CI=true yarn test",
"test:integration": "vscode-test",
"pretest": "yarn run compile-tests && yarn run build && yarn run lint",
"compile-tests": "tsc -p . --outDir out"
"activationEvents": [
"onResolveRemoteAuthority:ssh-remote",
"onCommand:coder.connect",
"onUri"
],
"resolutions": {
"semver": "7.7.1",
"trim": "0.0.3",
"word-wrap": "1.2.5"
},
"dependencies": {
"axios": "1.8.4",
"date-fns": "^3.6.0",
"eventsource": "^3.0.6",
"find-process": "https://github.com/coder/find-process#fix/sequoia-compat",
"jsonc-parser": "^3.3.1",
"memfs": "^4.17.1",
"node-forge": "^1.3.1",
"pretty-bytes": "^6.1.1",
"proxy-agent": "^6.4.0",
"semver": "^7.7.1",
"ua-parser-js": "1.0.40",
"ws": "^8.18.2",
"zod": "^3.25.65"
},
"devDependencies": {
"@types/eventsource": "^3.0.0",
Expand All @@ -294,6 +302,7 @@
"@types/ws": "^8.18.1",
"@typescript-eslint/eslint-plugin": "^7.0.0",
"@typescript-eslint/parser": "^6.21.0",
"@vscode/test-cli": "^0.0.10",
"@vscode/test-electron": "^2.5.2",
"@vscode/vsce": "^2.21.1",
"bufferutil": "^4.0.9",
Expand All @@ -303,8 +312,10 @@
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-md": "^1.0.19",
"eslint-plugin-package-json": "^0.40.1",
"eslint-plugin-prettier": "^5.4.1",
"glob": "^10.4.2",
"jsonc-eslint-parser": "^2.4.0",
"nyc": "^17.1.0",
"prettier": "^3.5.3",
"ts-loader": "^9.5.1",
Expand All @@ -314,28 +325,22 @@
"vitest": "^0.34.6",
"vscode-test": "^1.5.0",
"webpack": "^5.99.6",
"webpack-cli": "^5.1.4",
"@vscode/test-cli": "^0.0.10"
"webpack-cli": "^5.1.4"
},
"dependencies": {
"axios": "1.8.4",
"date-fns": "^3.6.0",
"eventsource": "^3.0.6",
"find-process": "https://github.com/coder/find-process#fix/sequoia-compat",
"jsonc-parser": "^3.3.1",
"memfs": "^4.17.1",
"node-forge": "^1.3.1",
"pretty-bytes": "^6.1.1",
"proxy-agent": "^6.4.0",
"semver": "^7.7.1",
"ua-parser-js": "1.0.40",
"ws": "^8.18.2",
"zod": "^3.25.65"
},
"resolutions": {
"semver": "7.7.1",
"trim": "0.0.3",
"word-wrap": "1.2.5"
"extensionPack": [
"ms-vscode-remote.remote-ssh"
],
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e",
"engines": {
"vscode": "^1.73.0"
},
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
"icon": "media/logo.png",
"extensionKind": [
"ui"
],
"capabilities": {
"untrustedWorkspaces": {
"supported": true
}
}
}
50 changes: 23 additions & 27 deletions src/workspacesProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,35 +155,31 @@ export class WorkspaceProvider
});

// Create tree items for each workspace
const workspaceTreeItems = await Promise.all(
resp.workspaces.map((workspace) => {
const workspaceTreeItem = new WorkspaceTreeItem(
workspace,
this.getWorkspacesQuery === WorkspaceQuery.All,
showMetadata,
);
const workspaceTreeItems = resp.workspaces.map((workspace: Workspace) => {
const workspaceTreeItem = new WorkspaceTreeItem(
workspace,
this.getWorkspacesQuery === WorkspaceQuery.All,
showMetadata,
);

// Get app status from the workspace agents
const agents = extractAgents(workspace);
agents.forEach((agent) => {
// Check if agent has apps property with status reporting
if (agent.apps && Array.isArray(agent.apps)) {
workspaceTreeItem.appStatus = agent.apps.map(
(app: WorkspaceApp) => ({
name: app.display_name,
url: app.url,
agent_id: agent.id,
agent_name: agent.name,
command: app.command,
workspace_name: workspace.name,
}),
);
}
});
// Get app status from the workspace agents
const agents = extractAgents(workspace);
agents.forEach((agent) => {
// Check if agent has apps property with status reporting
if (agent.apps && Array.isArray(agent.apps)) {
workspaceTreeItem.appStatus = agent.apps.map((app: WorkspaceApp) => ({
name: app.display_name,
url: app.url,
agent_id: agent.id,
agent_name: agent.name,
command: app.command,
workspace_name: workspace.name,
}));
}
});

return workspaceTreeItem;
}),
);
return workspaceTreeItem;
});

return workspaceTreeItems;
}
Expand Down
6 changes: 3 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "ES2022",
"target": "ES2021",
"moduleResolution": "node",
"outDir": "out",
// "dom" is required for importing the API from coder/coder.
"lib": ["ES2022", "dom"],
"lib": ["ES2021", "dom"],
"sourceMap": true,
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
},
"exclude": ["node_modules", "vitest.config.ts"],
"exclude": ["node_modules"],
"include": ["src/**/*"]
}
Loading
0