From fa988dce59361e4f58239f46afca6a91667cd519 Mon Sep 17 00:00:00 2001 From: Blake Pettersson Date: Sat, 6 May 2023 15:15:31 +0200 Subject: [PATCH 1/2] chore: upgrade uuid Upgrading uuid should solve the build issues in argo-cd#11006. As is usual in JS land, a single upgrade has a bunch of follow-on effects, the main one being that node needs to be upgraded to at least `14.15` in order for this to build at all. Signed-off-by: Blake Pettersson --- .github/workflows/build-docs.yml | 2 +- .github/workflows/build-v1.yml | 2 +- .github/workflows/npm-publish-v1.yml | 2 +- .github/workflows/npm-publish.yml | 2 +- .nvmrc | 2 +- package.json | 2 ++ src/components/form-field/form-field.tsx | 2 +- tsconfig.json | 1 + yarn.lock | 10 ++++++++++ 9 files changed, 19 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index 54c3ea6a..658a2e7e 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -10,6 +10,6 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: 12 + node-version: 14.15 - run: yarn install - run: yarn build-v2 diff --git a/.github/workflows/build-v1.yml b/.github/workflows/build-v1.yml index d0e465a9..d1dfbbc1 100644 --- a/.github/workflows/build-v1.yml +++ b/.github/workflows/build-v1.yml @@ -13,7 +13,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: 12 + node-version: 14.15 - run: yarn install - run: yarn build - run: yarn lint diff --git a/.github/workflows/npm-publish-v1.yml b/.github/workflows/npm-publish-v1.yml index 066f0b0f..9bc36c9f 100644 --- a/.github/workflows/npm-publish-v1.yml +++ b/.github/workflows/npm-publish-v1.yml @@ -12,7 +12,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: 12 + node-version: 14.15 - run: npm publish env: NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 4427daff..a234b463 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -16,7 +16,7 @@ jobs: ref: ${{ github.event.inputs.tag }} - uses: actions/setup-node@v3 with: - node-version: 12 + node-version: 14.15 - run: cd v2 && npm publish env: NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} diff --git a/.nvmrc b/.nvmrc index 82f87fa0..bbfaef74 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -v12.18.4 +v14.15 diff --git a/package.json b/package.json index c876bf24..5cd1a240 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,7 @@ "react-toastify": "^9.0.8", "rxjs": "^7.5.6", "typescript": "^4.8.3", + "uuid": "^9.0.0", "xterm": "^4.18.0", "xterm-addon-fit": "^0.5.0" }, @@ -79,6 +80,7 @@ "@types/storybook__addon-actions": "^5.2.1", "@types/storybook__addon-links": "^3.3.0", "@types/storybook__react": "^3.0.7", + "@types/uuid": "^9.0.1", "@types/yamljs": "^0.2.31", "babel-loader": "^8.2.5", "chai": "^4.3.7", diff --git a/src/components/form-field/form-field.tsx b/src/components/form-field/form-field.tsx index 1dd5b3d4..59cf383b 100644 --- a/src/components/form-field/form-field.tsx +++ b/src/components/form-field/form-field.tsx @@ -4,7 +4,7 @@ import * as ReactForm from 'react-form'; import { Select as ArgoSelect, SelectOption, SelectProps } from '../select/select'; -const uuid = require('uuid/v1'); +import { v1 as uuid } from 'uuid'; require('./form-field.scss'); diff --git a/tsconfig.json b/tsconfig.json index f3093b2c..74cb29b8 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -6,6 +6,7 @@ "module": "commonjs", "target": "es6", "jsx": "react", + "esModuleInterop": true, "experimentalDecorators": true, "noUnusedLocals": true, "declaration": true, diff --git a/yarn.lock b/yarn.lock index e744c7c9..868698d1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3988,6 +3988,11 @@ resolved "https://registry.yarnpkg.com/@types/unist/-/unist-2.0.6.tgz#250a7b16c3b91f672a24552ec64678eeb1d3a08d" integrity sha512-PBjIUxZHOuj0R15/xuwJYjFi+KZdNFrehocChv4g5hu6aFroHue8m0lBP0POdK2nKzbw0cgV1mws8+V/JAcEkQ== +"@types/uuid@^9.0.1": + version "9.0.1" + resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-9.0.1.tgz#98586dc36aee8dacc98cc396dbca8d0429647aa6" + integrity sha512-rFT3ak0/2trgvp4yYZo5iKFEPsET7vKydKF+VRCxlQ9bpheehyAJH89dAkaLEq/j/RZXJIqcgsmPJKUP1Z28HA== + "@types/webpack-env@*", "@types/webpack-env@^1.16.0": version "1.16.2" resolved "https://registry.yarnpkg.com/@types/webpack-env/-/webpack-env-1.16.2.tgz#8db514b059c1b2ae14ce9d7bb325296de6a9a0fa" @@ -17699,6 +17704,11 @@ uuid@^8.3.2: resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== +uuid@^9.0.0: + version "9.0.0" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.0.tgz#592f550650024a38ceb0c562f2f6aa435761efb5" + integrity sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg== + v8-compile-cache-lib@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz#6336e8d71965cb3d35a1bbb7868445a7c05264bf" From 2fa37e4d62628675c13514967a01ecc7224de7ab Mon Sep 17 00:00:00 2001 From: Blake Pettersson Date: Sat, 6 May 2023 15:48:37 +0200 Subject: [PATCH 2/2] fix: typescript tweaks Signed-off-by: Blake Pettersson --- src/components/autocomplete/autocomplete.tsx | 9 +++++---- src/components/ticker.tsx | 2 +- src/setupTests.ts | 2 +- v2/utils/utils.tsx | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/components/autocomplete/autocomplete.tsx b/src/components/autocomplete/autocomplete.tsx index 63be3336..145eb19f 100644 --- a/src/components/autocomplete/autocomplete.tsx +++ b/src/components/autocomplete/autocomplete.tsx @@ -1,6 +1,7 @@ import {default as classNames} from 'classnames'; +import {CSSProperties, ReactNode} from 'react'; import * as React from 'react'; -import * as ReactAutocomplete from 'react-autocomplete'; +import ReactAutocomplete from 'react-autocomplete'; require('./autocomplete.scss'); export interface AutocompleteApi { @@ -106,16 +107,16 @@ export const Autocomplete = (props: AutocompleteProps) => { shouldItemRender={(item: AutocompleteOption, val: string) => { return !props.filterSuggestions || item.label.toLowerCase().includes(val.toLowerCase()); }} - renderMenu={function(menuItems, _, style) { + renderMenu={function(menuItems: ReactNode[], _: string, style: CSSProperties) { if (menuItems.length === 0) { return
; } return
; }} - getItemValue={(item) => item.label} + getItemValue={(item: any) => item.label} items={items} value={props.value} - renderItem={(item, isSelected) => ( + renderItem={(item: any, isSelected: boolean) => (
{(props.renderItem && props.renderItem(item)) || item.label}
diff --git a/src/components/ticker.tsx b/src/components/ticker.tsx index 52383d77..90bc7c2e 100644 --- a/src/components/ticker.tsx +++ b/src/components/ticker.tsx @@ -1,4 +1,4 @@ -import * as moment from 'moment'; +import moment from 'moment'; import * as React from 'react'; import {interval, Subscription} from 'rxjs'; diff --git a/src/setupTests.ts b/src/setupTests.ts index aba54047..855c3132 100644 --- a/src/setupTests.ts +++ b/src/setupTests.ts @@ -1,4 +1,4 @@ import {configure } from 'enzyme'; -import * as Adapter from 'enzyme-adapter-react-16'; +import Adapter from 'enzyme-adapter-react-16'; configure({ adapter: new Adapter() }); diff --git a/v2/utils/utils.tsx b/v2/utils/utils.tsx index a2afee1a..374f9375 100644 --- a/v2/utils/utils.tsx +++ b/v2/utils/utils.tsx @@ -1,4 +1,4 @@ -import * as moment from 'moment'; +import moment from 'moment'; import * as React from 'react'; export interface Error {