fix: Build errors

Signed-off-by: Avior <f.bouillon@aptatio.com>
This commit is contained in:
Florian Bouillon 2023-01-20 12:46:33 +01:00
parent 9eb417f340
commit e4b8ab4db8
Signed by: Florian Bouillon
GPG Key ID: E05B3A94178D3A7C
8 changed files with 5615 additions and 6456 deletions

View File

@ -8,7 +8,7 @@ package:
stage: package
before_script:
- npm install -g vsce typescript ovsx
- npm install
- npm ci
cache:
paths:
- node_modules/

3022
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -66,26 +66,27 @@
]
},
"scripts": {
"vscode:prepublish": "tsc -p ./",
"compile": "tsc -watch -p ./",
"test:browser": "vscode-test-web --extensionDevelopmentPath=. .",
"compile:browser": "node esbuild.js"
"vscode:prepublish": "tsc --project tsconfig.json",
"build": "npm run build:native && npm run build:browser",
"build:browser": "node esbuild.js",
"build:native": "tsc --project tsconfig.json",
"dev": "tsc --project tsconfig.json -watch",
"test:browser": "vscode-test-web --extensionDevelopmentPath=. ."
},
"devDependencies": {
"@dzeio/config": "^1",
"@esbuild-plugins/node-modules-polyfill": "^0.1.4",
"@types/mocha": "^7.0.2",
"@types/node": "^13.9.8",
"@types/node-fetch": "^2.6.2",
"@types/vscode": "^1.43.2",
"@types/lodash.template": "^4",
"@types/node": "^16",
"@types/node-fetch": "^2",
"@types/vscode": "^1",
"@vscode/test-web": "^0.0.34",
"esbuild": "^0.17.3",
"growl": "^1.10.5",
"mocha": "^7.1.1",
"typescript": "^3.8.3",
"vscode-test": "^1.5.2"
},
"dependencies": {
"lodash.template": "^4.5.0",
"node-fetch": "^2.6.8"
"typescript": "^4",
"vscode-test": "^1"
},
"dependencies": {
"lodash.template": "^4",
"node-fetch": "^2"
}
}

View File

@ -13,8 +13,8 @@ if (typeof fetch === 'undefined') {
}
export class CodeStatsAPI {
private API_KEY = null;
private USER_NAME = null;
private API_KEY?: string;
private USER_NAME?: string;
private UPDATE_URL = "https://codestats.net/api";
private headers: Record<string, string> = {
"Content-Type": "application/json"
@ -47,7 +47,6 @@ export class CodeStatsAPI {
return null;
}
// tslint:disable-next-line:typedef
const data = new ApiJSON(new Date());
for (let lang of pulse.xps.keys()) {
@ -86,7 +85,7 @@ export class CodeStatsAPI {
class ApiJSON {
constructor(date: Date) {
this.coded_at = getISOTimestamp(new Date());
this.coded_at = getISOTimestamp(date);
this.xps = new Array<ApiXP>();
}

View File

@ -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 profileHtmlEex from './profile.html.eex'
@ -16,9 +16,9 @@ export class ProfileProvider implements TextDocumentContentProvider {
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;

View File

@ -6,7 +6,7 @@ export class Pulse {
}
public getXP(language: string): number {
let xp: number = this.xps.get(language);
let xp = this.xps.get(language);
if (xp === null || xp === undefined) {
return 0;

View File

@ -11,7 +11,7 @@ export class XpCounter {
private combinedDisposable: Disposable;
private statusBarItem: StatusBarItem;
private pulse: Pulse;
private api: CodeStatsAPI;
private api!: CodeStatsAPI;
private updateTimeout: any;
// wait 10s after each change in the document before sending an update
@ -33,10 +33,8 @@ export class XpCounter {
let subscriptions: Disposable[] = [];
if (!this.statusBarItem) {
this.statusBarItem = window.createStatusBarItem(StatusBarAlignment.Left);
this.statusBarItem.command = "code-stats.profile";
}
subscriptions.push(workspace.registerTextDocumentContentProvider('code-stats', new ProfileProvider(context, this.api)));
@ -166,9 +164,9 @@ export class XpCounter {
return;
}
const apiKey: string = config.get("apikey");
const apiURL: string = config.get("apiurl");
const userName: string = config.get("username");
const apiKey = config.get("apikey") as string;
const apiURL = config.get("apiurl") as string;
const userName = config.get("username") as string;
console.log(
`code-stats-vscode setting up:
@ -178,9 +176,7 @@ export class XpCounter {
`
);
if(this.api != null )
this.api.updateSettings(apiKey, apiURL, userName);
else
this.api = new CodeStatsAPI(apiKey,apiURL,userName);
if(this.api != null ) this.api.updateSettings(apiKey, apiURL, userName);
else this.api = new CodeStatsAPI(apiKey,apiURL,userName);
}
}

View File

@ -1,16 +1,15 @@
{
"include": ["src"],
"extends": "./node_modules/@dzeio/config/tsconfig.base.json",
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"outDir": "out",
"lib": [
"es6"
],
"sourceMap": true,
"rootDir": "."
"skipLibCheck": true
},
"exclude": [
"node_modules",
".vscode-test"
".vscode-test*"
]
}