Skip to content

Commit

Permalink
fix: use logger instead of console.log (#683)
Browse files Browse the repository at this point in the history
* fix: use logger instead of console.log

* fix: change set

* fix: add dependency

* fix: cyclic dependencies

* fix: change set

* fix: sonar

* fix: failing tests

* fix: add new package to tsconfig.json

* fix: remove duplicate
  • Loading branch information
marufrasully authored Jan 5, 2024
1 parent 6960178 commit a9a2141
Show file tree
Hide file tree
Showing 54 changed files with 1,101 additions and 892 deletions.
17 changes: 17 additions & 0 deletions .changeset/odd-lies-grab.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
"@ui5-language-assistant/vscode-ui5-language-assistant-bas-ext": patch
"vscode-ui5-language-assistant": patch
"@ui5-language-assistant/language-server": patch
"@ui5-language-assistant/semantic-model": patch
"@ui5-language-assistant/logic-utils": patch
"@ui5-language-assistant/binding": patch
"@ui5-language-assistant/context": patch
"@ui5-language-assistant/xml-views-completion": patch
"@ui5-language-assistant/xml-views-validation": patch
"@ui5-language-assistant/xml-views-tooltip": patch
"@ui5-language-assistant/fe": patch
"@ui5-language-assistant/test-utils": patch
"@ui5-language-assistant/test-framework": patch
---

Add logger package
2 changes: 0 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
const { join } = require("path");

module.exports = {
preset: "ts-jest",
testEnvironment: "node",
Expand Down
3 changes: 1 addition & 2 deletions jest.setup.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
jest.setTimeout(120000); // 2 min

jest.setTimeout(420000); // 7 min
// add all jest-extended matchers
const matchers = require("jest-extended");
expect.extend(matchers);
1 change: 0 additions & 1 deletion packages/binding/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const defaultConfig = require("../../jest.config");

module.exports = {
...defaultConfig,
setupFilesAfterEnv: ["./jest.setup.js"],
globals: {
"ts-jest": {
tsconfig: join(__dirname, "tsconfig-test.json"),
Expand Down
5 changes: 0 additions & 5 deletions packages/binding/jest.setup.js

This file was deleted.

1 change: 1 addition & 0 deletions packages/binding/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"license": "Apache-2.0",
"dependencies": {
"@ui5-language-assistant/binding-parser": "1.0.6",
"@ui5-language-assistant/logger": "0.0.1",
"@ui5-language-assistant/context": "4.0.21",
"@ui5-language-assistant/logic-utils": "4.0.15",
"@ui5-language-assistant/xml-views-completion": "4.0.21",
Expand Down
1 change: 1 addition & 0 deletions packages/binding/src/constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ export const AGGREGATION_BINDING_INFO =
export const Binding_Mode = "sap.ui.model.BindingMode";
export const PARTS = "parts";
export const FILTER_OPERATOR = "FilterOperator";
export const PACKAGE_NAME = "@ui5-language-assistant/binding";
24 changes: 3 additions & 21 deletions packages/binding/src/utils/logger.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,6 @@
import {
getLogger as logger,
ILogger,
} from "@ui5-language-assistant/logic-utils";

const getPackageName = (): string => {
let meta: { name: string };
try {
meta = require("../../package.json");
} catch (e) {
meta = require("../../../package.json");
}

if (!meta) {
return "";
}
// eslint-disable-next-line @typescript-eslint/no-var-requires -- Using `require` for .json file as this gets bundled with webpack correctly.
return meta.name;
};
import { getLogger as logger, ILogger } from "@ui5-language-assistant/logger";
import { PACKAGE_NAME } from "../constant";

export const getLogger = (): ILogger => {
const name = getPackageName();
return logger(name);
return logger(PACKAGE_NAME);
};
Loading

0 comments on commit a9a2141

Please sign in to comment.