Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ca383da85f | ||
|
|
6b26a03ce1 | ||
|
|
834322cb6a | ||
|
|
349f5e1ff8 | ||
|
|
fc674d3e0d | ||
|
|
e6b404f009 | ||
|
|
30b87d515f | ||
|
|
087dc3dad1 | ||
|
|
8fb2196e67 | ||
|
|
fe4e5393e0 | ||
|
|
437f07ccc1 | ||
|
|
afa57178d9 | ||
|
|
f9824e1523 | ||
|
|
9fa19fe316 | ||
|
|
1e8b682afc | ||
|
|
7ee9dd2a49 | ||
|
|
9535565349 | ||
|
|
bcabfe6db1 | ||
|
|
b67d12ecdd | ||
|
|
2d865f87dd | ||
|
|
9403710c8a | ||
|
|
cb5b4478e5 | ||
|
|
05cf7e7256 | ||
|
|
c9b39ffca0 | ||
|
|
0ddeb439ee | ||
|
|
5316114dae | ||
|
|
edb296c6e8 | ||
|
|
143eff95bc | ||
|
|
ce7dd93de5 | ||
|
|
f250f48788 | ||
|
|
840564fc69 | ||
|
|
a7086bdaf6 | ||
|
|
6ec43bf622 | ||
|
|
73494bf805 | ||
|
|
94b058a6e7 | ||
|
|
a896a8e7fc |
@@ -18,6 +18,7 @@ steps:
|
|||||||
commands:
|
commands:
|
||||||
- npm install -g vsce
|
- npm install -g vsce
|
||||||
- npm ci
|
- npm ci
|
||||||
|
- xvfb-run -a npm test
|
||||||
- vsce package
|
- vsce package
|
||||||
|
|
||||||
- name: gitea_release
|
- name: gitea_release
|
||||||
|
|||||||
@@ -33,3 +33,4 @@ data/
|
|||||||
/dist/
|
/dist/
|
||||||
tsconfig.tsbuildinfo
|
tsconfig.tsbuildinfo
|
||||||
.twig-cs-fixer.cache
|
.twig-cs-fixer.cache
|
||||||
|
testfront-screenshots/
|
||||||
|
|||||||
@@ -5,14 +5,15 @@ collect stats about a user's activity in vscode
|
|||||||
## Features
|
## Features
|
||||||
|
|
||||||
it can track :
|
it can track :
|
||||||
|
|
||||||
- file opening
|
- file opening
|
||||||
- file saving
|
- file saving
|
||||||
- window focus
|
- window focus
|
||||||
|
|
||||||
## Extension Settings
|
## Extension Settings
|
||||||
|
|
||||||
* `vscodestat.setUrl`: function to set the remote server's url
|
- `vscodestat.setUrl`: function to set the remote server's url
|
||||||
this will set the variable vscodestat.url
|
this will set the variable vscodestat.url
|
||||||
* `vscodestat.callUrl`: funciton to test if it works
|
- `vscodestat.callUrl`: funciton to test if it works
|
||||||
|
|
||||||
Sample url : https://xxxxxx/vscodestat?userName=raf
|
Sample url : https://xxxxxx/vscodestat?userName=raf
|
||||||
|
|||||||
+9
-4
@@ -2,6 +2,7 @@ import js from '@eslint/js';
|
|||||||
import tsparser from '@typescript-eslint/parser';
|
import tsparser from '@typescript-eslint/parser';
|
||||||
import tsplugin from '@typescript-eslint/eslint-plugin';
|
import tsplugin from '@typescript-eslint/eslint-plugin';
|
||||||
import globals from 'globals';
|
import globals from 'globals';
|
||||||
|
import prettierConfig from 'eslint-config-prettier';
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
// remonte (et --fix supprime) tout eslint-disable inutile : regle deja off, inactive, ou qui ne tire pas
|
// remonte (et --fix supprime) tout eslint-disable inutile : regle deja off, inactive, ou qui ne tire pas
|
||||||
@@ -32,10 +33,10 @@ export default [
|
|||||||
format: ['camelCase', 'PascalCase'],
|
format: ['camelCase', 'PascalCase'],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
'curly': 'warn',
|
curly: 'warn',
|
||||||
'eqeqeq': 'warn',
|
eqeqeq: 'warn',
|
||||||
'no-throw-literal': 'warn',
|
'no-throw-literal': 'warn',
|
||||||
'semi': 'off',
|
semi: 'off',
|
||||||
// Règles générales réutilisées de flatbay
|
// Règles générales réutilisées de flatbay
|
||||||
'prefer-const': ['error', { destructuring: 'all' }],
|
'prefer-const': ['error', { destructuring: 'all' }],
|
||||||
'no-var': 'error',
|
'no-var': 'error',
|
||||||
@@ -47,7 +48,7 @@ export default [
|
|||||||
'one-var-declaration-per-line': ['error', 'always'],
|
'one-var-declaration-per-line': ['error', 'always'],
|
||||||
'one-var': ['error', 'never'],
|
'one-var': ['error', 'never'],
|
||||||
'vars-on-top': 'error',
|
'vars-on-top': 'error',
|
||||||
'yoda': 'error',
|
yoda: 'error',
|
||||||
'prefer-arrow-callback': 'error',
|
'prefer-arrow-callback': 'error',
|
||||||
'no-implicit-globals': 'error',
|
'no-implicit-globals': 'error',
|
||||||
'no-labels': 'error',
|
'no-labels': 'error',
|
||||||
@@ -65,4 +66,8 @@ export default [
|
|||||||
{
|
{
|
||||||
ignores: ['legacy/', 'out/', 'dist/', '.vscode-test/', '**/*.d.ts'],
|
ignores: ['legacy/', 'out/', 'dist/', '.vscode-test/', '**/*.d.ts'],
|
||||||
},
|
},
|
||||||
|
// EN DERNIER : prettier est seul juge du formatage. Neutralise les regles de formatage des presets
|
||||||
|
// (unicorn/number-literal-case, no-confusing-arrow, no-multi-spaces...) que le cron `eslint --fix`
|
||||||
|
// reecrivait en sens inverse du cron `prettier --write` sur les memes octets (ticket 4152).
|
||||||
|
prettierConfig,
|
||||||
];
|
];
|
||||||
|
|||||||
Generated
+577
-911
File diff suppressed because it is too large
Load Diff
+10
-9
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "vscodestat",
|
"name": "vscodestat",
|
||||||
"displayName": "vscodestat",
|
"displayName": "vscodestat",
|
||||||
"version": "1.5.1",
|
"version": "1.8.10",
|
||||||
"description": "",
|
"description": "",
|
||||||
"categories": [
|
"categories": [
|
||||||
"Other"
|
"Other"
|
||||||
@@ -51,17 +51,18 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint/js": "^10.0.1",
|
"@eslint/js": "^10.0.1",
|
||||||
"@types/mocha": "^10.0.10",
|
"@types/mocha": "^10.0.10",
|
||||||
"@types/node": "25.x",
|
"@types/node": "26.x",
|
||||||
"@types/vscode": "^1.125.0",
|
"@types/vscode": "^1.125.0",
|
||||||
"@typescript-eslint/eslint-plugin": "^8.61.1",
|
"@typescript-eslint/eslint-plugin": "^8.65.0",
|
||||||
"@typescript-eslint/parser": "^8.61.1",
|
"@typescript-eslint/parser": "^8.65.0",
|
||||||
"@vscode/test-cli": "^0.0.12",
|
"@vscode/test-cli": "^0.0.15",
|
||||||
"@vscode/test-electron": "^3.0.0",
|
"@vscode/test-electron": "^3.1.0",
|
||||||
"eslint": "^10.1.0",
|
"eslint": "^10.1.0",
|
||||||
"globals": "^17.6.0",
|
"eslint-config-prettier": "^10.1.8",
|
||||||
|
"globals": "^17.9.0",
|
||||||
"husky": "^9.1.7",
|
"husky": "^9.1.7",
|
||||||
"lint-staged": "^17.0.7",
|
"lint-staged": "^17.3.0",
|
||||||
"prettier": "^3.8.4",
|
"prettier": "^3.9.6",
|
||||||
"ts-api-utils": "^2.5.0",
|
"ts-api-utils": "^2.5.0",
|
||||||
"typescript": "^6.0.3"
|
"typescript": "^6.0.3"
|
||||||
},
|
},
|
||||||
|
|||||||
+22
-22
@@ -4,33 +4,33 @@ export function activate(context: vscode.ExtensionContext) {
|
|||||||
console.log('Congratulations, your extension "vscodestat" is now active!');
|
console.log('Congratulations, your extension "vscodestat" is now active!');
|
||||||
|
|
||||||
// commande pour definir l'url
|
// commande pour definir l'url
|
||||||
const disposable2 = vscode.commands.registerCommand('vscodestat.setUrl', async () => {
|
const setUrlCommand = vscode.commands.registerCommand('vscodestat.setUrl', async () => {
|
||||||
const url = await vscode.window.showInputBox({
|
const url = await vscode.window.showInputBox({
|
||||||
prompt: 'Enter the URL:',
|
prompt: 'Enter the URL:',
|
||||||
placeHolder: ''
|
placeHolder: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
if (url) {
|
if (url) {
|
||||||
vscode.workspace.getConfiguration().update('vscodestat.url', url, vscode.ConfigurationTarget.Global);
|
await vscode.workspace.getConfiguration().update('vscodestat.url', url, vscode.ConfigurationTarget.Global);
|
||||||
vscode.window.showInformationMessage('URL set successfully.');
|
vscode.window.showInformationMessage('URL set successfully.');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
context.subscriptions.push(disposable2);
|
context.subscriptions.push(setUrlCommand);
|
||||||
|
|
||||||
// commande pour tester l'url
|
// commande pour tester l'url
|
||||||
const disposable3 = vscode.commands.registerCommand('vscodestat.callUrl', async () => {
|
const callUrlCommand = vscode.commands.registerCommand('vscodestat.callUrl', async () => {
|
||||||
const storedUrl = vscode.workspace.getConfiguration().get('vscodestat.url') as string;
|
const storedUrl = vscode.workspace.getConfiguration().get('vscodestat.url') as string;
|
||||||
if (!storedUrl) {
|
if (!storedUrl) {
|
||||||
vscode.window.showWarningMessage('URL is not set. Please set the URL first.');
|
vscode.window.showWarningMessage('URL is not set. Please set the URL first.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await makeHttpRequest({ event: 'ping'});
|
await makeHttpRequest({ event: 'ping' });
|
||||||
vscode.window.showInformationMessage('callUrl done');
|
vscode.window.showInformationMessage('callUrl done');
|
||||||
});
|
});
|
||||||
context.subscriptions.push(disposable3);
|
context.subscriptions.push(callUrlCommand);
|
||||||
|
|
||||||
// detecte une ouverture de fichier / nouvel onglet
|
// detecte une ouverture de fichier / nouvel onglet
|
||||||
vscode.window.onDidChangeActiveTextEditor(async editor => {
|
vscode.window.onDidChangeActiveTextEditor(async (editor) => {
|
||||||
if (editor) {
|
if (editor) {
|
||||||
const filePath = editor.document.fileName;
|
const filePath = editor.document.fileName;
|
||||||
console.log('Opened file:', filePath);
|
console.log('Opened file:', filePath);
|
||||||
@@ -41,7 +41,7 @@ export function activate(context: vscode.ExtensionContext) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// detecte une sauvegarde de fichier
|
// detecte une sauvegarde de fichier
|
||||||
vscode.workspace.onDidSaveTextDocument(async document => {
|
vscode.workspace.onDidSaveTextDocument(async (document) => {
|
||||||
const filePath = document.fileName;
|
const filePath = document.fileName;
|
||||||
console.log('Saved file:', filePath);
|
console.log('Saved file:', filePath);
|
||||||
|
|
||||||
@@ -50,25 +50,25 @@ export function activate(context: vscode.ExtensionContext) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// detecte un focus / blur de la fenetre vscode
|
// detecte un focus / blur de la fenetre vscode
|
||||||
vscode.window.onDidChangeWindowState(async event => {
|
vscode.window.onDidChangeWindowState(async (event) => {
|
||||||
console.log('Window state changed:', event.focused);
|
console.log('Window state changed:', event.focused);
|
||||||
await makeHttpRequest({ event: 'focus', focused: event.focused });
|
await makeHttpRequest({ event: 'focus', focused: event.focused });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function deactivate() { }
|
export function deactivate() {}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* extractProjectName will extract a project name from a path
|
* extractProjectName will extract a project name from a path
|
||||||
* /root/docker/monitoringserver/controller/homeController.js
|
* /root/docker/monitoringserver/controller/homeController.js
|
||||||
* => monitoringserver
|
* => monitoringserver
|
||||||
*/
|
*/
|
||||||
export function extractProjectName(path: string) {
|
export function extractProjectName(path: string) {
|
||||||
// des c'est l'un des fois l'autre ?
|
// des c'est l'un des fois l'autre ?
|
||||||
// /root/docker/vscodestat/src/extension.ts
|
// /root/docker/vscodestat/src/extension.ts
|
||||||
// \root\docker\vscodestat\src\extension.ts
|
// \root\docker\vscodestat\src\extension.ts
|
||||||
path = path.replace(/\\/g, '/');
|
path = path.replace(/\\/g, '/');
|
||||||
|
|
||||||
const match = path.match(/\/docker\/([^/]+)/);
|
const match = path.match(/\/docker\/([^/]+)/);
|
||||||
if (match) {
|
if (match) {
|
||||||
return match[1];
|
return match[1];
|
||||||
@@ -78,8 +78,8 @@ export function extractProjectName(path: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* fonction qui envoie un event au serveur
|
* fonction qui envoie un event au serveur
|
||||||
*/
|
*/
|
||||||
async function makeHttpRequest(json: Object) {
|
async function makeHttpRequest(json: Object) {
|
||||||
try {
|
try {
|
||||||
const url = vscode.workspace.getConfiguration().get('vscodestat.url') as string;
|
const url = vscode.workspace.getConfiguration().get('vscodestat.url') as string;
|
||||||
@@ -91,16 +91,16 @@ async function makeHttpRequest(json: Object) {
|
|||||||
const rawResponse = await fetch(url, {
|
const rawResponse = await fetch(url, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Accept': 'application/json',
|
Accept: 'application/json',
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json',
|
||||||
},
|
},
|
||||||
body: JSON.stringify(json)
|
body: JSON.stringify(json),
|
||||||
});
|
});
|
||||||
const content = await rawResponse.json();
|
const content = await rawResponse.json();
|
||||||
|
|
||||||
console.log(content);
|
console.log(content);
|
||||||
// vscode.window.showInformationMessage('HTTP request successful.');
|
// vscode.window.showInformationMessage('HTTP request successful.');
|
||||||
} catch (error:any) {
|
} catch (error: any) {
|
||||||
console.error('Error making HTTP request:', error);
|
console.error('Error making HTTP request:', error);
|
||||||
// vscode.window.showErrorMessage('Error making HTTP request: ' + error.message);
|
// vscode.window.showErrorMessage('Error making HTTP request: ' + error.message);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,17 +3,11 @@ import { extractProjectName } from '../extension.js';
|
|||||||
|
|
||||||
suite('extractProjectName', () => {
|
suite('extractProjectName', () => {
|
||||||
test('extrait le nom de projet depuis un path Linux /root/docker/X', () => {
|
test('extrait le nom de projet depuis un path Linux /root/docker/X', () => {
|
||||||
assert.strictEqual(
|
assert.strictEqual(extractProjectName('/root/docker/vscodestat/src/extension.ts'), 'vscodestat');
|
||||||
extractProjectName('/root/docker/vscodestat/src/extension.ts'),
|
|
||||||
'vscodestat'
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('extrait le nom de projet depuis un path Windows \\root\\docker\\X', () => {
|
test('extrait le nom de projet depuis un path Windows \\root\\docker\\X', () => {
|
||||||
assert.strictEqual(
|
assert.strictEqual(extractProjectName('C:\\root\\docker\\monitoringserver\\controller\\homeController.js'), 'monitoringserver');
|
||||||
extractProjectName('C:\\root\\docker\\monitoringserver\\controller\\homeController.js'),
|
|
||||||
'monitoringserver'
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('retourne null pour un path hors /docker/', () => {
|
test('retourne null pour un path hors /docker/', () => {
|
||||||
@@ -25,16 +19,10 @@ suite('extractProjectName', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('extrait correctement quand le chemin contient docker plusieurs fois', () => {
|
test('extrait correctement quand le chemin contient docker plusieurs fois', () => {
|
||||||
assert.strictEqual(
|
assert.strictEqual(extractProjectName('/root/docker/flatbay/lib/docker/foo.js'), 'flatbay');
|
||||||
extractProjectName('/root/docker/flatbay/lib/docker/foo.js'),
|
|
||||||
'flatbay'
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('gere les paths avec tirets et chiffres', () => {
|
test('gere les paths avec tirets et chiffres', () => {
|
||||||
assert.strictEqual(
|
assert.strictEqual(extractProjectName('/root/docker/gextra6/bin/console'), 'gextra6');
|
||||||
extractProjectName('/root/docker/gextra6/bin/console'),
|
|
||||||
'gextra6'
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
+10
-20
@@ -1,22 +1,12 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"module": "Node16",
|
"module": "Node16",
|
||||||
"target": "ES2022",
|
"target": "ES2022",
|
||||||
"outDir": "out",
|
"outDir": "out",
|
||||||
"lib": [
|
"lib": ["ES2022"],
|
||||||
"ES2022"
|
"types": ["node", "mocha", "vscode"],
|
||||||
],
|
"sourceMap": true,
|
||||||
"types": [
|
"rootDir": "src",
|
||||||
"node",
|
"strict": true
|
||||||
"mocha",
|
}
|
||||||
"vscode"
|
|
||||||
],
|
|
||||||
"sourceMap": true,
|
|
||||||
"rootDir": "src",
|
|
||||||
"strict": true /* enable all strict type-checking options */
|
|
||||||
/* Additional Checks */
|
|
||||||
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
|
|
||||||
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
|
||||||
// "noUnusedParameters": true, /* Report errors on unused parameters. */
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user