Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

chore(build): sync version in package json#1376

Merged
mydearxym merged 3 commits intodevfromsync-version-in-package-json
Sep 11, 2022
Merged
Show file tree
Hide file tree
Changes fromall 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
3 changes: 2 additions & 1 deletion.eslintignore
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -17,4 +17,5 @@ tsconfig.tsbuildinfo
*.tar.gz
*.xml
public/*
Makefile
Makefile
config/version.ts
1 change: 0 additions & 1 deletionconfig/config.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -59,7 +59,6 @@
"//--- contact configs ---//": "",
"EMAIL_SUPPORT": "coderplanets@outlook.com",
"// GRAPHQL_ENDPOINT": "https://api.coderplanets.com/graphiql",
"BUILD_VERSION": "v2.1.13",
"// 1000 * 60 * 10 = 10 mins": "",
"SSR_CACHE_TIME": 60000
}
3 changes: 2 additions & 1 deletionconfig/index.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,6 +7,8 @@ export { default as SEO } from './next_seo'

export const DEFAULT_THEME = CONFIG.DEFAULT_THEME as TThemeName

export { APP_VERSION } from './version'

export const SITE_LOGO =
'https://assets.coderplanets.com/icons/static/new-logo.jpg'

Expand All@@ -33,5 +35,4 @@ export const {
ISSUE_ADDR,
MENTION_USER_ADDR,
EMAIL_SUPPORT,
BUILD_VERSION,
} = CONFIG
1 change: 1 addition & 0 deletionsconfig/version.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
export const APP_VERSION = '1.0.91'
17 changes: 14 additions & 3 deletionsglobal.d.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import type { IziToast } from 'iziToast'

interface IWindow extends Window {
iziToast?: IziToast
appVersion?: string
/**
* used for check platform hook
*/
chrome?: any
safari?: any
StyleMedia?: any
HTMLElement?: any
}

declare global {
interface IWindow extends Window {
iziToast: IziToast
}
type TWindow = IWindow | null
}
6 changes: 5 additions & 1 deletionpackage.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
{
"name": "coderplanets_web",
"version": "1.0.8",
"version": "1.0.10",
"license": "Apache License 2.0",
"scripts": {
"dev": "cross-env NODE_ENV=dev next dev",
"dev.boost": "next-boost",
"ci": "cross-env NODE_ENV=ci node server",
"prebuild": "node -p \"'export const APP_VERSION = ' + JSON.stringify(require('./package.json').version)\" > config/version.ts",
"prebuild.ci": "npm run prebuild",
"prebuild.dev": "npm run prebuild",
"prebuild.prod": "npm run prebuild",
"build": "next build",
"build:clean": "run-s dist clean",
"build.prod": "cross-env NODE_ENV=production next build",
Expand Down
11 changes: 11 additions & 0 deletionssrc/containers/layout/GlobalLayout/logic.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,7 +7,9 @@ import {
} from 'react'

import type { TScrollDirection } from '@/spec'
import { APP_VERSION } from '@/config'
import { buildLog } from '@/utils/logger'
import { Global } from '@/utils/helper'

import type { TStore } from './store'

Expand DownExpand Up@@ -73,6 +75,14 @@ export const childrenWithProps = (
})
}

/**
* set appVersion to window from package.json
* @link https://stackoverflow.com/a/67701490/4050784
*/
const initAppVersion = (): void => {
Global.appVersion = APP_VERSION || 'unknow'
}

// ###############################
// init & uninit
// ###############################
Expand All@@ -82,5 +92,6 @@ export const useInit = (_store: TStore, extra): void => {

const { online, isMobile } = extra
store.mark({ online, isMobile })
initAppVersion()
}, [_store, extra])
}
4 changes: 2 additions & 2 deletionssrc/containers/unit/Footer/DesktopView/HomeLayout.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,7 +2,7 @@ import { FC, memo } from 'react'
import { useTheme } from 'styled-components'

import type { TThemeMap, TMetric, TOnlineStatus } from '@/spec'
import { GITHUB, ABOUT_LINK,BUILD_VERSION } from '@/config'
import { GITHUB, ABOUT_LINK,APP_VERSION } from '@/config'
import { ROUTE } from '@/constant'
import { siteBirthDay } from '@/utils/helper'

Expand DownExpand Up@@ -109,7 +109,7 @@ const HomeView: FC<TProps> = ({ metric, onlineStatus }) => {
<Title>网站状态</Title>
<Body>
<Item as="span" normal>
版本: {BUILD_VERSION}
版本: {APP_VERSION}
</Item>
<Item as="span" normal>
年龄: {siteBirthDay('2019/02/01')}
Expand Down
4 changes: 2 additions & 2 deletionssrc/containers/unit/Footer/MobileView/index.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,7 +3,7 @@ import { FC } from 'react'
import Link from 'next/link'

import type { TMetric } from '@/spec'
import { ICON, GITHUB,BUILD_VERSION, ABOUT_LINK } from '@/config'
import { ICON, GITHUB,APP_VERSION, ABOUT_LINK } from '@/config'
import { bond } from '@/utils/mobx'
import { ROUTE } from '@/constant'

Expand DownExpand Up@@ -56,7 +56,7 @@ const FooterContainer: FC<TProps> = ({ footer: store, metric }) => {
</Link>
</SiteInfoWrapper>
<VersionWrapper>
<Item>{BUILD_VERSION}</Item>
<Item>{APP_VERSION}</Item>
</VersionWrapper>
</Wrapper>
)
Expand Down
2 changes: 1 addition & 1 deletionsrc/containers/unit/Footer/logic.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -58,7 +58,7 @@ export const handleLogout = (): void => {
store.logout()

setTimeout(() => {
Global.location.reload(false)
Global.location.reload()
}, 1000)
}

Expand Down
2 changes: 1 addition & 1 deletionsrc/containers/unit/Header/logic.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -47,7 +47,7 @@ export const onLogout = (): void => {
store.logout()

setTimeout(() => {
Global.location.reload(false)
Global.location.reload()
}, 2000)
}

Expand Down
2 changes: 1 addition & 1 deletionutils/helper.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -61,7 +61,7 @@ type TSORTABLE_ITEMS = {
logo?: string
}[]

export const Global:any = typeof window !== 'undefined' ? window :{}
export const Global:TWindow = typeof window !== 'undefined' ? window :null

// see https://github.com/ramda/ramda/issues/1361
export const mapKeys = curry((fn, obj) => {
Expand Down
4 changes: 2 additions & 2 deletionsutils/toast.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,13 +12,13 @@ import { nilOrEmpty } from './validator'

type TToastType = 'success' | 'error' | 'warn'

const checkValid = () => (Global asIWindow).iziToast || false
const checkValid = () => (Global asTWindow).iziToast || false

const doNotify = (options = {}): void => {
if (!checkValid()) {
return
}
const { iziToast } = Global asIWindow
const { iziToast } = Global asTWindow
iziToast.show(merge(DEFAULT_TOAST_OPTIONS, reject(nilOrEmpty, options)))
}

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp