Compare commits
234
Commits
1.1.87
...
e6b404f009
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 | ||
|
|
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 | ||
|
|
49e7ba7597 | ||
|
|
d9ac7f1fe1 | ||
|
|
8717509909 | ||
|
|
b1465077a1 | ||
|
|
31fa528fe2 | ||
|
|
71a054b964 | ||
|
|
15c05b5667 | ||
|
|
9d0fb0901e | ||
|
|
87cc7b7e38 | ||
|
|
8f802c4574 | ||
|
|
942b4a3865 | ||
|
|
c8d79ef509 | ||
|
|
8bd362922a | ||
|
|
cb4d1366bf | ||
|
|
e5cde7df45 | ||
|
|
50b051e155 | ||
|
|
efe9250969 | ||
|
|
39e4e03b29 | ||
|
|
eb97144726 | ||
|
|
b695d0ff1f | ||
|
|
c004b7c70a | ||
|
|
b15be4bf7c | ||
|
|
5a3fd218bc | ||
|
|
9a33fc258f | ||
|
|
1781912d3f | ||
|
|
2a494213ff | ||
|
|
9cc4bb48fc | ||
|
|
f67562c8ac | ||
|
|
e4682d493e | ||
|
|
e4afa91517 | ||
|
|
9b8134441c | ||
|
|
d16bc0a1ef | ||
|
|
3a54763a53 | ||
|
|
81177f27ce | ||
|
|
f1e5244ee2 | ||
|
|
e30bdcd6cf | ||
|
|
0615d39c61 | ||
|
|
d3bb430a98 | ||
|
|
3eac7da736 | ||
|
|
1f16dcdbf0 | ||
|
|
fe433ad929 | ||
|
|
96c172c1ff | ||
|
|
6fd2ba027c | ||
|
|
85d50e183f | ||
|
|
aa3fd27451 | ||
|
|
c15d443595 | ||
|
|
cdc9e40d0b | ||
|
|
e3fd433c9b | ||
|
|
3969b22310 | ||
|
|
58ff5ccc5a | ||
|
|
74533cc9b9 | ||
|
|
0cd8d6c0d1 | ||
|
|
7a654ffad8 | ||
|
|
703225acdd | ||
|
|
8c3b9f0ca6 | ||
|
|
0b40b2dee8 | ||
|
|
afe65f5e34 | ||
|
|
fa14e6fbfe | ||
|
|
7968d84047 | ||
|
|
a2fe9e239a | ||
|
|
a6f849d0f5 | ||
|
|
4869be90b8 | ||
|
|
ddca7cc92e | ||
|
|
12fc16e71f | ||
|
|
d8014e94b8 | ||
|
|
54d05237ed | ||
|
|
60037aec07 | ||
|
|
8378fe9eb1 | ||
|
|
8acbc35562 | ||
|
|
30deaa961b | ||
|
|
0d120cd51d | ||
|
|
86213539f7 | ||
|
|
94b921fbe2 | ||
|
|
f62b4b7804 | ||
|
|
be89eda130 | ||
|
|
79d2d781b0 | ||
|
|
3619d3375e | ||
|
|
70a942faee | ||
|
|
4c3ff7c1bb | ||
|
|
00e78de6f3 | ||
|
|
0eba2547cc | ||
|
|
febfec0e36 | ||
|
|
c191899971 | ||
|
|
a87e823a9c | ||
|
|
5f1232e8b8 | ||
|
|
c5bdfe13fa | ||
|
|
d8f6796249 | ||
|
|
5610154ff9 | ||
|
|
669abfb38a | ||
|
|
124154e4e9 | ||
|
|
545a9ff9f3 | ||
|
|
57d5804a33 | ||
|
|
675c64368a | ||
|
|
b1191ffae5 | ||
|
|
e4ac2ed95f | ||
|
|
d784c1cb79 | ||
|
|
ced70cee93 | ||
|
|
b54472aa93 | ||
|
|
fddc5b7c89 | ||
|
|
195da823b1 | ||
|
|
2685146634 | ||
|
|
39aced4f8e | ||
|
|
56463f999d | ||
|
|
bfbe69fb14 | ||
|
|
5c47fc1aae | ||
|
|
a858023e39 | ||
|
|
1228d53827 | ||
|
|
3acd8ff2d6 | ||
|
|
a9171987c3 | ||
|
|
82cab2c498 | ||
|
|
78921cfa48 | ||
|
|
fd8bdac192 | ||
|
|
304dcae79d | ||
|
|
692fe08353 | ||
|
|
ddf00fc06a | ||
|
|
e4ad9d3302 | ||
|
|
f4e75d8079 | ||
|
|
6e997e5491 | ||
|
|
babb81e49b | ||
|
|
0e0fa2e798 | ||
|
|
eaab7e68d4 | ||
|
|
a944b6ef33 | ||
|
|
c15bbc9aed | ||
|
|
08f3a0b590 | ||
|
|
647f8a22cc | ||
|
|
ee930c9fa3 | ||
|
|
faa37adde2 | ||
|
|
33ab03fbd6 | ||
|
|
2a9025302e | ||
|
|
87e25628fa | ||
|
|
1009ed5132 | ||
|
|
95df217bf8 | ||
|
|
b7e1f8bc94 | ||
|
|
f7f35a01df | ||
|
|
bca29b7a23 | ||
|
|
1b2439a0b6 | ||
|
|
7e7d40b77f | ||
|
|
6c3ecc1392 | ||
|
|
65d34bffe3 | ||
|
|
1aecf03aac | ||
|
|
71fb6fed1a |
@@ -1,6 +1,13 @@
|
||||
kind: pipeline
|
||||
type: ssh
|
||||
name: default
|
||||
|
||||
server:
|
||||
host: build.gextra.net
|
||||
user: root
|
||||
ssh_key:
|
||||
from_secret: ssh_key_secret
|
||||
|
||||
trigger:
|
||||
event:
|
||||
- tag
|
||||
@@ -11,6 +18,7 @@ steps:
|
||||
commands:
|
||||
- npm install -g vsce
|
||||
- npm ci
|
||||
- xvfb-run -a npm test
|
||||
- vsce package
|
||||
|
||||
- name: gitea_release
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
{
|
||||
"root": true,
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 6,
|
||||
"sourceType": "module"
|
||||
},
|
||||
"plugins": [
|
||||
"@typescript-eslint"
|
||||
],
|
||||
"rules": {
|
||||
"@typescript-eslint/naming-convention": [
|
||||
"warn",
|
||||
{
|
||||
"selector": "import",
|
||||
"format": [ "camelCase", "PascalCase" ]
|
||||
}
|
||||
],
|
||||
"@typescript-eslint/semi": "warn",
|
||||
"curly": "warn",
|
||||
"eqeqeq": "warn",
|
||||
"no-throw-literal": "warn",
|
||||
"semi": "off"
|
||||
},
|
||||
"ignorePatterns": [
|
||||
"out",
|
||||
"dist",
|
||||
"**/*.d.ts"
|
||||
]
|
||||
}
|
||||
+4
-1
@@ -1,5 +1,4 @@
|
||||
out
|
||||
dist
|
||||
node_modules
|
||||
.vscode-test/
|
||||
*.vsix
|
||||
@@ -31,3 +30,7 @@ coverage/
|
||||
.config/
|
||||
data/
|
||||
.aider*
|
||||
/dist/
|
||||
tsconfig.tsbuildinfo
|
||||
.twig-cs-fixer.cache
|
||||
testfront-screenshots/
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
[extend]
|
||||
useDefault = true
|
||||
|
||||
[allowlist]
|
||||
paths = ['''\.vscode-test/''']
|
||||
@@ -0,0 +1 @@
|
||||
_
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
|
||||
if [ -z "$(cat "$1" | grep -E '(^fix:)|(^feature:)|(^up$)|^Merge branch .+$')" ] ; then
|
||||
echo ""
|
||||
echo respecte le format de commit ❤
|
||||
echo " fix: xxx"
|
||||
echo " feature: xxx"
|
||||
echo ""
|
||||
exit 1
|
||||
fi
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
|
||||
if git diff --name-only HEAD@{1} HEAD | grep package-lock.json ; then
|
||||
echo "📦 package-lock.json changed. Running npm ci to update your dependencies..."
|
||||
npm ci
|
||||
else
|
||||
echo "📦 no need to update dependencies"
|
||||
fi
|
||||
Executable
+13
@@ -0,0 +1,13 @@
|
||||
|
||||
# prevent commits on master
|
||||
branch="$(git rev-parse --abbrev-ref HEAD)"
|
||||
if [ "$branch" = "master" ]; then
|
||||
echo ""
|
||||
echo "You can't commit directly to master branch"
|
||||
echo "please create a pull request"
|
||||
echo ""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# run linters
|
||||
npx lint-staged
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"*.js": ["eslint --fix", "prettier --write"],
|
||||
"*.ts": ["eslint --fix", "prettier --write"],
|
||||
"*.css": ["prettier --write"],
|
||||
"*.jsx": ["prettier --write"],
|
||||
"*.tsx": ["prettier --write"],
|
||||
"*.php": ["php-cs-fixer fix --config .php-cs-fixer.php"],
|
||||
"Dockerfile": ["hadolint --ignore DL3002 --ignore DL3003 --ignore DL3008 --ignore DL3013 --ignore DL3016 --ignore DL3022"],
|
||||
"*.md": ["markdownlint --fix"],
|
||||
"*openapi.json": ["spectral lint"],
|
||||
"*.tf": ["tflint"]
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
web/*
|
||||
views/*
|
||||
log/*
|
||||
node_modules/*
|
||||
coverage/*
|
||||
data/*
|
||||
.vscode-test/
|
||||
/dist/
|
||||
tsconfig.tsbuildinfo
|
||||
legacy/*
|
||||
@@ -0,0 +1,7 @@
|
||||
export default {
|
||||
tabWidth: 4,
|
||||
singleQuote: true,
|
||||
trailingComma: 'es5',
|
||||
printWidth: 150,
|
||||
arrowParens: 'always',
|
||||
};
|
||||
@@ -5,14 +5,15 @@ collect stats about a user's activity in vscode
|
||||
## Features
|
||||
|
||||
it can track :
|
||||
|
||||
- file opening
|
||||
- file saving
|
||||
- window focus
|
||||
|
||||
## Extension Settings
|
||||
|
||||
* `vscodestat.setUrl`: function to set the remote server's url
|
||||
this will set the variable vscodestat.url
|
||||
* `vscodestat.callUrl`: funciton to test if it works
|
||||
- `vscodestat.setUrl`: function to set the remote server's url
|
||||
this will set the variable vscodestat.url
|
||||
- `vscodestat.callUrl`: funciton to test if it works
|
||||
|
||||
Sample url : https://xxxxxx/vscodestat?userName=raf
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
import js from '@eslint/js';
|
||||
import tsparser from '@typescript-eslint/parser';
|
||||
import tsplugin from '@typescript-eslint/eslint-plugin';
|
||||
import globals from 'globals';
|
||||
|
||||
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,
|
||||
{
|
||||
files: ['**/*.ts'],
|
||||
languageOptions: {
|
||||
parser: tsparser,
|
||||
parserOptions: {
|
||||
ecmaVersion: 6,
|
||||
sourceType: 'module',
|
||||
},
|
||||
globals: {
|
||||
...globals.browser,
|
||||
...globals.node,
|
||||
...globals.mocha,
|
||||
},
|
||||
},
|
||||
plugins: {
|
||||
'@typescript-eslint': tsplugin,
|
||||
},
|
||||
rules: {
|
||||
'@typescript-eslint/naming-convention': [
|
||||
'warn',
|
||||
{
|
||||
selector: 'import',
|
||||
format: ['camelCase', 'PascalCase'],
|
||||
},
|
||||
],
|
||||
curly: 'warn',
|
||||
eqeqeq: 'warn',
|
||||
'no-throw-literal': 'warn',
|
||||
semi: 'off',
|
||||
// Règles générales réutilisées de flatbay
|
||||
'prefer-const': ['error', { destructuring: 'all' }],
|
||||
'no-var': 'error',
|
||||
'object-shorthand': ['error', 'properties'],
|
||||
'prefer-template': 'error',
|
||||
'dot-notation': 'error',
|
||||
'no-unused-expressions': 'error',
|
||||
'no-nested-ternary': 'error',
|
||||
'one-var-declaration-per-line': ['error', 'always'],
|
||||
'one-var': ['error', 'never'],
|
||||
'vars-on-top': 'error',
|
||||
yoda: 'error',
|
||||
'prefer-arrow-callback': 'error',
|
||||
'no-implicit-globals': 'error',
|
||||
'no-labels': 'error',
|
||||
'no-new-func': 'error',
|
||||
'no-script-url': 'error',
|
||||
'no-sequences': 'error',
|
||||
'no-unused-labels': 'error',
|
||||
'prefer-spread': 'error',
|
||||
'no-console': 0, // Garder les console.log pour debug
|
||||
'no-empty': 0,
|
||||
'no-redeclare': 0,
|
||||
'no-useless-escape': 0,
|
||||
},
|
||||
},
|
||||
{
|
||||
ignores: ['legacy/', 'out/', 'dist/', '.vscode-test/', '**/*.d.ts'],
|
||||
},
|
||||
];
|
||||
Generated
+877
-1999
File diff suppressed because it is too large
Load Diff
+18
-14
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "vscodestat",
|
||||
"displayName": "vscodestat",
|
||||
"version": "1.1.87",
|
||||
"version": "1.8.8",
|
||||
"description": "",
|
||||
"categories": [
|
||||
"Other"
|
||||
@@ -12,10 +12,12 @@
|
||||
},
|
||||
"license": "ISC",
|
||||
"author": "Raphael Piccolo",
|
||||
"type": "module",
|
||||
"main": "./out/extension.js",
|
||||
"scripts": {
|
||||
"compile": "tsc -p ./",
|
||||
"lint": "eslint src --ext ts",
|
||||
"prepare": "husky",
|
||||
"pretest": "npm run compile && npm run lint",
|
||||
"test": "vscode-test",
|
||||
"vscode:prepublish": "npm run compile",
|
||||
@@ -23,10 +25,6 @@
|
||||
},
|
||||
"contributes": {
|
||||
"commands": [
|
||||
{
|
||||
"command": "vscodestat.helloWorld",
|
||||
"title": "Hello World"
|
||||
},
|
||||
{
|
||||
"command": "vscodestat.setUrl",
|
||||
"title": "setUrl"
|
||||
@@ -51,18 +49,24 @@
|
||||
"onStartupFinished"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^10.0.1",
|
||||
"@types/mocha": "^10.0.10",
|
||||
"@types/node": "22.x",
|
||||
"@types/vscode": "^1.100.0",
|
||||
"@typescript-eslint/eslint-plugin": "^8.32.0",
|
||||
"@typescript-eslint/parser": "^8.32.0",
|
||||
"@vscode/test-cli": "^0.0.10",
|
||||
"@vscode/test-electron": "^2.5.2",
|
||||
"eslint": "^9.26.0",
|
||||
"typescript": "^5.8.3"
|
||||
"@types/node": "26.x",
|
||||
"@types/vscode": "^1.125.0",
|
||||
"@typescript-eslint/eslint-plugin": "^8.65.0",
|
||||
"@typescript-eslint/parser": "^8.65.0",
|
||||
"@vscode/test-cli": "^0.0.15",
|
||||
"@vscode/test-electron": "^3.1.0",
|
||||
"eslint": "^10.1.0",
|
||||
"globals": "^17.8.0",
|
||||
"husky": "^9.1.7",
|
||||
"lint-staged": "^17.2.0",
|
||||
"prettier": "^3.9.6",
|
||||
"ts-api-utils": "^2.5.0",
|
||||
"typescript": "^6.0.3"
|
||||
},
|
||||
"engines": {
|
||||
"vscode": "^1.100.0"
|
||||
"vscode": "^1.125.0"
|
||||
},
|
||||
"icon": "icon.png",
|
||||
"extensionKind": [
|
||||
|
||||
+26
-32
@@ -3,78 +3,72 @@ import * as vscode from 'vscode';
|
||||
export function activate(context: vscode.ExtensionContext) {
|
||||
console.log('Congratulations, your extension "vscodestat" is now active!');
|
||||
|
||||
// crée une commande de test
|
||||
let disposable = vscode.commands.registerCommand('vscodestat.helloWorld', () => {
|
||||
vscode.window.showInformationMessage('Hello World from vscodestat!');
|
||||
});
|
||||
context.subscriptions.push(disposable);
|
||||
|
||||
// commande pour definir l'url
|
||||
let disposable2 = vscode.commands.registerCommand('vscodestat.setUrl', async () => {
|
||||
const setUrlCommand = vscode.commands.registerCommand('vscodestat.setUrl', async () => {
|
||||
const url = await vscode.window.showInputBox({
|
||||
prompt: 'Enter the URL:',
|
||||
placeHolder: ''
|
||||
placeHolder: '',
|
||||
});
|
||||
|
||||
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.');
|
||||
}
|
||||
});
|
||||
context.subscriptions.push(disposable2);
|
||||
context.subscriptions.push(setUrlCommand);
|
||||
|
||||
// commande pour tester l'url
|
||||
let 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;
|
||||
if (!storedUrl) {
|
||||
vscode.window.showWarningMessage('URL is not set. Please set the URL first.');
|
||||
return;
|
||||
}
|
||||
await makeHttpRequest({ event: 'ping'});
|
||||
await makeHttpRequest({ event: 'ping' });
|
||||
vscode.window.showInformationMessage('callUrl done');
|
||||
});
|
||||
context.subscriptions.push(disposable3);
|
||||
context.subscriptions.push(callUrlCommand);
|
||||
|
||||
// detecte une ouverture de fichier / nouvel onglet
|
||||
vscode.window.onDidChangeActiveTextEditor(async editor => {
|
||||
vscode.window.onDidChangeActiveTextEditor(async (editor) => {
|
||||
if (editor) {
|
||||
const filePath = editor.document.fileName;
|
||||
console.log('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
|
||||
vscode.workspace.onDidSaveTextDocument(async document => {
|
||||
vscode.workspace.onDidSaveTextDocument(async (document) => {
|
||||
const filePath = document.fileName;
|
||||
console.log('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
|
||||
vscode.window.onDidChangeWindowState(async event => {
|
||||
vscode.window.onDidChangeWindowState(async (event) => {
|
||||
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
|
||||
* /root/docker/monitoringserver/controller/homeController.js
|
||||
* => monitoringserver
|
||||
*/
|
||||
function extractProjectName(path: string) {
|
||||
* extractProjectName will extract a project name from a path
|
||||
* /root/docker/monitoringserver/controller/homeController.js
|
||||
* => monitoringserver
|
||||
*/
|
||||
export function extractProjectName(path: string) {
|
||||
// des c'est l'un des fois l'autre ?
|
||||
// /root/docker/vscodestat/src/extension.ts
|
||||
// \root\docker\vscodestat\src\extension.ts
|
||||
path = path.replace(/\\/g, '/');
|
||||
|
||||
|
||||
const match = path.match(/\/docker\/([^/]+)/);
|
||||
if (match) {
|
||||
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) {
|
||||
try {
|
||||
const url = vscode.workspace.getConfiguration().get('vscodestat.url') as string;
|
||||
@@ -97,16 +91,16 @@ async function makeHttpRequest(json: Object) {
|
||||
const rawResponse = await fetch(url, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json'
|
||||
Accept: 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(json)
|
||||
body: JSON.stringify(json),
|
||||
});
|
||||
const content = await rawResponse.json();
|
||||
|
||||
console.log(content);
|
||||
// vscode.window.showInformationMessage('HTTP request successful.');
|
||||
} catch (error:any) {
|
||||
} catch (error: any) {
|
||||
console.error('Error making HTTP request:', error);
|
||||
// vscode.window.showErrorMessage('Error making HTTP request: ' + error.message);
|
||||
}
|
||||
|
||||
+23
-10
@@ -1,15 +1,28 @@
|
||||
import * as assert from 'assert';
|
||||
import { extractProjectName } from '../extension.js';
|
||||
|
||||
// You can import and use all API from the 'vscode' module
|
||||
// as well as import your extension to test it
|
||||
import * as vscode from 'vscode';
|
||||
// import * as myExtension from '../../extension';
|
||||
suite('extractProjectName', () => {
|
||||
test('extrait le nom de projet depuis un path Linux /root/docker/X', () => {
|
||||
assert.strictEqual(extractProjectName('/root/docker/vscodestat/src/extension.ts'), 'vscodestat');
|
||||
});
|
||||
|
||||
suite('Extension Test Suite', () => {
|
||||
vscode.window.showInformationMessage('Start all tests.');
|
||||
test('extrait le nom de projet depuis un path Windows \\root\\docker\\X', () => {
|
||||
assert.strictEqual(extractProjectName('C:\\root\\docker\\monitoringserver\\controller\\homeController.js'), 'monitoringserver');
|
||||
});
|
||||
|
||||
test('Sample test', () => {
|
||||
assert.strictEqual(-1, [1, 2, 3].indexOf(5));
|
||||
assert.strictEqual(-1, [1, 2, 3].indexOf(0));
|
||||
});
|
||||
test('retourne null pour un path hors /docker/', () => {
|
||||
assert.strictEqual(extractProjectName('/home/user/projet/file.js'), null);
|
||||
});
|
||||
|
||||
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": {
|
||||
"module": "Node16",
|
||||
"target": "ES2022",
|
||||
"outDir": "out",
|
||||
"lib": [
|
||||
"ES2022"
|
||||
],
|
||||
"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. */
|
||||
}
|
||||
"compilerOptions": {
|
||||
"module": "Node16",
|
||||
"target": "ES2022",
|
||||
"outDir": "out",
|
||||
"lib": ["ES2022"],
|
||||
"types": ["node", "mocha", "vscode"],
|
||||
"sourceMap": true,
|
||||
"rootDir": "src",
|
||||
"strict": true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user