mirror of
https://github.com/SomboChea/ui
synced 2024-11-24 15:04:27 +07:00
Merge branch 'master' into juanpicado-patch-1
This commit is contained in:
commit
cdfbde1df1
28
.github/workflows/nodejs.yml
vendored
Normal file
28
.github/workflows/nodejs.yml
vendored
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
name: Node CI
|
||||||
|
|
||||||
|
on: [push]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
ci:
|
||||||
|
name: Test on node ${{ matrix.node_version }} and ${{ matrix.os }}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
node_version: [8, 10, 12]
|
||||||
|
os: [ubuntu-latest, windows-latest, macOS-latest]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- name: Use Node.js ${{ matrix.node_version }}
|
||||||
|
uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
version: ${{ matrix.node_version }}
|
||||||
|
|
||||||
|
- name: Use Yarn 1.17.2
|
||||||
|
run: |
|
||||||
|
npm install -g yarn@1.17.2
|
||||||
|
- name: yarn build
|
||||||
|
run: |
|
||||||
|
yarn install
|
||||||
|
yarn lint
|
||||||
|
yarn build
|
62
package.json
62
package.json
@ -19,8 +19,8 @@
|
|||||||
"@types/enzyme": "3.10.3",
|
"@types/enzyme": "3.10.3",
|
||||||
"@types/lodash": "4.14.136",
|
"@types/lodash": "4.14.136",
|
||||||
"@types/material-ui": "0.21.6",
|
"@types/material-ui": "0.21.6",
|
||||||
"@types/node": "12.6.9",
|
"@types/node": "12.7.1",
|
||||||
"@types/react": "16.8.24",
|
"@types/react": "16.9.1",
|
||||||
"@types/react-dom": "16.8.5",
|
"@types/react-dom": "16.8.5",
|
||||||
"@types/react-router-dom": "4.3.4",
|
"@types/react-router-dom": "4.3.4",
|
||||||
"@types/validator": "10.11.2",
|
"@types/validator": "10.11.2",
|
||||||
@ -30,75 +30,77 @@
|
|||||||
"autosuggest-highlight": "3.1.1",
|
"autosuggest-highlight": "3.1.1",
|
||||||
"babel-loader": "8.0.6",
|
"babel-loader": "8.0.6",
|
||||||
"bundlesize": "0.18.0",
|
"bundlesize": "0.18.0",
|
||||||
"codeceptjs": "2.1.0",
|
"codeceptjs": "2.2.1",
|
||||||
"codecov": "3.5.0",
|
"codecov": "3.5.0",
|
||||||
"concurrently": "4.1.1",
|
"concurrently": "4.1.1",
|
||||||
"cross-env": "5.2.0",
|
"cross-env": "5.2.0",
|
||||||
"css-loader": "0.28.10",
|
"css-loader": "3.2.0",
|
||||||
"date-fns": "1.30.1",
|
"date-fns": "1.30.1",
|
||||||
"emotion": "9.2.12",
|
"emotion": "9.2.12",
|
||||||
"enzyme": "3.10.0",
|
"enzyme": "3.10.0",
|
||||||
"enzyme-adapter-react-16": "1.14.0",
|
"enzyme-adapter-react-16": "1.14.0",
|
||||||
"enzyme-to-json": "3.4.0",
|
"enzyme-to-json": "3.4.0",
|
||||||
"eslint": "5.16.0",
|
"eslint": "5.16.0",
|
||||||
"eslint-plugin-codeceptjs": "1.0.0",
|
"eslint-plugin-codeceptjs": "1.1.0",
|
||||||
"eslint-plugin-jsx-a11y": "6.2.1",
|
"eslint-plugin-jsx-a11y": "6.2.3",
|
||||||
"eslint-plugin-prettier": "3.1.0",
|
"eslint-plugin-prettier": "3.1.0",
|
||||||
"eslint-plugin-react": "7.13.0",
|
"eslint-plugin-react": "7.14.3",
|
||||||
"eslint-plugin-verdaccio": "2.0.0",
|
"eslint-plugin-verdaccio": "2.0.0",
|
||||||
"file-loader": "2.0.0",
|
"file-loader": "4.2.0",
|
||||||
"friendly-errors-webpack-plugin": "1.7.0",
|
"friendly-errors-webpack-plugin": "1.7.0",
|
||||||
"get-stdin": "6.0.0",
|
"get-stdin": "6.0.0",
|
||||||
"github-markdown-css": "2.10.0",
|
"github-markdown-css": "3.0.1",
|
||||||
"html-webpack-plugin": "3.2.0",
|
"html-webpack-plugin": "3.2.0",
|
||||||
"husky": "3.0.2",
|
"husky": "3.0.3",
|
||||||
"identity-obj-proxy": "3.0.0",
|
"identity-obj-proxy": "3.0.0",
|
||||||
"in-publish": "2.0.0",
|
"in-publish": "2.0.0",
|
||||||
"jest": "24.8.0",
|
"jest": "24.8.0",
|
||||||
"jest-emotion": "10.0.11",
|
"jest-emotion": "10.0.14",
|
||||||
"jest-environment-jsdom": "24.8.0",
|
"jest-environment-jsdom": "24.8.0",
|
||||||
"jest-environment-jsdom-global": "1.2.0",
|
"jest-environment-jsdom-global": "1.2.0",
|
||||||
"jest-environment-node": "24.8.0",
|
"jest-environment-node": "24.8.0",
|
||||||
|
"js-base64": "2.5.1",
|
||||||
"js-yaml": "3.13.1",
|
"js-yaml": "3.13.1",
|
||||||
"localstorage-memory": "1.0.3",
|
"localstorage-memory": "1.0.3",
|
||||||
"mini-css-extract-plugin": "0.7.0",
|
"mini-css-extract-plugin": "0.8.0",
|
||||||
"node-mocks-http": "1.7.3",
|
"node-mocks-http": "1.7.6",
|
||||||
"normalize.css": "8.0.1",
|
"normalize.css": "8.0.1",
|
||||||
"optimize-css-assets-webpack-plugin": "5.0.1",
|
"optimize-css-assets-webpack-plugin": "5.0.3",
|
||||||
"ora": "3.4.0",
|
"ora": "3.4.0",
|
||||||
"prettier": "1.18.2",
|
"prettier": "1.18.2",
|
||||||
"prop-types": "15.7.2",
|
"prop-types": "15.7.2",
|
||||||
"puppeteer": "1.17.0",
|
"puppeteer": "1.17.0",
|
||||||
"react": "16.8.3",
|
"react": "16.9.0",
|
||||||
"react-autosuggest": "9.4.2",
|
"react-autosuggest": "9.4.3",
|
||||||
"react-dom": "16.8.3",
|
"react-dom": "16.9.0",
|
||||||
"react-emotion": "9.2.12",
|
"react-emotion": "9.2.12",
|
||||||
"react-hot-loader": "4.7.1",
|
"react-hot-loader": "4.12.10",
|
||||||
"react-router": "4.3.1",
|
"react-router": "5.0.1",
|
||||||
"react-router-dom": "4.3.1",
|
"react-router-dom": "5.0.1",
|
||||||
"resolve-url-loader": "3.0.1",
|
"resolve-url-loader": "3.1.0",
|
||||||
"rimraf": "2.6.3",
|
"rimraf": "2.6.3",
|
||||||
"source-map-loader": "0.2.4",
|
"source-map-loader": "0.2.4",
|
||||||
"standard-version": "4.4.0",
|
"standard-version": "7.0.0",
|
||||||
"style-loader": "0.23.1",
|
"style-loader": "1.0.0",
|
||||||
"stylelint": "10.1.0",
|
"stylelint": "10.1.0",
|
||||||
"stylelint-config-recommended": "2.2.0",
|
"stylelint-config-recommended": "2.2.0",
|
||||||
"stylelint-config-styled-components": "0.1.1",
|
"stylelint-config-styled-components": "0.1.1",
|
||||||
"stylelint-processor-styled-components": "1.8.0",
|
"stylelint-processor-styled-components": "1.8.0",
|
||||||
"stylelint-webpack-plugin": "0.10.5",
|
"stylelint-webpack-plugin": "0.10.5",
|
||||||
"supertest": "4.0.2",
|
"supertest": "4.0.2",
|
||||||
"typeface-roboto": "0.0.54",
|
"typeface-roboto": "0.0.75",
|
||||||
"typescript": "3.5.3",
|
"typescript": "3.5.3",
|
||||||
"url-loader": "1.1.2",
|
"uglifyjs-webpack-plugin": "2.2.0",
|
||||||
"validator": "10.11.0",
|
"url-loader": "2.1.0",
|
||||||
"verdaccio": "4.2.0",
|
"validator": "11.1.0",
|
||||||
|
"verdaccio": "4.2.1",
|
||||||
"verdaccio-auth-memory": "1.1.5",
|
"verdaccio-auth-memory": "1.1.5",
|
||||||
"verdaccio-memory": "2.0.0",
|
"verdaccio-memory": "2.0.0",
|
||||||
"webpack": "4.20.2",
|
"webpack": "4.39.1",
|
||||||
"webpack-bundle-analyzer": "3.3.2",
|
"webpack-bundle-analyzer": "3.4.1",
|
||||||
"webpack-bundle-size-analyzer": "3.0.0",
|
"webpack-bundle-size-analyzer": "3.0.0",
|
||||||
"webpack-cli": "3.3.6",
|
"webpack-cli": "3.3.6",
|
||||||
"webpack-dev-server": "3.7.2",
|
"webpack-dev-server": "3.8.0",
|
||||||
"webpack-merge": "4.2.1",
|
"webpack-merge": "4.2.1",
|
||||||
"whatwg-fetch": "3.0.0",
|
"whatwg-fetch": "3.0.0",
|
||||||
"xss": "1.0.6"
|
"xss": "1.0.6"
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
import styled from 'react-emotion';
|
import styled from 'react-emotion';
|
||||||
import ListItem from '@material-ui/core/ListItem';
|
import ListItem from '@material-ui/core/ListItem';
|
||||||
import Typography from '@material-ui/core/Typography';
|
import Typography from '@material-ui/core/Typography';
|
||||||
|
import { fontWeight } from '../../utils/styles/sizes';
|
||||||
|
|
||||||
export const Heading = styled(Typography)({
|
export const Heading = styled(Typography)({
|
||||||
'&&': {
|
'&&': {
|
||||||
fontWeight: 700,
|
fontWeight: fontWeight.bold,
|
||||||
textTransform: 'capitalize',
|
textTransform: 'capitalize',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -2,6 +2,7 @@ import styled from 'react-emotion';
|
|||||||
import Card from '@material-ui/core/Card';
|
import Card from '@material-ui/core/Card';
|
||||||
import Typography from '@material-ui/core/Typography';
|
import Typography from '@material-ui/core/Typography';
|
||||||
import Chip from '@material-ui/core/Chip';
|
import Chip from '@material-ui/core/Chip';
|
||||||
|
import { fontWeight } from '../../utils/styles/sizes';
|
||||||
|
|
||||||
export const CardWrap = styled(Card)({
|
export const CardWrap = styled(Card)({
|
||||||
'&&': {
|
'&&': {
|
||||||
@ -11,7 +12,7 @@ export const CardWrap = styled(Card)({
|
|||||||
|
|
||||||
export const Heading = styled(Typography)({
|
export const Heading = styled(Typography)({
|
||||||
'&&': {
|
'&&': {
|
||||||
fontWeight: 700,
|
fontWeight: fontWeight.bold,
|
||||||
textTransform: 'capitalize',
|
textTransform: 'capitalize',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -2,6 +2,7 @@ import styled from 'react-emotion';
|
|||||||
import Typography from '@material-ui/core/Typography';
|
import Typography from '@material-ui/core/Typography';
|
||||||
import { default as MuiFab } from '@material-ui/core/Fab';
|
import { default as MuiFab } from '@material-ui/core/Fab';
|
||||||
import colors from '../../utils/styles/colors';
|
import colors from '../../utils/styles/colors';
|
||||||
|
import { fontWeight } from '../../utils/styles/sizes';
|
||||||
|
|
||||||
export const Details = styled('span')({
|
export const Details = styled('span')({
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
@ -20,7 +21,7 @@ export const Content = styled('div')({
|
|||||||
|
|
||||||
export const Heading = styled(Typography)({
|
export const Heading = styled(Typography)({
|
||||||
'&&': {
|
'&&': {
|
||||||
fontWeight: 700,
|
fontWeight: fontWeight.bold,
|
||||||
marginBottom: '10px',
|
marginBottom: '10px',
|
||||||
textTransform: 'capitalize',
|
textTransform: 'capitalize',
|
||||||
},
|
},
|
||||||
|
@ -5,10 +5,11 @@ import ListItem from '@material-ui/core/ListItem';
|
|||||||
import Typography from '@material-ui/core/Typography';
|
import Typography from '@material-ui/core/Typography';
|
||||||
|
|
||||||
import colors from '../../utils/styles/colors';
|
import colors from '../../utils/styles/colors';
|
||||||
|
import { fontWeight } from '../../utils/styles/sizes';
|
||||||
|
|
||||||
export const Heading = styled(Typography)({
|
export const Heading = styled(Typography)({
|
||||||
'&&': {
|
'&&': {
|
||||||
fontWeight: 700,
|
fontWeight: fontWeight.bold,
|
||||||
textTransform: 'capitalize',
|
textTransform: 'capitalize',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
import styled from 'react-emotion';
|
import styled from 'react-emotion';
|
||||||
import ListItem from '@material-ui/core/ListItem';
|
import ListItem from '@material-ui/core/ListItem';
|
||||||
import Typography from '@material-ui/core/Typography';
|
import Typography from '@material-ui/core/Typography';
|
||||||
|
import { fontWeight } from '../../utils/styles/sizes';
|
||||||
|
|
||||||
export const Heading = styled(Typography)({
|
export const Heading = styled(Typography)({
|
||||||
'&&': {
|
'&&': {
|
||||||
fontWeight: 700,
|
fontWeight: fontWeight.bold,
|
||||||
textTransform: 'capitalize',
|
textTransform: 'capitalize',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -49,7 +49,7 @@ export const InnerMobileNavBar = styled('div')({
|
|||||||
backgroundColor: colors.greyLight,
|
backgroundColor: colors.greyLight,
|
||||||
color: colors.white,
|
color: colors.white,
|
||||||
width: '100%',
|
width: '100%',
|
||||||
padding: '0px 5px',
|
padding: '0 5px',
|
||||||
margin: '0 10px 0 0',
|
margin: '0 10px 0 0',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -2,10 +2,11 @@ import Avatar from '@material-ui/core/Avatar';
|
|||||||
import ListItem from '@material-ui/core/ListItem';
|
import ListItem from '@material-ui/core/ListItem';
|
||||||
import Typography from '@material-ui/core/Typography';
|
import Typography from '@material-ui/core/Typography';
|
||||||
import styled from 'react-emotion';
|
import styled from 'react-emotion';
|
||||||
|
import { fontWeight } from '../../utils/styles/sizes';
|
||||||
|
|
||||||
export const Heading = styled(Typography)({
|
export const Heading = styled(Typography)({
|
||||||
'&&': {
|
'&&': {
|
||||||
fontWeight: 700,
|
fontWeight: fontWeight.bold,
|
||||||
textTransform: 'capitalize',
|
textTransform: 'capitalize',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
import styled, { css } from 'react-emotion';
|
import styled, { css } from 'react-emotion';
|
||||||
|
import colors from '../../utils/styles/colors';
|
||||||
|
|
||||||
export const Content = styled('div')({
|
export const Content = styled('div')({
|
||||||
'&&': {
|
'&&': {
|
||||||
backgroundColor: '#ffffff',
|
backgroundColor: colors.white,
|
||||||
flex: 1,
|
flex: 1,
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
position: 'relative',
|
position: 'relative',
|
||||||
|
@ -13,6 +13,7 @@ import { breakpoints } from '../../utils/styles/media';
|
|||||||
import Ico from '../Icon';
|
import Ico from '../Icon';
|
||||||
import Label from '../Label';
|
import Label from '../Label';
|
||||||
import colors from '../../utils/styles/colors';
|
import colors from '../../utils/styles/colors';
|
||||||
|
import { fontWeight } from '../../utils/styles/sizes';
|
||||||
|
|
||||||
export const OverviewItem = styled('span')`
|
export const OverviewItem = styled('span')`
|
||||||
&& {
|
&& {
|
||||||
@ -36,7 +37,7 @@ export const OverviewItem = styled('span')`
|
|||||||
|
|
||||||
export const Icon = styled(Ico)({
|
export const Icon = styled(Ico)({
|
||||||
'&&': {
|
'&&': {
|
||||||
margin: '2px 10px 0px 0',
|
margin: '2px 10px 0 0',
|
||||||
fill: colors.greyLight2,
|
fill: colors.greyLight2,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@ -44,7 +45,7 @@ export const Icon = styled(Ico)({
|
|||||||
export const Published = styled('span')({
|
export const Published = styled('span')({
|
||||||
'&&': {
|
'&&': {
|
||||||
color: colors.greyLight2,
|
color: colors.greyLight2,
|
||||||
margin: '0px 5px 0px 0px',
|
margin: '0 5px 0 0',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -52,7 +53,7 @@ export const Published = styled('span')({
|
|||||||
export const Text = styled(Label)({
|
export const Text = styled(Label)({
|
||||||
'&&': {
|
'&&': {
|
||||||
fontSize: '12px',
|
fontSize: '12px',
|
||||||
fontWeight: 500,
|
fontWeight: fontWeight.semiBold,
|
||||||
color: colors.greyLight2,
|
color: colors.greyLight2,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -5,10 +5,11 @@ import Typography from '@material-ui/core/Typography';
|
|||||||
|
|
||||||
import Github from '../../icons/GitHub';
|
import Github from '../../icons/GitHub';
|
||||||
import colors from '../../utils/styles/colors';
|
import colors from '../../utils/styles/colors';
|
||||||
|
import { fontWeight } from '../../utils/styles/sizes';
|
||||||
|
|
||||||
export const Heading = styled(Typography)({
|
export const Heading = styled(Typography)({
|
||||||
'&&': {
|
'&&': {
|
||||||
fontWeight: 700,
|
fontWeight: fontWeight.bold,
|
||||||
textTransform: 'capitalize',
|
textTransform: 'capitalize',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
import styled from 'react-emotion';
|
import styled from 'react-emotion';
|
||||||
import Typography from '@material-ui/core/Typography';
|
import Typography from '@material-ui/core/Typography';
|
||||||
import { default as MuiListItemText } from '@material-ui/core/ListItemText';
|
import { default as MuiListItemText } from '@material-ui/core/ListItemText';
|
||||||
|
import { fontWeight } from '../../utils/styles/sizes';
|
||||||
|
|
||||||
export const Heading = styled(Typography)({
|
export const Heading = styled(Typography)({
|
||||||
'&&': {
|
'&&': {
|
||||||
fontWeight: 700,
|
fontWeight: fontWeight.bold,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
import styled from 'react-emotion';
|
import styled from 'react-emotion';
|
||||||
import Typography from '@material-ui/core/Typography';
|
import Typography from '@material-ui/core/Typography';
|
||||||
import { default as MuiListItemText } from '@material-ui/core/ListItemText';
|
import { default as MuiListItemText } from '@material-ui/core/ListItemText';
|
||||||
|
import { fontWeight } from '../../utils/styles/sizes';
|
||||||
|
|
||||||
export const Heading = styled(Typography)({
|
export const Heading = styled(Typography)({
|
||||||
'&&': {
|
'&&': {
|
||||||
fontWeight: 700,
|
fontWeight: fontWeight.bold,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -11,6 +11,22 @@ describe('api', () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
describe('handleResponseType', () => {
|
describe('handleResponseType', () => {
|
||||||
|
test('should handle missing Content-Type', async () => {
|
||||||
|
const response: Response = {
|
||||||
|
url: 'http://localhost:8080/-/packages',
|
||||||
|
ok: false,
|
||||||
|
// @ts-ignore
|
||||||
|
headers: {
|
||||||
|
get: () => null,
|
||||||
|
} as Headers,
|
||||||
|
} as Response;
|
||||||
|
|
||||||
|
const handled = await handleResponseType(response);
|
||||||
|
|
||||||
|
// Should this actually return [false, null] ?
|
||||||
|
expect(handled).toBeUndefined();
|
||||||
|
});
|
||||||
|
|
||||||
test('should test tgz scenario', async () => {
|
test('should test tgz scenario', async () => {
|
||||||
const blob = new Blob(['foo']);
|
const blob = new Blob(['foo']);
|
||||||
const blobPromise = Promise.resolve<Blob>(blob);
|
const blobPromise = Promise.resolve<Blob>(blob);
|
||||||
|
@ -8,20 +8,20 @@ import '../../types';
|
|||||||
*/
|
*/
|
||||||
export function handleResponseType(response: Response): Promise<[boolean, Blob | string]> | Promise<void> {
|
export function handleResponseType(response: Response): Promise<[boolean, Blob | string]> | Promise<void> {
|
||||||
if (response.headers) {
|
if (response.headers) {
|
||||||
const contentType = response.headers.get('Content-Type') as string;
|
const contentType = response.headers.get('Content-Type');
|
||||||
if (contentType.includes('application/pdf')) {
|
if (contentType && contentType.includes('application/pdf')) {
|
||||||
return Promise.all([response.ok, response.blob()]);
|
return Promise.all([response.ok, response.blob()]);
|
||||||
}
|
}
|
||||||
if (contentType.includes('application/json')) {
|
if (contentType && contentType.includes('application/json')) {
|
||||||
return Promise.all([response.ok, response.json()]);
|
return Promise.all([response.ok, response.json()]);
|
||||||
}
|
}
|
||||||
// it includes all text types
|
// it includes all text types
|
||||||
if (contentType.includes('text/')) {
|
if (contentType && contentType.includes('text/')) {
|
||||||
return Promise.all([response.ok, response.text()]);
|
return Promise.all([response.ok, response.text()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// unfortunatelly on download files there is no header available
|
// unfortunatelly on download files there is no header available
|
||||||
if (response.url && response.url.endsWith('.tgz') !== null) {
|
if (response.url && response.url.endsWith('.tgz') === true) {
|
||||||
return Promise.all([response.ok, response.blob()]);
|
return Promise.all([response.ok, response.blob()]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user