From 005525c88a5267cf3055a374f4426acfb2c5becf Mon Sep 17 00:00:00 2001 From: Zach Wasserman Date: Mon, 4 Oct 2021 10:14:04 -0700 Subject: [PATCH] Add vscode configs (#2347) This only effects contributor experience. - Run Docker dependencies and Webpack when opening project. - Run/debug configs for Fleet server and UI. - Basic settings. --- .gitignore | 1 - .vscode/extensions.json | 11 ++++++ .vscode/launch.json | 79 +++++++++++++++++++++++++++++++++++++++++ .vscode/settings.json | 31 ++++++++++++++++ .vscode/tasks.json | 41 +++++++++++++++++++++ 5 files changed, 162 insertions(+), 1 deletion(-) create mode 100644 .vscode/extensions.json create mode 100644 .vscode/launch.json create mode 100644 .vscode/settings.json create mode 100644 .vscode/tasks.json diff --git a/.gitignore b/.gitignore index b6049ee72..5ec0f90f2 100644 --- a/.gitignore +++ b/.gitignore @@ -35,7 +35,6 @@ mysqldata/ helm-temp #editors -.vscode .idea # Cypress e2e testing diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 000000000..130599c6b --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,11 @@ +{ + "recommendations": [ + "stkb.rewrap", + "github.vscode-pull-request-github", + "golang.go", + "esbenp.prettier-vscode", + "redhat.vscode-yaml", + "dbaeumer.vscode-eslint", + "firefox-devtools.vscode-firefox-debug" + ] +} \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 000000000..990e84680 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,79 @@ +{ + // 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 + "version": "0.2.0", + "configurations": [ + { + "name": "Test package", + "type": "go", + "request": "launch", + "mode": "test", + "cwd": "${fileDirname}", + "env": { + "MYSQL_TEST": 1, + "REDIS_TEST": 1 + }, + "buildFlags": "--tags='full,fts5'", + "program": "${fileDirname}" + }, + { + "name": "Test file", + "type": "go", + "request": "launch", + "mode": "test", + "cwd": "${fileDirname}", + "env": { + "MYSQL_TEST": 1, + "REDIS_TEST": 1 + }, + "buildFlags": "--tags='full,fts5'", + "program": "${file}" + }, + { + "name": "Fleet serve", + "type": "go", + "request": "launch", + "mode": "auto", + "buildFlags": "--tags='full,fts5'", + "cwd": "${workspaceFolder}", + "program": "${workspaceFolder}/cmd/fleet", + "args": [ + "serve", + "--dev" + ] + }, + { + "name": "Fleet serve (licensed)", + "type": "go", + "request": "launch", + "mode": "auto", + "buildFlags": "--tags='full,fts5'", + "cwd": "${workspaceFolder}", + "program": "${workspaceFolder}/cmd/fleet", + "args": [ + "serve", + "--dev", + "--dev_license" + ] + }, + { + "type": "pwa-chrome", + "name": "Fleet UI (Chrome)", + "request": "launch", + "url": "https://localhost:8080" + }, + { + "type": "firefox", + "name": "Fleet UI (Firefox)", + "request": "launch", + "url": "https://localhost:8080", + "pathMappings": [ + { + "url": "webpack:///frontend", + "path": "${workspaceFolder}/frontend" + } + ] + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000..2f0efa221 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,31 @@ +{ + "makefile.extensionOutputFolder": "./.vscode", + "editor.formatOnPaste": true, + "editor.formatOnSave": true, + "editor.formatOnType": true, + "diffEditor.codeLens": true, + "rewrap.autoWrap.enabled": true, + "rewrap.wrappingColumn": 100, + "go.formatTool": "gofumports", + "go.lintTool": "golangci-lint", + "go.useLanguageServer": true, + "gopls": { + "gofumpt": true, + }, + "go.autocompleteUnimportedPackages": true, + "go.buildTags": "full,fts5", + "go.delveConfig": { + "dlvLoadConfig": { + "followPointers": true, + "maxVariableRecurse": 1, + "maxStringLen": 256, + "maxArrayValues": 64, + "maxStructFields": -1 + }, + "apiVersion": 2, + "showGlobalVariables": true, + "debugAdapter": "legacy", + "substitutePath": [] + }, + "go.testTimeout": "60s" +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 000000000..dd1bb4ee2 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,41 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "type": "npm", + "script": "lint", + "problemMatcher": [ + "$eslint-stylish" + ], + "label": "npm: lint", + "detail": "eslint frontend cypress --ext .js,.jsx,.ts,.tsx" + }, + { + "type": "shell", + "label": "Docker Compose Dependencies", + "command": "docker-compose up", + "isBackground": true, + "presentation": { + "panel": "dedicated" + }, + "runOptions": { + "instanceLimit": 1, + "runOn": "folderOpen" + }, + "problemMatcher": [] + }, + { + "type": "shell", + "label": "Make generate-dev", + "command": "make generate-dev", + "isBackground": true, + "presentation": { + "panel": "dedicated" + }, + "runOptions": { + "instanceLimit": 1, + "runOn": "folderOpen" + } + } + ] +} \ No newline at end of file