From 39c38c737114dc7f946b1895b2a4ba27a5546c60 Mon Sep 17 00:00:00 2001 From: HampusM Date: Tue, 6 Jul 2021 13:07:07 +0200 Subject: Migrated frontend to typescript --- packages/client/.eslintrc.js | 5 +- packages/client/package.json | 77 ++-- packages/client/src/App.vue | 15 +- packages/client/src/components/BaseBackButton.vue | 8 +- packages/client/src/components/BaseBreadcrumb.vue | 8 +- packages/client/src/components/BaseButton.vue | 8 +- .../client/src/components/BaseErrorMessage.vue | 8 +- packages/client/src/components/CommitPatch.vue | 248 +++++++------ packages/client/src/components/HomeHeader.vue | 8 +- .../client/src/components/HomeProjectsHeader.vue | 10 +- .../src/components/RepositoryCloneDropdown.vue | 106 +++--- .../client/src/components/RepositoryHeader.vue | 10 +- .../client/src/components/RepositoryNavbar.vue | 10 +- .../client/src/components/RepositoryTreeBlob.vue | 39 ++- .../client/src/components/RepositoryTreeTree.vue | 15 +- packages/client/src/lib/marked.min.js | 8 - packages/client/src/main.js | 5 - packages/client/src/main.ts | 5 + packages/client/src/router/index.js | 54 --- packages/client/src/router/index.ts | 54 +++ packages/client/src/shims-vue.d.ts | 6 + packages/client/src/util/fetch.js | 35 -- packages/client/src/util/fetch.ts | 37 ++ packages/client/src/util/hljs-languages.js | 45 --- packages/client/src/util/hljs-languages.ts | 45 +++ packages/client/src/util/util.ts | 7 + packages/client/src/views/Home.vue | 38 +- packages/client/src/views/PageNotFound.vue | 6 +- packages/client/src/views/Repository.vue | 27 +- packages/client/src/views/RepositoryAbout.vue | 26 +- packages/client/src/views/RepositoryCommit.vue | 28 +- packages/client/src/views/RepositoryLog.vue | 41 ++- packages/client/src/views/RepositoryRedirect.vue | 0 packages/client/src/views/RepositoryTree.vue | 60 ++-- packages/client/tsconfig.json | 40 +++ yarn.lock | 387 ++++++++++++++++++++- 36 files changed, 1032 insertions(+), 497 deletions(-) delete mode 100644 packages/client/src/lib/marked.min.js delete mode 100644 packages/client/src/main.js create mode 100644 packages/client/src/main.ts delete mode 100644 packages/client/src/router/index.js create mode 100644 packages/client/src/router/index.ts create mode 100644 packages/client/src/shims-vue.d.ts delete mode 100644 packages/client/src/util/fetch.js create mode 100644 packages/client/src/util/fetch.ts delete mode 100644 packages/client/src/util/hljs-languages.js create mode 100644 packages/client/src/util/hljs-languages.ts create mode 100644 packages/client/src/util/util.ts delete mode 100644 packages/client/src/views/RepositoryRedirect.vue create mode 100644 packages/client/tsconfig.json diff --git a/packages/client/.eslintrc.js b/packages/client/.eslintrc.js index 89ac051..595cce8 100644 --- a/packages/client/.eslintrc.js +++ b/packages/client/.eslintrc.js @@ -5,10 +5,11 @@ module.exports = { }, extends: [ "plugin:vue/vue3-strongly-recommended", - "@vue/standard" + "@vue/standard", + "@vue/typescript" ], parserOptions: { - parser: "babel-eslint" + parser: "@typescript-eslint/parser" }, ignorePatterns: [ "/src/lib/*" ], rules: { diff --git a/packages/client/package.json b/packages/client/package.json index 11df741..deaacdf 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,37 +1,44 @@ { - "name": "client", - "version": "1.0.0", - "private": true, - "author": "HampusMat", - "license": "MIT", - "scripts": { - "serve": "vue-cli-service serve", - "build": "vue-cli-service build --dest dist", - "lint": "vue-cli-service lint" - }, - "dependencies": { - "@popperjs/core": "^2.9.2", - "core-js": "^3.6.5", - "date-fns": "^2.22.1", - "highlight.js": "^11.0.1", - "js-yaml": "^4.1.0", - "vue": "^3.0.0", - "vue-loading-overlay": "^4.0.3", - "vue-router": "^4.0.0-0" - }, - "devDependencies": { - "@vue/cli-plugin-babel": "~4.5.0", - "@vue/cli-plugin-eslint": "~4.5.0", - "@vue/cli-plugin-router": "~4.5.0", - "@vue/cli-service": "~4.5.0", - "@vue/compiler-sfc": "^3.0.0", - "@vue/eslint-config-standard": "^5.1.2", - "babel-eslint": "^10.1.0", - "eslint-plugin-import": "^2.23.4", - "eslint-plugin-promise": "^5.1.0", - "eslint-plugin-standard": "^5.0.0", - "eslint-plugin-vue": "^7.0.0", - "sass": "^1.26.5", - "sass-loader": "^8.0.2" - } + "name": "client", + "version": "1.0.0", + "private": true, + "author": "HampusMat", + "scripts": { + "serve": "vue-cli-service serve", + "build": "vue-cli-service build --dest dist", + "lint": "vue-cli-service lint" + }, + "dependencies": { + "@popperjs/core": "^2.9.2", + "core-js": "^3.6.5", + "date-fns": "^2.22.1", + "highlight.js": "^11.0.1", + "js-yaml": "^4.1.0", + "marked": "^2.1.3", + "vue": "^3.0.0", + "vue-loading-overlay": "^4.0.3", + "vue-router": "^4.0.0-0" + }, + "devDependencies": { + "@types/marked": "^2.0.3", + "@typescript-eslint/eslint-plugin": "^4.28.1", + "@typescript-eslint/parser": "^4.28.1", + "@vue/cli-plugin-babel": "~4.5.0", + "@vue/cli-plugin-eslint": "~4.5.0", + "@vue/cli-plugin-router": "~4.5.0", + "@vue/cli-plugin-typescript": "^4.5.13", + "@vue/cli-service": "~4.5.0", + "@vue/compiler-sfc": "^3.0.0", + "@vue/eslint-config-standard": "^5.1.2", + "@vue/eslint-config-typescript": "^7.0.0", + "babel-eslint": "^10.1.0", + "eslint-plugin-import": "^2.23.4", + "eslint-plugin-promise": "^5.1.0", + "eslint-plugin-standard": "^5.0.0", + "eslint-plugin-vue": "^7.0.0", + "sass": "^1.26.5", + "sass-loader": "^8.0.2", + "typescript": "^4.3.5" + }, + "license": "MIT" } diff --git a/packages/client/src/App.vue b/packages/client/src/App.vue index 0c50f3a..d34fcc5 100644 --- a/packages/client/src/App.vue +++ b/packages/client/src/App.vue @@ -2,8 +2,11 @@ -