mirror of
https://gitlab.com/aviortheking/code-stats-vscode.git
synced 2025-04-22 10:52:13 +00:00
fix: Build errors
Signed-off-by: Avior <f.bouillon@aptatio.com>
This commit is contained in:
parent
9eb417f340
commit
e4b8ab4db8
@ -8,7 +8,7 @@ package:
|
|||||||
stage: package
|
stage: package
|
||||||
before_script:
|
before_script:
|
||||||
- npm install -g vsce typescript ovsx
|
- npm install -g vsce typescript ovsx
|
||||||
- npm install
|
- npm ci
|
||||||
cache:
|
cache:
|
||||||
paths:
|
paths:
|
||||||
- node_modules/
|
- node_modules/
|
||||||
|
3022
package-lock.json
generated
3022
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
29
package.json
29
package.json
@ -66,26 +66,27 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"vscode:prepublish": "tsc -p ./",
|
"vscode:prepublish": "tsc --project tsconfig.json",
|
||||||
"compile": "tsc -watch -p ./",
|
"build": "npm run build:native && npm run build:browser",
|
||||||
"test:browser": "vscode-test-web --extensionDevelopmentPath=. .",
|
"build:browser": "node esbuild.js",
|
||||||
"compile:browser": "node esbuild.js"
|
"build:native": "tsc --project tsconfig.json",
|
||||||
|
"dev": "tsc --project tsconfig.json -watch",
|
||||||
|
"test:browser": "vscode-test-web --extensionDevelopmentPath=. ."
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@dzeio/config": "^1",
|
||||||
"@esbuild-plugins/node-modules-polyfill": "^0.1.4",
|
"@esbuild-plugins/node-modules-polyfill": "^0.1.4",
|
||||||
"@types/mocha": "^7.0.2",
|
"@types/lodash.template": "^4",
|
||||||
"@types/node": "^13.9.8",
|
"@types/node": "^16",
|
||||||
"@types/node-fetch": "^2.6.2",
|
"@types/node-fetch": "^2",
|
||||||
"@types/vscode": "^1.43.2",
|
"@types/vscode": "^1",
|
||||||
"@vscode/test-web": "^0.0.34",
|
"@vscode/test-web": "^0.0.34",
|
||||||
"esbuild": "^0.17.3",
|
"esbuild": "^0.17.3",
|
||||||
"growl": "^1.10.5",
|
"typescript": "^4",
|
||||||
"mocha": "^7.1.1",
|
"vscode-test": "^1"
|
||||||
"typescript": "^3.8.3",
|
|
||||||
"vscode-test": "^1.5.2"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"lodash.template": "^4.5.0",
|
"lodash.template": "^4",
|
||||||
"node-fetch": "^2.6.8"
|
"node-fetch": "^2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,8 +13,8 @@ if (typeof fetch === 'undefined') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class CodeStatsAPI {
|
export class CodeStatsAPI {
|
||||||
private API_KEY = null;
|
private API_KEY?: string;
|
||||||
private USER_NAME = null;
|
private USER_NAME?: string;
|
||||||
private UPDATE_URL = "https://codestats.net/api";
|
private UPDATE_URL = "https://codestats.net/api";
|
||||||
private headers: Record<string, string> = {
|
private headers: Record<string, string> = {
|
||||||
"Content-Type": "application/json"
|
"Content-Type": "application/json"
|
||||||
@ -47,7 +47,6 @@ export class CodeStatsAPI {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// tslint:disable-next-line:typedef
|
|
||||||
const data = new ApiJSON(new Date());
|
const data = new ApiJSON(new Date());
|
||||||
|
|
||||||
for (let lang of pulse.xps.keys()) {
|
for (let lang of pulse.xps.keys()) {
|
||||||
@ -86,7 +85,7 @@ export class CodeStatsAPI {
|
|||||||
|
|
||||||
class ApiJSON {
|
class ApiJSON {
|
||||||
constructor(date: Date) {
|
constructor(date: Date) {
|
||||||
this.coded_at = getISOTimestamp(new Date());
|
this.coded_at = getISOTimestamp(date);
|
||||||
this.xps = new Array<ApiXP>();
|
this.xps = new Array<ApiXP>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
import { CancellationToken, Event, ExtensionContext, TextDocumentContentProvider, Uri, workspace } from "vscode"
|
import { CancellationToken, Event, ExtensionContext, TextDocumentContentProvider, Uri } from "vscode"
|
||||||
import { CodeStatsAPI } from "./code-stats-api"
|
import { CodeStatsAPI } from "./code-stats-api"
|
||||||
import profileHtmlEex from './profile.html.eex'
|
import profileHtmlEex from './profile.html.eex'
|
||||||
|
|
||||||
@ -16,9 +16,9 @@ export class ProfileProvider implements TextDocumentContentProvider {
|
|||||||
this.api = api;
|
this.api = api;
|
||||||
}
|
}
|
||||||
|
|
||||||
provideTextDocumentContent(uri: Uri, token: CancellationToken): string | Thenable<string> {
|
provideTextDocumentContent(_uri: Uri, token: CancellationToken): string | Thenable<string> {
|
||||||
|
|
||||||
if (token.isCancellationRequested) return;
|
if (token.isCancellationRequested) return '';
|
||||||
|
|
||||||
const LEVEL_FACTOR = 0.025;
|
const LEVEL_FACTOR = 0.025;
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ export class Pulse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public getXP(language: string): number {
|
public getXP(language: string): number {
|
||||||
let xp: number = this.xps.get(language);
|
let xp = this.xps.get(language);
|
||||||
|
|
||||||
if (xp === null || xp === undefined) {
|
if (xp === null || xp === undefined) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -11,7 +11,7 @@ export class XpCounter {
|
|||||||
private combinedDisposable: Disposable;
|
private combinedDisposable: Disposable;
|
||||||
private statusBarItem: StatusBarItem;
|
private statusBarItem: StatusBarItem;
|
||||||
private pulse: Pulse;
|
private pulse: Pulse;
|
||||||
private api: CodeStatsAPI;
|
private api!: CodeStatsAPI;
|
||||||
private updateTimeout: any;
|
private updateTimeout: any;
|
||||||
|
|
||||||
// wait 10s after each change in the document before sending an update
|
// wait 10s after each change in the document before sending an update
|
||||||
@ -33,10 +33,8 @@ export class XpCounter {
|
|||||||
|
|
||||||
let subscriptions: Disposable[] = [];
|
let subscriptions: Disposable[] = [];
|
||||||
|
|
||||||
if (!this.statusBarItem) {
|
|
||||||
this.statusBarItem = window.createStatusBarItem(StatusBarAlignment.Left);
|
this.statusBarItem = window.createStatusBarItem(StatusBarAlignment.Left);
|
||||||
this.statusBarItem.command = "code-stats.profile";
|
this.statusBarItem.command = "code-stats.profile";
|
||||||
}
|
|
||||||
|
|
||||||
subscriptions.push(workspace.registerTextDocumentContentProvider('code-stats', new ProfileProvider(context, this.api)));
|
subscriptions.push(workspace.registerTextDocumentContentProvider('code-stats', new ProfileProvider(context, this.api)));
|
||||||
|
|
||||||
@ -166,9 +164,9 @@ export class XpCounter {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const apiKey: string = config.get("apikey");
|
const apiKey = config.get("apikey") as string;
|
||||||
const apiURL: string = config.get("apiurl");
|
const apiURL = config.get("apiurl") as string;
|
||||||
const userName: string = config.get("username");
|
const userName = config.get("username") as string;
|
||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
`code-stats-vscode setting up:
|
`code-stats-vscode setting up:
|
||||||
@ -178,9 +176,7 @@ export class XpCounter {
|
|||||||
`
|
`
|
||||||
);
|
);
|
||||||
|
|
||||||
if(this.api != null )
|
if(this.api != null ) this.api.updateSettings(apiKey, apiURL, userName);
|
||||||
this.api.updateSettings(apiKey, apiURL, userName);
|
else this.api = new CodeStatsAPI(apiKey,apiURL,userName);
|
||||||
else
|
|
||||||
this.api = new CodeStatsAPI(apiKey,apiURL,userName);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,15 @@
|
|||||||
{
|
{
|
||||||
|
"include": ["src"],
|
||||||
|
"extends": "./node_modules/@dzeio/config/tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"module": "commonjs",
|
|
||||||
"target": "es6",
|
|
||||||
"outDir": "out",
|
"outDir": "out",
|
||||||
"lib": [
|
"lib": [
|
||||||
"es6"
|
"es6"
|
||||||
],
|
],
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"rootDir": "."
|
"skipLibCheck": true
|
||||||
},
|
},
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"node_modules",
|
".vscode-test*"
|
||||||
".vscode-test"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user