Skip to content
This repository was archived by the owner on Nov 8, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
23 changes: 19 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,24 @@ jobs:
- name: (Frontend) Build Project
working-directory: ./frontend_server
run: npm run build.ci
- name: (Frontend) Check Bundle Size
- name: check /etc/hosts
working-directory: ./frontend_server
run: BUNDLEWATCH_GITHUB_TOKEN=${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }} npm run size.check
- name: (Frontend) Run e2e Tests
run: echo "#>>>>#"; cat /etc/hosts; pwd; echo "#>>>>#"
# - name: (Frontend) Check Bundle Size
# working-directory: ./frontend_server
# run: BUNDLEWATCH_GITHUB_TOKEN=${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }} npm run size.check
# - name: (Frontend) Run e2e Tests
# working-directory: ./frontend_server
# run: npm run test:ci
cypress-run:
name: run cypress
runs-on: ubuntu-latest
steps:
- name: Cypress run
working-directory: ./frontend_server
run: npm run test:ci
uses: cypress-io/github-action@v2
with:
browser: chrome
# build: npm run build
start: npm run ci
wait-on: http://localhost:3000
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"dev": "cross-env NODE_ENV=dev node server.js",
"prod": "cross-env NODE_ENV=production run-p server",
"local": "cross-env NODE_ENV=local node server",
"ci": "cross-env NODE_ENV=ci node server --inspect",
"ci": "cross-env NODE_ENV=ci node server",
"server": "npm run clean && node server.js",
"build": "next build",
"build:clean": "run-s dist clean",
Expand Down Expand Up @@ -149,7 +149,7 @@
"bundlewatch": "^0.2.7",
"commitizen": "3.1.2",
"coveralls": "3.0.14",
"cypress": "4.2.0",
"cypress": "^8.1.0",
"cz-conventional-changelog": "^3.0.0",
"enzyme": "3.11.0",
"enzyme-adapter-react-16": "1.15.2",
Expand Down
3 changes: 2 additions & 1 deletion src/components/FormItem/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import React from 'react'
import T from 'prop-types'
import { isEmpty } from 'ramda'

import { buildLog, hasValue } from '@/utils'
import { buildLog } from '@/utils/logger'
import { hasValue } from '@/utils/validator'
import { SIZE } from '@/constant'
import Maybe from '@/components/Maybe'

Expand Down
2 changes: 1 addition & 1 deletion src/components/Modal/Belt.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'

import { useScript } from '@/hooks'
import useScript from '@/hooks/useScript'

import { Wrapper, Holder } from './styles/belt'

Expand Down
2 changes: 1 addition & 1 deletion src/components/Modal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import usePortal from 'react-useportal'
import { ICON_CMD } from '@/config'
import { toggleGlobalBlur } from '@/utils/dom'
import { buildLog } from '@/utils/logger'
import { useShortcut } from '@/hooks'
import useShortcut from '@/hooks/useShortcut'

import ViewportTracker from '@/components/ViewportTracker'
import Belt from './Belt'
Expand Down
12 changes: 5 additions & 7 deletions src/components/NaviCatalog/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@ import { FC, useState, useCallback, useEffect, memo } from 'react'
import { find, findIndex, propEq, last } from 'ramda'

import { URL_QUERY } from '@/constant'
import {
buildLog,
nilOrEmpty,
getQueryFromUrl,
markRoute,
findDeepMatch,
} from '@/utils'

import { findDeepMatch } from '@/utils/helper'
import { buildLog } from '@/utils/logger'
import { nilOrEmpty } from '@/utils/validator'
import { getQueryFromUrl, markRoute } from '@/utils/route'

import type { TMenuItem, TMenuMode } from './spec'
import { ROOT_MENU, CHILD_MENU } from './constant'
Expand Down
3 changes: 2 additions & 1 deletion src/components/PostItem/ListView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import TimeAgo from 'timeago-react'

import type { TPost } from '@/spec'
import { ICON_CMD } from '@/config'
import { cutRest, parseDomain } from '@/utils'
import { cutRest } from '@/utils/helper'
import { parseDomain } from '@/utils/route'

import InlineTags from '@/components/InlineTags'

Expand Down
8 changes: 6 additions & 2 deletions src/components/Switcher/Tabs/TabIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { FC, useCallback } from 'react'
import { FC, useCallback } from 'react'
import dynamic from 'next/dynamic'

import type { TTabItem } from '@/spec'
import LocalIcon from './LocalIcon'
import { Wrapper, Icon } from '../styles/tabs/tab_icon'

type TProps = {
Expand All @@ -12,6 +12,10 @@ type TProps = {
active: boolean
}

export const LocalIcon = dynamic(() => import('./LocalIcon'), {
ssr: false,
})

const TabIcon: FC<TProps> = ({ item, clickableRef, active }) => {
const { localIcon, icon } = item

Expand Down
4 changes: 3 additions & 1 deletion src/components/Switcher/Tabs/TabItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
import { FC, useEffect, useCallback, useRef, memo } from 'react'

import type { TSIZE_SM, TTabItem } from '@/spec'
import { buildLog, isString, Trans } from '@/utils'
import { Trans } from '@/utils/i18n'
import { isString } from '@/utils/validator'
import { buildLog } from '@/utils/logger'

import TabIcon from './TabIcon'
import {
Expand Down
3 changes: 2 additions & 1 deletion src/components/ThemeSelector/styles/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import styled from 'styled-components'

import type { TActive, TThemeName } from '@/spec'
import { theme, themeCoverMap, themeCoverIndexMap, css } from '@/utils'
import { theme, themeCoverMap, themeCoverIndexMap } from '@/utils/themes'
import css from '@/utils/css'

type TDot = TActive & { name: TThemeName }
export const Dot = styled.div<TDot>`
Expand Down
9 changes: 7 additions & 2 deletions src/components/Tooltip/RealTooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@ import { FC, ReactNode, useState, useRef, memo } from 'react'
import { hideAll } from 'tippy.js'

import type { TTooltipPlacement } from '@/spec'
import { css, buildLog, isDescendant, isString } from '@/utils'
import { useOutsideClick } from '@/hooks'

import css from '@/utils/css'
import { buildLog } from '@/utils/logger'
import { isString } from '@/utils/validator'
import { isDescendant } from '@/utils/dom'

import useOutsideClick from '@/hooks/useOutsideClick'

import ConfirmFooter from './ConfirmFooter'
import { FOOTER_BEHAVIOR } from './constant'
Expand Down
2 changes: 1 addition & 1 deletion src/components/UserBrief/NumbersPad.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'

import { prettyNum } from '@/utils'
import { prettyNum } from '@/utils/helper'
import { Wrapper, Section, Title, Number } from './styles/numbers_pad'

const NumbersPad = ({ user, listFollowers, listFollowings }) => (
Expand Down
3 changes: 2 additions & 1 deletion src/components/UserBrief/SocialIcons.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import React from 'react'
import { contains } from 'ramda'

import { ICON_CMD } from '@/config'
import { nilOrEmpty, SOCIAL_LISTS } from '@/utils'
import SOCIAL_LISTS from '@/utils/social'
import { nilOrEmpty } from '@/utils/validator'

import Tooltip from '@/components/Tooltip'
import { Wrapper, Linker, SocialIcon } from './styles/social_icons'
Expand Down
2 changes: 1 addition & 1 deletion src/containers/Route/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import React from 'react'
import { useRouter } from 'next/router'

import { pluggedIn } from '@/utils'
import { pluggedIn } from '@/utils/mobx'
import { useInit } from './logic'

const RouteContainer = ({ route }) => {
Expand Down
5 changes: 4 additions & 1 deletion src/containers/Route/logic.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { useEffect } from 'react'
import { Global, buildLog, parseURL } from '@/utils'

import { parseURL } from '@/utils/route'
import { Global } from '@/utils/helper'
import { buildLog } from '@/utils/logger'

/* eslint-disable-next-line */
const log = buildLog('L:Route')
Expand Down
5 changes: 4 additions & 1 deletion src/containers/content/ArticleContent/logic.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { useEffect } from 'react'

import { EVENT, ERR } from '@/constant'
import { asyncSuit, buildLog, errRescue, isElementInViewport } from '@/utils'
import { isElementInViewport } from '@/utils/dom'
import { errRescue } from '@/utils/helper'
import { buildLog } from '@/utils/logger'
import asyncSuit from '@/utils/async'

import type { TStore } from './store'
import S from './schema'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import styled from 'styled-components'

import type { TTestable, TMetric } from '@/spec'
import { theme, css, WIDTH } from '@/utils'
import css from '@/utils/css'
import { theme } from '@/utils/themes'
import { WIDTH } from '@/utils/css/metric'

export const Wrapper = styled.article.attrs(({ testid }: TTestable) => ({
'data-test-id': testid,
Expand Down
6 changes: 5 additions & 1 deletion src/containers/content/CommunityContent/logic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import { values, includes } from 'ramda'

import type { TThread } from '@/spec'
import { ERR, EVENT, ARTICLE_THREAD } from '@/constant'
import { send, asyncSuit, buildLog, errRescue, thread2Subpath } from '@/utils'

import { send, errRescue } from '@/utils/helper'
import { thread2Subpath } from '@/utils/route'
import asyncSuit from '@/utils/async'
import { buildLog } from '@/utils/logger'

import type { TStore } from './store'

Expand Down
2 changes: 1 addition & 1 deletion src/containers/content/CoolGuideContent/FilterBar.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { FC, Fragment, memo } from 'react'

import { ICON_CMD } from '@/config'
import { mockNaviCatalogMenu } from '@/utils'
import { mockNaviCatalogMenu } from '@/utils/mock'

import Sticky from '@/components/Sticky'
import NaviIntro from '@/components/NaviIntro'
Expand Down
4 changes: 3 additions & 1 deletion src/containers/content/CoolGuideContent/logic.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { useEffect } from 'react'

import { ERR } from '@/constant'
import { asyncSuit, buildLog, errRescue } from '@/utils'
import { errRescue } from '@/utils/helper'
import asyncSuit from '@/utils/async'
import { buildLog } from '@/utils/logger'

import type { TStore } from './store'

Expand Down
2 changes: 1 addition & 1 deletion src/containers/content/DiscoveryContent/CommunityCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react'
import { contains } from 'ramda'

import { NON_FILL_COMMUNITY } from '@/constant'
import { prettyNum, cutRest } from '@/utils'
import { prettyNum, cutRest } from '@/utils/helper'

import TrendLine from '@/components/TrendLine'
import { CommunityHolder } from '@/components/Loading'
Expand Down
13 changes: 6 additions & 7 deletions src/containers/content/DiscoveryContent/logic.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ import { useEffect } from 'react'
import { isEmpty } from 'ramda'

import { EVENT, ERR } from '@/constant'
import {
asyncSuit,
buildLog,
pagedFilter,
errRescue,
updateEditing,
} from '@/utils'

import { errRescue } from '@/utils/helper'
import { pagedFilter } from '@/utils/graphql'
import asyncSuit from '@/utils/async'
import { buildLog } from '@/utils/logger'
import { updateEditing } from '@/utils/mobx'

import S from './schema'

Expand Down
7 changes: 5 additions & 2 deletions src/containers/content/HaveADrinkContent/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ import { FC } from 'react'
import dynamic from 'next/dynamic'

import type { TMetric } from '@/spec'
import { pluggedIn, buildLog, scrollToTop, lockPage, unlockPage } from '@/utils'
import { useShortcut } from '@/hooks'
import { scrollToTop, lockPage, unlockPage } from '@/utils/dom'
import { buildLog } from '@/utils/logger'
import { pluggedIn } from '@/utils/mobx'

import useShortcut from '@/hooks/useShortcut'

import type { TStore } from './store'
import Header from './Header'
Expand Down
5 changes: 4 additions & 1 deletion src/containers/content/HaveADrinkContent/logic.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { useEffect } from 'react'

import { ERR } from '@/constant'
import { asyncSuit, buildLog, errRescue } from '@/utils'

import { errRescue } from '@/utils/helper'
import asyncSuit from '@/utils/async'
import { buildLog } from '@/utils/logger'

import { ANIMATE_TIMER_CLASS } from './constant'
import type { TStore } from './store'
Expand Down
5 changes: 4 additions & 1 deletion src/containers/content/MeetupsContent/logic.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { useEffect } from 'react'

import { ERR } from '@/constant'
import { asyncSuit, buildLog, errRescue } from '@/utils'

import { errRescue } from '@/utils/helper'
import asyncSuit from '@/utils/async'
import { buildLog } from '@/utils/logger'

import type { TStore } from './store'

Expand Down
3 changes: 2 additions & 1 deletion src/containers/content/MembershipContent/logic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { useEffect } from 'react'

import { SENIOR_AMOUNT_THRESHOLD } from '@/config'
import { PAYMENT_USAGE } from '@/constant'
import { asyncSuit, buildLog } from '@/utils'
import asyncSuit from '@/utils/async'
import { buildLog } from '@/utils/logger'

import type { TStore } from './store'
import type { TPackage } from './spec'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import styled, { css as styledCss } from 'styled-components'

import type { TActive } from '@/spec'
import { animate, css } from '@/utils'
import css from '@/utils/css'
import animate from '@/utils/animations'
import Img from '@/Img'

export const Wrapper = styled.div<TActive>`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import styled, { css as styledCss } from 'styled-components'

import type { TTestable, TActive } from '@/spec'
import { animate, css } from '@/utils'
import css from '@/utils/css'
import animate from '@/utils/animations'

import {
Star1 as Star1Base,
Expand Down
2 changes: 1 addition & 1 deletion src/containers/content/RecipesContent/tempData.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ICON_BASE } from '@/config'
import { uid } from '@/utils'
import uid from '@/utils/uid'

const menu = [
{
Expand Down
2 changes: 1 addition & 1 deletion src/containers/content/SubscribeContent/Actions/Detail.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react'

import { ICON_CMD } from '@/config'

import { useCopyToClipboard } from '@/hooks'
import useCopyToClipboard from 'react-use/lib/useCopyToClipboard'
import EmailSubscriber from '@/components/EmailSubscriber'
import { Br, SpaceGrow } from '@/components/Common'
// TODO: extract to Email Subscriber
Expand Down
5 changes: 4 additions & 1 deletion src/containers/content/SubscribeContent/styles/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import styled from 'styled-components'

import type { TTestable } from '@/spec'
import { css, theme, WIDTH } from '@/utils'
import Sticky from '@/components/Sticky'

import { theme } from '@/utils/themes'
import css from '@/utils/css'
import { WIDTH } from '@/utils/css/metric'

export const Wrapper = styled.div.attrs(({ testid }: TTestable) => ({
'data-test-id': testid,
}))<TTestable>`
Expand Down
5 changes: 4 additions & 1 deletion src/containers/content/UserContent/logic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ import { useEffect } from 'react'

import type { TID, TThread, TUser } from '@/spec'
import { TYPE, EVENT, ERR } from '@/constant'
import { asyncSuit, buildLog, send, errRescue } from '@/utils'

import asyncSuit from '@/utils/async'
import { send, errRescue } from '@/utils/helper'
import { buildLog } from '@/utils/logger'

import type { TStore } from './store'

Expand Down
Loading