Skip to content

Commit

Permalink
chore(deps): bump to latest sdk version and fix code (Kong#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewwylde authored Jun 8, 2023
1 parent 345c215 commit 61c8590
Show file tree
Hide file tree
Showing 10 changed files with 422 additions and 184 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ on:
pull_request:

jobs:
commitlint:
code-quality:
name: Lint and type check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -13,6 +14,10 @@ jobs:
- uses: wagoid/commitlint-github-action@v5
- name: Check unpinned versions
run: ./.github/scripts/pin-version
- name: Install Dependencies
run: yarn install --frozen-lockfile
- name: Check TypeScript types
run: yarn typecheck
tests:
name: Tests
runs-on: ubuntu-latest
Expand Down
10 changes: 8 additions & 2 deletions cypress/e2e/fixtures/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ const product: Product = {
id: 'a5afb115-025e-4da1-a013-bf05b326e0a51',
name: 'barAPI',
description: null,
labels: {}
document_count: 0,
latest_version: {
id: versions[0].id,
name: versions[0].name
},
version_count: 1
}

const productVersion: ProductVersion = {
Expand Down Expand Up @@ -82,7 +87,8 @@ const defaultContext: PortalContext = {
basic_auth_enabled: true,
oidc_auth_enabled: false,
featureset_id: '6202956f054d96149719eed0',
rbac_enabled: false
rbac_enabled: false,
allowed_time_period: '2022-03-25T13:15:02.104Z'
}

export { versions, product, productVersion, productRegistration, apps, defaultContext }
2 changes: 1 addition & 1 deletion cypress/e2e/support/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ declare global {
mockStylesheetFont(fonts?: {[key:string]:string}): Chainable<JQuery<HTMLElement>>
mockStylesheetCss(themeName?: string, fonts?: {[key:string]:string}): Chainable<JQuery<HTMLElement>>
mockAppearance(appearance?: PortalAppearance): Chainable<JQuery<HTMLElement>>
mockLaunchDarklyFlags(flags: Array<{name:string,value:boolean}>): Chainable<JQuery<HTMLElement>>
mockLaunchDarklyFlags(flags: Array<{name:string, value:boolean}>): Chainable<JQuery<HTMLElement>>
mockDeveloperRefresh(): Chainable<JQuery<HTMLElement>>
}
}
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/support/utils/generateProducts.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ProductCatalogIndexSource, ProductCatalogIndexSourceLatestVersion, ProductVersion, SearchResultsDataInner } from '@kong/sdk-portal-js'
import { ProductCatalogIndexSource, ProductCatalogIndexSourceLatestVersion, SearchResultsDataInner } from '@kong/sdk-portal-js'

export const generateProducts = (count: number, options: Partial<ProductCatalogIndexSource>[] = []): SearchResultsDataInner[] => {
const productsList: SearchResultsDataInner[] = []
Expand Down
15 changes: 15 additions & 0 deletions cypress/e2e/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"allowJs": true,
"types": [
"node",
"cypress"
],
"resolveJsonModule": true,
"sourceMap": false,
},
"include": [
"./**/*.ts"
]
}
16 changes: 10 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
"build:watch:dev": "vite build --watch --mode development --minify false",
"test": "yarn lint && yarn test:e2e",
"test:e2e": "concurrently --kill-others \"yarn build:watch\" \"cypress open -C cypress.config.js --e2e -b chrome\" \"node cypress.server.mjs \"",
"test:e2e:ci": "concurrently --success first --kill-others \"yarn build && DEBUG=cypress:server cypress run -C cypress.config.js --e2e -b chrome\" \"node cypress.server.mjs \""
"test:e2e:ci": "concurrently --success first --kill-others \"yarn build && DEBUG=cypress:server cypress run -C cypress.config.js --e2e -b chrome\" \"node cypress.server.mjs \"",
"typecheck": "vue-tsc -p './tsconfig.json' --noEmit",
"typecheck:tests": "vue-tsc -p './cypress/e2e/tsconfig.json' --noEmit"
},
"optionalDependencies": {
"launchdarkly-js-client-sdk": "2.24.2"
Expand All @@ -24,16 +26,14 @@
"@kong-ui-public/copy-uuid": "0.3.15",
"@kong-ui-public/document-viewer": "0.8.0",
"@kong-ui-public/spec-renderer": "0.9.0",
"@kong/kong-auth-elements": "2.0.3",
"@kong/kong-auth-elements": "2.0.4",
"@kong/kongponents": "8.73.1",
"@kong/sdk-portal-js": "0.0.1-beta.20",
"@kong/sdk-portal-js": "0.0.1-beta.23",
"@xstate/vue": "2.0.0",
"autoprefixer": "10.4.14",
"axios": "0.27.2",
"date-fns": "2.30.0",
"js-yaml": "4.1.0",
"pinia": "2.1.3",
"vite": "4.3",
"vue": "3.3.4",
"vue-router": "4.2.1",
"xstate": "4.37.2"
Expand All @@ -48,6 +48,7 @@
"@vue/compiler-sfc": "3.3.4",
"@vue/eslint-config-standard": "8.0.1",
"@vue/eslint-config-typescript": "11.0.3",
"autoprefixer": "10.4.14",
"commitizen": "4.3.0",
"concurrently": "8.1.0",
"cypress": "12.13.0",
Expand All @@ -64,10 +65,13 @@
"eslint-plugin-vue": "9.14.1",
"express": "4.18.2",
"lefthook": "1.4.1",
"openapi-types": "12.1.3",
"sass": "1.62.1",
"tailwindcss": "3.3.2",
"typescript": "4.9.5",
"vite-svg-loader": "4.0.0"
"vite-svg-loader": "4.0.0",
"vite": "4.3",
"vue-tsc": "1.6.5"
},
"config": {
"commitizen": {
Expand Down
4 changes: 2 additions & 2 deletions src/components/ApiDocumentation/DocumentTree.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@
<script lang="ts">
import { PropType, defineComponent, watch, ref, onMounted } from 'vue'
import { hasDocumentInTree } from '@/helpers/document'
import { SpecDocument } from '@kong-ui-public/spec-renderer'
import { DocumentTree } from '@kong/sdk-portal-js'
export default defineComponent({
name: 'DocumentTree',
props: {
documents: {
type: Array as PropType<SpecDocument[]>,
type: Array as PropType<DocumentTree[]>,
required: true
},
productId: {
Expand Down
8 changes: 0 additions & 8 deletions src/services/AuthApiService.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import axios, { AxiosError, AxiosInstance, AxiosResponse } from 'axios'
import { AuthenticationApi, Configuration } from '@kong/sdk-portal-js'
import { useAppStore } from '@/stores'
import { storeToRefs } from 'pinia'
import SessionCookie from './SessionCookie'
Expand All @@ -9,8 +8,6 @@ export default class KongAuthApi {

baseUrl: string

authentication: AuthenticationApi

failedQueue = []

session: SessionCookie
Expand Down Expand Up @@ -119,11 +116,6 @@ export default class KongAuthApi {
return Promise.reject(originalErr)
})

const baseConfig = new Configuration({
basePath: this.baseUrl
})

this.authentication = new AuthenticationApi(baseConfig, baseConfig.basePath, this.client)
this.authenticationV1 = {
logout: () => this.client.post(this.baseUrl + '/api/v1/developer-logout'),
refresh: () => this.client.post(this.baseUrl + '/api/v1/developer-refresh')
Expand Down
9 changes: 1 addition & 8 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@
"target": "ESNext",
"types": [
"node",
"cypress",
"./cypress/support",
"vite/client",
"vitest/globals"
"vite/client"
]
},
"vueCompilerOptions": {
Expand All @@ -39,10 +36,6 @@
"src/**/*.ts",
"src/**/*.tsx",
"src/**/*.vue",
"src/additionalModules.ts",
"src/hooks/usePortalApi.js",
"tests/unit/**/*.ts",
"cypress/**/*.ts",
],
"exclude": [
"node_modules"
Expand Down
Loading

0 comments on commit 61c8590

Please sign in to comment.