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.

Commit3e4dd71

Browse files
authored
chore(build): sync version in package json (#1376)
* feat: sync appVserion from pakcage.json* feat: sync appVserion from pakcage.json* chore: remove old version in config
1 parent9234c54 commit3e4dd71

File tree

13 files changed

+44
-16
lines changed

13 files changed

+44
-16
lines changed

‎.eslintignore‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ tsconfig.tsbuildinfo
1717
*.tar.gz
1818
*.xml
1919
public/*
20-
Makefile
20+
Makefile
21+
config/version.ts

‎config/config.json‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@
5959
"//--- contact configs ---//":"",
6060
"EMAIL_SUPPORT":"coderplanets@outlook.com",
6161
"// GRAPHQL_ENDPOINT":"https://api.coderplanets.com/graphiql",
62-
"BUILD_VERSION":"v2.1.13",
6362
"// 1000 * 60 * 10 = 10 mins":"",
6463
"SSR_CACHE_TIME":60000
6564
}

‎config/index.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ export { default as SEO } from './next_seo'
77

88
exportconstDEFAULT_THEME=CONFIG.DEFAULT_THEMEasTThemeName
99

10+
export{APP_VERSION}from'./version'
11+
1012
exportconstSITE_LOGO=
1113
'https://assets.coderplanets.com/icons/static/new-logo.jpg'
1214

@@ -33,5 +35,4 @@ export const {
3335
ISSUE_ADDR,
3436
MENTION_USER_ADDR,
3537
EMAIL_SUPPORT,
36-
BUILD_VERSION,
3738
}=CONFIG

‎config/version.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
exportconstAPP_VERSION='1.0.91'

‎global.d.ts‎

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
1+
/* eslint-disable @typescript-eslint/no-explicit-any */
12
importtype{IziToast}from'iziToast'
23

4+
interfaceIWindowextendsWindow{
5+
iziToast?:IziToast
6+
appVersion?:string
7+
/**
8+
* used for check platform hook
9+
*/
10+
chrome?:any
11+
safari?:any
12+
StyleMedia?:any
13+
HTMLElement?:any
14+
}
15+
316
declare global{
4-
interfaceIWindowextendsWindow{
5-
iziToast:IziToast
6-
}
17+
typeTWindow=IWindow|null
718
}

‎package.json‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
{
22
"name":"coderplanets_web",
3-
"version":"1.0.8",
3+
"version":"1.0.10",
44
"license":"Apache License 2.0",
55
"scripts": {
66
"dev":"cross-env NODE_ENV=dev next dev",
77
"dev.boost":"next-boost",
88
"ci":"cross-env NODE_ENV=ci node server",
9+
"prebuild":"node -p\"'export const APP_VERSION = ' + JSON.stringify(require('./package.json').version)\" > config/version.ts",
10+
"prebuild.ci":"npm run prebuild",
11+
"prebuild.dev":"npm run prebuild",
12+
"prebuild.prod":"npm run prebuild",
913
"build":"next build",
1014
"build:clean":"run-s dist clean",
1115
"build.prod":"cross-env NODE_ENV=production next build",

‎src/containers/layout/GlobalLayout/logic.ts‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ import {
77
}from'react'
88

99
importtype{TScrollDirection}from'@/spec'
10+
import{APP_VERSION}from'@/config'
1011
import{buildLog}from'@/utils/logger'
12+
import{Global}from'@/utils/helper'
1113

1214
importtype{TStore}from'./store'
1315

@@ -73,6 +75,14 @@ export const childrenWithProps = (
7375
})
7476
}
7577

78+
/**
79+
* set appVersion to window from package.json
80+
*@link https://stackoverflow.com/a/67701490/4050784
81+
*/
82+
constinitAppVersion=():void=>{
83+
Global.appVersion=APP_VERSION||'unknow'
84+
}
85+
7686
// ###############################
7787
// init & uninit
7888
// ###############################
@@ -82,5 +92,6 @@ export const useInit = (_store: TStore, extra): void => {
8292

8393
const{ online, isMobile}=extra
8494
store.mark({ online, isMobile})
95+
initAppVersion()
8596
},[_store,extra])
8697
}

‎src/containers/unit/Footer/DesktopView/HomeLayout.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { FC, memo } from 'react'
22
import{useTheme}from'styled-components'
33

44
importtype{TThemeMap,TMetric,TOnlineStatus}from'@/spec'
5-
import{GITHUB,ABOUT_LINK,BUILD_VERSION}from'@/config'
5+
import{GITHUB,ABOUT_LINK,APP_VERSION}from'@/config'
66
import{ROUTE}from'@/constant'
77
import{siteBirthDay}from'@/utils/helper'
88

@@ -109,7 +109,7 @@ const HomeView: FC<TProps> = ({ metric, onlineStatus }) => {
109109
<Title>网站状态</Title>
110110
<Body>
111111
<Itemas="span"normal>
112-
版本:{BUILD_VERSION}
112+
版本:{APP_VERSION}
113113
</Item>
114114
<Itemas="span"normal>
115115
年龄:{siteBirthDay('2019/02/01')}

‎src/containers/unit/Footer/MobileView/index.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { FC } from 'react'
33
importLinkfrom'next/link'
44

55
importtype{TMetric}from'@/spec'
6-
import{ICON,GITHUB,BUILD_VERSION,ABOUT_LINK}from'@/config'
6+
import{ICON,GITHUB,APP_VERSION,ABOUT_LINK}from'@/config'
77
import{bond}from'@/utils/mobx'
88
import{ROUTE}from'@/constant'
99

@@ -56,7 +56,7 @@ const FooterContainer: FC<TProps> = ({ footer: store, metric }) => {
5656
</Link>
5757
</SiteInfoWrapper>
5858
<VersionWrapper>
59-
<Item>{BUILD_VERSION}</Item>
59+
<Item>{APP_VERSION}</Item>
6060
</VersionWrapper>
6161
</Wrapper>
6262
)

‎src/containers/unit/Footer/logic.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export const handleLogout = (): void => {
5858
store.logout()
5959

6060
setTimeout(()=>{
61-
Global.location.reload(false)
61+
Global.location.reload()
6262
},1000)
6363
}
6464

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp