Skip to content

Commit

Permalink
fixes and features
Browse files Browse the repository at this point in the history
 - require cursor position change for heartbeat

 - add settings to configurations instead of global storage

 - use secret store for apikey

 - update deps

 - setting to disable testaustime

 - setting to hash project names in specified paths

 - async flush on exit

 - maybe other fixes
  • Loading branch information
Chicken committed Oct 6, 2022
1 parent a949c8a commit 3374f27
Show file tree
Hide file tree
Showing 11 changed files with 831 additions and 708 deletions.
13 changes: 2 additions & 11 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,14 @@
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 6,
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"@typescript-eslint/naming-convention": "warn",
"@typescript-eslint/semi": "warn",
"curly": "warn",
"eqeqeq": "warn",
"no-throw-literal": "warn",
"semi": "off"
},
"ignorePatterns": [
"out",
"dist",
"**/*.d.ts"
]
}
}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
*.vsix
node_modules
out
dist
17 changes: 2 additions & 15 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,9 @@
"--extensionDevelopmentPath=${workspaceFolder}"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"preLaunchTask": "${defaultBuildTask}"
},
{
"name": "Extension Tests",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test/suite/index"
],
"outFiles": [
"${workspaceFolder}/out/test/**/*.js"
"${workspaceFolder}/dist/**/*.js"
],
"preLaunchTask": "${defaultBuildTask}"
}
]
}
}
22 changes: 18 additions & 4 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
Copyright 2022 Testausserveri ry
MIT License

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:
Copyright (c) 2022 Testausserveri ry

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
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 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.
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.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ Official Testaustime VSCode extension.

You need to open the command palette `CTRL+SHIFT+P` and select `Testaustime: Set API key` and then enter your API key.

If you don't want to use the official server at `https://api.testaustime.fi`, you can use the `Testaustime: Set custom API endpoint` to use an unofficial server.
If you don't want to use the official server at `https://api.testaustime.fi`, you can use the `Testaustime: Set custom API endpoint` to use an unofficial server.
54 changes: 34 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,25 @@
"displayName": "Testaustime",
"version": "0.0.10",
"description": "The VSCode extension of Testaustime",
"main": "out/index.js",
"main": "dist/index.js",
"publisher": "testausserveri-ry",
"icon": "icon.png",
"repository": {
"type": "git",
"url": "git+https://github.com/Testausserveri/testaustime-vscode.git"
"url": "git+https://github.com/Testaustime/testaustime-vscode.git"
},
"keywords": [
"testaustime"
],
"scripts": {
"vscode:prepublish": "yarn run compile",
"compile": "tsc -p ./",
"vscode:prepublish": "yarn build",
"build": "tsc -p ./",
"watch": "tsc -watch -p ./",
"pretest": "yarn run compile && yarn run lint",
"lint": "eslint src --ext ts",
"test": "node ./out/test/runTest.js"
"bundle": "yarn vsce package"
},
"engines": {
"vscode": "^1.65.0"
"vscode": "^1.71.0"
},
"contributors": [
"Antti <[email protected]>",
Expand All @@ -31,9 +30,9 @@
],
"license": "MIT",
"bugs": {
"url": "https://github.com/Testausserveri/testaustime-vscode/issues"
"url": "https://github.com/Testaustime/testaustime-vscode/issues"
},
"homepage": "https://time.testausserveri.fi",
"homepage": "https://testaustime.fi",
"categories": [
"Other"
],
Expand All @@ -45,28 +44,43 @@
{
"command": "testaustime.setapikey",
"title": "Testaustime: Set API key"
},
{
"command": "testaustime.setendpoint",
"title": "Testaustime: Set custom API endpoint"
}
]
],
"configuration": {
"title": "Testaustime",
"properties": {
"testaustime.apiEndpoint": {
"type": "string",
"default": "https://api.testaustime.fi",
"description": "API endpoint for Testaustime"
},
"testaustime.hiddenPaths": {
"type": "array",
"items": {
"type": "string"
},
"default": [],
"description": "The names of projects under these paths will be hashed in the format of \"hidden-xxxxxxx\""
},
"testaustime.disabled": {
"type": "boolean",
"default": false,
"description": "Disable Testaustime"
}
}
}
},
"dependencies": {
"axios": "^0.21.1",
"date-fns": "^2.29.1"
},
"devDependencies": {
"@types/node": "18.8.2",
"@types/vscode": "^1.65.0",
"@types/glob": "^7.2.0",
"@types/mocha": "^9.1.0",
"@types/node": "14.x",
"@typescript-eslint/eslint-plugin": "^5.12.1",
"@typescript-eslint/parser": "^5.12.1",
"eslint": "^8.9.0",
"glob": "^7.2.0",
"mocha": "^9.2.1",
"typescript": "^4.5.5",
"@vscode/test-electron": "^2.1.2"
"vsce": "^2.11.0"
}
}
16 changes: 6 additions & 10 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
import { ExtensionContext } from "vscode";
import Testaustime from "./testaustime";

let testaustime: Testaustime | null;

let testaustime: Testaustime;
function activate(context: ExtensionContext) {
export async function activate(context: ExtensionContext) {
testaustime = new Testaustime(context);
testaustime.activate();
}
function deactivate() {
testaustime.deactivate();
await testaustime.activate();
}

module.exports = {
activate,
deactivate,
};
export async function deactivate() {
if (testaustime) await testaustime.deactivate();
}
Loading

0 comments on commit 3374f27

Please sign in to comment.