Skip to content

Commit 67670a6

Browse files
nprijicveredcon
andauthored
feat: migrating to Vue3 (#280)
* feat: migrating to Vue3 * fix: removing unnecessary code from Vite config * fix: removing unnecessary css style * fix: adding folder browser to test case * fix: proxy objects --------- Co-authored-by: Vered Constantin1 <[email protected]>
1 parent f68b953 commit 67670a6

29 files changed

+4568
-6400
lines changed

.eslintrc.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ module.exports = {
77
node: true,
88
jest: true,
99
es6: true,
10+
es2020: true,
1011
},
1112
rules: {
1213
"eslint-comments/require-description": ["error", { ignore: [] }],
@@ -19,7 +20,7 @@ module.exports = {
1920
parserOptions: {
2021
// The `ecmaVersion` should align to the supported features of our target runtimes (browsers / nodejs / others)
2122
// Consult with: https://kangax.github.io/compat-table/es2016plus/
22-
ecmaVersion: 2017,
23+
ecmaVersion: 2020,
2324
},
2425
},
2526
{
@@ -30,7 +31,7 @@ module.exports = {
3031
sourceType: "module",
3132
// The `ecmaVersion` should align to the supported features of our target runtimes (browsers / nodejs / others)
3233
// Consult with: https://kangax.github.io/compat-table/es2016plus/
33-
ecmaVersion: 2018,
34+
ecmaVersion: 2020,
3435
},
3536
},
3637
{

.github/workflows/ci.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@ jobs:
1515
strategy:
1616
matrix:
1717
node_version:
18-
- 14.x
19-
# Build fails on node versions 16 and 18
20-
# - 16.x
21-
# - 18.x
18+
- 20.x
2219
# https://stackoverflow.com/questions/61070925/github-actions-disable-auto-cancel-when-job-fails
2320
fail-fast: false
2421

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
- uses: actions/checkout@v1
1212
- uses: actions/setup-node@v3
1313
with:
14-
node-version: '14.x'
14+
node-version: '20.x'
1515
registry-url: 'https://registry.npmjs.org'
1616
cache: 'yarn'
1717

examples/vscode-snippet-contrib/src/configHelper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export class ConfigHelper {
1313
}
1414
try {
1515
return _.merge(parse(content), ConfigHelper.getDefaultContent());
16-
} catch (e) {
16+
} catch (e: any) {
1717
vscode.window.showErrorMessage(e.message);
1818
return Promise.reject();
1919
}

examples/vscode-snippet-contrib/src/extension.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,23 @@ function createCodeSnippetQuestions(): any[] {
142142
default: "",
143143
message: "Program",
144144
},
145+
{
146+
guiOptions: {
147+
hint: "Select the folder you want to run.",
148+
type: "folder-browser",
149+
link: {
150+
text: "Open Settings",
151+
command: {
152+
id: "workbench.action.openSettings",
153+
params: ["Typescript.Format"],
154+
},
155+
},
156+
},
157+
type: "input",
158+
name: "folder",
159+
default: "",
160+
message: "Select folder",
161+
},
145162
{
146163
type: "input",
147164
guiOptions: {

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
"@commitlint/config-conventional": "11.0.0",
3535
"@types/chai": "4.2.16",
3636
"@types/mocha": "7.0.2",
37-
"@typescript-eslint/eslint-plugin": "4.15.0",
38-
"@typescript-eslint/parser": "4.20.0",
37+
"@typescript-eslint/eslint-plugin": "5.28.0",
38+
"@typescript-eslint/parser": "5.28.0",
3939
"chai": "4.3.4",
4040
"coveralls": "2.11.16",
4141
"cz-conventional-changelog": "3.3.0",
@@ -53,7 +53,7 @@
5353
"prettier": "2.2.1",
5454
"rimraf": "3.0.2",
5555
"shx": "0.3.3",
56-
"typescript": "^3.9.7"
56+
"typescript": "~4.5.0"
5757
},
5858
"husky": {
5959
"hooks": {

packages/backend/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@
121121
"lodash": "4.17.21",
122122
"strip-ansi": "6.0.0",
123123
"ws": "7.4.4",
124-
"yeoman-environment": "2.10.3"
124+
"yeoman-environment": "2.10.3",
125+
"jsdom": "23.2.0"
125126
},
126127
"devDependencies": {
127128
"@types/fs-extra": "^9.0.4",
@@ -136,7 +137,7 @@
136137
"ts-loader": "^8.0.14",
137138
"ts-node": "^9.1.1",
138139
"vsce": "^1.73.0",
139-
"webpack": "^4.43.0",
140-
"webpack-cli": "^3.3.11"
140+
"webpack": "^5.89.0",
141+
"webpack-cli": "5.1.4"
141142
}
142143
}

packages/backend/src/extension.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export function activate(context: vscode.ExtensionContext): void {
1616
try {
1717
createExtensionLoggerAndSubscribeToLogSettingsChanges(context);
1818
SWA.createSWATracker(getLogger());
19-
} catch (error) {
19+
} catch (error: any) {
2020
console.error(
2121
"Extension activation failed due to Logger configuration failure:",
2222
error.message

packages/backend/src/panels/AbstractWebviewPanel.ts

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import * as fsextra from "fs-extra";
55
import { IChildLogger } from "@vscode-logging/logger";
66
import { getClassLogger } from "../logger/logger-wrapper";
77
import { createFlowPromise, FlowPromise } from "../utils";
8+
import { JSDOM } from "jsdom";
89

910
export abstract class AbstractWebviewPanel {
1011
public viewType: string;
@@ -147,20 +148,26 @@ export abstract class AbstractWebviewPanel {
147148
scriptPathOnDisk
148149
);
149150

150-
// TODO: very fragile: assuming double quotes and src is first attribute
151-
// specifically, doesn't work when building vue for development (vue-cli-service build --mode development)
152-
indexHtml = indexHtml.replace(
153-
/<link href=/g,
154-
`<link href=${scriptUri.toString()}`
155-
);
156-
indexHtml = indexHtml.replace(
157-
/<script src=/g,
158-
`<script src=${scriptUri.toString()}`
159-
);
160-
indexHtml = indexHtml.replace(
161-
/<img src=/g,
162-
`<img src=${scriptUri.toString()}`
163-
);
151+
const baseUrl = scriptUri.toString();
152+
const dom = new JSDOM(indexHtml);
153+
const { document } = dom.window;
154+
155+
function replaceAttributePaths(elements: any, attributeName: string) {
156+
elements.forEach((element: any) => {
157+
const currentAttr = element.getAttribute(attributeName);
158+
if (currentAttr) {
159+
element.setAttribute(attributeName, `${baseUrl}/${currentAttr}`);
160+
}
161+
});
162+
}
163+
164+
const srcElements = document.querySelectorAll("[src]");
165+
const hrefElements = document.querySelectorAll("[href]");
166+
167+
replaceAttributePaths(srcElements, "src");
168+
replaceAttributePaths(hrefElements, "href");
169+
170+
indexHtml = dom.serialize();
164171
}
165172
this.webViewPanel.webview.html = indexHtml;
166173
}

packages/backend/src/swa-tracker/swa-tracker-wrapper.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export class SWA {
7979
`SAP Web Analytics tracker was created for ${SWA.CODE_SNIPPET}`
8080
);
8181
}
82-
} catch (error) {
82+
} catch (error: any) {
8383
logger.error(error);
8484
}
8585
}
@@ -106,7 +106,7 @@ export class SWA {
106106
);
107107
}
108108
}
109-
} catch (error) {
109+
} catch (error: any) {
110110
logger.error(error);
111111
}
112112
}
@@ -144,7 +144,7 @@ export class SWA {
144144
});
145145
}
146146
}
147-
} catch (error) {
147+
} catch (error: any) {
148148
logger.error(error);
149149
}
150150
}

0 commit comments

Comments
 (0)