Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 | ||
|
|
a05d2218c6 | ||
|
|
8908a32a68 | ||
|
|
695d1c1b50 | ||
|
|
7da16a82e5 | ||
|
|
c297beb494 | ||
|
|
da5bbfe1a8 | ||
|
|
5b116e016c | ||
|
|
39b5d46122 | ||
|
|
fa606b745d | ||
|
|
b98b3db80b | ||
|
|
44b8302801 | ||
|
|
b16b775efb | ||
|
|
f332115e6a | ||
|
|
24a26551ce | ||
|
|
ef8c92a4b4 | ||
|
|
bf88d3526f | ||
|
|
c70435e58a | ||
|
|
852901b3d4 | ||
|
|
569b8e9fb8 | ||
|
|
8cdded7043 | ||
|
|
7513901a40 | ||
|
|
93e52dff3d | ||
|
|
cc613f0ba2 | ||
|
|
89c79b096f | ||
|
|
f0fb696a0e | ||
|
|
8b83bbe16f | ||
|
|
899eba65dd | ||
|
|
ef476c0891 | ||
|
|
c6ceff6841 | ||
|
|
25f8680fce | ||
|
|
b25fcc8fcf | ||
|
|
dc9863ccc4 | ||
|
|
229e0f4c03 | ||
|
|
4ea75811de | ||
|
|
7cf1d6f7dc | ||
|
|
b8e2339c9c | ||
|
|
d29a1bea80 | ||
|
|
8d282828c0 | ||
|
|
07a89c5829 | ||
|
|
dac0a7b6fa | ||
|
|
a574802ffb | ||
|
|
228211991d | ||
|
|
be832c4df4 | ||
|
|
ff7da312a0 | ||
|
|
af175e078c | ||
|
|
09c3aa6fa6 | ||
|
|
84d69cad92 | ||
|
|
30aa53c049 | ||
|
|
e5c2b7d428 | ||
|
|
742b91bd90 | ||
|
|
94e9b3de43 | ||
|
|
76a01082fe | ||
|
|
90f630d07c | ||
|
|
2361c555ed | ||
|
|
4345e9cf92 | ||
|
|
515fa59dcd | ||
|
|
c171fefc5e | ||
|
|
ca3e610df2 | ||
|
|
c4a79dc07a | ||
|
|
a7d467534c | ||
|
|
4c9ef78d4b | ||
|
|
afadea311c |
@@ -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
|
||||||
|
|||||||
+4
-1
@@ -1,5 +1,4 @@
|
|||||||
out
|
out
|
||||||
dist
|
|
||||||
node_modules
|
node_modules
|
||||||
.vscode-test/
|
.vscode-test/
|
||||||
*.vsix
|
*.vsix
|
||||||
@@ -31,3 +30,7 @@ coverage/
|
|||||||
.config/
|
.config/
|
||||||
data/
|
data/
|
||||||
.aider*
|
.aider*
|
||||||
|
/dist/
|
||||||
|
tsconfig.tsbuildinfo
|
||||||
|
.twig-cs-fixer.cache
|
||||||
|
testfront-screenshots/
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
[extend]
|
||||||
|
useDefault = true
|
||||||
|
|
||||||
|
[allowlist]
|
||||||
|
paths = ['''\.vscode-test/''']
|
||||||
+2
-1
@@ -1,8 +1,9 @@
|
|||||||
{
|
{
|
||||||
"*.js": ["eslint --fix", "prettier --write"],
|
"*.js": ["eslint --fix", "prettier --write"],
|
||||||
|
"*.ts": ["eslint --fix", "prettier --write"],
|
||||||
"*.css": ["prettier --write"],
|
"*.css": ["prettier --write"],
|
||||||
"*.jsx": ["prettier --write"],
|
"*.jsx": ["prettier --write"],
|
||||||
"*.html.twig": ["twig-cs-fixer lint --fix", "myhtmlvalidate -q"],
|
"*.tsx": ["prettier --write"],
|
||||||
"*.php": ["php-cs-fixer fix --config .php-cs-fixer.php"],
|
"*.php": ["php-cs-fixer fix --config .php-cs-fixer.php"],
|
||||||
"Dockerfile": ["hadolint --ignore DL3002 --ignore DL3003 --ignore DL3008 --ignore DL3013 --ignore DL3016 --ignore DL3022"],
|
"Dockerfile": ["hadolint --ignore DL3002 --ignore DL3003 --ignore DL3008 --ignore DL3013 --ignore DL3016 --ignore DL3022"],
|
||||||
"*.md": ["markdownlint --fix"],
|
"*.md": ["markdownlint --fix"],
|
||||||
|
|||||||
@@ -4,3 +4,7 @@ log/*
|
|||||||
node_modules/*
|
node_modules/*
|
||||||
coverage/*
|
coverage/*
|
||||||
data/*
|
data/*
|
||||||
|
.vscode-test/
|
||||||
|
/dist/
|
||||||
|
tsconfig.tsbuildinfo
|
||||||
|
legacy/*
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
+7
-5
@@ -4,6 +4,8 @@ import tsplugin from '@typescript-eslint/eslint-plugin';
|
|||||||
import globals from 'globals';
|
import globals from 'globals';
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
|
// remonte (et --fix supprime) tout eslint-disable inutile : regle deja off, inactive, ou qui ne tire pas
|
||||||
|
{ linterOptions: { reportUnusedDisableDirectives: 'error' } },
|
||||||
js.configs.recommended,
|
js.configs.recommended,
|
||||||
{
|
{
|
||||||
files: ['**/*.ts'],
|
files: ['**/*.ts'],
|
||||||
@@ -30,10 +32,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',
|
||||||
@@ -45,7 +47,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',
|
||||||
@@ -61,6 +63,6 @@ export default [
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ignores: ['out/', 'dist/', '**/*.d.ts'],
|
ignores: ['legacy/', 'out/', 'dist/', '.vscode-test/', '**/*.d.ts'],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
Generated
+648
-977
File diff suppressed because it is too large
Load Diff
+15
-17
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "vscodestat",
|
"name": "vscodestat",
|
||||||
"displayName": "vscodestat",
|
"displayName": "vscodestat",
|
||||||
"version": "1.1.153",
|
"version": "1.8.6",
|
||||||
"description": "",
|
"description": "",
|
||||||
"categories": [
|
"categories": [
|
||||||
"Other"
|
"Other"
|
||||||
@@ -17,18 +17,14 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"compile": "tsc -p ./",
|
"compile": "tsc -p ./",
|
||||||
"lint": "eslint src --ext ts",
|
"lint": "eslint src --ext ts",
|
||||||
|
"prepare": "husky",
|
||||||
"pretest": "npm run compile && npm run lint",
|
"pretest": "npm run compile && npm run lint",
|
||||||
"test": "vscode-test",
|
"test": "vscode-test",
|
||||||
"vscode:prepublish": "npm run compile",
|
"vscode:prepublish": "npm run compile",
|
||||||
"watch": "tsc -watch -p ./",
|
"watch": "tsc -watch -p ./"
|
||||||
"prepare": "husky"
|
|
||||||
},
|
},
|
||||||
"contributes": {
|
"contributes": {
|
||||||
"commands": [
|
"commands": [
|
||||||
{
|
|
||||||
"command": "vscodestat.helloWorld",
|
|
||||||
"title": "Hello World"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"command": "vscodestat.setUrl",
|
"command": "vscodestat.setUrl",
|
||||||
"title": "setUrl"
|
"title": "setUrl"
|
||||||
@@ -53,22 +49,24 @@
|
|||||||
"onStartupFinished"
|
"onStartupFinished"
|
||||||
],
|
],
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@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.115.0",
|
"@types/vscode": "^1.125.0",
|
||||||
"@typescript-eslint/eslint-plugin": "^8.58.1",
|
"@typescript-eslint/eslint-plugin": "^8.65.0",
|
||||||
"@typescript-eslint/parser": "^8.58.1",
|
"@typescript-eslint/parser": "^8.65.0",
|
||||||
"@vscode/test-cli": "^0.0.12",
|
"@vscode/test-cli": "^0.0.15",
|
||||||
"@vscode/test-electron": "^2.5.2",
|
"@vscode/test-electron": "^3.1.0",
|
||||||
"eslint": "^10.1.0",
|
"eslint": "^10.1.0",
|
||||||
|
"globals": "^17.7.0",
|
||||||
"husky": "^9.1.7",
|
"husky": "^9.1.7",
|
||||||
"lint-staged": "^16.4.0",
|
"lint-staged": "^17.2.0",
|
||||||
"prettier": "^3.8.1",
|
"prettier": "^3.9.6",
|
||||||
"ts-api-utils": "^2.5.0",
|
"ts-api-utils": "^2.5.0",
|
||||||
"typescript": "^6.0.2"
|
"typescript": "^6.0.3"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"vscode": "^1.115.0"
|
"vscode": "^1.125.0"
|
||||||
},
|
},
|
||||||
"icon": "icon.png",
|
"icon": "icon.png",
|
||||||
"extensionKind": [
|
"extensionKind": [
|
||||||
|
|||||||
+21
-27
@@ -3,17 +3,11 @@ import * as vscode from 'vscode';
|
|||||||
export function activate(context: vscode.ExtensionContext) {
|
export function activate(context: vscode.ExtensionContext) {
|
||||||
console.log('Congratulations, your extension "vscodestat" is now active!');
|
console.log('Congratulations, your extension "vscodestat" is now active!');
|
||||||
|
|
||||||
// crée une commande de test
|
|
||||||
const disposable = vscode.commands.registerCommand('vscodestat.helloWorld', () => {
|
|
||||||
vscode.window.showInformationMessage('Hello World from vscodestat!');
|
|
||||||
});
|
|
||||||
context.subscriptions.push(disposable);
|
|
||||||
|
|
||||||
// commande pour definir l'url
|
// commande pour definir l'url
|
||||||
const disposable2 = vscode.commands.registerCommand('vscodestat.setUrl', async () => {
|
const disposable2 = 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) {
|
||||||
@@ -30,51 +24,51 @@ export function activate(context: vscode.ExtensionContext) {
|
|||||||
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(disposable3);
|
||||||
|
|
||||||
// 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);
|
||||||
|
|
||||||
// vscode.window.showInformationMessage(`Opened file: ${filePath}`);
|
// vscode.window.showInformationMessage(`Opened file: ${filePath}`);
|
||||||
await makeHttpRequest({ event: 'open', project: extractProjectName(filePath) });
|
await makeHttpRequest({ event: 'open', project: extractProjectName(filePath), source: 'vscode' });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// 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);
|
||||||
|
|
||||||
// vscode.window.showInformationMessage(`Saved file: ${filePath}`);
|
// vscode.window.showInformationMessage(`Saved file: ${filePath}`);
|
||||||
await makeHttpRequest({ event: 'save', project: extractProjectName(filePath) });
|
await makeHttpRequest({ event: 'save', project: extractProjectName(filePath), source: 'vscode' });
|
||||||
});
|
});
|
||||||
|
|
||||||
// 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({ focus: 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
|
||||||
*/
|
*/
|
||||||
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];
|
||||||
@@ -84,8 +78,8 @@ 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;
|
||||||
@@ -97,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);
|
||||||
}
|
}
|
||||||
|
|||||||
+23
-10
@@ -1,15 +1,28 @@
|
|||||||
import * as assert from 'assert';
|
import * as assert from 'assert';
|
||||||
|
import { extractProjectName } from '../extension.js';
|
||||||
|
|
||||||
// You can import and use all API from the 'vscode' module
|
suite('extractProjectName', () => {
|
||||||
// as well as import your extension to test it
|
test('extrait le nom de projet depuis un path Linux /root/docker/X', () => {
|
||||||
import * as vscode from 'vscode';
|
assert.strictEqual(extractProjectName('/root/docker/vscodestat/src/extension.ts'), 'vscodestat');
|
||||||
// import * as myExtension from '../../extension';
|
});
|
||||||
|
|
||||||
suite('Extension Test Suite', () => {
|
test('extrait le nom de projet depuis un path Windows \\root\\docker\\X', () => {
|
||||||
vscode.window.showInformationMessage('Start all tests.');
|
assert.strictEqual(extractProjectName('C:\\root\\docker\\monitoringserver\\controller\\homeController.js'), 'monitoringserver');
|
||||||
|
});
|
||||||
|
|
||||||
test('Sample test', () => {
|
test('retourne null pour un path hors /docker/', () => {
|
||||||
assert.strictEqual(-1, [1, 2, 3].indexOf(5));
|
assert.strictEqual(extractProjectName('/home/user/projet/file.js'), null);
|
||||||
assert.strictEqual(-1, [1, 2, 3].indexOf(0));
|
});
|
||||||
});
|
|
||||||
|
test('retourne null pour un path vide', () => {
|
||||||
|
assert.strictEqual(extractProjectName(''), null);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('extrait correctement quand le chemin contient docker plusieurs fois', () => {
|
||||||
|
assert.strictEqual(extractProjectName('/root/docker/flatbay/lib/docker/foo.js'), 'flatbay');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('gere les paths avec tirets et chiffres', () => {
|
||||||
|
assert.strictEqual(extractProjectName('/root/docker/gextra6/bin/console'), 'gextra6');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
+10
-15
@@ -1,17 +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,
|
||||||
"sourceMap": true,
|
"rootDir": "src",
|
||||||
"rootDir": "src",
|
"strict": true
|
||||||
"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