Skip to content
This repository has been archived by the owner on Jan 16, 2022. It is now read-only.

Refactor: migrating Flow to Typescript #47

Merged
merged 69 commits into from
Jun 20, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
13b1d89
refactor: refactoring to typescript
priscilawebdev May 3, 2019
66632ac
refactor: migrating to typescript
priscilawebdev May 3, 2019
64c8b7f
refactor: applied feedbacks
priscilawebdev May 4, 2019
c54c256
Merge branch '4.x-master' into refactor/7_convert_flow_type_to_typesc…
priscilawebdev May 4, 2019
c225d77
fix: fixed conflicts
priscilawebdev May 4, 2019
8ee20c6
refactored: changed registry
priscilawebdev May 4, 2019
23c281a
refactor: updated registry & removed unnecessary lib
priscilawebdev May 4, 2019
a329d7e
fix: fixed registry ur
priscilawebdev May 4, 2019
8c82c92
fix: fixed page load
priscilawebdev May 4, 2019
274bc2c
refactor: refactored footer wip
priscilawebdev May 4, 2019
f0fde1d
Merge branch '4.x-master' into refactor/7_convert_flow_type_to_typesc…
juanpicado May 4, 2019
a863612
refactor: converting to ts..wip
priscilawebdev May 5, 2019
85a140e
Merge branch 'refactor/7_convert_flow_type_to_typescript' of https://…
priscilawebdev May 5, 2019
59f7815
refactor: converting to ts. wip
priscilawebdev May 5, 2019
e40849b
refactor: converting to ts. wip
priscilawebdev May 5, 2019
b3ed8f5
refactor: converting to ts
priscilawebdev May 5, 2019
682ab3b
refactor: converting to ts
priscilawebdev May 5, 2019
a0413ac
fix: fixed load errors
priscilawebdev May 5, 2019
089cb5b
refactor: converted files to ts
priscilawebdev May 5, 2019
a7c8ad5
refactor: removed flow from tests
priscilawebdev May 5, 2019
ede2d0b
fix: removed transpiled files
priscilawebdev May 7, 2019
47520be
refactor: added ts-ignore
priscilawebdev May 7, 2019
99d3451
fix: fixed errors
priscilawebdev May 7, 2019
e1768b3
Merge branch '4.x-master' into refactor/7_convert_flow_type_to_typesc…
verdacciobot May 7, 2019
17ddd9f
fix: fixed types
priscilawebdev May 7, 2019
dc0bec4
Merge branch 'refactor/7_convert_flow_type_to_typescript' of https://…
priscilawebdev May 7, 2019
b07d18d
fix: fixing jest import -.-
priscilawebdev May 9, 2019
442ce7c
fix: fixing lint errors
priscilawebdev May 9, 2019
db7efdb
Merge branch '4.x-master' into refactor/7_convert_flow_type_to_typesc…
juanpicado May 10, 2019
46c8c7c
Merge branch '4.x-master' into refactor/7_convert_flow_type_to_typesc…
priscilawebdev May 12, 2019
589b26b
fix: fixing lint errors
priscilawebdev May 12, 2019
af73e7e
fix: fixed lint errors
priscilawebdev May 12, 2019
c245ec5
refactor: removed unnecessary tsconfig's config
priscilawebdev May 12, 2019
c930301
fix: fixing errors
priscilawebdev May 12, 2019
781d8e3
fix: fixed warning
priscilawebdev May 12, 2019
b90ae4b
Merge branch '4.x-master' into refactor/7_convert_flow_type_to_typesc…
priscilawebdev May 16, 2019
9a5d884
fix: fixed test
priscilawebdev May 16, 2019
3fb3ad6
Merge branch '4.x-master' into refactor/7_convert_flow_type_to_typesc…
priscilawebdev May 19, 2019
303abc2
refactor: wip
priscilawebdev May 19, 2019
60974c3
refactor: wip
priscilawebdev May 19, 2019
4d92a6e
refactor: wip
priscilawebdev May 19, 2019
bd66f87
fix: fixing tests: wip
priscilawebdev May 19, 2019
9647666
wip
priscilawebdev May 19, 2019
a3e8229
wip
priscilawebdev May 19, 2019
0b7f4fb
fix: fixed search test
priscilawebdev May 19, 2019
fee8d72
wip
priscilawebdev May 19, 2019
9d93f1d
fix: fixing lint errors
priscilawebdev May 23, 2019
28c7632
Merge branch 'refactor/7_convert_flow_type_to_typescript' of https://…
priscilawebdev May 23, 2019
b58fde7
fix: re-added stylelint
priscilawebdev May 23, 2019
3edbbdc
refactor: updated stylelint script
priscilawebdev May 23, 2019
2a85821
fix: fixed: 'styles.js' were found.
priscilawebdev May 26, 2019
998a5fd
Merge branch '4.x-master' into refactor/7_convert_flow_type_to_typesc…
juanpicado May 27, 2019
6f08526
Merge remote-tracking branch 'origin/4.x-master' into refactor/7_conv…
juanpicado Jun 10, 2019
f29d153
Merge branch '4.x-master' into refactor/7_convert_flow_type_to_typesc…
juanpicado Jun 15, 2019
a740a9a
fix: fixed Search tests
priscilawebdev Jun 15, 2019
0b497cb
chore: enable eslint
juanpicado Jun 17, 2019
a2812c9
chore: vcode eslint settings
juanpicado Jun 18, 2019
a045626
chore: restore eslint previous conf
juanpicado Jun 18, 2019
803f6ca
chore: clean jest config
juanpicado Jun 18, 2019
e91b738
chore: fix eslint warnings
juanpicado Jun 18, 2019
07493be
chore: eslint errors cleared
juanpicado Jun 19, 2019
462d744
chore: update handler name
juanpicado Jun 19, 2019
e573713
chore: restore logo from img to url css prop
juanpicado Jun 19, 2019
b25e19e
chore: update stylelint linting
juanpicado Jun 19, 2019
f205bb3
chore: update stylelint linting
juanpicado Jun 19, 2019
deb918d
chore: fix a mistake on move tabs to a function
juanpicado Jun 20, 2019
6cf5d28
chore: eanble bundlezie
juanpicado Jun 20, 2019
5a39ebe
chore: use default_executor in circleci
juanpicado Jun 20, 2019
1599cc3
chore: update readme
juanpicado Jun 20, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
"@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",
"@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",
Expand Down Expand Up @@ -88,7 +93,14 @@
"stylelint-scss": "3.5.4",
"stylelint-webpack-plugin": "0.10.5",
"supertest": "3.4.2",
"ts-loader": "5.4.5",
priscilawebdev marked this conversation as resolved.
Show resolved Hide resolved
"tslint": "5.16.0",
priscilawebdev marked this conversation as resolved.
Show resolved Hide resolved
"tslint-config-prettier": "1.18.0",
priscilawebdev marked this conversation as resolved.
Show resolved Hide resolved
"tslint-plugin-prettier": "2.0.1",
"tslint-react": "4.0.0",
"typeface-roboto": "0.0.54",
"typescript": "3.4.5",
priscilawebdev marked this conversation as resolved.
Show resolved Hide resolved
"typescript-tslint-plugin": "0.3.1",
"url-loader": "1.1.2",
"verdaccio": "4.0.0-alpha.7",
"verdaccio-auth-memory": "0.0.4",
Expand All @@ -107,6 +119,7 @@
"verdaccio-theme"
],
"scripts": {
"tslint": "tslint --project . --format verbose",
priscilawebdev marked this conversation as resolved.
Show resolved Hide resolved
"flow": "flow check",
"release": "standard-version -a -s",
"test:clean": "npx jest --clearCache",
Expand Down
1 change: 0 additions & 1 deletion src/config/env.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/**
* @prettier
* @flow
*/

const path = require('path');
Expand Down
2 changes: 0 additions & 2 deletions src/lib/constants.js → src/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
* @prettier
*/

// @flow

export const DIST_TAGS = 'dist-tags';

export const HEADERS = {
Expand Down
Original file line number Diff line number Diff line change
@@ -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<IProps> = ({ text, children }) => {
const renderToolTipFileCopy = () => (
<Tooltip disableFocusListener={true} title={TEXT.CLIPBOARD_COPY}>
<Tooltip disableFocusListener title={TEXT.CLIPBOARD_COPY}>
<CopyIcon onClick={copyToClipBoardUtility(text)}>
<FileCopy />
</CopyIcon>
</Tooltip>
);

const renderText = children => {
const renderText = (children: any) => {
if (children) {
return <ClipBoardCopyText>{children}</ClipBoardCopyText>;
}
Expand Down
1 change: 1 addition & 0 deletions src/webui/components/CopyToClipBoard/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './CopyToClipBoard'
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
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;
justify-content: space-between;
}
`;

export const ClipBoardCopyText = styled.span`
export const ClipBoardCopyText = styled('span')`
&& {
display: inline-block;
text-overflow: ellipsis;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/**
* @prettier
* @flow
*/

export interface IProps {
Expand Down
50 changes: 50 additions & 0 deletions src/webui/components/Help/Help.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<>
<Typography variant={'body2'}>{title}</Typography>
<CopyToClipBoard text={text} />
</>
);
}

const Help: React.FC = () => {
const registryUrl = getRegistryURL();

return (
<Card id="help-card">
<CardContent>
<Typography component="h2" gutterBottom id="help-card__title" variant="headline">
No Package Published Yet.
</Typography>
<HelpTitle color="textSecondary" gutterBottom>
To publish your first package just:
</HelpTitle>
{renderHeadingClipboardSegments('1. Login', `npm adduser --registry ${registryUrl}`)}
{renderHeadingClipboardSegments('2. Publish', `npm publish --registry ${registryUrl}`)}
<Typography variant="body2">3. Refresh this page.</Typography>
</CardContent>
<CardActions>
<Button color="primary" href="https://verdaccio.org/docs/en/installation" size="small" target="_blank">
Learn More
</Button>
</CardActions>
</Card>
);
};

export default Help;
51 changes: 0 additions & 51 deletions src/webui/components/Help/index.js

This file was deleted.

1 change: 1 addition & 0 deletions src/webui/components/Help/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './Help'
Original file line number Diff line number Diff line change
Expand Up @@ -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)`
&& {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,44 @@
* @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 (
<DetailContextConsumer>
{context => {
{(context: any) => {
return this.renderCopyCLI(context);
}}
</DetailContextConsumer>
);
}

renderCopyCLI = ({ packageName }) => {
public renderCopyCLI = ({ packageName }: { packageName: string }) => {
return (
<>
<List subheader={<Heading variant={'subheading'}>{'Installation'}</Heading>}>{this.renderListItems(packageName)}</List>
</>
);
};

renderListItems = packageName => {
public renderListItems = (packageName: string) => {
return (
<>
<InstallItem>
Expand Down
1 change: 1 addition & 0 deletions src/webui/components/Install/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './Install'
Original file line number Diff line number Diff line change
@@ -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)`
&& {
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -18,6 +19,7 @@ const Logo = styled.div`
width: 40px;
height: 40px;
${props =>
// @ts-ignore
props.md &&
css`
width: 90px;
Expand Down
1 change: 1 addition & 0 deletions src/webui/components/Logo/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './Logo'
Original file line number Diff line number Diff line change
Expand Up @@ -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<RouteComponentProps & { width: any }> = ({ history, width }) => {
const handleGoTo = (to: string) => () => {
history.push(to);
};

Expand All @@ -24,17 +26,17 @@ const NotFound = ({ history, width }) => {

const renderList = () => (
<List>
<ListItem button={true} divider={true} onClick={handleGoTo('/')}>
{'Home'}
<ListItem button divider onClick={handleGoTo('/')}>
Home
</ListItem>
<ListItem button={true} divider={true} onClick={handleGoBack()}>
{'Back'}
<ListItem button divider onClick={handleGoBack()}>
Back
</ListItem>
</List>
);

const renderSubTitle = () => (
<Typography variant={'subtitle1'}>
<Typography variant="subtitle1">
<div>{"The page you're looking for doesn't exist."}</div>
<div>{'Perhaps these links will help find what you are looking for:'}</div>
</Typography>
Expand All @@ -43,8 +45,8 @@ const NotFound = ({ history, width }) => {
return (
<Wrapper>
<Inner>
<EmptyPackage alt={'404 - Page not found'} src={PackageImg} />
<Heading className={'not-found-text'} variant={isWidthUp('sm', width) ? 'h2' : 'h4'}>
<EmptyPackage alt="404 - Page not found" src={PackageImg} />
<Heading className="not-found-text" variant={isWidthUp('sm', width) ? 'h2' : 'h4'}>
{NOT_FOUND_TEXT}
</Heading>
{renderSubTitle()}
Expand Down
1 change: 1 addition & 0 deletions src/webui/components/NotFound/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './NotFound'
Loading