From 0ccff561c0c997612e458a3c4c835e0a645102bb Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Sun, 17 May 2020 12:45:58 +0200 Subject: [PATCH] added patches for bad types in dependencies --- package.json | 2 + patches/README.md | 15 ++++++++ patches/graphiql+1.0.0-alpha.8.patch | 49 ++++++++++++++++++++++++ patches/material-table+1.57.2.patch | 12 ++++++ yarn.lock | 56 ++++++++++++++++++++++++++++ 5 files changed, 134 insertions(+) create mode 100644 patches/README.md create mode 100644 patches/graphiql+1.0.0-alpha.8.patch create mode 100644 patches/material-table+1.57.2.patch diff --git a/package.json b/package.json index f98ac41ad2..624c29065e 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "remove-plugin": "backstage-cli remove-plugin", "release": "if [ \"$(git symbolic-ref --short HEAD)\" = master ]; then echo \"don't try to release master\"; exit 1; else lerna version --no-push; fi", "lerna": "lerna", + "postinstall": "patch-package", "storybook": "yarn workspace storybook start" }, "workspaces": { @@ -33,6 +34,7 @@ "husky": "^4.2.3", "lerna": "^3.20.2", "lint-staged": "^10.1.0", + "patch-package": "^6.2.2", "prettier": "^2.0.5" }, "husky": { diff --git a/patches/README.md b/patches/README.md new file mode 100644 index 0000000000..5cebd1f222 --- /dev/null +++ b/patches/README.md @@ -0,0 +1,15 @@ +# patches + +This folder contains patches for dependency type declarations. Typescript doesn't provide a way to override of fix types that are installed as a part of the dependent package itself. + +Do not add any more patches here, these patches were added as a part of getting the entire repo type-checked, and we depended on some packages with bad types. + +As soon as the below issues are fixed, we should remove the patching functionality completely. + +## graphiql + +Some bad TS config in the alpha release - tracked here: https://github.com/graphql/graphiql/issues/1530 + +## material-table + +Fixed in master but not released yet, tracked here: https://github.com/mbrn/material-table/pull/1624 diff --git a/patches/graphiql+1.0.0-alpha.8.patch b/patches/graphiql+1.0.0-alpha.8.patch new file mode 100644 index 0000000000..4634aab64e --- /dev/null +++ b/patches/graphiql+1.0.0-alpha.8.patch @@ -0,0 +1,49 @@ +diff --git a/node_modules/graphiql/dist/components/HistoryQuery.d.ts b/node_modules/graphiql/dist/components/HistoryQuery.d.ts +index c903bde..761b76b 100644 +--- a/node_modules/graphiql/dist/components/HistoryQuery.d.ts ++++ b/node_modules/graphiql/dist/components/HistoryQuery.d.ts +@@ -1,5 +1,5 @@ + import React from 'react'; +-import { QueryStoreItem } from 'src/utility/QueryStore'; ++import { QueryStoreItem } from '../utility/QueryStore'; + export declare type HandleEditLabelFn = (query?: string, variables?: string, operationName?: string, label?: string, favorite?: boolean) => void; + export declare type HandleToggleFavoriteFn = (query?: string, variables?: string, operationName?: string, label?: string, favorite?: boolean) => void; + export declare type HandleSelectQueryFn = (query?: string, variables?: string, operationName?: string, label?: string) => void; +diff --git a/node_modules/graphiql/dist/components/QueryEditor.d.ts b/node_modules/graphiql/dist/components/QueryEditor.d.ts +index b508e92..35e7fb7 100644 +--- a/node_modules/graphiql/dist/components/QueryEditor.d.ts ++++ b/node_modules/graphiql/dist/components/QueryEditor.d.ts +@@ -1,7 +1,7 @@ + import React from 'react'; + import * as CM from 'codemirror'; + import { GraphQLSchema, GraphQLType } from 'graphql'; +-import { SizerComponent } from 'src/utility/CodeMirrorSizer'; ++import { SizerComponent } from '../utility/CodeMirrorSizer'; + declare type QueryEditorProps = { + schema?: GraphQLSchema; + value?: string; +diff --git a/node_modules/graphiql/dist/components/QueryHistory.d.ts b/node_modules/graphiql/dist/components/QueryHistory.d.ts +index 409af29..9362657 100644 +--- a/node_modules/graphiql/dist/components/QueryHistory.d.ts ++++ b/node_modules/graphiql/dist/components/QueryHistory.d.ts +@@ -1,7 +1,7 @@ + import React from 'react'; + import QueryStore, { QueryStoreItem } from '../utility/QueryStore'; + import { HandleEditLabelFn, HandleToggleFavoriteFn, HandleSelectQueryFn } from './HistoryQuery'; +-import StorageAPI from 'src/utility/StorageAPI'; ++import StorageAPI from '../utility/StorageAPI'; + declare type QueryHistoryProps = { + query?: string; + variables?: string; +diff --git a/node_modules/graphiql/dist/components/ResultViewer.d.ts b/node_modules/graphiql/dist/components/ResultViewer.d.ts +index 55976f5..11b725a 100644 +--- a/node_modules/graphiql/dist/components/ResultViewer.d.ts ++++ b/node_modules/graphiql/dist/components/ResultViewer.d.ts +@@ -1,6 +1,6 @@ + import React, { Component, FunctionComponent } from 'react'; + import * as CM from 'codemirror'; +-import { SizerComponent } from 'src/utility/CodeMirrorSizer'; ++import { SizerComponent } from '../utility/CodeMirrorSizer'; + import { ImagePreview as ImagePreviewComponent } from './ImagePreview'; + declare type ResultViewerProps = { + value?: string; diff --git a/patches/material-table+1.57.2.patch b/patches/material-table+1.57.2.patch new file mode 100644 index 0000000000..5751243775 --- /dev/null +++ b/patches/material-table+1.57.2.patch @@ -0,0 +1,12 @@ +diff --git a/node_modules/material-table/types/index.d.ts b/node_modules/material-table/types/index.d.ts +index 06b700b..5b3c765 100644 +--- a/node_modules/material-table/types/index.d.ts ++++ b/node_modules/material-table/types/index.d.ts +@@ -228,7 +228,6 @@ export interface Options { + showTitle?: boolean; + showTextRowsSelected?: boolean; + search?: boolean; +- searchText?: string; + searchFieldAlignment?: 'left' | 'right'; + searchFieldStyle?: React.CSSProperties; + searchText?: string; diff --git a/yarn.lock b/yarn.lock index 2c2b9eb6ba..07ab5e1707 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4621,6 +4621,11 @@ resolved "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz#d291c6a4e97989b5c61d9acf396ae4fe133a718d" integrity sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ== +"@yarnpkg/lockfile@^1.1.0": + version "1.1.0" + resolved "https://registry.npmjs.org/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz#e77a97fbd345b76d83245edcd17d393b1b41fb31" + integrity sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ== + "@zkochan/cmd-shim@^3.1.0": version "3.1.0" resolved "https://registry.npmjs.org/@zkochan/cmd-shim/-/cmd-shim-3.1.0.tgz#2ab8ed81f5bb5452a85f25758eb9b8681982fd2e" @@ -9317,6 +9322,14 @@ find-versions@^3.0.0, find-versions@^3.2.0: dependencies: semver-regex "^2.0.0" +find-yarn-workspace-root@^1.2.1: + version "1.2.1" + resolved "https://registry.npmjs.org/find-yarn-workspace-root/-/find-yarn-workspace-root-1.2.1.tgz#40eb8e6e7c2502ddfaa2577c176f221422f860db" + integrity sha512-dVtfb0WuQG+8Ag2uWkbG79hOUzEsRrhBzgfn86g2sJPkzmcpGdghbNTfUKGTxymFrY/tLIodDzLoW9nOJ4FY8Q== + dependencies: + fs-extra "^4.0.3" + micromatch "^3.1.4" + findup-sync@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/findup-sync/-/findup-sync-3.0.0.tgz#17b108f9ee512dfb7a5c7f3c8b27ea9e1a9c08d1" @@ -9548,6 +9561,24 @@ fs-extra@^0.30.0: path-is-absolute "^1.0.0" rimraf "^2.2.8" +fs-extra@^4.0.3: + version "4.0.3" + resolved "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.3.tgz#0d852122e5bc5beb453fb028e9c0c9bf36340c94" + integrity sha512-q6rbdDd1o2mAnQreO7YADIxf/Whx4AHBiRf6d+/cVT8h44ss+lHgxf1FemcqDnQt9X3ct4McHr+JMGlYSsK7Cg== + dependencies: + graceful-fs "^4.1.2" + jsonfile "^4.0.0" + universalify "^0.1.0" + +fs-extra@^7.0.1: + version "7.0.1" + resolved "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz#4f189c44aa123b895f722804f55ea23eadc348e9" + integrity sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw== + dependencies: + graceful-fs "^4.1.2" + jsonfile "^4.0.0" + universalify "^0.1.0" + fs-extra@^9.0.0: version "9.0.0" resolved "https://registry.npmjs.org/fs-extra/-/fs-extra-9.0.0.tgz#b6afc31036e247b2466dc99c29ae797d5d4580a3" @@ -12490,6 +12521,13 @@ kind-of@^6.0.0, kind-of@^6.0.2: resolved "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd" integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw== +klaw-sync@^6.0.0: + version "6.0.0" + resolved "https://registry.npmjs.org/klaw-sync/-/klaw-sync-6.0.0.tgz#1fd2cfd56ebb6250181114f0a581167099c2b28c" + integrity sha512-nIeuVSzdCCs6TDPTqI8w1Yre34sSq7AkZ4B3sfOBbI2CgVSB4Du4aLQijFU2+lhAFCwt9+42Hel6lQNIv6AntQ== + dependencies: + graceful-fs "^4.1.11" + klaw@^1.0.0: version "1.3.1" resolved "https://registry.npmjs.org/klaw/-/klaw-1.3.1.tgz#4088433b46b3b1ba259d78785d8e96f73ba02439" @@ -15221,6 +15259,24 @@ pascalcase@^0.1.1: resolved "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz#b363e55e8006ca6fe21784d2db22bd15d7917f14" integrity sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ= +patch-package@^6.2.2: + version "6.2.2" + resolved "https://registry.npmjs.org/patch-package/-/patch-package-6.2.2.tgz#71d170d650c65c26556f0d0fbbb48d92b6cc5f39" + integrity sha512-YqScVYkVcClUY0v8fF0kWOjDYopzIM8e3bj/RU1DPeEF14+dCGm6UeOYm4jvCyxqIEQ5/eJzmbWfDWnUleFNMg== + dependencies: + "@yarnpkg/lockfile" "^1.1.0" + chalk "^2.4.2" + cross-spawn "^6.0.5" + find-yarn-workspace-root "^1.2.1" + fs-extra "^7.0.1" + is-ci "^2.0.0" + klaw-sync "^6.0.0" + minimist "^1.2.0" + rimraf "^2.6.3" + semver "^5.6.0" + slash "^2.0.0" + tmp "^0.0.33" + path-browserify@0.0.1: version "0.0.1" resolved "https://registry.npmjs.org/path-browserify/-/path-browserify-0.0.1.tgz#e6c4ddd7ed3aa27c68a20cc4e50e1a4ee83bbc4a"