From 13b1d899296d466ae6732a1add58e03580c1a4e5 Mon Sep 17 00:00:00 2001 From: Priscila Oliveira Date: Fri, 3 May 2019 23:55:15 +0200 Subject: [PATCH 01/56] refactor: refactoring to typescript --- package.json | 12 ++ src/config/env.js | 1 - src/lib/{constants.js => constants.ts} | 2 - .../{index.js => CopyToClipBoard.tsx} | 16 +- src/webui/components/CopyToClipBoard/index.ts | 1 + .../CopyToClipBoard/{styles.js => styles.ts} | 6 +- .../CopyToClipBoard/{types.js => types.ts} | 1 - src/webui/components/Help/Help.tsx | 50 +++++ src/webui/components/Help/index.js | 51 ----- src/webui/components/Help/index.ts | 1 + .../components/Help/{styles.js => styles.ts} | 4 +- .../Install/{index.js => Install.tsx} | 22 +- src/webui/components/Install/index.ts | 1 + .../Install/{styles.js => styles.ts} | 7 +- .../utils/{cli-utils.js => cli-utils.ts} | 8 +- .../utils/{constants.js => constants.ts} | 0 src/webui/utils/{url.js => url.ts} | 0 tools/webpack.config.js | 7 +- tsconfig.json | 34 +++ tslint.json | 66 ++++++ yarn.lock | 195 +++++++++++++++++- 21 files changed, 391 insertions(+), 94 deletions(-) rename src/lib/{constants.js => constants.ts} (95%) rename src/webui/components/CopyToClipBoard/{index.js => CopyToClipBoard.tsx} (74%) create mode 100644 src/webui/components/CopyToClipBoard/index.ts rename src/webui/components/CopyToClipBoard/{styles.js => styles.ts} (70%) rename src/webui/components/CopyToClipBoard/{types.js => types.ts} (90%) create mode 100644 src/webui/components/Help/Help.tsx delete mode 100644 src/webui/components/Help/index.js create mode 100644 src/webui/components/Help/index.ts rename src/webui/components/Help/{styles.js => styles.ts} (68%) rename src/webui/components/Install/{index.js => Install.tsx} (75%) create mode 100644 src/webui/components/Install/index.ts rename src/webui/components/Install/{styles.js => styles.ts} (65%) rename src/webui/utils/{cli-utils.js => cli-utils.ts} (89%) rename src/webui/utils/{constants.js => constants.ts} (100%) rename src/webui/utils/{url.js => url.ts} (100%) create mode 100644 tsconfig.json create mode 100644 tslint.json diff --git a/package.json b/package.json index 381ec8dde..1d74d74a3 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,10 @@ "@material-ui/core": "3.9.0", "@material-ui/icons": "3.0.2", "@octokit/rest": "16.23.2", + "@types/material-ui": "0.21.6", + "@types/node": "12.0.0", + "@types/react": "16.8.15", + "@types/react-dom": "16.8.4", "@verdaccio/babel-preset": "0.1.0", "@verdaccio/types": "5.0.0-beta.4", "autosuggest-highlight": "3.1.1", @@ -88,7 +92,14 @@ "stylelint-scss": "3.5.4", "stylelint-webpack-plugin": "0.10.5", "supertest": "3.4.2", + "ts-loader": "5.4.5", + "tslint": "5.16.0", + "tslint-config-prettier": "1.18.0", + "tslint-plugin-prettier": "2.0.1", + "tslint-react": "4.0.0", "typeface-roboto": "0.0.54", + "typescript": "3.4.5", + "typescript-tslint-plugin": "0.3.1", "url-loader": "1.1.2", "verdaccio": "4.0.0-alpha.7", "verdaccio-auth-memory": "0.0.4", @@ -107,6 +118,7 @@ "verdaccio-theme" ], "scripts": { + "tslint": "tslint --project . --format verbose", "flow": "flow check", "release": "standard-version -a -s", "test:clean": "npx jest --clearCache", diff --git a/src/config/env.js b/src/config/env.js index 8c9df6990..b488602b7 100644 --- a/src/config/env.js +++ b/src/config/env.js @@ -1,6 +1,5 @@ /** * @prettier - * @flow */ const path = require('path'); diff --git a/src/lib/constants.js b/src/lib/constants.ts similarity index 95% rename from src/lib/constants.js rename to src/lib/constants.ts index e34e0ecfc..b75b9fda8 100644 --- a/src/lib/constants.js +++ b/src/lib/constants.ts @@ -2,8 +2,6 @@ * @prettier */ -// @flow - export const DIST_TAGS = 'dist-tags'; export const HEADERS = { diff --git a/src/webui/components/CopyToClipBoard/index.js b/src/webui/components/CopyToClipBoard/CopyToClipBoard.tsx similarity index 74% rename from src/webui/components/CopyToClipBoard/index.js rename to src/webui/components/CopyToClipBoard/CopyToClipBoard.tsx index e127c4718..2f59e7139 100644 --- a/src/webui/components/CopyToClipBoard/index.js +++ b/src/webui/components/CopyToClipBoard/CopyToClipBoard.tsx @@ -1,29 +1,27 @@ /** * @prettier - * @flow */ -import React from 'react'; -import type { Node } from 'react'; - +import Tooltip from '@material-ui/core/Tooltip'; import FileCopy from '@material-ui/icons/FileCopy'; -import Tooltip from '@material-ui/core/Tooltip/index'; +import React from 'react'; -import { ClipBoardCopy, ClipBoardCopyText, CopyIcon } from './styles'; import { copyToClipBoardUtility } from '../../utils/cli-utils'; import { TEXT } from '../../utils/constants'; + +import { ClipBoardCopy, ClipBoardCopyText, CopyIcon } from './styles'; import { IProps } from './types'; -const CopyToClipBoard = ({ text, children }: IProps): Node => { +const CopyToClipBoard: React.FC = ({ text, children }) => { const renderToolTipFileCopy = () => ( - + ); - const renderText = children => { + const renderText = (children: any) => { if (children) { return {children}; } diff --git a/src/webui/components/CopyToClipBoard/index.ts b/src/webui/components/CopyToClipBoard/index.ts new file mode 100644 index 000000000..ad86d77c4 --- /dev/null +++ b/src/webui/components/CopyToClipBoard/index.ts @@ -0,0 +1 @@ +export { default } from './CopyToClipBoard' diff --git a/src/webui/components/CopyToClipBoard/styles.js b/src/webui/components/CopyToClipBoard/styles.ts similarity index 70% rename from src/webui/components/CopyToClipBoard/styles.js rename to src/webui/components/CopyToClipBoard/styles.ts index d18f1662a..8efd1b8a8 100644 --- a/src/webui/components/CopyToClipBoard/styles.js +++ b/src/webui/components/CopyToClipBoard/styles.ts @@ -1,7 +1,7 @@ +import IconButton from '@material-ui/core/IconButton'; import styled from 'react-emotion'; -import IconButton from '@material-ui/core/IconButton/index'; -export const ClipBoardCopy = styled.div` +export const ClipBoardCopy = styled('div')` && { display: flex; align-items: center; @@ -9,7 +9,7 @@ export const ClipBoardCopy = styled.div` } `; -export const ClipBoardCopyText = styled.span` +export const ClipBoardCopyText = styled('span')` && { display: inline-block; text-overflow: ellipsis; diff --git a/src/webui/components/CopyToClipBoard/types.js b/src/webui/components/CopyToClipBoard/types.ts similarity index 90% rename from src/webui/components/CopyToClipBoard/types.js rename to src/webui/components/CopyToClipBoard/types.ts index 36edbedf8..38308f0f0 100644 --- a/src/webui/components/CopyToClipBoard/types.js +++ b/src/webui/components/CopyToClipBoard/types.ts @@ -1,6 +1,5 @@ /** * @prettier - * @flow */ export interface IProps { diff --git a/src/webui/components/Help/Help.tsx b/src/webui/components/Help/Help.tsx new file mode 100644 index 000000000..15ca1c87f --- /dev/null +++ b/src/webui/components/Help/Help.tsx @@ -0,0 +1,50 @@ +/** + * @prettier + */ + +import Button from '@material-ui/core/Button'; +import CardActions from '@material-ui/core/CardActions'; +import CardContent from '@material-ui/core/CardContent'; +import Typography from '@material-ui/core/Typography'; +import React from 'react'; + +import { getRegistryURL } from '../../utils/url'; +import CopyToClipBoard from '../CopyToClipBoard'; + +import { CardStyled as Card, HelpTitle } from './styles'; + +function renderHeadingClipboardSegments(title: string, text: string) { + return ( + <> + {title} + + + ); +} + +const Help: React.FC = () => { + const registryUrl = getRegistryURL(); + + return ( + + + + No Package Published Yet. + + + To publish your first package just: + + {renderHeadingClipboardSegments('1. Login', `npm adduser --registry ${registryUrl}`)} + {renderHeadingClipboardSegments('2. Publish', `npm publish --registry ${registryUrl}`)} + 3. Refresh this page. + + + + + + ); +}; + +export default Help; diff --git a/src/webui/components/Help/index.js b/src/webui/components/Help/index.js deleted file mode 100644 index d5531359e..000000000 --- a/src/webui/components/Help/index.js +++ /dev/null @@ -1,51 +0,0 @@ -/** - * @prettier - * @flow - */ - -import React, { Fragment } from 'react'; -import type { Node } from 'react'; -import CardActions from '@material-ui/core/CardActions/index'; -import CardContent from '@material-ui/core/CardContent/index'; -import Button from '@material-ui/core/Button/index'; -import Typography from '@material-ui/core/Typography/index'; - -import CopyToClipBoard from '../CopyToClipBoard/index'; -import { getRegistryURL } from '../../utils/url'; -import { CardStyled as Card, HelpTitle } from './styles'; - -function renderHeadingClipboardSegments(title: string, text: string): Node { - return ( - - {title} - - - ); -} - -const Help = (): Node => { - const registryUrl = getRegistryURL(); - - return ( - - - - {'No Package Published Yet.'} - - - {'To publish your first package just:'} - - {renderHeadingClipboardSegments('1. Login', `npm adduser --registry ${registryUrl}`)} - {renderHeadingClipboardSegments('2. Publish', `npm publish --registry ${registryUrl}`)} - {'3. Refresh this page.'} - - - - - - ); -}; - -export default Help; diff --git a/src/webui/components/Help/index.ts b/src/webui/components/Help/index.ts new file mode 100644 index 000000000..b14823f5a --- /dev/null +++ b/src/webui/components/Help/index.ts @@ -0,0 +1 @@ +export { default } from './Help' diff --git a/src/webui/components/Help/styles.js b/src/webui/components/Help/styles.ts similarity index 68% rename from src/webui/components/Help/styles.js rename to src/webui/components/Help/styles.ts index aa1868d43..9090575d1 100644 --- a/src/webui/components/Help/styles.js +++ b/src/webui/components/Help/styles.ts @@ -3,9 +3,9 @@ * @flow */ +import Card from '@material-ui/core/Card'; +import Typography from '@material-ui/core/Typography'; import styled from 'react-emotion'; -import Card from '@material-ui/core/Card/index'; -import Typography from '@material-ui/core/Typography/index'; export const CardStyled = styled(Card)` && { diff --git a/src/webui/components/Install/index.js b/src/webui/components/Install/Install.tsx similarity index 75% rename from src/webui/components/Install/index.js rename to src/webui/components/Install/Install.tsx index e28d1f518..9a8ebef3b 100644 --- a/src/webui/components/Install/index.js +++ b/src/webui/components/Install/Install.tsx @@ -2,32 +2,36 @@ * @prettier */ +import List from '@material-ui/core/List'; +import ListItemText from '@material-ui/core/ListItemText'; import React, { Component } from 'react'; -import List from '@material-ui/core/List/index'; -import ListItemText from '@material-ui/core/ListItemText/index'; - -import { DetailContextConsumer } from '../../pages/version/index'; +// @ts-ignore +import { DetailContextConsumer } from '../../pages/version'; import CopyToClipBoard from '../CopyToClipBoard'; -import { Heading, InstallItem, PackageMangerAvatar } from './styles'; // logos of package managers +//@ts-ignore // TODO: add svg type import npm from './img/npm.svg'; +//@ts-ignore // TODO: add svg type import pnpm from './img/pnpm.svg'; +//@ts-ignore // TODO: add svg type import yarn from './img/yarn.svg'; +import { Heading, InstallItem, PackageMangerAvatar } from './styles'; + class Install extends Component { - render() { + public render() { return ( - {context => { + {(context: any) => { return this.renderCopyCLI(context); }} ); } - renderCopyCLI = ({ packageName }) => { + public renderCopyCLI = ({ packageName }: { packageName: string }) => { return ( <> {'Installation'}}>{this.renderListItems(packageName)} @@ -35,7 +39,7 @@ class Install extends Component { ); }; - renderListItems = packageName => { + public renderListItems = (packageName: string) => { return ( <> diff --git a/src/webui/components/Install/index.ts b/src/webui/components/Install/index.ts new file mode 100644 index 000000000..6396cadf3 --- /dev/null +++ b/src/webui/components/Install/index.ts @@ -0,0 +1 @@ +export { default } from './Install' diff --git a/src/webui/components/Install/styles.js b/src/webui/components/Install/styles.ts similarity index 65% rename from src/webui/components/Install/styles.js rename to src/webui/components/Install/styles.ts index 654368d1b..e0c684828 100644 --- a/src/webui/components/Install/styles.js +++ b/src/webui/components/Install/styles.ts @@ -1,12 +1,11 @@ /** * @prettier - * @flow */ +import Avatar from '@material-ui/core/Avatar'; +import ListItem from '@material-ui/core/ListItem'; +import Typography from '@material-ui/core/Typography'; import styled from 'react-emotion'; -import Typography from '@material-ui/core/Typography/index'; -import ListItem from '@material-ui/core/ListItem/index'; -import Avatar from '@material-ui/core/Avatar/index'; export const Heading = styled(Typography)` && { diff --git a/src/webui/utils/cli-utils.js b/src/webui/utils/cli-utils.ts similarity index 89% rename from src/webui/utils/cli-utils.js rename to src/webui/utils/cli-utils.ts index 4429c05fc..05b20f174 100644 --- a/src/webui/utils/cli-utils.js +++ b/src/webui/utils/cli-utils.ts @@ -1,8 +1,9 @@ /** * @prettier - * @flow */ +import { SyntheticEvent } from 'react'; + export const copyToClipBoardUtility = (str: string) => (event: SyntheticEvent) => { event.preventDefault(); const node = document.createElement('div'); @@ -12,10 +13,9 @@ export const copyToClipBoardUtility = (str: string) => (event: SyntheticEvent=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdi dependencies: minimist "0.0.8" +mock-require@^3.0.2: + version "3.0.3" + resolved "https://registry.npmjs.org/mock-require/-/mock-require-3.0.3.tgz#ccd544d9eae81dd576b3f219f69ec867318a1946" + integrity sha512-lLzfLHcyc10MKQnNUCv7dMcoY/2Qxd6wJfbqCcVk3LDb8An4hF6ohk5AztrvgKhJCqj36uyzi/p5se+tvyD+Wg== + dependencies: + get-caller-file "^1.0.2" + normalize-path "^2.1.1" + modify-values@^1.0.0: version "1.0.1" resolved "https://registry.npmjs.org/modify-values/-/modify-values-1.0.1.tgz#b3939fa605546474e3e3e3c63d64bd43b4ee6022" @@ -11603,7 +11674,7 @@ selfsigned@^1.9.1: dependencies: node-forge "0.7.5" -"semver@2 || 3 || 4 || 5", semver@^5.1.0, semver@^5.3.0, semver@^5.4.1, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0: +"semver@2 || 3 || 4 || 5", semver@^5.0.1, semver@^5.1.0, semver@^5.3.0, semver@^5.4.1, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0: version "5.7.0" resolved "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz#790a7cf6fea5459bac96110b29b60412dc8ff96b" integrity sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA== @@ -12795,11 +12866,76 @@ tryer@^1.0.0: resolved "https://registry.npmjs.org/tryer/-/tryer-1.0.1.tgz#f2c85406800b9b0f74c9f7465b81eaad241252f8" integrity sha512-c3zayb8/kWWpycWYg87P71E1S1ZL6b6IJxfb5fvsUgsf0S2MVGaDhDXXjDMpdCpfWXqptc+4mXwmiy1ypXqRAA== -tslib@^1.9.0: +ts-loader@5.4.5: + version "5.4.5" + resolved "https://registry.npmjs.org/ts-loader/-/ts-loader-5.4.5.tgz#a0c1f034b017a9344cef0961bfd97cc192492b8b" + integrity sha512-XYsjfnRQCBum9AMRZpk2rTYSVpdZBpZK+kDh0TeT3kxmQNBDVIeUjdPjY5RZry4eIAb8XHc4gYSUiUWPYvzSRw== + dependencies: + chalk "^2.3.0" + enhanced-resolve "^4.0.0" + loader-utils "^1.0.2" + micromatch "^3.1.4" + semver "^5.0.1" + +tslib@^1.7.1, tslib@^1.8.0, tslib@^1.8.1, tslib@^1.9.0: version "1.9.3" resolved "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286" integrity sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ== +tslint-config-prettier@1.18.0: + version "1.18.0" + resolved "https://registry.npmjs.org/tslint-config-prettier/-/tslint-config-prettier-1.18.0.tgz#75f140bde947d35d8f0d238e0ebf809d64592c37" + integrity sha512-xPw9PgNPLG3iKRxmK7DWr+Ea/SzrvfHtjFt5LBl61gk2UBG/DB9kCXRjv+xyIU1rUtnayLeMUVJBcMX8Z17nDg== + +tslint-plugin-prettier@2.0.1: + version "2.0.1" + resolved "https://registry.npmjs.org/tslint-plugin-prettier/-/tslint-plugin-prettier-2.0.1.tgz#95b6a3b766622ffc44375825d7760225c50c3680" + integrity sha512-4FX9JIx/1rKHIPJNfMb+ooX1gPk5Vg3vNi7+dyFYpLO+O57F4g+b/fo1+W/G0SUOkBLHB/YKScxjX/P+7ZT/Tw== + dependencies: + eslint-plugin-prettier "^2.2.0" + lines-and-columns "^1.1.6" + tslib "^1.7.1" + +tslint-react@4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/tslint-react/-/tslint-react-4.0.0.tgz#b4bb4c01c32448cb14d23f143a2f5e4989bb961e" + integrity sha512-9fNE0fm9zNDx1+b6hgy8rgDN2WsQLRiIrn3+fbqm0tazBVF6jiaCFAITxmU+WSFWYE03Xhp1joCircXOe1WVAQ== + dependencies: + tsutils "^3.9.1" + +tslint@5.16.0: + version "5.16.0" + resolved "https://registry.npmjs.org/tslint/-/tslint-5.16.0.tgz#ae61f9c5a98d295b9a4f4553b1b1e831c1984d67" + integrity sha512-UxG2yNxJ5pgGwmMzPMYh/CCnCnh0HfPgtlVRDs1ykZklufFBL1ZoTlWFRz2NQjcoEiDoRp+JyT0lhBbbH/obyA== + dependencies: + "@babel/code-frame" "^7.0.0" + builtin-modules "^1.1.1" + chalk "^2.3.0" + commander "^2.12.1" + diff "^3.2.0" + glob "^7.1.1" + js-yaml "^3.13.0" + minimatch "^3.0.4" + mkdirp "^0.5.1" + resolve "^1.3.2" + semver "^5.3.0" + tslib "^1.8.0" + tsutils "^2.29.0" + +tsutils@^2.29.0: + version "2.29.0" + resolved "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz#32b488501467acbedd4b85498673a0812aca0b99" + integrity sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA== + dependencies: + tslib "^1.8.1" + +tsutils@^3.9.1: + version "3.10.0" + resolved "https://registry.npmjs.org/tsutils/-/tsutils-3.10.0.tgz#6f1c95c94606e098592b0dff06590cf9659227d6" + integrity sha512-q20XSMq7jutbGB8luhKKsQldRKWvyBO2BGqni3p4yq8Ys9bEP/xQw3KepKmMRt9gJ4lvQSScrihJrcKdKoSU7Q== + dependencies: + tslib "^1.8.1" + tty-browserify@0.0.0: version "0.0.0" resolved "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz#a157ba402da24e9bf957f9aa69d524eed42901a6" @@ -12842,6 +12978,20 @@ typeface-roboto@0.0.54: resolved "https://registry.npmjs.org/typeface-roboto/-/typeface-roboto-0.0.54.tgz#8f02c9a18d1cfa7f49381a6ff0d21ff061f38ad2" integrity sha512-sOFA1FXgP0gOgBYlS6irwq6hHYA370KE3dPlgYEJHL3PJd5X8gQE0RmL79ONif6fL5JZuGDj+rtOrFeOqz5IZQ== +typescript-tslint-plugin@0.3.1: + version "0.3.1" + resolved "https://registry.npmjs.org/typescript-tslint-plugin/-/typescript-tslint-plugin-0.3.1.tgz#d86ae0342c9e8f9ecfcbcc47f7a7c2b5ab0e86f9" + integrity sha512-h8HEPBm36UEs901ld1x6m5eY/UFb4mF+A0nvERr4BWMww5wnV5nfcm9ZFt18foYL0GQ5NVMt1Tb3466WUU8dRQ== + dependencies: + minimatch "^3.0.4" + mock-require "^3.0.2" + vscode-languageserver "^5.1.0" + +typescript@3.4.5: + version "3.4.5" + resolved "https://registry.npmjs.org/typescript/-/typescript-3.4.5.tgz#2d2618d10bb566572b8d7aad5180d84257d70a99" + integrity sha512-YycBxUb49UUhdNMU5aJ7z5Ej2XGmaIBL0x34vZ82fn3hGvD+bgrMrVDpatgz2f7YxUMJxMkbWxJZeAvDxVe7Vw== + ua-parser-js@^0.7.18: version "0.7.19" resolved "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.19.tgz#94151be4c0a7fb1d001af7022fdaca4642659e4b" @@ -13282,6 +13432,37 @@ vm-browserify@0.0.4: dependencies: indexof "0.0.1" +vscode-jsonrpc@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-4.0.0.tgz#a7bf74ef3254d0a0c272fab15c82128e378b3be9" + integrity sha512-perEnXQdQOJMTDFNv+UF3h1Y0z4iSiaN9jIlb0OqIYgosPCZGYh/MCUlkFtV2668PL69lRDO32hmvL2yiidUYg== + +vscode-languageserver-protocol@3.14.1: + version "3.14.1" + resolved "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.14.1.tgz#b8aab6afae2849c84a8983d39a1cf742417afe2f" + integrity sha512-IL66BLb2g20uIKog5Y2dQ0IiigW0XKrvmWiOvc0yXw80z3tMEzEnHjaGAb3ENuU7MnQqgnYJ1Cl2l9RvNgDi4g== + dependencies: + vscode-jsonrpc "^4.0.0" + vscode-languageserver-types "3.14.0" + +vscode-languageserver-types@3.14.0: + version "3.14.0" + resolved "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.14.0.tgz#d3b5952246d30e5241592b6dde8280e03942e743" + integrity sha512-lTmS6AlAlMHOvPQemVwo3CezxBp0sNB95KNPkqp3Nxd5VFEnuG1ByM0zlRWos0zjO3ZWtkvhal0COgiV1xIA4A== + +vscode-languageserver@^5.1.0: + version "5.2.1" + resolved "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-5.2.1.tgz#0d2feddd33f92aadf5da32450df498d52f6f14eb" + integrity sha512-GuayqdKZqAwwaCUjDvMTAVRPJOp/SLON3mJ07eGsx/Iq9HjRymhKWztX41rISqDKhHVVyFM+IywICyZDla6U3A== + dependencies: + vscode-languageserver-protocol "3.14.1" + vscode-uri "^1.0.6" + +vscode-uri@^1.0.6: + version "1.0.6" + resolved "https://registry.npmjs.org/vscode-uri/-/vscode-uri-1.0.6.tgz#6b8f141b0bbc44ad7b07e94f82f168ac7608ad4d" + integrity sha512-sLI2L0uGov3wKVb9EB+vIQBl9tVP90nqRvxSoJ35vI3NjxE8jfsE5DSOhWgSunHSZmKS4OCi2jrtfxK7uyp2ww== + w3c-hr-time@^1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.1.tgz#82ac2bff63d950ea9e3189a58a65625fedf19045" From 66632aca70d2359eac18e5fcdef58afdb25b4593 Mon Sep 17 00:00:00 2001 From: Priscila Oliveira Date: Sat, 4 May 2019 00:26:06 +0200 Subject: [PATCH 02/56] refactor: migrating to typescript --- package.json | 1 + .../components/Logo/{index.js => Logo.ts} | 6 ++-- src/webui/components/Logo/index.ts | 1 + .../NotFound/{index.js => NotFound.tsx} | 30 ++++++++++--------- src/webui/components/NotFound/index.ts | 1 + .../NotFound/{styles.js => styles.ts} | 7 ++--- .../Spinner/{index.js => Spinner.tsx} | 7 ++--- src/webui/components/Spinner/index.tsx | 1 + .../Spinner/{styles.js => styles.ts} | 7 +++-- .../components/Spinner/{types.js => types.ts} | 1 - .../components/Tag/{index.js => Tag.tsx} | 6 ++-- src/webui/components/Tag/index.ts | 1 + .../components/Tag/{styles.js => styles.ts} | 5 +--- .../components/Tag/{types.js => types.ts} | 2 -- .../TextField/{index.js => TextField.tsx} | 5 ++-- src/webui/components/TextField/index.ts | 1 + .../utils/styles/{colors.js => colors.ts} | 1 + .../utils/styles/{mixings.js => mixings.ts} | 1 - yarn.lock | 22 ++++++++++++++ 19 files changed, 64 insertions(+), 42 deletions(-) rename src/webui/components/Logo/{index.js => Logo.ts} (83%) create mode 100644 src/webui/components/Logo/index.ts rename src/webui/components/NotFound/{index.js => NotFound.tsx} (55%) create mode 100644 src/webui/components/NotFound/index.ts rename src/webui/components/NotFound/{styles.js => styles.ts} (75%) rename src/webui/components/Spinner/{index.js => Spinner.tsx} (54%) create mode 100644 src/webui/components/Spinner/index.tsx rename src/webui/components/Spinner/{styles.js => styles.ts} (89%) rename src/webui/components/Spinner/{types.js => types.ts} (90%) rename src/webui/components/Tag/{index.js => Tag.tsx} (51%) create mode 100644 src/webui/components/Tag/index.ts rename src/webui/components/Tag/{styles.js => styles.ts} (66%) rename src/webui/components/Tag/{types.js => types.ts} (60%) rename src/webui/components/TextField/{index.js => TextField.tsx} (58%) create mode 100644 src/webui/components/TextField/index.ts rename src/webui/utils/styles/{colors.js => colors.ts} (97%) rename src/webui/utils/styles/{mixings.js => mixings.ts} (99%) diff --git a/package.json b/package.json index 1d74d74a3..eb0b482d3 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "@types/node": "12.0.0", "@types/react": "16.8.15", "@types/react-dom": "16.8.4", + "@types/react-router-dom": "4.3.2", "@verdaccio/babel-preset": "0.1.0", "@verdaccio/types": "5.0.0-beta.4", "autosuggest-highlight": "3.1.1", diff --git a/src/webui/components/Logo/index.js b/src/webui/components/Logo/Logo.ts similarity index 83% rename from src/webui/components/Logo/index.js rename to src/webui/components/Logo/Logo.ts index 361afe60e..4a0be34af 100644 --- a/src/webui/components/Logo/index.js +++ b/src/webui/components/Logo/Logo.ts @@ -1,12 +1,13 @@ /** * @prettier - * @flow */ import styled, { css } from 'react-emotion'; + +// @ts-ignore import logo from './img/logo.svg'; -const Logo = styled.div` +const Logo = styled('div')` && { display: inline-block; vertical-align: middle; @@ -18,6 +19,7 @@ const Logo = styled.div` width: 40px; height: 40px; ${props => + // @ts-ignore props.md && css` width: 90px; diff --git a/src/webui/components/Logo/index.ts b/src/webui/components/Logo/index.ts new file mode 100644 index 000000000..93dce23b4 --- /dev/null +++ b/src/webui/components/Logo/index.ts @@ -0,0 +1 @@ +export { default } from './Logo' diff --git a/src/webui/components/NotFound/index.js b/src/webui/components/NotFound/NotFound.tsx similarity index 55% rename from src/webui/components/NotFound/index.js rename to src/webui/components/NotFound/NotFound.tsx index 39bf39542..fef0fc211 100644 --- a/src/webui/components/NotFound/index.js +++ b/src/webui/components/NotFound/NotFound.tsx @@ -2,19 +2,21 @@ * @prettier */ +import ListItem from '@material-ui/core/ListItem'; +import Typography from '@material-ui/core/Typography'; +import withWidth, { isWidthUp } from '@material-ui/core/withWidth'; import React from 'react'; -import { withRouter } from 'react-router-dom'; -import withWidth, { isWidthUp } from '@material-ui/core/withWidth/index'; -import ListItem from '@material-ui/core/ListItem/index'; -import Typography from '@material-ui/core/Typography/index'; -import { Wrapper, Inner, EmptyPackage, Heading, Card, List } from './styles'; +import { RouteComponentProps, withRouter } from 'react-router-dom'; + +// @ts-ignore import PackageImg from './img/package.svg'; +import { Card, EmptyPackage, Heading, Inner, List, Wrapper } from './styles'; export const NOT_FOUND_TEXT = "Sorry, we couldn't find it..."; // eslint-disable-next-line react/prop-types -const NotFound = ({ history, width }) => { - const handleGoTo = to => () => { +const NotFound: React.FC = ({ history, width }) => { + const handleGoTo = (to: string) => () => { history.push(to); }; @@ -24,17 +26,17 @@ const NotFound = ({ history, width }) => { const renderList = () => ( - - {'Home'} + + Home - - {'Back'} + + Back ); const renderSubTitle = () => ( - +
{"The page you're looking for doesn't exist."}
{'Perhaps these links will help find what you are looking for:'}
@@ -43,8 +45,8 @@ const NotFound = ({ history, width }) => { return ( - - + + {NOT_FOUND_TEXT} {renderSubTitle()} diff --git a/src/webui/components/NotFound/index.ts b/src/webui/components/NotFound/index.ts new file mode 100644 index 000000000..289321667 --- /dev/null +++ b/src/webui/components/NotFound/index.ts @@ -0,0 +1 @@ +export { default } from './NotFound' diff --git a/src/webui/components/NotFound/styles.js b/src/webui/components/NotFound/styles.ts similarity index 75% rename from src/webui/components/NotFound/styles.js rename to src/webui/components/NotFound/styles.ts index 818a43df3..390edff4d 100644 --- a/src/webui/components/NotFound/styles.js +++ b/src/webui/components/NotFound/styles.ts @@ -1,12 +1,11 @@ /** * @prettier - * @flow */ +import { default as MuiCard } from '@material-ui/core/Card'; +import { default as MuiList } from '@material-ui/core/List'; +import Typography from '@material-ui/core/Typography'; import styled from 'react-emotion'; -import Typography from '@material-ui/core/Typography/index'; -import { default as MuiList } from '@material-ui/core/List/index'; -import { default as MuiCard } from '@material-ui/core/Card/index'; export const Wrapper = styled('div')` display: flex; diff --git a/src/webui/components/Spinner/index.js b/src/webui/components/Spinner/Spinner.tsx similarity index 54% rename from src/webui/components/Spinner/index.js rename to src/webui/components/Spinner/Spinner.tsx index d7ba7de34..9efdb535f 100644 --- a/src/webui/components/Spinner/index.js +++ b/src/webui/components/Spinner/Spinner.tsx @@ -1,15 +1,14 @@ /** * @prettier - * @flow */ import React from 'react'; -import type { Node } from 'react'; +import { Circular, Wrapper } from './styles'; import { IProps } from './types'; -import { Wrapper, Circular } from './styles'; -const Spinner = ({ size = 50, centered = false }: IProps): Node => ( +const Spinner: React.FC = ({ size = 50, centered = false }) => ( + // @ts-ignore diff --git a/src/webui/components/Spinner/index.tsx b/src/webui/components/Spinner/index.tsx new file mode 100644 index 000000000..0be018841 --- /dev/null +++ b/src/webui/components/Spinner/index.tsx @@ -0,0 +1 @@ +export { default } from './Spinner' diff --git a/src/webui/components/Spinner/styles.js b/src/webui/components/Spinner/styles.ts similarity index 89% rename from src/webui/components/Spinner/styles.js rename to src/webui/components/Spinner/styles.ts index f219f5881..b31f625cd 100644 --- a/src/webui/components/Spinner/styles.js +++ b/src/webui/components/Spinner/styles.ts @@ -1,18 +1,19 @@ /** * @prettier - * @flow */ +import CircularProgress from '@material-ui/core/CircularProgress'; import styled, { css } from 'react-emotion'; -import CircularProgress from '@material-ui/core/CircularProgress/index'; + import colors from '../../utils/styles/colors'; -export const Wrapper = styled.div` +export const Wrapper = styled('div')` && { display: flex; align-items: center; justify-content: center; ${props => + // @ts-ignore props.centered && css` position: absolute; diff --git a/src/webui/components/Spinner/types.js b/src/webui/components/Spinner/types.ts similarity index 90% rename from src/webui/components/Spinner/types.js rename to src/webui/components/Spinner/types.ts index 1214420a5..0a34fe539 100644 --- a/src/webui/components/Spinner/types.js +++ b/src/webui/components/Spinner/types.ts @@ -1,6 +1,5 @@ /** * @prettier - * @flow */ export interface IProps { diff --git a/src/webui/components/Tag/index.js b/src/webui/components/Tag/Tag.tsx similarity index 51% rename from src/webui/components/Tag/index.js rename to src/webui/components/Tag/Tag.tsx index 359d5bdbb..d7a6b6d36 100644 --- a/src/webui/components/Tag/index.js +++ b/src/webui/components/Tag/Tag.tsx @@ -1,14 +1,12 @@ /** * @prettier - * @flow */ import React from 'react'; -import type { Element } from 'react'; -import { IProps } from './types'; import { Wrapper } from './styles'; +import { IProps } from './types'; -const Tag = ({ children }: IProps): Element => {children}; +const Tag: React.FC = ({ children }) => {children}; export default Tag; diff --git a/src/webui/components/Tag/index.ts b/src/webui/components/Tag/index.ts new file mode 100644 index 000000000..db996e4f6 --- /dev/null +++ b/src/webui/components/Tag/index.ts @@ -0,0 +1 @@ +export { default } from './Tag' diff --git a/src/webui/components/Tag/styles.js b/src/webui/components/Tag/styles.ts similarity index 66% rename from src/webui/components/Tag/styles.js rename to src/webui/components/Tag/styles.ts index cd624ed7e..eb12ba8c4 100644 --- a/src/webui/components/Tag/styles.js +++ b/src/webui/components/Tag/styles.ts @@ -1,12 +1,10 @@ /** * @prettier - * @flow */ import styled from 'react-emotion'; -import { ellipsis } from '../../utils/styles/mixings'; -export const Wrapper = styled.span` +export const Wrapper = styled('span')` && { vertical-align: middle; line-height: 22px; @@ -15,6 +13,5 @@ export const Wrapper = styled.span` background-color: #f3f4f2; padding: 0.22rem 0.4rem; margin: 8px 8px 0 0; - ${ellipsis('300px')}; } `; diff --git a/src/webui/components/Tag/types.js b/src/webui/components/Tag/types.ts similarity index 60% rename from src/webui/components/Tag/types.js rename to src/webui/components/Tag/types.ts index b8ccd4136..9bcc5ae2c 100644 --- a/src/webui/components/Tag/types.js +++ b/src/webui/components/Tag/types.ts @@ -1,8 +1,6 @@ /** * @prettier - * @flow */ -import type { Node } from 'react'; export interface IProps { children: Node; diff --git a/src/webui/components/TextField/index.js b/src/webui/components/TextField/TextField.tsx similarity index 58% rename from src/webui/components/TextField/index.js rename to src/webui/components/TextField/TextField.tsx index 9be032103..6d0af841c 100644 --- a/src/webui/components/TextField/index.js +++ b/src/webui/components/TextField/TextField.tsx @@ -1,12 +1,11 @@ /** * @prettier - * @flow */ +import { default as TextFieldMaterialUI, TextFieldProps } from '@material-ui/core/TextField'; import React from 'react'; -import { TextFieldProps, default as TextFieldMaterialUI } from '@material-ui/core/TextField'; -const TextField = ({ InputProps, classes, ...other }: TextFieldProps) => ( +const TextField: React.FC = ({ InputProps, classes, ...other }) => ( Date: Sat, 4 May 2019 14:28:56 +0200 Subject: [PATCH 03/56] refactor: applied feedbacks --- .babelrc | 2 +- package.json | 5 ++-- tools/webpack.config.js | 2 +- tsconfig.json | 40 ++++++++++--------------- tslint.json | 66 ----------------------------------------- yarn.lock | 57 ++++------------------------------- 6 files changed, 24 insertions(+), 148 deletions(-) delete mode 100644 tslint.json diff --git a/.babelrc b/.babelrc index dfb8d742d..9b4e2143f 100644 --- a/.babelrc +++ b/.babelrc @@ -1,3 +1,3 @@ { - "presets": [["@verdaccio", { "flow": true }]] + "presets": [["@verdaccio", {"typescript": true}]] } diff --git a/package.json b/package.json index eb0b482d3..130a5c44d 100644 --- a/package.json +++ b/package.json @@ -93,8 +93,6 @@ "stylelint-scss": "3.5.4", "stylelint-webpack-plugin": "0.10.5", "supertest": "3.4.2", - "ts-loader": "5.4.5", - "tslint": "5.16.0", "tslint-config-prettier": "1.18.0", "tslint-plugin-prettier": "2.0.1", "tslint-react": "4.0.0", @@ -119,7 +117,8 @@ "verdaccio-theme" ], "scripts": { - "tslint": "tslint --project . --format verbose", + "type-check": "tsc --noEmit", + "type-check:watch": "npm run type-check -- --watch", "flow": "flow check", "release": "standard-version -a -s", "test:clean": "npx jest --clearCache", diff --git a/tools/webpack.config.js b/tools/webpack.config.js index 7e98782ab..7dd101dc4 100644 --- a/tools/webpack.config.js +++ b/tools/webpack.config.js @@ -89,7 +89,7 @@ module.exports = { }, { test: /\.tsx?$/, - use: 'ts-loader', + use: 'babel-loader', exclude: /node_modules/ } ], diff --git a/tsconfig.json b/tsconfig.json index 4171dd5a1..b5f583f53 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,34 +1,24 @@ { "compilerOptions": { - "plugins": [{ "name": "typescript-tslint-plugin" }], - "types": ["react"], - - "resolveJsonModule": true, - "skipLibCheck": true, - "diagnostics": true, - "lib": ["dom", "es2018", "esnext"], - "target": "es2017", - "module": "es2015", - "moduleResolution": "node", - "esModuleInterop": true, - "noEmit": false, - "sourceMap": true, - "jsx": "react", - "allowJs": false, - "checkJs": false, + "target": "esnext", + "module": "commonjs", + "declaration": true, + "noImplicitAny": false, "strict": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - - "baseUrl": "." + "outDir": "lib", + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + "typeRoots": [ + "./node_modules/@verdaccio/types/lib/verdaccio", + "./node_modules/@types" + ] }, + "include": [ + "src/*.ts", + "types/*.d.ts" + ], "exclude": [ "node_modules", - "flow-typed", - "scripts" ] } \ No newline at end of file diff --git a/tslint.json b/tslint.json deleted file mode 100644 index 247e9526e..000000000 --- a/tslint.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "defaultSeverity": "error", - "extends": [ - "tslint:latest", - "tslint-react", - "tslint-plugin-prettier", - "tslint-config-prettier" - ], - "rules": { - "prettier": true, - - "enum-prefixed-screaming-snake-case": true, - - // https://palantir.github.io/tslint/rules/ - // TypeScript-specific - "no-unnecessary-type-assertion": true, - "promise-function-async": { "severity": "warning" }, - - // Functionality - "await-promise": [true, "PromiseLike", "Bluebird"], - "curly": [true, "ignore-same-line"], - "no-console": { "severity": "warning" }, - "no-empty": [true, "allow-empty-catch", "allow-empty-functions"], - "no-floating-promises": true, - "no-for-in-array": true, - "no-shadowed-variable": { "severity": "warning" }, - "no-this-assignment": [true, { "allow-destructuring": true }], - "prefer-object-spread": true, - "no-namespace": [true, "allow-declarations"], - - // Maintainability - "max-classes-per-file": false, - "object-literal-sort-keys": false, - - // Style - "array-type": [true, "generic"], - "arrow-return-shorthand": true, - "interface-name": [true, "never-prefix"], - "no-angle-bracket-type-assertion": true, - "no-redundant-jsdoc": { "severity": "warning" }, - "no-unnecessary-callback-wrapper": true, - "object-literal-key-quotes": [true, "as-needed"], - "object-literal-shorthand": true, - "ordered-imports": [true, { "grouped-imports": true }], - "variable-name": [true, "ban-keywords", "check-format", "allow-leading-underscore", "allow-pascal-case"], - - // https://github.com/palantir/tslint-react#rules - // TODO: evaluate jsx-use-translation-function - "jsx-boolean-value": [true, "never"], - "jsx-no-lambda": false, - "jsx-no-multiline-js": false, - - // https://github.com/ajafff/tslint-consistent-codestyle#rules - "early-exit": { "severity": "warning" }, - "no-unnecessary-else": { "severity": "warning" }, - - // https://github.com/SonarSource/SonarTS - "no-dead-store": true, - "no-use-of-empty-return-value": true, - "no-ignored-return": true, - "prefer-optional": true - }, - "linterOptions": { - "exclude": ["**/*.js"] - } - } diff --git a/yarn.lock b/yarn.lock index f06586c9f..d4e358b47 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2948,11 +2948,6 @@ buffer@^4.3.0: ieee754 "^1.1.4" isarray "^1.0.0" -builtin-modules@^1.1.1: - version "1.1.1" - resolved "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" - integrity sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8= - builtin-status-codes@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz#85982878e21b98e1c66425e03d0174788f569ee8" @@ -3172,7 +3167,7 @@ chalk@2.3.1: escape-string-regexp "^1.0.5" supports-color "^5.2.0" -chalk@2.4.2, chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.3.0, chalk@^2.4.1, chalk@^2.4.2: +chalk@2.4.2, chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.4.1, chalk@^2.4.2: version "2.4.2" resolved "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== @@ -3505,7 +3500,7 @@ commander@2.17.x: resolved "https://registry.npmjs.org/commander/-/commander-2.17.1.tgz#bd77ab7de6de94205ceacc72f1716d29f20a77bf" integrity sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg== -commander@2.20.0, commander@^2.11.0, commander@^2.12.1, commander@^2.18.0, commander@^2.19.0, commander@^2.8.1, commander@^2.9.0: +commander@2.20.0, commander@^2.11.0, commander@^2.18.0, commander@^2.19.0, commander@^2.8.1, commander@^2.9.0: version "2.20.0" resolved "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz#d58bb2b5c1ee8f87b0d340027e9e94e222c5a422" integrity sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ== @@ -4541,11 +4536,6 @@ diff-sequences@^24.3.0: resolved "https://registry.npmjs.org/diff-sequences/-/diff-sequences-24.3.0.tgz#0f20e8a1df1abddaf4d9c226680952e64118b975" integrity sha512-xLqpez+Zj9GKSnPWS0WZw1igGocZ+uua8+y+5dDNTT934N3QuY1sp2LkHzwiaYQGz60hMq0pjAshdeXm5VUOEw== -diff@^3.2.0: - version "3.5.0" - resolved "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz#800c0dd1e0a8bfbc95835c202ad220fe317e5a12" - integrity sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA== - diffie-hellman@^5.0.0: version "5.0.3" resolved "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz#40e8ee98f55a2149607146921c63e1ae5f3d2875" @@ -4800,7 +4790,7 @@ end-of-stream@^1.0.0, end-of-stream@^1.1.0: dependencies: once "^1.4.0" -enhanced-resolve@^4.0.0, enhanced-resolve@^4.1.0: +enhanced-resolve@^4.1.0: version "4.1.0" resolved "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-4.1.0.tgz#41c7e0bfdfe74ac1ffe1e57ad6a5c6c9f3742a7f" integrity sha512-F/7vkyTtyc/llOIn8oWclcB25KdRaiPBpZYDgJHgh/UHtpgT2p2eldQgtQnLtUvfMKPKxbRaQM/hHkvLHt1Vng== @@ -11696,7 +11686,7 @@ selfsigned@^1.9.1: dependencies: node-forge "0.7.5" -"semver@2 || 3 || 4 || 5", semver@^5.0.1, semver@^5.1.0, semver@^5.3.0, semver@^5.4.1, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0: +"semver@2 || 3 || 4 || 5", semver@^5.1.0, semver@^5.3.0, semver@^5.4.1, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0: version "5.7.0" resolved "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz#790a7cf6fea5459bac96110b29b60412dc8ff96b" integrity sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA== @@ -12888,18 +12878,7 @@ tryer@^1.0.0: resolved "https://registry.npmjs.org/tryer/-/tryer-1.0.1.tgz#f2c85406800b9b0f74c9f7465b81eaad241252f8" integrity sha512-c3zayb8/kWWpycWYg87P71E1S1ZL6b6IJxfb5fvsUgsf0S2MVGaDhDXXjDMpdCpfWXqptc+4mXwmiy1ypXqRAA== -ts-loader@5.4.5: - version "5.4.5" - resolved "https://registry.npmjs.org/ts-loader/-/ts-loader-5.4.5.tgz#a0c1f034b017a9344cef0961bfd97cc192492b8b" - integrity sha512-XYsjfnRQCBum9AMRZpk2rTYSVpdZBpZK+kDh0TeT3kxmQNBDVIeUjdPjY5RZry4eIAb8XHc4gYSUiUWPYvzSRw== - dependencies: - chalk "^2.3.0" - enhanced-resolve "^4.0.0" - loader-utils "^1.0.2" - micromatch "^3.1.4" - semver "^5.0.1" - -tslib@^1.7.1, tslib@^1.8.0, tslib@^1.8.1, tslib@^1.9.0: +tslib@^1.7.1, tslib@^1.8.1, tslib@^1.9.0: version "1.9.3" resolved "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286" integrity sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ== @@ -12925,32 +12904,6 @@ tslint-react@4.0.0: dependencies: tsutils "^3.9.1" -tslint@5.16.0: - version "5.16.0" - resolved "https://registry.npmjs.org/tslint/-/tslint-5.16.0.tgz#ae61f9c5a98d295b9a4f4553b1b1e831c1984d67" - integrity sha512-UxG2yNxJ5pgGwmMzPMYh/CCnCnh0HfPgtlVRDs1ykZklufFBL1ZoTlWFRz2NQjcoEiDoRp+JyT0lhBbbH/obyA== - dependencies: - "@babel/code-frame" "^7.0.0" - builtin-modules "^1.1.1" - chalk "^2.3.0" - commander "^2.12.1" - diff "^3.2.0" - glob "^7.1.1" - js-yaml "^3.13.0" - minimatch "^3.0.4" - mkdirp "^0.5.1" - resolve "^1.3.2" - semver "^5.3.0" - tslib "^1.8.0" - tsutils "^2.29.0" - -tsutils@^2.29.0: - version "2.29.0" - resolved "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz#32b488501467acbedd4b85498673a0812aca0b99" - integrity sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA== - dependencies: - tslib "^1.8.1" - tsutils@^3.9.1: version "3.10.0" resolved "https://registry.npmjs.org/tsutils/-/tsutils-3.10.0.tgz#6f1c95c94606e098592b0dff06590cf9659227d6" From c225d77bd2018c2d798b505fa6c7c832a9496c82 Mon Sep 17 00:00:00 2001 From: Priscila Oliveira Date: Sat, 4 May 2019 15:02:54 +0200 Subject: [PATCH 04/56] fix: fixed conflicts --- package.json | 2 +- tsconfig.json | 1 + yarn.lock | 8 ++++---- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 130a5c44d..854138cae 100644 --- a/package.json +++ b/package.json @@ -97,7 +97,7 @@ "tslint-plugin-prettier": "2.0.1", "tslint-react": "4.0.0", "typeface-roboto": "0.0.54", - "typescript": "3.4.5", + "typescript": "3.2.1", "typescript-tslint-plugin": "0.3.1", "url-loader": "1.1.2", "verdaccio": "4.0.0-alpha.7", diff --git a/tsconfig.json b/tsconfig.json index b5f583f53..afe2b2fb6 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -21,4 +21,5 @@ "node_modules", ] } + \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index d4e358b47..4fcee6ec6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12962,10 +12962,10 @@ typescript-tslint-plugin@0.3.1: mock-require "^3.0.2" vscode-languageserver "^5.1.0" -typescript@3.4.5: - version "3.4.5" - resolved "https://registry.npmjs.org/typescript/-/typescript-3.4.5.tgz#2d2618d10bb566572b8d7aad5180d84257d70a99" - integrity sha512-YycBxUb49UUhdNMU5aJ7z5Ej2XGmaIBL0x34vZ82fn3hGvD+bgrMrVDpatgz2f7YxUMJxMkbWxJZeAvDxVe7Vw== +typescript@3.2.1: + version "3.2.1" + resolved "https://registry.npmjs.org/typescript/-/typescript-3.2.1.tgz#0b7a04b8cf3868188de914d9568bd030f0c56192" + integrity sha512-jw7P2z/h6aPT4AENXDGjcfHTu5CSqzsbZc6YlUIebTyBAq8XaKp78x7VcSh30xwSCcsu5irZkYZUSFP1MrAMbg== ua-parser-js@^0.7.18: version "0.7.19" From 8ee20c6733f29a8e5f84f19bd764024417ffed7b Mon Sep 17 00:00:00 2001 From: Priscila Oliveira Date: Sat, 4 May 2019 15:16:50 +0200 Subject: [PATCH 05/56] refactored: changed registry --- package.json | 4 ++-- yarn.lock | 68 ++++++++++++++++++++++++---------------------------- 2 files changed, 33 insertions(+), 39 deletions(-) diff --git a/package.json b/package.json index 854138cae..b6312d236 100644 --- a/package.json +++ b/package.json @@ -13,12 +13,12 @@ "devDependencies": { "@commitlint/cli": "7.5.2", "@commitlint/config-conventional": "7.5.0", - "@material-ui/core": "3.9.0", + "@material-ui/core": "3.9.3", "@material-ui/icons": "3.0.2", "@octokit/rest": "16.23.2", "@types/material-ui": "0.21.6", "@types/node": "12.0.0", - "@types/react": "16.8.15", + "@types/react": "16.8.16", "@types/react-dom": "16.8.4", "@types/react-router-dom": "4.3.2", "@verdaccio/babel-preset": "0.1.0", diff --git a/yarn.lock b/yarn.lock index 4fcee6ec6..aee8f489b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1290,10 +1290,10 @@ mkdirp "^0.5.1" rimraf "^2.5.2" -"@material-ui/core@3.9.0": - version "3.9.0" - resolved "https://registry.npmjs.org/@material-ui/core/-/core-3.9.0.tgz#7e74cf1979ee65f9fd388145764b3e58f48da6c6" - integrity sha512-9fxu0B9zx/TfiU0OJmwRFk+I+2J7fcXzTfQl+ZPxqlVRrPDqTHnMZlqWRJjlHCe3AVXlgpJ6/a4QCvGEohEbIQ== +"@material-ui/core@3.9.3": + version "3.9.3" + resolved "https://registry.verdaccio.org/@material-ui%2fcore/-/core-3.9.3.tgz#d378c1f4beb18df9a534ca7258c2c33fb8e0e51f" + integrity sha512-REIj62+zEvTgI/C//YL4fZxrCVIySygmpZglsu/Nl5jPqy3CDjZv1F9ubBYorHqmRgeVPh64EghMMWqk4egmfg== dependencies: "@babel/runtime" "^7.2.0" "@material-ui/system" "^3.0.0-alpha.0" @@ -1315,7 +1315,6 @@ jss-nested "^6.0.1" jss-props-sort "^6.0.0" jss-vendor-prefixer "^7.0.0" - keycode "^2.1.9" normalize-scroll-left "^0.1.2" popper.js "^1.14.1" prop-types "^15.6.0" @@ -1326,7 +1325,7 @@ "@material-ui/icons@3.0.2": version "3.0.2" - resolved "https://registry.npmjs.org/@material-ui/icons/-/icons-3.0.2.tgz#d67a6dd1ec8312d3a88ec97944a63daeef24fe10" + resolved "https://registry.verdaccio.org/@material-ui%2ficons/-/icons-3.0.2.tgz#d67a6dd1ec8312d3a88ec97944a63daeef24fe10" integrity sha512-QY/3gJnObZQ3O/e6WjH+0ah2M3MOgLOzCy8HTUoUx9B6dDrS18vP7Ycw3qrDEKlB6q1KNxy6CZHm5FCauWGy2g== dependencies: "@babel/runtime" "^7.2.0" @@ -1453,7 +1452,7 @@ "@types/history@*": version "4.7.2" - resolved "https://registry.npmjs.org/@types/history/-/history-4.7.2.tgz#0e670ea254d559241b6eeb3894f8754991e73220" + resolved "http://localhost:4873/@types%2fhistory/-/history-4.7.2.tgz#0e670ea254d559241b6eeb3894f8754991e73220" integrity sha512-ui3WwXmjTaY73fOQ3/m3nnajU/Orhi6cEu5rzX+BrAAJxa3eITXZ5ch9suPqtM03OWhAHhPSyBGCN4UKoxO20Q== "@types/istanbul-lib-coverage@^2.0.0": @@ -1476,7 +1475,7 @@ "@types/material-ui@0.21.6": version "0.21.6" - resolved "https://registry.npmjs.org/@types/material-ui/-/material-ui-0.21.6.tgz#047377ac49e623c2dafe47ccdf8713dcb02bd793" + resolved "https://registry.verdaccio.org/@types%2fmaterial-ui/-/material-ui-0.21.6.tgz#047377ac49e623c2dafe47ccdf8713dcb02bd793" integrity sha512-zq0FVny7dwE94CvY0Z7ejKcGD5IYjqHPZNkC2Wb4r8z/K+YuqRWKcIG7YP5flow46vVeOkojBPHDnic7wSv4yw== dependencies: "@types/react" "*" @@ -1494,7 +1493,7 @@ "@types/node@12.0.0": version "12.0.0" - resolved "https://registry.npmjs.org/@types/node/-/node-12.0.0.tgz#d11813b9c0ff8aaca29f04cbc12817f4c7d656e5" + resolved "https://registry.verdaccio.org/@types%2fnode/-/node-12.0.0.tgz#d11813b9c0ff8aaca29f04cbc12817f4c7d656e5" integrity sha512-Jrb/x3HT4PTJp6a4avhmJCDEVrPdqLfl3e8GGMbpkGGdwAV5UGlIs4vVEfsHHfylZVOKZWpOqmqFH8CbfOZ6kg== "@types/prop-types@*": @@ -1509,21 +1508,21 @@ "@types/react-addons-linked-state-mixin@*": version "0.14.20" - resolved "https://registry.npmjs.org/@types/react-addons-linked-state-mixin/-/react-addons-linked-state-mixin-0.14.20.tgz#5f0cd884ace049d538982a3b254f4807b9395eb6" + resolved "http://localhost:4873/@types%2freact-addons-linked-state-mixin/-/react-addons-linked-state-mixin-0.14.20.tgz#5f0cd884ace049d538982a3b254f4807b9395eb6" integrity sha512-17M8ymjR/vvyaQnLNuLSQipxtUrxaIq19phbWKKz1drIXeVQx+AnqMVVVIClno/gPheJWcLVCbf+yXXbbRalIg== dependencies: "@types/react" "*" "@types/react-dom@16.8.4": version "16.8.4" - resolved "https://registry.npmjs.org/@types/react-dom/-/react-dom-16.8.4.tgz#7fb7ba368857c7aa0f4e4511c4710ca2c5a12a88" + resolved "https://registry.verdaccio.org/@types%2freact-dom/-/react-dom-16.8.4.tgz#7fb7ba368857c7aa0f4e4511c4710ca2c5a12a88" integrity sha512-eIRpEW73DCzPIMaNBDP5pPIpK1KXyZwNgfxiVagb5iGiz6da+9A5hslSX6GAQKdO7SayVCS/Fr2kjqprgAvkfA== dependencies: "@types/react" "*" "@types/react-router-dom@4.3.2": version "4.3.2" - resolved "https://registry.npmjs.org/@types/react-router-dom/-/react-router-dom-4.3.2.tgz#52c17c3682597638f31c17c42620403dc5c2a3f5" + resolved "https://registry.verdaccio.org/@types%2freact-router-dom/-/react-router-dom-4.3.2.tgz#52c17c3682597638f31c17c42620403dc5c2a3f5" integrity sha512-biesHodFxPgDxku2m08XwPeAfUYBcxAnrQG7pwFikuA3L2e3u2OKAb+Sb16bJuU3L5CTHd+Ivap+ke4mmGsHqQ== dependencies: "@types/history" "*" @@ -1532,7 +1531,7 @@ "@types/react-router@*": version "4.4.5" - resolved "https://registry.npmjs.org/@types/react-router/-/react-router-4.4.5.tgz#1166997dc7eef2917b5ebce890ebecb32ee5c1b3" + resolved "http://localhost:4873/@types%2freact-router/-/react-router-4.4.5.tgz#1166997dc7eef2917b5ebce890ebecb32ee5c1b3" integrity sha512-12+VOu1+xiC8RPc9yrgHCyLI79VswjtuqeS2gPrMcywH6tkc8rGIUhs4LaL3AJPqo5d+RPnfRpNKiJ7MK2Qhcg== dependencies: "@types/history" "*" @@ -1553,10 +1552,10 @@ "@types/prop-types" "*" csstype "^2.2.0" -"@types/react@16.8.15": - version "16.8.15" - resolved "https://registry.npmjs.org/@types/react/-/react-16.8.15.tgz#a76515fed5aa3e996603056f54427fec5f2a5122" - integrity sha512-dMhzw1rWK+wwJWvPp5Pk12ksSrm/z/C/+lOQbMZ7YfDQYnJ02bc0wtg4EJD9qrFhuxFrf/ywNgwTboucobJqQg== +"@types/react@16.8.16": + version "16.8.16" + resolved "https://registry.verdaccio.org/@types%2freact/-/react-16.8.16.tgz#2bf980b4fb29cceeb01b2c139b3e185e57d3e08e" + integrity sha512-A0+6kS6zwPtvubOLiCJmZ8li5bm3wKIkoKV0h3RdMDOnCj9cYkUnj3bWbE03/lcICdQmwBmUfoFiHeNhbFiyHQ== dependencies: "@types/prop-types" "*" csstype "^2.2.0" @@ -5061,7 +5060,7 @@ eslint-plugin-prettier@3.0.1: eslint-plugin-prettier@^2.2.0: version "2.7.0" - resolved "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-2.7.0.tgz#b4312dcf2c1d965379d7f9d5b5f8aaadc6a45904" + resolved "http://localhost:4873/eslint-plugin-prettier/-/eslint-plugin-prettier-2.7.0.tgz#b4312dcf2c1d965379d7f9d5b5f8aaadc6a45904" integrity sha512-CStQYJgALoQBw3FsBzH0VOVDRnJ/ZimUlpLm226U8qgqYJfPOY/CPK6wyRInMxh73HSKg5wyRwdS4BVYYHwokA== dependencies: fast-diff "^1.1.1" @@ -7410,7 +7409,7 @@ jest-diff@^24.7.0: jest-docblock@^21.0.0: version "21.2.0" - resolved "https://registry.npmjs.org/jest-docblock/-/jest-docblock-21.2.0.tgz#51529c3b30d5fd159da60c27ceedc195faf8d414" + resolved "http://localhost:4873/jest-docblock/-/jest-docblock-21.2.0.tgz#51529c3b30d5fd159da60c27ceedc195faf8d414" integrity sha512-5IZ7sY9dBAYSV+YjQ0Ovb540Ku7AO9Z5o2Cg789xj167iQuZ2cG+z0f3Uct6WeYLbU6aQiM2pCs7sZ+4dotydw== jest-docblock@^24.3.0: @@ -7978,11 +7977,6 @@ jws@^3.2.2: jwa "^1.4.1" safe-buffer "^5.0.1" -keycode@^2.1.9: - version "2.2.0" - resolved "https://registry.npmjs.org/keycode/-/keycode-2.2.0.tgz#3d0af56dc7b8b8e5cba8d0a97f107204eec22b04" - integrity sha1-PQr1bce4uOXLqNCpfxByBO7CKwQ= - keygrip@~1.0.3: version "1.0.3" resolved "https://registry.npmjs.org/keygrip/-/keygrip-1.0.3.tgz#399d709f0aed2bab0a059e0cdd3a5023a053e1dc" @@ -8069,7 +8063,7 @@ levn@^0.3.0, levn@~0.3.0: lines-and-columns@^1.1.6: version "1.1.6" - resolved "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00" + resolved "http://localhost:4873/lines-and-columns/-/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00" integrity sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA= load-json-file@^1.0.0: @@ -8769,7 +8763,7 @@ mkdirp@0.5.1, mkdirp@0.5.x, "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdi mock-require@^3.0.2: version "3.0.3" - resolved "https://registry.npmjs.org/mock-require/-/mock-require-3.0.3.tgz#ccd544d9eae81dd576b3f219f69ec867318a1946" + resolved "http://localhost:4873/mock-require/-/mock-require-3.0.3.tgz#ccd544d9eae81dd576b3f219f69ec867318a1946" integrity sha512-lLzfLHcyc10MKQnNUCv7dMcoY/2Qxd6wJfbqCcVk3LDb8An4hF6ohk5AztrvgKhJCqj36uyzi/p5se+tvyD+Wg== dependencies: get-caller-file "^1.0.2" @@ -12885,12 +12879,12 @@ tslib@^1.7.1, tslib@^1.8.1, tslib@^1.9.0: tslint-config-prettier@1.18.0: version "1.18.0" - resolved "https://registry.npmjs.org/tslint-config-prettier/-/tslint-config-prettier-1.18.0.tgz#75f140bde947d35d8f0d238e0ebf809d64592c37" + resolved "http://localhost:4873/tslint-config-prettier/-/tslint-config-prettier-1.18.0.tgz#75f140bde947d35d8f0d238e0ebf809d64592c37" integrity sha512-xPw9PgNPLG3iKRxmK7DWr+Ea/SzrvfHtjFt5LBl61gk2UBG/DB9kCXRjv+xyIU1rUtnayLeMUVJBcMX8Z17nDg== tslint-plugin-prettier@2.0.1: version "2.0.1" - resolved "https://registry.npmjs.org/tslint-plugin-prettier/-/tslint-plugin-prettier-2.0.1.tgz#95b6a3b766622ffc44375825d7760225c50c3680" + resolved "http://localhost:4873/tslint-plugin-prettier/-/tslint-plugin-prettier-2.0.1.tgz#95b6a3b766622ffc44375825d7760225c50c3680" integrity sha512-4FX9JIx/1rKHIPJNfMb+ooX1gPk5Vg3vNi7+dyFYpLO+O57F4g+b/fo1+W/G0SUOkBLHB/YKScxjX/P+7ZT/Tw== dependencies: eslint-plugin-prettier "^2.2.0" @@ -12899,14 +12893,14 @@ tslint-plugin-prettier@2.0.1: tslint-react@4.0.0: version "4.0.0" - resolved "https://registry.npmjs.org/tslint-react/-/tslint-react-4.0.0.tgz#b4bb4c01c32448cb14d23f143a2f5e4989bb961e" + resolved "http://localhost:4873/tslint-react/-/tslint-react-4.0.0.tgz#b4bb4c01c32448cb14d23f143a2f5e4989bb961e" integrity sha512-9fNE0fm9zNDx1+b6hgy8rgDN2WsQLRiIrn3+fbqm0tazBVF6jiaCFAITxmU+WSFWYE03Xhp1joCircXOe1WVAQ== dependencies: tsutils "^3.9.1" tsutils@^3.9.1: version "3.10.0" - resolved "https://registry.npmjs.org/tsutils/-/tsutils-3.10.0.tgz#6f1c95c94606e098592b0dff06590cf9659227d6" + resolved "http://localhost:4873/tsutils/-/tsutils-3.10.0.tgz#6f1c95c94606e098592b0dff06590cf9659227d6" integrity sha512-q20XSMq7jutbGB8luhKKsQldRKWvyBO2BGqni3p4yq8Ys9bEP/xQw3KepKmMRt9gJ4lvQSScrihJrcKdKoSU7Q== dependencies: tslib "^1.8.1" @@ -12955,7 +12949,7 @@ typeface-roboto@0.0.54: typescript-tslint-plugin@0.3.1: version "0.3.1" - resolved "https://registry.npmjs.org/typescript-tslint-plugin/-/typescript-tslint-plugin-0.3.1.tgz#d86ae0342c9e8f9ecfcbcc47f7a7c2b5ab0e86f9" + resolved "http://localhost:4873/typescript-tslint-plugin/-/typescript-tslint-plugin-0.3.1.tgz#d86ae0342c9e8f9ecfcbcc47f7a7c2b5ab0e86f9" integrity sha512-h8HEPBm36UEs901ld1x6m5eY/UFb4mF+A0nvERr4BWMww5wnV5nfcm9ZFt18foYL0GQ5NVMt1Tb3466WUU8dRQ== dependencies: minimatch "^3.0.4" @@ -12964,7 +12958,7 @@ typescript-tslint-plugin@0.3.1: typescript@3.2.1: version "3.2.1" - resolved "https://registry.npmjs.org/typescript/-/typescript-3.2.1.tgz#0b7a04b8cf3868188de914d9568bd030f0c56192" + resolved "http://localhost:4873/typescript/-/typescript-3.2.1.tgz#0b7a04b8cf3868188de914d9568bd030f0c56192" integrity sha512-jw7P2z/h6aPT4AENXDGjcfHTu5CSqzsbZc6YlUIebTyBAq8XaKp78x7VcSh30xwSCcsu5irZkYZUSFP1MrAMbg== ua-parser-js@^0.7.18: @@ -13409,12 +13403,12 @@ vm-browserify@0.0.4: vscode-jsonrpc@^4.0.0: version "4.0.0" - resolved "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-4.0.0.tgz#a7bf74ef3254d0a0c272fab15c82128e378b3be9" + resolved "http://localhost:4873/vscode-jsonrpc/-/vscode-jsonrpc-4.0.0.tgz#a7bf74ef3254d0a0c272fab15c82128e378b3be9" integrity sha512-perEnXQdQOJMTDFNv+UF3h1Y0z4iSiaN9jIlb0OqIYgosPCZGYh/MCUlkFtV2668PL69lRDO32hmvL2yiidUYg== vscode-languageserver-protocol@3.14.1: version "3.14.1" - resolved "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.14.1.tgz#b8aab6afae2849c84a8983d39a1cf742417afe2f" + resolved "http://localhost:4873/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.14.1.tgz#b8aab6afae2849c84a8983d39a1cf742417afe2f" integrity sha512-IL66BLb2g20uIKog5Y2dQ0IiigW0XKrvmWiOvc0yXw80z3tMEzEnHjaGAb3ENuU7MnQqgnYJ1Cl2l9RvNgDi4g== dependencies: vscode-jsonrpc "^4.0.0" @@ -13422,12 +13416,12 @@ vscode-languageserver-protocol@3.14.1: vscode-languageserver-types@3.14.0: version "3.14.0" - resolved "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.14.0.tgz#d3b5952246d30e5241592b6dde8280e03942e743" + resolved "http://localhost:4873/vscode-languageserver-types/-/vscode-languageserver-types-3.14.0.tgz#d3b5952246d30e5241592b6dde8280e03942e743" integrity sha512-lTmS6AlAlMHOvPQemVwo3CezxBp0sNB95KNPkqp3Nxd5VFEnuG1ByM0zlRWos0zjO3ZWtkvhal0COgiV1xIA4A== vscode-languageserver@^5.1.0: version "5.2.1" - resolved "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-5.2.1.tgz#0d2feddd33f92aadf5da32450df498d52f6f14eb" + resolved "http://localhost:4873/vscode-languageserver/-/vscode-languageserver-5.2.1.tgz#0d2feddd33f92aadf5da32450df498d52f6f14eb" integrity sha512-GuayqdKZqAwwaCUjDvMTAVRPJOp/SLON3mJ07eGsx/Iq9HjRymhKWztX41rISqDKhHVVyFM+IywICyZDla6U3A== dependencies: vscode-languageserver-protocol "3.14.1" @@ -13435,7 +13429,7 @@ vscode-languageserver@^5.1.0: vscode-uri@^1.0.6: version "1.0.6" - resolved "https://registry.npmjs.org/vscode-uri/-/vscode-uri-1.0.6.tgz#6b8f141b0bbc44ad7b07e94f82f168ac7608ad4d" + resolved "http://localhost:4873/vscode-uri/-/vscode-uri-1.0.6.tgz#6b8f141b0bbc44ad7b07e94f82f168ac7608ad4d" integrity sha512-sLI2L0uGov3wKVb9EB+vIQBl9tVP90nqRvxSoJ35vI3NjxE8jfsE5DSOhWgSunHSZmKS4OCi2jrtfxK7uyp2ww== w3c-hr-time@^1.0.1: From 23c281afbd9965516a87b8fdd9fbaf6cc9946250 Mon Sep 17 00:00:00 2001 From: Priscila Oliveira Date: Sat, 4 May 2019 15:18:02 +0200 Subject: [PATCH 06/56] refactor: updated registry & removed unnecessary lib --- package.json | 1 - yarn.lock | 50 +------------------------------------------------- 2 files changed, 1 insertion(+), 50 deletions(-) diff --git a/package.json b/package.json index b6312d236..fb026d9cd 100644 --- a/package.json +++ b/package.json @@ -98,7 +98,6 @@ "tslint-react": "4.0.0", "typeface-roboto": "0.0.54", "typescript": "3.2.1", - "typescript-tslint-plugin": "0.3.1", "url-loader": "1.1.2", "verdaccio": "4.0.0-alpha.7", "verdaccio-auth-memory": "0.0.4", diff --git a/yarn.lock b/yarn.lock index aee8f489b..fc588467a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5909,7 +5909,7 @@ gaze@^1.0.0: dependencies: globule "^1.0.0" -get-caller-file@^1.0.1, get-caller-file@^1.0.2: +get-caller-file@^1.0.1: version "1.0.3" resolved "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz#f978fa4c90d1dfe7ff2d6beda2a515e713bdcf4a" integrity sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w== @@ -8761,14 +8761,6 @@ mkdirp@0.5.1, mkdirp@0.5.x, "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdi dependencies: minimist "0.0.8" -mock-require@^3.0.2: - version "3.0.3" - resolved "http://localhost:4873/mock-require/-/mock-require-3.0.3.tgz#ccd544d9eae81dd576b3f219f69ec867318a1946" - integrity sha512-lLzfLHcyc10MKQnNUCv7dMcoY/2Qxd6wJfbqCcVk3LDb8An4hF6ohk5AztrvgKhJCqj36uyzi/p5se+tvyD+Wg== - dependencies: - get-caller-file "^1.0.2" - normalize-path "^2.1.1" - modify-values@^1.0.0: version "1.0.1" resolved "https://registry.npmjs.org/modify-values/-/modify-values-1.0.1.tgz#b3939fa605546474e3e3e3c63d64bd43b4ee6022" @@ -12947,15 +12939,6 @@ typeface-roboto@0.0.54: resolved "https://registry.npmjs.org/typeface-roboto/-/typeface-roboto-0.0.54.tgz#8f02c9a18d1cfa7f49381a6ff0d21ff061f38ad2" integrity sha512-sOFA1FXgP0gOgBYlS6irwq6hHYA370KE3dPlgYEJHL3PJd5X8gQE0RmL79ONif6fL5JZuGDj+rtOrFeOqz5IZQ== -typescript-tslint-plugin@0.3.1: - version "0.3.1" - resolved "http://localhost:4873/typescript-tslint-plugin/-/typescript-tslint-plugin-0.3.1.tgz#d86ae0342c9e8f9ecfcbcc47f7a7c2b5ab0e86f9" - integrity sha512-h8HEPBm36UEs901ld1x6m5eY/UFb4mF+A0nvERr4BWMww5wnV5nfcm9ZFt18foYL0GQ5NVMt1Tb3466WUU8dRQ== - dependencies: - minimatch "^3.0.4" - mock-require "^3.0.2" - vscode-languageserver "^5.1.0" - typescript@3.2.1: version "3.2.1" resolved "http://localhost:4873/typescript/-/typescript-3.2.1.tgz#0b7a04b8cf3868188de914d9568bd030f0c56192" @@ -13401,37 +13384,6 @@ vm-browserify@0.0.4: dependencies: indexof "0.0.1" -vscode-jsonrpc@^4.0.0: - version "4.0.0" - resolved "http://localhost:4873/vscode-jsonrpc/-/vscode-jsonrpc-4.0.0.tgz#a7bf74ef3254d0a0c272fab15c82128e378b3be9" - integrity sha512-perEnXQdQOJMTDFNv+UF3h1Y0z4iSiaN9jIlb0OqIYgosPCZGYh/MCUlkFtV2668PL69lRDO32hmvL2yiidUYg== - -vscode-languageserver-protocol@3.14.1: - version "3.14.1" - resolved "http://localhost:4873/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.14.1.tgz#b8aab6afae2849c84a8983d39a1cf742417afe2f" - integrity sha512-IL66BLb2g20uIKog5Y2dQ0IiigW0XKrvmWiOvc0yXw80z3tMEzEnHjaGAb3ENuU7MnQqgnYJ1Cl2l9RvNgDi4g== - dependencies: - vscode-jsonrpc "^4.0.0" - vscode-languageserver-types "3.14.0" - -vscode-languageserver-types@3.14.0: - version "3.14.0" - resolved "http://localhost:4873/vscode-languageserver-types/-/vscode-languageserver-types-3.14.0.tgz#d3b5952246d30e5241592b6dde8280e03942e743" - integrity sha512-lTmS6AlAlMHOvPQemVwo3CezxBp0sNB95KNPkqp3Nxd5VFEnuG1ByM0zlRWos0zjO3ZWtkvhal0COgiV1xIA4A== - -vscode-languageserver@^5.1.0: - version "5.2.1" - resolved "http://localhost:4873/vscode-languageserver/-/vscode-languageserver-5.2.1.tgz#0d2feddd33f92aadf5da32450df498d52f6f14eb" - integrity sha512-GuayqdKZqAwwaCUjDvMTAVRPJOp/SLON3mJ07eGsx/Iq9HjRymhKWztX41rISqDKhHVVyFM+IywICyZDla6U3A== - dependencies: - vscode-languageserver-protocol "3.14.1" - vscode-uri "^1.0.6" - -vscode-uri@^1.0.6: - version "1.0.6" - resolved "http://localhost:4873/vscode-uri/-/vscode-uri-1.0.6.tgz#6b8f141b0bbc44ad7b07e94f82f168ac7608ad4d" - integrity sha512-sLI2L0uGov3wKVb9EB+vIQBl9tVP90nqRvxSoJ35vI3NjxE8jfsE5DSOhWgSunHSZmKS4OCi2jrtfxK7uyp2ww== - w3c-hr-time@^1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.1.tgz#82ac2bff63d950ea9e3189a58a65625fedf19045" From a329d7e1e21860be558c82d2406dc48cd4a4ffc1 Mon Sep 17 00:00:00 2001 From: Priscila Oliveira Date: Sat, 4 May 2019 15:20:53 +0200 Subject: [PATCH 07/56] fix: fixed registry ur --- yarn.lock | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/yarn.lock b/yarn.lock index fc588467a..df74e8855 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1325,7 +1325,7 @@ "@material-ui/icons@3.0.2": version "3.0.2" - resolved "https://registry.verdaccio.org/@material-ui%2ficons/-/icons-3.0.2.tgz#d67a6dd1ec8312d3a88ec97944a63daeef24fe10" + resolved "https://registry.npmjs.org/@material-ui/icons/-/icons-3.0.2.tgz#d67a6dd1ec8312d3a88ec97944a63daeef24fe10" integrity sha512-QY/3gJnObZQ3O/e6WjH+0ah2M3MOgLOzCy8HTUoUx9B6dDrS18vP7Ycw3qrDEKlB6q1KNxy6CZHm5FCauWGy2g== dependencies: "@babel/runtime" "^7.2.0" @@ -1452,7 +1452,7 @@ "@types/history@*": version "4.7.2" - resolved "http://localhost:4873/@types%2fhistory/-/history-4.7.2.tgz#0e670ea254d559241b6eeb3894f8754991e73220" + resolved "https://registry.verdaccio.org/@types%2fhistory/-/history-4.7.2.tgz#0e670ea254d559241b6eeb3894f8754991e73220" integrity sha512-ui3WwXmjTaY73fOQ3/m3nnajU/Orhi6cEu5rzX+BrAAJxa3eITXZ5ch9suPqtM03OWhAHhPSyBGCN4UKoxO20Q== "@types/istanbul-lib-coverage@^2.0.0": @@ -1508,7 +1508,7 @@ "@types/react-addons-linked-state-mixin@*": version "0.14.20" - resolved "http://localhost:4873/@types%2freact-addons-linked-state-mixin/-/react-addons-linked-state-mixin-0.14.20.tgz#5f0cd884ace049d538982a3b254f4807b9395eb6" + resolved "https://registry.verdaccio.org/@types%2freact-addons-linked-state-mixin/-/react-addons-linked-state-mixin-0.14.20.tgz#5f0cd884ace049d538982a3b254f4807b9395eb6" integrity sha512-17M8ymjR/vvyaQnLNuLSQipxtUrxaIq19phbWKKz1drIXeVQx+AnqMVVVIClno/gPheJWcLVCbf+yXXbbRalIg== dependencies: "@types/react" "*" @@ -1531,7 +1531,7 @@ "@types/react-router@*": version "4.4.5" - resolved "http://localhost:4873/@types%2freact-router/-/react-router-4.4.5.tgz#1166997dc7eef2917b5ebce890ebecb32ee5c1b3" + resolved "https://registry.verdaccio.org/@types%2freact-router/-/react-router-4.4.5.tgz#1166997dc7eef2917b5ebce890ebecb32ee5c1b3" integrity sha512-12+VOu1+xiC8RPc9yrgHCyLI79VswjtuqeS2gPrMcywH6tkc8rGIUhs4LaL3AJPqo5d+RPnfRpNKiJ7MK2Qhcg== dependencies: "@types/history" "*" @@ -5060,7 +5060,7 @@ eslint-plugin-prettier@3.0.1: eslint-plugin-prettier@^2.2.0: version "2.7.0" - resolved "http://localhost:4873/eslint-plugin-prettier/-/eslint-plugin-prettier-2.7.0.tgz#b4312dcf2c1d965379d7f9d5b5f8aaadc6a45904" + resolved "https://registry.verdaccio.org/eslint-plugin-prettier/-/eslint-plugin-prettier-2.7.0.tgz#b4312dcf2c1d965379d7f9d5b5f8aaadc6a45904" integrity sha512-CStQYJgALoQBw3FsBzH0VOVDRnJ/ZimUlpLm226U8qgqYJfPOY/CPK6wyRInMxh73HSKg5wyRwdS4BVYYHwokA== dependencies: fast-diff "^1.1.1" @@ -7409,7 +7409,7 @@ jest-diff@^24.7.0: jest-docblock@^21.0.0: version "21.2.0" - resolved "http://localhost:4873/jest-docblock/-/jest-docblock-21.2.0.tgz#51529c3b30d5fd159da60c27ceedc195faf8d414" + resolved "https://registry.verdaccio.org/jest-docblock/-/jest-docblock-21.2.0.tgz#51529c3b30d5fd159da60c27ceedc195faf8d414" integrity sha512-5IZ7sY9dBAYSV+YjQ0Ovb540Ku7AO9Z5o2Cg789xj167iQuZ2cG+z0f3Uct6WeYLbU6aQiM2pCs7sZ+4dotydw== jest-docblock@^24.3.0: @@ -8063,7 +8063,7 @@ levn@^0.3.0, levn@~0.3.0: lines-and-columns@^1.1.6: version "1.1.6" - resolved "http://localhost:4873/lines-and-columns/-/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00" + resolved "https://registry.verdaccio.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00" integrity sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA= load-json-file@^1.0.0: @@ -12871,12 +12871,12 @@ tslib@^1.7.1, tslib@^1.8.1, tslib@^1.9.0: tslint-config-prettier@1.18.0: version "1.18.0" - resolved "http://localhost:4873/tslint-config-prettier/-/tslint-config-prettier-1.18.0.tgz#75f140bde947d35d8f0d238e0ebf809d64592c37" + resolved "https://registry.verdaccio.org/tslint-config-prettier/-/tslint-config-prettier-1.18.0.tgz#75f140bde947d35d8f0d238e0ebf809d64592c37" integrity sha512-xPw9PgNPLG3iKRxmK7DWr+Ea/SzrvfHtjFt5LBl61gk2UBG/DB9kCXRjv+xyIU1rUtnayLeMUVJBcMX8Z17nDg== tslint-plugin-prettier@2.0.1: version "2.0.1" - resolved "http://localhost:4873/tslint-plugin-prettier/-/tslint-plugin-prettier-2.0.1.tgz#95b6a3b766622ffc44375825d7760225c50c3680" + resolved "https://registry.verdaccio.org/tslint-plugin-prettier/-/tslint-plugin-prettier-2.0.1.tgz#95b6a3b766622ffc44375825d7760225c50c3680" integrity sha512-4FX9JIx/1rKHIPJNfMb+ooX1gPk5Vg3vNi7+dyFYpLO+O57F4g+b/fo1+W/G0SUOkBLHB/YKScxjX/P+7ZT/Tw== dependencies: eslint-plugin-prettier "^2.2.0" @@ -12885,14 +12885,14 @@ tslint-plugin-prettier@2.0.1: tslint-react@4.0.0: version "4.0.0" - resolved "http://localhost:4873/tslint-react/-/tslint-react-4.0.0.tgz#b4bb4c01c32448cb14d23f143a2f5e4989bb961e" + resolved "https://registry.verdaccio.org/tslint-react/-/tslint-react-4.0.0.tgz#b4bb4c01c32448cb14d23f143a2f5e4989bb961e" integrity sha512-9fNE0fm9zNDx1+b6hgy8rgDN2WsQLRiIrn3+fbqm0tazBVF6jiaCFAITxmU+WSFWYE03Xhp1joCircXOe1WVAQ== dependencies: tsutils "^3.9.1" tsutils@^3.9.1: version "3.10.0" - resolved "http://localhost:4873/tsutils/-/tsutils-3.10.0.tgz#6f1c95c94606e098592b0dff06590cf9659227d6" + resolved "https://registry.verdaccio.org/tsutils/-/tsutils-3.10.0.tgz#6f1c95c94606e098592b0dff06590cf9659227d6" integrity sha512-q20XSMq7jutbGB8luhKKsQldRKWvyBO2BGqni3p4yq8Ys9bEP/xQw3KepKmMRt9gJ4lvQSScrihJrcKdKoSU7Q== dependencies: tslib "^1.8.1" @@ -12941,7 +12941,7 @@ typeface-roboto@0.0.54: typescript@3.2.1: version "3.2.1" - resolved "http://localhost:4873/typescript/-/typescript-3.2.1.tgz#0b7a04b8cf3868188de914d9568bd030f0c56192" + resolved "https://registry.verdaccio.org/typescript/-/typescript-3.2.1.tgz#0b7a04b8cf3868188de914d9568bd030f0c56192" integrity sha512-jw7P2z/h6aPT4AENXDGjcfHTu5CSqzsbZc6YlUIebTyBAq8XaKp78x7VcSh30xwSCcsu5irZkYZUSFP1MrAMbg== ua-parser-js@^0.7.18: From 8c82c92af164133ba837195a78ee2dd0ff600414 Mon Sep 17 00:00:00 2001 From: Priscila Oliveira Date: Sat, 4 May 2019 15:30:58 +0200 Subject: [PATCH 08/56] fix: fixed page load --- .babelrc | 5 ++++- src/webui/{history.js => history.ts} | 0 src/webui/utils/url.ts | 6 ++++-- tools/webpack.config.js | 2 ++ 4 files changed, 10 insertions(+), 3 deletions(-) rename src/webui/{history.js => history.ts} (100%) diff --git a/.babelrc b/.babelrc index 9b4e2143f..87bbf722e 100644 --- a/.babelrc +++ b/.babelrc @@ -1,3 +1,6 @@ { - "presets": [["@verdaccio", {"typescript": true}]] + "presets": [ + ["@verdaccio", { "typescript": true }], + "@babel/preset-flow", + ] } diff --git a/src/webui/history.js b/src/webui/history.ts similarity index 100% rename from src/webui/history.js rename to src/webui/history.ts diff --git a/src/webui/utils/url.ts b/src/webui/utils/url.ts index 92963ecbb..34bb11f79 100644 --- a/src/webui/utils/url.ts +++ b/src/webui/utils/url.ts @@ -4,9 +4,11 @@ export function getRegistryURL() { } export function getBaseNamePath() { - return window.__VERDACCIO_BASENAME_UI_OPTIONS.url_prefix; + // @ts-ignore + return window.__VERDACCIO_BASENAME_UI_OPTIONS && window.__VERDACCIO_BASENAME_UI_OPTIONS.url_prefix!; } export function getRootPath() { - return window.__VERDACCIO_BASENAME_UI_OPTIONS.base; + // @ts-ignore + return window.__VERDACCIO_BASENAME_UI_OPTIONS && window.__VERDACCIO_BASENAME_UI_OPTIONS.base!; } diff --git a/tools/webpack.config.js b/tools/webpack.config.js index 22fec3984..55057c676 100644 --- a/tools/webpack.config.js +++ b/tools/webpack.config.js @@ -88,6 +88,8 @@ module.exports = { }, ], }, + + /* Typescript loader */ { test: /\.tsx?$/, use: 'babel-loader', From 274bc2c06b6b758e3bb4dec2f64b80682b6afb41 Mon Sep 17 00:00:00 2001 From: Priscila Oliveira Date: Sat, 4 May 2019 15:47:20 +0200 Subject: [PATCH 09/56] refactor: refactored footer wip --- .../Footer/{index.js => Footer.tsx} | 21 +++++++++---------- src/webui/components/Footer/index.ts | 1 + src/webui/components/Footer/styles.js | 12 +++++------ 3 files changed, 17 insertions(+), 17 deletions(-) rename src/webui/components/Footer/{index.js => Footer.tsx} (62%) create mode 100644 src/webui/components/Footer/index.ts diff --git a/src/webui/components/Footer/index.js b/src/webui/components/Footer/Footer.tsx similarity index 62% rename from src/webui/components/Footer/index.js rename to src/webui/components/Footer/Footer.tsx index 24bc4b3eb..2722d47d1 100644 --- a/src/webui/components/Footer/index.js +++ b/src/webui/components/Footer/Footer.tsx @@ -1,24 +1,22 @@ /** * @prettier - * @flow */ import React from 'react'; -import type { Element } from 'react'; import { Wrapper, Left, Right, Earth, Flags, Love, Flag, Logo, Inner, ToolTip } from './styles'; import { goToVerdaccioWebsite } from '../../utils/windows.js'; const renderTooltip = () => ( - + - - - - - - + + + + + + ); @@ -27,10 +25,11 @@ const MADEWITH_LABEL = ' Made with'; const ON_LABEL = 'on'; const HEARTH_EMOJI = '♥'; +// @ts-ignore const renderRight = (version = window.VERDACCIO_VERSION) => ( {POWERED_LABEL} - + {`/ ${version}`} ); @@ -44,7 +43,7 @@ const renderLeft = () => ( ); -const Footer = (): Element => ( +const Footer: React.FC = () => ( {renderLeft()} diff --git a/src/webui/components/Footer/index.ts b/src/webui/components/Footer/index.ts new file mode 100644 index 000000000..5d06e9b71 --- /dev/null +++ b/src/webui/components/Footer/index.ts @@ -0,0 +1 @@ +export { default } from './Footer' diff --git a/src/webui/components/Footer/styles.js b/src/webui/components/Footer/styles.js index 50e3b8a85..107879fb7 100644 --- a/src/webui/components/Footer/styles.js +++ b/src/webui/components/Footer/styles.js @@ -8,7 +8,7 @@ import mq from '../../utils/styles/media'; import Icon from '../Icon'; import colors from '../../utils/styles/colors'; -export const Wrapper = styled.div` +export const Wrapper = styled('div')` && { background: ${colors.snow}; border-top: 1px solid ${colors.greyGainsboro}; @@ -18,7 +18,7 @@ export const Wrapper = styled.div` } `; -export const Inner = styled.div` +export const Inner = styled('div')` && { display: flex; align-items: center; @@ -36,7 +36,7 @@ export const Inner = styled.div` } `; -export const Left = styled.div` +export const Left = styled('div')` && { align-items: center; display: none; @@ -52,7 +52,7 @@ export const Right = styled(Left)` } `; -export const ToolTip = styled.span` +export const ToolTip = styled('span')` && { position: relative; height: 18px; @@ -65,7 +65,7 @@ export const Earth = styled(Icon)` } `; -export const Flags = styled.span` +export const Flags = styled('span')` && { position: absolute; background: ${colors.greyAthens}; @@ -92,7 +92,7 @@ export const Flags = styled.span` } `; -export const Love = styled.span` +export const Love = styled('span')` && { color: ${colors.love}; padding: 0 5px; From a8636129cc2f1202cca0948517957aaf98abf70b Mon Sep 17 00:00:00 2001 From: Priscila Oliveira Date: Sun, 5 May 2019 12:12:31 +0200 Subject: [PATCH 10/56] refactor: converting to ts..wip --- package.json | 1 + src/webui/app.js | 2 +- .../ActionBar/{index.js => ActionBar.tsx} | 2 +- src/webui/components/ActionBar/index.ts | 1 + .../ActionBar/{styles.js => styles.ts} | 3 ++- .../Author/{index.js => Author.tsx} | 10 +++---- src/webui/components/Author/index.ts | 1 + .../Author/{styles.js => styles.ts} | 5 ++-- src/webui/components/Dependencies/index.js | 2 +- src/webui/components/DetailContainer/index.js | 2 +- src/webui/components/DetailSidebar/index.js | 6 ++--- src/webui/components/Developers/index.js | 2 +- .../components/Dist/{index.js => Dist.tsx} | 14 +++++----- src/webui/components/Dist/index.ts | 1 + .../components/Dist/{styles.js => styles.ts} | 8 +++--- src/webui/components/Engines/index.js | 2 +- src/webui/components/Footer/styles.js | 3 +-- .../components/Icon/{index.js => Icon.tsx} | 26 ++++++++++++++----- src/webui/components/Icon/index.ts | 1 + .../components/Icon/{styles.js => styles.ts} | 7 +++-- .../components/Icon/{types.js => types.ts} | 12 ++++----- src/webui/components/Install/Install.tsx | 2 +- .../Loading/{index.js => Loading.tsx} | 6 ++--- src/webui/components/Loading/index.ts | 1 + .../Loading/{styles.js => styles.ts} | 5 ++-- .../components/Logo/{Logo.ts => Logo.tsx} | 17 ++++++++++-- src/webui/components/Package/styles.js | 2 +- src/webui/components/Repository/index.js | 2 +- src/webui/components/UpLinks/index.js | 2 +- src/webui/components/Versions/index.js | 2 +- .../pages/version/{index.js => Version.tsx} | 12 ++++++--- src/webui/pages/version/index.ts | 1 + .../pages/version/{styles.js => styles.ts} | 3 +-- src/webui/pages/version/types.js | 0 src/webui/router.js | 2 +- yarn.lock | 5 ++++ 36 files changed, 106 insertions(+), 67 deletions(-) rename src/webui/components/ActionBar/{index.js => ActionBar.tsx} (96%) create mode 100644 src/webui/components/ActionBar/index.ts rename src/webui/components/ActionBar/{styles.js => styles.ts} (88%) rename src/webui/components/Author/{index.js => Author.tsx} (79%) create mode 100644 src/webui/components/Author/index.ts rename src/webui/components/Author/{styles.js => styles.ts} (68%) rename src/webui/components/Dist/{index.js => Dist.tsx} (74%) create mode 100644 src/webui/components/Dist/index.ts rename src/webui/components/Dist/{styles.js => styles.ts} (70%) rename src/webui/components/Icon/{index.js => Icon.tsx} (75%) create mode 100644 src/webui/components/Icon/index.ts rename src/webui/components/Icon/{styles.js => styles.ts} (87%) rename src/webui/components/Icon/{types.js => types.ts} (68%) rename src/webui/components/Loading/{index.js => Loading.tsx} (71%) create mode 100644 src/webui/components/Loading/index.ts rename src/webui/components/Loading/{styles.js => styles.ts} (79%) rename src/webui/components/Logo/{Logo.ts => Logo.tsx} (65%) rename src/webui/pages/version/{index.js => Version.tsx} (92%) create mode 100644 src/webui/pages/version/index.ts rename src/webui/pages/version/{styles.js => styles.ts} (81%) delete mode 100644 src/webui/pages/version/types.js diff --git a/package.json b/package.json index fb026d9cd..1b1b51457 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "@material-ui/core": "3.9.3", "@material-ui/icons": "3.0.2", "@octokit/rest": "16.23.2", + "@types/lodash": "4.14.123", "@types/material-ui": "0.21.6", "@types/node": "12.0.0", "@types/react": "16.8.16", diff --git a/src/webui/app.js b/src/webui/app.js index a54606829..093621457 100644 --- a/src/webui/app.js +++ b/src/webui/app.js @@ -8,7 +8,7 @@ import isNil from 'lodash/isNil'; import storage from './utils/storage'; import { makeLogin, isTokenExpire } from './utils/login'; -import Loading from './components/Loading'; +import Loading from './components/Loading/Loading'; import LoginModal from './components/Login'; import Header from './components/Header'; import { Container, Content } from './components/Layout'; diff --git a/src/webui/components/ActionBar/index.js b/src/webui/components/ActionBar/ActionBar.tsx similarity index 96% rename from src/webui/components/ActionBar/index.js rename to src/webui/components/ActionBar/ActionBar.tsx index 8a0362e38..9cf977ab2 100644 --- a/src/webui/components/ActionBar/index.js +++ b/src/webui/components/ActionBar/ActionBar.tsx @@ -10,7 +10,7 @@ import HomeIcon from '@material-ui/icons/Home'; import List from '@material-ui/core/List/index'; import Tooltip from '@material-ui/core/Tooltip/index'; -import { DetailContextConsumer } from '../../pages/version/index'; +import { DetailContextConsumer } from '../../pages/version/Version'; import { Fab, ActionListItem } from './styles'; const ACTIONS = { diff --git a/src/webui/components/ActionBar/index.ts b/src/webui/components/ActionBar/index.ts new file mode 100644 index 000000000..f6ffef4ac --- /dev/null +++ b/src/webui/components/ActionBar/index.ts @@ -0,0 +1 @@ +export { default } from './ActionBar' diff --git a/src/webui/components/ActionBar/styles.js b/src/webui/components/ActionBar/styles.ts similarity index 88% rename from src/webui/components/ActionBar/styles.js rename to src/webui/components/ActionBar/styles.ts index 2fce31d2a..ad28e9e45 100644 --- a/src/webui/components/ActionBar/styles.js +++ b/src/webui/components/ActionBar/styles.ts @@ -1,9 +1,10 @@ /** * @prettier */ + import styled from 'react-emotion'; import { default as MuiFab } from '@material-ui/core/Fab'; -import ListItem from '@material-ui/core/ListItem/index'; +import ListItem from '@material-ui/core/ListItem'; import colors from '../../utils/styles/colors'; diff --git a/src/webui/components/Author/index.js b/src/webui/components/Author/Author.tsx similarity index 79% rename from src/webui/components/Author/index.js rename to src/webui/components/Author/Author.tsx index 5f26c708e..a86ce2174 100644 --- a/src/webui/components/Author/index.js +++ b/src/webui/components/Author/Author.tsx @@ -2,27 +2,27 @@ * @prettier */ -import React, { Component } from 'react'; +import React, { Component, ReactNode } from 'react'; import Avatar from '@material-ui/core/Avatar/index'; import List from '@material-ui/core/List/index'; import ListItemText from '@material-ui/core/ListItemText/index'; -import { DetailContextConsumer } from '../../pages/version/index'; +import { DetailContextConsumer } from '../../pages/version/Version'; import { Heading, AuthorListItem } from './styles'; class Authors extends Component { render() { return ( - {context => { + {(context: any) => { return this.renderAuthor(context); }} ); } - renderLinkForMail(email, avatarComponent, packageName, version) { + renderLinkForMail(email: string, avatarComponent: ReactNode, packageName: string, version: string) { if (!email) { return avatarComponent; } @@ -33,7 +33,7 @@ class Authors extends Component { ); } - renderAuthor = ({ packageMeta }) => { + renderAuthor = ({ packageMeta }: any) => { const { author, name: packageName, version } = packageMeta.latest; if (!author) { diff --git a/src/webui/components/Author/index.ts b/src/webui/components/Author/index.ts new file mode 100644 index 000000000..3119cace7 --- /dev/null +++ b/src/webui/components/Author/index.ts @@ -0,0 +1 @@ +export { default } from './Author' diff --git a/src/webui/components/Author/styles.js b/src/webui/components/Author/styles.ts similarity index 68% rename from src/webui/components/Author/styles.js rename to src/webui/components/Author/styles.ts index ae02d2357..cd06198b1 100644 --- a/src/webui/components/Author/styles.js +++ b/src/webui/components/Author/styles.ts @@ -1,11 +1,10 @@ /** * @prettier - * @flow */ import styled from 'react-emotion'; -import ListItem from '@material-ui/core/ListItem/index'; -import Typography from '@material-ui/core/Typography/index'; +import ListItem from '@material-ui/core/ListItem'; +import Typography from '@material-ui/core/Typography'; export const Heading = styled(Typography)` && { diff --git a/src/webui/components/Dependencies/index.js b/src/webui/components/Dependencies/index.js index ce3175daf..64f4d9566 100644 --- a/src/webui/components/Dependencies/index.js +++ b/src/webui/components/Dependencies/index.js @@ -7,7 +7,7 @@ import React, { Component, Fragment } from 'react'; import { withRouter } from 'react-router-dom'; import CardContent from '@material-ui/core/CardContent/index'; -import { DetailContextConsumer } from '../../pages/version'; +import { DetailContextConsumer } from '../../pages/version/Version'; import { CardWrap, Heading, Tags, Tag } from './styles'; import NoItems from '../NoItems'; diff --git a/src/webui/components/DetailContainer/index.js b/src/webui/components/DetailContainer/index.js index d01514e03..fa2158b64 100644 --- a/src/webui/components/DetailContainer/index.js +++ b/src/webui/components/DetailContainer/index.js @@ -5,7 +5,7 @@ import React, { Component } from 'react'; -import { DetailContextConsumer } from '../../pages/version/index'; +import { DetailContextConsumer } from '../../pages/version/Version'; import Readme from '../Readme'; import Versions from '../Versions'; import { preventXSS } from '../../utils/sec-utils'; diff --git a/src/webui/components/DetailSidebar/index.js b/src/webui/components/DetailSidebar/index.js index 0b9fcb76b..f98571be0 100644 --- a/src/webui/components/DetailSidebar/index.js +++ b/src/webui/components/DetailSidebar/index.js @@ -4,16 +4,16 @@ import Card from '@material-ui/core/Card/index'; import CardContent from '@material-ui/core/CardContent/index'; import List from '@material-ui/core/List/index'; -import ActionBar from '../ActionBar'; +import ActionBar from '../ActionBar/ActionBar'; import Author from '../Author'; import Developers from '../Developers'; -import Dist from '../Dist'; +import Dist from '../Dist/Dist'; import Engine from '../Engines'; import Install from '../Install'; import Repository from '../Repository'; -import { DetailContextConsumer } from '../../pages/version/index'; +import { DetailContextConsumer } from '../../pages/version/Version'; import { TitleListItem, TitleListItemText } from './styles'; diff --git a/src/webui/components/Developers/index.js b/src/webui/components/Developers/index.js index f8b1c67c8..77c7d98a4 100644 --- a/src/webui/components/Developers/index.js +++ b/src/webui/components/Developers/index.js @@ -8,7 +8,7 @@ import Avatar from '@material-ui/core/Avatar'; import Add from '@material-ui/icons/Add'; import Tooltip from '@material-ui/core/Tooltip'; -import { DetailContextConsumer } from '../../pages/version'; +import { DetailContextConsumer } from '../../pages/version/Version'; import { Details, Heading, Content, Fab } from './styles'; interface Props { diff --git a/src/webui/components/Dist/index.js b/src/webui/components/Dist/Dist.tsx similarity index 74% rename from src/webui/components/Dist/index.js rename to src/webui/components/Dist/Dist.tsx index 976f77fc9..2e7c797ac 100644 --- a/src/webui/components/Dist/index.js +++ b/src/webui/components/Dist/Dist.tsx @@ -4,9 +4,9 @@ import React, { Component } from 'react'; -import List from '@material-ui/core/List/index'; +import List from '@material-ui/core/List'; -import { DetailContextConsumer } from '../../pages/version/index'; +import { DetailContextConsumer } from '../../pages/version/Version'; import { Heading, DistListItem, DistChips } from './styles'; import fileSizeSI from '../../utils/file-size'; @@ -14,14 +14,14 @@ class Dist extends Component { render() { return ( - {context => { + {(context: any) => { return this.renderDist(context); }} ); } - renderChips(dist, license) { + renderChips(dist: any, license: string) { const distDict = { 'file-count': dist.fileCount, size: dist.unpackedSize && fileSizeSI(dist.unpackedSize), @@ -29,6 +29,7 @@ class Dist extends Component { }; const chipsList = Object.keys(distDict).reduce((componentList, title, key) => { + // @ts-ignore const value = distDict[title]; if (value) { const label = ( @@ -37,6 +38,7 @@ class Dist extends Component { {title.split('-').join(' ')}:{value} ); + // @ts-ignore is not assignable to parameter of type 'never' componentList.push(); } return componentList; @@ -45,11 +47,11 @@ class Dist extends Component { return chipsList; } - renderDist = ({ packageMeta }) => { + renderDist = ({ packageMeta }: any) => { const { dist = {}, license } = packageMeta.latest; return ( - {'Latest Distribution'}}> + {'Latest Distribution'}}> {this.renderChips(dist, license)} ); diff --git a/src/webui/components/Dist/index.ts b/src/webui/components/Dist/index.ts new file mode 100644 index 000000000..744a5418f --- /dev/null +++ b/src/webui/components/Dist/index.ts @@ -0,0 +1 @@ +export { default } from './Dist' diff --git a/src/webui/components/Dist/styles.js b/src/webui/components/Dist/styles.ts similarity index 70% rename from src/webui/components/Dist/styles.js rename to src/webui/components/Dist/styles.ts index 82c65d4a1..ec1ebe021 100644 --- a/src/webui/components/Dist/styles.js +++ b/src/webui/components/Dist/styles.ts @@ -3,10 +3,10 @@ */ import styled from 'react-emotion'; -import { default as MuiFab } from '@material-ui/core/Fab/index'; -import Chip from '@material-ui/core/Chip/index'; -import ListItem from '@material-ui/core/ListItem/index'; -import Typography from '@material-ui/core/Typography/index'; +import { default as MuiFab } from '@material-ui/core/Fab'; +import Chip from '@material-ui/core/Chip'; +import ListItem from '@material-ui/core/ListItem'; +import Typography from '@material-ui/core/Typography'; import colors from '../../utils/styles/colors'; diff --git a/src/webui/components/Engines/index.js b/src/webui/components/Engines/index.js index 223322569..e6328fc46 100644 --- a/src/webui/components/Engines/index.js +++ b/src/webui/components/Engines/index.js @@ -9,7 +9,7 @@ import Grid from '@material-ui/core/Grid/index'; import List from '@material-ui/core/List/index'; import ListItemText from '@material-ui/core/ListItemText/index'; -import { DetailContextConsumer } from '../../pages/version/index'; +import { DetailContextConsumer } from '../../pages/version/Version'; import { Heading, EngineListItem } from './styles'; import node from './img/node.png'; import npm from '../Install/img/npm.svg'; diff --git a/src/webui/components/Footer/styles.js b/src/webui/components/Footer/styles.js index 107879fb7..9bb06bab1 100644 --- a/src/webui/components/Footer/styles.js +++ b/src/webui/components/Footer/styles.js @@ -1,11 +1,10 @@ /** * @prettier - * @flow */ import styled, { css } from 'react-emotion'; import mq from '../../utils/styles/media'; -import Icon from '../Icon'; +import Icon from '../Icon/Icon'; import colors from '../../utils/styles/colors'; export const Wrapper = styled('div')` diff --git a/src/webui/components/Icon/index.js b/src/webui/components/Icon/Icon.tsx similarity index 75% rename from src/webui/components/Icon/index.js rename to src/webui/components/Icon/Icon.tsx index ae78da338..86e0ce9ea 100644 --- a/src/webui/components/Icon/index.js +++ b/src/webui/components/Icon/Icon.tsx @@ -1,32 +1,43 @@ /** * @prettier - * @flow */ import React from 'react'; -import type { Node } from 'react'; import capitalize from 'lodash/capitalize'; import { Svg, Img, ImgWrapper } from './styles'; import { IProps, IIconsMap } from './types'; +// @ts-ignore import brazil from './img/brazil.svg'; +// @ts-ignore import china from './img/china.svg'; +// @ts-ignore import india from './img/india.svg'; +// @ts-ignore import nicaragua from './img/nicaragua.svg'; +// @ts-ignore import pakistan from './img/pakistan.svg'; +// @ts-ignore import austria from './img/austria.svg'; +// @ts-ignore import spain from './img/spain.svg'; +// @ts-ignore import earth from './img/earth.svg'; +// @ts-ignore import verdaccio from './img/verdaccio.svg'; +// @ts-ignore import filebinary from './img/filebinary.svg'; +// @ts-ignore import law from './img/law.svg'; +// @ts-ignore import license from './img/license.svg'; +// @ts-ignore import time from './img/time.svg'; +// @ts-ignore import version from './img/version.svg'; -export const Icons: $Shape = { - // flags +export const Icons: IIconsMap = { brazil, spain, china, @@ -36,7 +47,6 @@ export const Icons: $Shape = { austria, earth, verdaccio, - // other icons filebinary, law, license, @@ -44,13 +54,15 @@ export const Icons: $Shape = { version, }; -const Icon = ({ className, name, size = 'sm', img = false, pointer = false, ...props }: IProps): Node => { +const Icon: React.FC = ({ className, name, size = 'sm', img = false, pointer = false, ...props }) => { + // @ts-ignore const title = capitalize(name); return img ? ( - + {title} ) : ( + // @ts-ignore {title} diff --git a/src/webui/components/Icon/index.ts b/src/webui/components/Icon/index.ts new file mode 100644 index 000000000..17f79ac55 --- /dev/null +++ b/src/webui/components/Icon/index.ts @@ -0,0 +1 @@ +export { default } from './Icon' diff --git a/src/webui/components/Icon/styles.js b/src/webui/components/Icon/styles.ts similarity index 87% rename from src/webui/components/Icon/styles.js rename to src/webui/components/Icon/styles.ts index fd3455f09..45abb78af 100644 --- a/src/webui/components/Icon/styles.js +++ b/src/webui/components/Icon/styles.ts @@ -1,6 +1,5 @@ /** * @prettier - * @flow */ import styled, { css } from 'react-emotion'; @@ -35,19 +34,19 @@ const commonStyle = ({ size = 'sm', pointer, modifiers }: IProps) => css` } `; -export const Svg = styled.svg` +export const Svg = styled('svg')` && { ${commonStyle}; } `; -export const ImgWrapper = styled.span` +export const ImgWrapper = styled('span')` && { ${commonStyle}; } `; -export const Img = styled.img` +export const Img = styled('img')` && { width: 100%; height: auto; diff --git a/src/webui/components/Icon/types.js b/src/webui/components/Icon/types.ts similarity index 68% rename from src/webui/components/Icon/types.js rename to src/webui/components/Icon/types.ts index 5b2adf68a..0ceae5f99 100644 --- a/src/webui/components/Icon/types.js +++ b/src/webui/components/Icon/types.ts @@ -1,9 +1,10 @@ /** * @prettier - * @flow */ -import { Icons } from './index'; -import type { Styles } from '../../../../types'; + +import { MouseEvent } from 'react'; +import { Icons } from './Icon'; +import { Styles } from '../../../../types'; export interface IIconsMap { brazil: string; @@ -24,10 +25,9 @@ export interface IIconsMap { } export interface IProps { - name: $Keys; + name: keyof typeof Icons; className?: string; - // $FlowFixMe - onClick?: (event: SyntheticMouseEvent) => void; + onClick?: (event: MouseEvent) => void; size?: 'sm' | 'md'; pointer?: boolean; img?: boolean; diff --git a/src/webui/components/Install/Install.tsx b/src/webui/components/Install/Install.tsx index 9a8ebef3b..94ad1a8b2 100644 --- a/src/webui/components/Install/Install.tsx +++ b/src/webui/components/Install/Install.tsx @@ -7,7 +7,7 @@ import ListItemText from '@material-ui/core/ListItemText'; import React, { Component } from 'react'; // @ts-ignore -import { DetailContextConsumer } from '../../pages/version'; +import { DetailContextConsumer } from '../../pages/version/Version'; import CopyToClipBoard from '../CopyToClipBoard'; // logos of package managers diff --git a/src/webui/components/Loading/index.js b/src/webui/components/Loading/Loading.tsx similarity index 71% rename from src/webui/components/Loading/index.js rename to src/webui/components/Loading/Loading.tsx index 94c4f2db1..45b593e88 100644 --- a/src/webui/components/Loading/index.js +++ b/src/webui/components/Loading/Loading.tsx @@ -1,20 +1,18 @@ /** * @prettier - * @flow */ import React from 'react'; -import type { Node } from 'react'; import Logo from '../Logo'; import Spinner from '../Spinner'; import { Wrapper, Badge } from './styles'; -const Loading = (): Node => ( +const Loading: React.FC = () => ( - + diff --git a/src/webui/components/Loading/index.ts b/src/webui/components/Loading/index.ts new file mode 100644 index 000000000..c81dfe707 --- /dev/null +++ b/src/webui/components/Loading/index.ts @@ -0,0 +1 @@ +export { default } from './Loading' diff --git a/src/webui/components/Loading/styles.js b/src/webui/components/Loading/styles.ts similarity index 79% rename from src/webui/components/Loading/styles.js rename to src/webui/components/Loading/styles.ts index d482253ad..854458f21 100644 --- a/src/webui/components/Loading/styles.js +++ b/src/webui/components/Loading/styles.ts @@ -1,11 +1,10 @@ /** * @prettier - * @flow */ import styled from 'react-emotion'; -export const Wrapper = styled.div` +export const Wrapper = styled('div')` && { transform: translate(-50%, -50%); top: 50%; @@ -14,7 +13,7 @@ export const Wrapper = styled.div` } `; -export const Badge = styled.div` +export const Badge = styled('div')` && { margin: 0 0 30px 0; border-radius: 25px; diff --git a/src/webui/components/Logo/Logo.ts b/src/webui/components/Logo/Logo.tsx similarity index 65% rename from src/webui/components/Logo/Logo.ts rename to src/webui/components/Logo/Logo.tsx index 4a0be34af..b16c97a7c 100644 --- a/src/webui/components/Logo/Logo.ts +++ b/src/webui/components/Logo/Logo.tsx @@ -1,13 +1,17 @@ /** * @prettier */ - +import React from 'react'; import styled, { css } from 'react-emotion'; // @ts-ignore import logo from './img/logo.svg'; -const Logo = styled('div')` +interface Props { + md?: boolean; +} + +const LogoWrapper = styled('div')` && { display: inline-block; vertical-align: middle; @@ -28,4 +32,13 @@ const Logo = styled('div')` } `; +const Logo: React.FC = ({ md }) => { + // @ts-ignore + return ; +}; + +Logo.defaultProps = { + md: false, +}; + export default Logo; diff --git a/src/webui/components/Package/styles.js b/src/webui/components/Package/styles.js index eaa486040..f894b1dfb 100644 --- a/src/webui/components/Package/styles.js +++ b/src/webui/components/Package/styles.js @@ -15,7 +15,7 @@ import Photo from '@material-ui/core/Avatar'; import Typography from '@material-ui/core/Typography/index'; import { breakpoints } from '../../utils/styles/media'; -import Ico from '../Icon'; +import Ico from '../Icon/Icon'; import Label from '../Label'; import colors from '../../utils/styles/colors'; diff --git a/src/webui/components/Repository/index.js b/src/webui/components/Repository/index.js index 68c2239a0..f7be699d2 100644 --- a/src/webui/components/Repository/index.js +++ b/src/webui/components/Repository/index.js @@ -5,7 +5,7 @@ import Avatar from '@material-ui/core/Avatar'; import List from '@material-ui/core/List'; import ListItemText from '@material-ui/core/ListItemText'; -import { DetailContextConsumer } from '../../pages/version/index'; +import { DetailContextConsumer } from '../../pages/version/Version'; import CopyToClipBoard from '../CopyToClipBoard'; import { Heading, GithubLink, RepositoryListItem } from './styles'; diff --git a/src/webui/components/UpLinks/index.js b/src/webui/components/UpLinks/index.js index 8756a07c0..c8b35d450 100644 --- a/src/webui/components/UpLinks/index.js +++ b/src/webui/components/UpLinks/index.js @@ -5,7 +5,7 @@ import React from 'react'; import List from '@material-ui/core/List/index'; import ListItem from '@material-ui/core/ListItem/index'; -import { DetailContextConsumer } from '../../pages/version/index'; +import { DetailContextConsumer } from '../../pages/version/Version'; import NoItems from '../NoItems'; import { formatDateDistance } from '../../utils/package'; diff --git a/src/webui/components/Versions/index.js b/src/webui/components/Versions/index.js index da036e75a..baef5b494 100644 --- a/src/webui/components/Versions/index.js +++ b/src/webui/components/Versions/index.js @@ -3,7 +3,7 @@ * @flow */ -import { DetailContextConsumer } from '../../pages/version/index'; +import { DetailContextConsumer } from '../../pages/version/Version'; import { formatDateDistance } from '../../utils/package'; import { Heading, Spacer, ListItemText } from './styles'; import List from '@material-ui/core/List/index'; diff --git a/src/webui/pages/version/index.js b/src/webui/pages/version/Version.tsx similarity index 92% rename from src/webui/pages/version/index.js rename to src/webui/pages/version/Version.tsx index ad7cefb85..839e91aff 100644 --- a/src/webui/pages/version/index.js +++ b/src/webui/pages/version/Version.tsx @@ -1,18 +1,24 @@ /** * @prettier - * @flow */ import React, { Component } from 'react'; import Grid from '@material-ui/core/Grid/index'; -import Loading from '../../components/Loading'; +import Loading from '../../components/Loading/Loading'; import DetailContainer from '../../components/DetailContainer'; import DetailSidebar from '../../components/DetailSidebar'; import { callDetailPage } from '../../utils/calls'; import { getRouterPackageName } from '../../utils/package'; import NotFound from '../../components/NotFound'; -export const DetailContext = React.createContext(); +export interface DetailContextProps { + packageMeta: any + readMe: any + packageName: string + enableLoading: () => void +} + +export const DetailContext = React.createContext(null); export const DetailContextProvider = DetailContext.Provider; export const DetailContextConsumer = DetailContext.Consumer; diff --git a/src/webui/pages/version/index.ts b/src/webui/pages/version/index.ts new file mode 100644 index 000000000..b4b180680 --- /dev/null +++ b/src/webui/pages/version/index.ts @@ -0,0 +1 @@ +export { default, DetailContextProps } from './Version' diff --git a/src/webui/pages/version/styles.js b/src/webui/pages/version/styles.ts similarity index 81% rename from src/webui/pages/version/styles.js rename to src/webui/pages/version/styles.ts index e64ae85fa..6aa19f273 100644 --- a/src/webui/pages/version/styles.js +++ b/src/webui/pages/version/styles.ts @@ -1,10 +1,9 @@ /** * @prettier - * @flow */ import styled from 'react-emotion'; -import DialogTitle from '@material-ui/core/DialogTitle/index'; +import DialogTitle from '@material-ui/core/DialogTitle'; import colors from '../../utils/styles/colors'; import { fontSize } from '../../utils/styles/sizes'; diff --git a/src/webui/pages/version/types.js b/src/webui/pages/version/types.js deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/webui/router.js b/src/webui/router.js index 53aaeb892..8fd42f076 100644 --- a/src/webui/router.js +++ b/src/webui/router.js @@ -14,7 +14,7 @@ import history from './history'; import Header from './components/Header'; const NotFound = asyncComponent(() => import('./components/NotFound')); -const VersionPackage = asyncComponent(() => import('./pages/version')); +const VersionPackage = asyncComponent(() => import('./pages/version/Version')); const HomePage = asyncComponent(() => import('./pages/home')); class RouterApp extends Component { diff --git a/yarn.lock b/yarn.lock index df74e8855..557ea7d83 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1473,6 +1473,11 @@ csstype "^2.0.0" indefinite-observable "^1.0.1" +"@types/lodash@4.14.123": + version "4.14.123" + resolved "https://registry.verdaccio.org/@types%2flodash/-/lodash-4.14.123.tgz#39be5d211478c8dd3bdae98ee75bb7efe4abfe4d" + integrity sha512-pQvPkc4Nltyx7G1Ww45OjVqUsJP4UsZm+GWJpigXgkikZqJgRm4c48g027o6tdgubWHwFRF15iFd+Y4Pmqv6+Q== + "@types/material-ui@0.21.6": version "0.21.6" resolved "https://registry.verdaccio.org/@types%2fmaterial-ui/-/material-ui-0.21.6.tgz#047377ac49e623c2dafe47ccdf8713dcb02bd793" From 59f7815a1e899d647e1dc87407bf8aaa5356177f Mon Sep 17 00:00:00 2001 From: Priscila Oliveira Date: Sun, 5 May 2019 12:30:53 +0200 Subject: [PATCH 11/56] refactor: converting to ts. wip --- src/webui/components/Label/Label.tsx | 35 +++++++++++++++++++ src/webui/components/Label/index.js | 27 -------------- src/webui/components/Label/index.ts | 1 + src/webui/components/Label/types.js | 12 ------- src/webui/components/Link/Link.tsx | 19 ++++++++++ src/webui/components/Link/index.js | 16 --------- src/webui/components/Link/index.ts | 1 + src/webui/components/Link/types.js | 12 ------- .../NoItems/{index.js => NoItems.tsx} | 9 ++--- src/webui/components/NoItems/index.ts | 1 + src/webui/components/NoItems/types.js | 8 ----- src/webui/components/Readme/Readme.tsx | 12 +++++++ src/webui/components/Readme/index.js | 13 ------- src/webui/components/Readme/index.ts | 1 + .../components/Readme/{types.js => types.ts} | 0 .../RegistryInfoDialog/RegistryInfoDialog.tsx | 25 +++++++++++++ .../components/RegistryInfoDialog/index.js | 28 --------------- .../components/RegistryInfoDialog/index.ts | 1 + .../{styles.js => styles.ts} | 5 ++- .../RegistryInfoDialog/{types.js => types.ts} | 5 ++- .../Repository/{index.js => Repository.tsx} | 16 ++++----- src/webui/components/Repository/index.ts | 1 + .../Repository/{styles.js => styles.ts} | 0 src/webui/icons/GitHub.js | 16 --------- src/webui/icons/GitHub.tsx | 13 +++++++ src/webui/icons/index.ts | 1 + 26 files changed, 126 insertions(+), 152 deletions(-) create mode 100644 src/webui/components/Label/Label.tsx delete mode 100644 src/webui/components/Label/index.js create mode 100644 src/webui/components/Label/index.ts delete mode 100644 src/webui/components/Label/types.js create mode 100644 src/webui/components/Link/Link.tsx delete mode 100644 src/webui/components/Link/index.js create mode 100644 src/webui/components/Link/index.ts delete mode 100644 src/webui/components/Link/types.js rename src/webui/components/NoItems/{index.js => NoItems.tsx} (53%) create mode 100644 src/webui/components/NoItems/index.ts delete mode 100644 src/webui/components/NoItems/types.js create mode 100644 src/webui/components/Readme/Readme.tsx delete mode 100644 src/webui/components/Readme/index.js create mode 100644 src/webui/components/Readme/index.ts rename src/webui/components/Readme/{types.js => types.ts} (100%) create mode 100644 src/webui/components/RegistryInfoDialog/RegistryInfoDialog.tsx delete mode 100644 src/webui/components/RegistryInfoDialog/index.js create mode 100644 src/webui/components/RegistryInfoDialog/index.ts rename src/webui/components/RegistryInfoDialog/{styles.js => styles.ts} (70%) rename src/webui/components/RegistryInfoDialog/{types.js => types.ts} (55%) rename src/webui/components/Repository/{index.js => Repository.tsx} (75%) create mode 100644 src/webui/components/Repository/index.ts rename src/webui/components/Repository/{styles.js => styles.ts} (100%) delete mode 100644 src/webui/icons/GitHub.js create mode 100644 src/webui/icons/GitHub.tsx create mode 100644 src/webui/icons/index.ts diff --git a/src/webui/components/Label/Label.tsx b/src/webui/components/Label/Label.tsx new file mode 100644 index 000000000..837ac6647 --- /dev/null +++ b/src/webui/components/Label/Label.tsx @@ -0,0 +1,35 @@ +/** + * @prettier + */ + +import React from 'react'; +import styled from 'react-emotion'; +import { fontWeight } from '../../utils/styles/sizes'; +import { Styles } from '../../../../types'; + +interface Props { + text: string; + capitalize?: boolean; + weight?: string; + modifiers?: Styles; +} + +const Wrapper = styled('div')` + font-weight: ${({ weight }) => { + // @ts-ignore + return fontWeight[weight]; + }}; + text-transform: ${({ capitalize }) => (capitalize ? 'capitalize' : 'none')}; + ${({ modifiers }: Props) => modifiers && modifiers}; +`; + +const Label: React.FC = ({ text = '', capitalize = false, weight = 'regular', ...props }) => { + return ( + // @ts-ignore + + {text} + + ); +}; + +export default Label; diff --git a/src/webui/components/Label/index.js b/src/webui/components/Label/index.js deleted file mode 100644 index 7d0354f42..000000000 --- a/src/webui/components/Label/index.js +++ /dev/null @@ -1,27 +0,0 @@ -/** - * @prettier - * @flow - */ - -import React from 'react'; -import styled from 'react-emotion'; -import { fontWeight } from '../../utils/styles/sizes'; - -import type { Node } from 'react'; -import { IProps } from './types'; - -const Wrapper = styled.div` - font-weight: ${({ weight }) => fontWeight[weight]}; - text-transform: ${({ capitalize }) => (capitalize ? 'capitalize' : 'none')}; - ${({ modifiers }: IProps) => modifiers && modifiers}; -`; - -const Label = ({ text = '', capitalize = false, weight = 'regular', ...props }: IProps): Node => { - return ( - - {text} - - ); -}; - -export default Label; diff --git a/src/webui/components/Label/index.ts b/src/webui/components/Label/index.ts new file mode 100644 index 000000000..01aab7060 --- /dev/null +++ b/src/webui/components/Label/index.ts @@ -0,0 +1 @@ +export { default } from './Label' diff --git a/src/webui/components/Label/types.js b/src/webui/components/Label/types.js deleted file mode 100644 index 2bda7b3d2..000000000 --- a/src/webui/components/Label/types.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - * @prettier - * @flow - */ -import type { Styles } from '../../../../types'; - -export interface IProps { - text: string; - capitalize?: boolean; - weight?: string; - modifiers?: Styles; -} diff --git a/src/webui/components/Link/Link.tsx b/src/webui/components/Link/Link.tsx new file mode 100644 index 000000000..5b950438b --- /dev/null +++ b/src/webui/components/Link/Link.tsx @@ -0,0 +1,19 @@ +/** + * @prettier + */ + +import React from 'react'; + +interface Props { + children?: Node; + to?: string; + blank?: boolean; +} + +const Link: React.FC = ({ children, to = '#', blank = false, ...props }) => ( + + {children} + +); + +export default Link; diff --git a/src/webui/components/Link/index.js b/src/webui/components/Link/index.js deleted file mode 100644 index 5a5e6e699..000000000 --- a/src/webui/components/Link/index.js +++ /dev/null @@ -1,16 +0,0 @@ -/** - * @prettier - * @flow - */ - -import React from 'react'; -import type { Node } from 'react'; -import { IProps } from './types'; - -const Link = ({ children, to = '#', blank = false, ...props }: IProps): Node => ( - - {children} - -); - -export default Link; diff --git a/src/webui/components/Link/index.ts b/src/webui/components/Link/index.ts new file mode 100644 index 000000000..518d37298 --- /dev/null +++ b/src/webui/components/Link/index.ts @@ -0,0 +1 @@ +export { default } from './Link' diff --git a/src/webui/components/Link/types.js b/src/webui/components/Link/types.js deleted file mode 100644 index 3ba30ca9f..000000000 --- a/src/webui/components/Link/types.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - * @prettier - * @flow - */ - -import type { Node } from 'react'; - -export interface IProps { - children?: Node; - to?: string; - blank?: boolean; -} diff --git a/src/webui/components/NoItems/index.js b/src/webui/components/NoItems/NoItems.tsx similarity index 53% rename from src/webui/components/NoItems/index.js rename to src/webui/components/NoItems/NoItems.tsx index e8fd6e546..e581c30b5 100644 --- a/src/webui/components/NoItems/index.js +++ b/src/webui/components/NoItems/NoItems.tsx @@ -1,14 +1,15 @@ /** * @prettier - * @flow */ import React from 'react'; -import Typography from '@material-ui/core/Typography/index'; +import Typography from '@material-ui/core/Typography'; -import { IProps } from './types'; +interface IProps { + text: string; +} -const NoItems = ({ text }: IProps) => ( +const NoItems: React.FC = ({ text }) => ( {text} diff --git a/src/webui/components/NoItems/index.ts b/src/webui/components/NoItems/index.ts new file mode 100644 index 000000000..6114feee7 --- /dev/null +++ b/src/webui/components/NoItems/index.ts @@ -0,0 +1 @@ +export { default } from './NoItems' diff --git a/src/webui/components/NoItems/types.js b/src/webui/components/NoItems/types.js deleted file mode 100644 index 50115e670..000000000 --- a/src/webui/components/NoItems/types.js +++ /dev/null @@ -1,8 +0,0 @@ -/** - * @prettier - * @flow - */ - -export interface IProps { - text: string; -} diff --git a/src/webui/components/Readme/Readme.tsx b/src/webui/components/Readme/Readme.tsx new file mode 100644 index 000000000..20e6b8793 --- /dev/null +++ b/src/webui/components/Readme/Readme.tsx @@ -0,0 +1,12 @@ +/** + * @prettier + */ + +import React from 'react'; +import 'github-markdown-css'; + +import { IProps } from './types'; + +const Readme: React.FC = ({ description }) =>
; + +export default Readme; diff --git a/src/webui/components/Readme/index.js b/src/webui/components/Readme/index.js deleted file mode 100644 index eac8a1e7e..000000000 --- a/src/webui/components/Readme/index.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * @prettier - * @flow - */ - -import React from 'react'; -import 'github-markdown-css'; - -import { IProps } from './types'; - -const Readme = ({ description }: IProps) =>
; - -export default Readme; diff --git a/src/webui/components/Readme/index.ts b/src/webui/components/Readme/index.ts new file mode 100644 index 000000000..3431b692e --- /dev/null +++ b/src/webui/components/Readme/index.ts @@ -0,0 +1 @@ +export { default } from './Readme' diff --git a/src/webui/components/Readme/types.js b/src/webui/components/Readme/types.ts similarity index 100% rename from src/webui/components/Readme/types.js rename to src/webui/components/Readme/types.ts diff --git a/src/webui/components/RegistryInfoDialog/RegistryInfoDialog.tsx b/src/webui/components/RegistryInfoDialog/RegistryInfoDialog.tsx new file mode 100644 index 000000000..87335ac53 --- /dev/null +++ b/src/webui/components/RegistryInfoDialog/RegistryInfoDialog.tsx @@ -0,0 +1,25 @@ +/** + * @prettier + */ + +import React from 'react'; +import Dialog from '@material-ui/core/Dialog'; +import DialogActions from '@material-ui/core/DialogActions'; +import Button from '@material-ui/core/Button'; +import { Title, Content } from './styles'; + +import { IProps } from './types'; + +const RegistryInfoDialog: React.FC = ({ open = false, children, onClose }) => ( + + Register Info + {children} + + + + +); + +export default RegistryInfoDialog; diff --git a/src/webui/components/RegistryInfoDialog/index.js b/src/webui/components/RegistryInfoDialog/index.js deleted file mode 100644 index 168937073..000000000 --- a/src/webui/components/RegistryInfoDialog/index.js +++ /dev/null @@ -1,28 +0,0 @@ -/** - * @prettier - * @flow - */ - -import React from 'react'; -import Dialog from '@material-ui/core/Dialog/index'; -import DialogActions from '@material-ui/core/DialogActions/index'; -import Button from '@material-ui/core/Button/index'; -import { Title, Content } from './styles'; - -import type { Node } from 'react'; - -import { IProps } from './types'; - -const RegistryInfoDialog = ({ open = false, children, onClose }: IProps): Node => ( - - {'Register Info'} - {children} - - - - -); - -export default RegistryInfoDialog; diff --git a/src/webui/components/RegistryInfoDialog/index.ts b/src/webui/components/RegistryInfoDialog/index.ts new file mode 100644 index 000000000..438d24bf7 --- /dev/null +++ b/src/webui/components/RegistryInfoDialog/index.ts @@ -0,0 +1 @@ +export { default } from './RegistryInfoDialog' diff --git a/src/webui/components/RegistryInfoDialog/styles.js b/src/webui/components/RegistryInfoDialog/styles.ts similarity index 70% rename from src/webui/components/RegistryInfoDialog/styles.js rename to src/webui/components/RegistryInfoDialog/styles.ts index ca085b142..3521c4b8c 100644 --- a/src/webui/components/RegistryInfoDialog/styles.js +++ b/src/webui/components/RegistryInfoDialog/styles.ts @@ -1,11 +1,10 @@ /** * @prettier - * @flow */ import styled from 'react-emotion'; -import DialogTitle from '@material-ui/core/DialogTitle/index'; -import DialogContent from '@material-ui/core/DialogContent/index'; +import DialogTitle from '@material-ui/core/DialogTitle'; +import DialogContent from '@material-ui/core/DialogContent'; import colors from '../../utils/styles/colors'; import { fontSize } from '../../utils/styles/sizes'; diff --git a/src/webui/components/RegistryInfoDialog/types.js b/src/webui/components/RegistryInfoDialog/types.ts similarity index 55% rename from src/webui/components/RegistryInfoDialog/types.js rename to src/webui/components/RegistryInfoDialog/types.ts index ee2d6b387..a732ce3bf 100644 --- a/src/webui/components/RegistryInfoDialog/types.js +++ b/src/webui/components/RegistryInfoDialog/types.ts @@ -1,12 +1,11 @@ /** * @prettier - * @flow */ -import type { Node } from 'react'; +import { ReactNode } from 'react'; export interface IProps { - children: Node; + children: ReactNode; open: boolean; onClose: () => void; } diff --git a/src/webui/components/Repository/index.js b/src/webui/components/Repository/Repository.tsx similarity index 75% rename from src/webui/components/Repository/index.js rename to src/webui/components/Repository/Repository.tsx index f7be699d2..95be1ee6f 100644 --- a/src/webui/components/Repository/index.js +++ b/src/webui/components/Repository/Repository.tsx @@ -9,6 +9,7 @@ import { DetailContextConsumer } from '../../pages/version/Version'; import CopyToClipBoard from '../CopyToClipBoard'; import { Heading, GithubLink, RepositoryListItem } from './styles'; +// @ts-ignore import git from './img/git.png'; class Repository extends Component { @@ -22,16 +23,11 @@ class Repository extends Component { ); }; - renderRepositoryText(url) { - return ({url}); + renderRepositoryText(url: string) { + return ({url}); } - renderRepository = ({packageMeta}) => { - const { - repository: { - url, - } = {}, - } = packageMeta.latest; + renderRepository = ({packageMeta: { latest: { repository: { url } } }}: any) => { if (!url) { return null; @@ -39,7 +35,7 @@ class Repository extends Component { return ( <> - {'Repository'}}> + Repository}> @@ -49,7 +45,7 @@ class Repository extends Component { ); } - renderContent(url) { + renderContent(url: string) { return ( {this.renderRepositoryText(url)} diff --git a/src/webui/components/Repository/index.ts b/src/webui/components/Repository/index.ts new file mode 100644 index 000000000..d85c2b7b6 --- /dev/null +++ b/src/webui/components/Repository/index.ts @@ -0,0 +1 @@ +export { default } from './Repository' diff --git a/src/webui/components/Repository/styles.js b/src/webui/components/Repository/styles.ts similarity index 100% rename from src/webui/components/Repository/styles.js rename to src/webui/components/Repository/styles.ts diff --git a/src/webui/icons/GitHub.js b/src/webui/icons/GitHub.js deleted file mode 100644 index 264784f1c..000000000 --- a/src/webui/icons/GitHub.js +++ /dev/null @@ -1,16 +0,0 @@ -// @flow -/* eslint-disable max-len */ -/* eslint-disable react/jsx-curly-brace-presence */ - -import React from 'react'; -import SvgIcon from '@material-ui/core/SvgIcon/index'; - -function GitHub(props: Object) { - return ( - - - - ); -} - -export default GitHub; diff --git a/src/webui/icons/GitHub.tsx b/src/webui/icons/GitHub.tsx new file mode 100644 index 000000000..fa005bb0d --- /dev/null +++ b/src/webui/icons/GitHub.tsx @@ -0,0 +1,13 @@ +/* eslint-disable max-len */ +/* eslint-disable react/jsx-curly-brace-presence */ + +import React from 'react'; +import SvgIcon from '@material-ui/core/SvgIcon/index'; + +const GitHub: React.FC = props => ( + + + +) + +export default GitHub; diff --git a/src/webui/icons/index.ts b/src/webui/icons/index.ts new file mode 100644 index 000000000..e1af0780c --- /dev/null +++ b/src/webui/icons/index.ts @@ -0,0 +1 @@ +export { default } from './GitHub' From e40849b92eebdd714b10eb70eceb8020341fda60 Mon Sep 17 00:00:00 2001 From: Priscila Oliveira Date: Sun, 5 May 2019 12:31:28 +0200 Subject: [PATCH 12/56] refactor: converting to ts. wip --- src/webui/components/Dependencies/index.js | 2 +- src/webui/components/DetailContainer/index.js | 2 +- src/webui/components/DetailSidebar/index.js | 2 +- src/webui/components/Header/index.js | 6 +++--- src/webui/components/Package/styles.js | 2 +- src/webui/components/UpLinks/index.js | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/webui/components/Dependencies/index.js b/src/webui/components/Dependencies/index.js index 64f4d9566..fe76067e6 100644 --- a/src/webui/components/Dependencies/index.js +++ b/src/webui/components/Dependencies/index.js @@ -10,7 +10,7 @@ import CardContent from '@material-ui/core/CardContent/index'; import { DetailContextConsumer } from '../../pages/version/Version'; import { CardWrap, Heading, Tags, Tag } from './styles'; -import NoItems from '../NoItems'; +import NoItems from '../NoItems/NoItems'; class DepDetail extends Component { constructor(props: any) { diff --git a/src/webui/components/DetailContainer/index.js b/src/webui/components/DetailContainer/index.js index fa2158b64..3c6930cc0 100644 --- a/src/webui/components/DetailContainer/index.js +++ b/src/webui/components/DetailContainer/index.js @@ -6,7 +6,7 @@ import React, { Component } from 'react'; import { DetailContextConsumer } from '../../pages/version/Version'; -import Readme from '../Readme'; +import Readme from '../Readme/Readme'; import Versions from '../Versions'; import { preventXSS } from '../../utils/sec-utils'; import Tabs from '@material-ui/core/Tabs/index'; diff --git a/src/webui/components/DetailSidebar/index.js b/src/webui/components/DetailSidebar/index.js index f98571be0..d908d225b 100644 --- a/src/webui/components/DetailSidebar/index.js +++ b/src/webui/components/DetailSidebar/index.js @@ -10,7 +10,7 @@ import Developers from '../Developers'; import Dist from '../Dist/Dist'; import Engine from '../Engines'; import Install from '../Install'; -import Repository from '../Repository'; +import Repository from '../Repository/Repository'; import { DetailContextConsumer } from '../../pages/version/Version'; diff --git a/src/webui/components/Header/index.js b/src/webui/components/Header/index.js index f1f1248d7..3fdff0c49 100644 --- a/src/webui/components/Header/index.js +++ b/src/webui/components/Header/index.js @@ -18,10 +18,10 @@ import AccountCircle from '@material-ui/icons/AccountCircle'; import { default as IconSearch } from '@material-ui/icons/Search'; import { getRegistryURL } from '../../utils/url'; -import ExternalLink from '../Link'; +import ExternalLink from '../Link/Link'; import Logo from '../Logo'; -import RegistryInfoDialog from '../RegistryInfoDialog'; -import Label from '../Label'; +import RegistryInfoDialog from '../RegistryInfoDialog/RegistryInfoDialog'; +import Label from '../Label/Label'; import Search from '../Search'; import RegistryInfoContent from '../RegistryInfoContent'; diff --git a/src/webui/components/Package/styles.js b/src/webui/components/Package/styles.js index f894b1dfb..22ae8106d 100644 --- a/src/webui/components/Package/styles.js +++ b/src/webui/components/Package/styles.js @@ -16,7 +16,7 @@ import Typography from '@material-ui/core/Typography/index'; import { breakpoints } from '../../utils/styles/media'; import Ico from '../Icon/Icon'; -import Label from '../Label'; +import Label from '../Label/Label'; import colors from '../../utils/styles/colors'; export const OverviewItem = styled.span` diff --git a/src/webui/components/UpLinks/index.js b/src/webui/components/UpLinks/index.js index c8b35d450..211ea265f 100644 --- a/src/webui/components/UpLinks/index.js +++ b/src/webui/components/UpLinks/index.js @@ -6,7 +6,7 @@ import List from '@material-ui/core/List/index'; import ListItem from '@material-ui/core/ListItem/index'; import { DetailContextConsumer } from '../../pages/version/Version'; -import NoItems from '../NoItems'; +import NoItems from '../NoItems/NoItems'; import { formatDateDistance } from '../../utils/package'; import { Heading, Spacer, ListItemText } from './styles'; From b3ed8f58f67fd401dccfa487a74bfd4e5fc12384 Mon Sep 17 00:00:00 2001 From: Priscila Oliveira Date: Sun, 5 May 2019 18:47:54 +0200 Subject: [PATCH 13/56] refactor: converting to ts --- package.json | 1 + src/webui/{app.js => app.tsx} | 43 +++---- .../{index.js => AutoComplete.tsx} | 22 ++-- src/webui/components/AutoComplete/index.ts | 1 + .../AutoComplete/{styles.js => styles.tsx} | 5 +- src/webui/components/AutoComplete/types.js | 29 ----- src/webui/components/AutoComplete/types.ts | 28 +++++ .../{index.js => Dependencies.tsx} | 18 ++- src/webui/components/Dependencies/index.ts | 1 + .../Dependencies/{styles.js => styles.ts} | 7 +- .../Dependencies/{types.js => types.ts} | 5 +- .../{index.js => DetailContainer.tsx} | 10 +- src/webui/components/DetailContainer/index.ts | 1 + .../DetailContainer/{styles.js => styles.ts} | 3 +- .../DetailContainer/{types.js => types.ts} | 5 +- .../{index.js => DetailSidebar.tsx} | 16 +-- src/webui/components/DetailSidebar/index.ts | 1 + .../DetailSidebar/{styles.js => styles.ts} | 7 +- src/webui/components/DetailSidebar/types.js | 12 -- .../Developers/{index.js => Developers.tsx} | 4 +- src/webui/components/Developers/index.ts | 1 + .../Developers/{styles.js => styles.ts} | 0 .../Engines/{index.js => Engines.tsx} | 4 +- src/webui/components/Engines/index.ts | 1 + .../Engines/{styles.js => styles.ts} | 5 +- .../Header/{index.js => Header.tsx} | 72 ++++++------ src/webui/components/Header/index.ts | 1 + .../Header/{styles.js => styles.ts} | 15 ++- .../components/Header/{types.js => types.ts} | 5 +- src/webui/components/Icon/Icon.tsx | 14 --- src/webui/components/Install/Install.tsx | 3 - .../Layout/{index.js => Layout.tsx} | 10 +- src/webui/components/Layout/index.ts | 1 + src/webui/components/Loading/Loading.tsx | 2 +- .../components/Login/{index.js => Login.tsx} | 5 +- src/webui/components/Login/index.ts | 1 + src/webui/components/Logo/Logo.tsx | 47 ++++---- src/webui/components/NoItems/NoItems.tsx | 5 +- src/webui/components/NotFound/NotFound.tsx | 1 - .../Package/{index.js => Package.tsx} | 36 +++--- src/webui/components/Package/index.ts | 1 + .../Package/{styles.js => styles.ts} | 29 ++--- .../components/Package/{types.js => types.ts} | 0 .../PackageList/{index.js => PackageList.tsx} | 17 ++- src/webui/components/PackageList/index.ts | 1 + src/webui/components/Readme/Readme.tsx | 2 +- .../{index.js => RegistryInfoContent.tsx} | 13 +-- .../components/RegistryInfoContent/index.ts | 1 + .../{styles.js => styles.ts} | 2 +- .../{types.js => types.ts} | 1 - .../Search/{index.js => Search.tsx} | 31 +++--- src/webui/components/Search/index.ts | 1 + src/webui/components/Search/types.js | 23 ---- src/webui/components/Search/types.ts | 20 ++++ .../UpLinks/{index.js => UpLinks.tsx} | 11 +- src/webui/components/UpLinks/index.ts | 1 + .../UpLinks/{styles.js => styles.ts} | 0 src/webui/components/UpLinks/types.js | 6 - .../Versions/{index.js => Versions.tsx} | 15 +-- src/webui/components/Versions/index.ts | 1 + .../Versions/{styles.js => styles.ts} | 0 src/webui/components/Versions/types.js | 6 - src/webui/pages/home/{index.js => Home.tsx} | 2 +- src/webui/pages/home/index.ts | 1 + tsconfig.json | 10 +- types/svg.d.ts | 4 + yarn.lock | 105 +++++++++++++++++- 67 files changed, 398 insertions(+), 354 deletions(-) rename src/webui/{app.js => app.tsx} (83%) rename src/webui/components/AutoComplete/{index.js => AutoComplete.tsx} (82%) create mode 100644 src/webui/components/AutoComplete/index.ts rename src/webui/components/AutoComplete/{styles.js => styles.tsx} (87%) delete mode 100644 src/webui/components/AutoComplete/types.js create mode 100644 src/webui/components/AutoComplete/types.ts rename src/webui/components/Dependencies/{index.js => Dependencies.tsx} (82%) create mode 100644 src/webui/components/Dependencies/index.ts rename src/webui/components/Dependencies/{styles.js => styles.ts} (72%) rename src/webui/components/Dependencies/{types.js => types.ts} (55%) rename src/webui/components/DetailContainer/{index.js => DetailContainer.tsx} (88%) create mode 100644 src/webui/components/DetailContainer/index.ts rename src/webui/components/DetailContainer/{styles.js => styles.ts} (67%) rename src/webui/components/DetailContainer/{types.js => types.ts} (55%) rename src/webui/components/DetailSidebar/{index.js => DetailSidebar.tsx} (82%) create mode 100644 src/webui/components/DetailSidebar/index.ts rename src/webui/components/DetailSidebar/{styles.js => styles.ts} (74%) delete mode 100644 src/webui/components/DetailSidebar/types.js rename src/webui/components/Developers/{index.js => Developers.tsx} (95%) create mode 100644 src/webui/components/Developers/index.ts rename src/webui/components/Developers/{styles.js => styles.ts} (100%) rename src/webui/components/Engines/{index.js => Engines.tsx} (95%) create mode 100644 src/webui/components/Engines/index.ts rename src/webui/components/Engines/{styles.js => styles.ts} (66%) rename src/webui/components/Header/{index.js => Header.tsx} (74%) create mode 100644 src/webui/components/Header/index.ts rename src/webui/components/Header/{styles.js => styles.ts} (82%) rename src/webui/components/Header/{types.js => types.ts} (82%) rename src/webui/components/Layout/{index.js => Layout.tsx} (73%) create mode 100644 src/webui/components/Layout/index.ts rename src/webui/components/Login/{index.js => Login.tsx} (97%) create mode 100644 src/webui/components/Login/index.ts rename src/webui/components/Package/{index.js => Package.tsx} (79%) create mode 100644 src/webui/components/Package/index.ts rename src/webui/components/Package/{styles.js => styles.ts} (78%) rename src/webui/components/Package/{types.js => types.ts} (100%) rename src/webui/components/PackageList/{index.js => PackageList.tsx} (84%) create mode 100644 src/webui/components/PackageList/index.ts rename src/webui/components/RegistryInfoContent/{index.js => RegistryInfoContent.tsx} (85%) create mode 100644 src/webui/components/RegistryInfoContent/index.ts rename src/webui/components/RegistryInfoContent/{styles.js => styles.ts} (61%) rename src/webui/components/RegistryInfoContent/{types.js => types.ts} (94%) rename src/webui/components/Search/{index.js => Search.tsx} (88%) create mode 100644 src/webui/components/Search/index.ts delete mode 100644 src/webui/components/Search/types.js create mode 100644 src/webui/components/Search/types.ts rename src/webui/components/UpLinks/{index.js => UpLinks.tsx} (81%) create mode 100644 src/webui/components/UpLinks/index.ts rename src/webui/components/UpLinks/{styles.js => styles.ts} (100%) delete mode 100644 src/webui/components/UpLinks/types.js rename src/webui/components/Versions/{index.js => Versions.tsx} (79%) create mode 100644 src/webui/components/Versions/index.ts rename src/webui/components/Versions/{styles.js => styles.ts} (100%) delete mode 100644 src/webui/components/Versions/types.js rename src/webui/pages/home/{index.js => Home.tsx} (91%) create mode 100644 src/webui/pages/home/index.ts create mode 100644 types/svg.d.ts diff --git a/package.json b/package.json index 8539f47c9..c1525b320 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "@commitlint/config-conventional": "7.5.0", "@material-ui/core": "3.9.3", "@material-ui/icons": "3.0.2", + "@material-ui/styles": "3.0.0-alpha.10", "@octokit/rest": "16.23.2", "@types/lodash": "4.14.123", "@types/material-ui": "0.21.6", diff --git a/src/webui/app.js b/src/webui/app.tsx similarity index 83% rename from src/webui/app.js rename to src/webui/app.tsx index 093621457..29add05a0 100644 --- a/src/webui/app.js +++ b/src/webui/app.tsx @@ -2,13 +2,13 @@ * @prettier */ -import React, { Component, Fragment } from 'react'; +import React, { Component } from 'react'; import isNil from 'lodash/isNil'; import storage from './utils/storage'; import { makeLogin, isTokenExpire } from './utils/login'; -import Loading from './components/Loading/Loading'; +import Loading from './components/Loading'; import LoginModal from './components/Login'; import Header from './components/Header'; import { Container, Content } from './components/Layout'; @@ -19,15 +19,17 @@ import './styles/main.scss'; import 'normalize.css'; import Footer from './components/Footer'; -export const AppContext = React.createContext(); +export const AppContext = React.createContext(null); export const AppContextProvider = AppContext.Provider; export const AppContextConsumer = AppContext.Consumer; -export default class App extends Component { +export default class App extends Component { state = { error: {}, + // @ts-ignore logoUrl: window.VERDACCIO_LOGO, user: {}, + // @ts-ignore scope: window.VERDACCIO_SCOPE ? `${window.VERDACCIO_SCOPE}:` : '', showLoginModal: false, isUserLoggedIn: false, @@ -51,14 +53,17 @@ export default class App extends Component { render() { const { isLoading, isUserLoggedIn, packages, logoUrl, user, scope } = this.state; + const context: any = { isUserLoggedIn, packages, logoUrl, user, scope }; + return ( + // @ts-ignore {isLoading ? ( ) : ( - - {this.renderContent()} - + <> + {this.renderContent()} + )} {this.renderLoginModal()} @@ -81,8 +86,10 @@ export default class App extends Component { loadOnHandler = async () => { try { + // @ts-ignore this.req = await API.request('packages', 'GET'); this.setState({ + // @ts-ignore packages: this.req, isLoading: false, }); @@ -107,6 +114,7 @@ export default class App extends Component { */ handleToggleLoginModal = () => { this.setState(prevState => ({ + // @ts-ignore showLoginModal: !prevState.showLoginModal, error: {}, })); @@ -159,32 +167,29 @@ export default class App extends Component { renderLoginModal = () => { const { error, showLoginModal } = this.state; - return ( - - ); + return ; }; renderContent = () => { return ( - + <> {this.renderHeader()}