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

Commit

Permalink
fix: 增加 pro 构建后版本日志
Browse files Browse the repository at this point in the history
  • Loading branch information
virgoone committed Sep 23, 2021
1 parent 3fac4d3 commit 6821560
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/polyfills/index.js
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
require('./rAF')
require('./logVersion')
23 changes: 23 additions & 0 deletions src/polyfills/logVersion.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/* eslint-disable */

export function logVersion() {
// eslint-disable-next-line no-underscore-dangle
if (__DEV__) {
return
}
try {
const isChrome = /Chrome/.test(window.navigator.userAgent)
const log = window.console.log
// eslint-disable-next-line no-unused-expressions
isChrome &&
log(
'%cLark%c CLI Service',
"font-family:'SF Pro SC', helvetica; text-shadow: 3px 3px 2px rgba(128, 125, 124, 1);font-size:4em;color:#6CCE64;",
"text-transform: capitalize;font-family:'SF Pro SC', helvetica;"
)
log('App Version v%s', VERSION)
log('CLI Version: v%s', CLI_VERSION)
log('Build Time: %s', BUILD_TIME)
} catch (error) {}
}
logVersion()
5 changes: 4 additions & 1 deletion src/variables/variables.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const { getCustomConfig } = require('../utils/custom-config')
const { getProjectFilePath } = require('../utils/path')
const pkg = require('../../package.json')

if (!process.env.APP_ENV) {
process.env.APP_ENV = 'production'
Expand All @@ -26,7 +27,7 @@ try {

const customVariables = getCustomConfig().variables
const RELEASE = GIT_COMMIT_SHA.substr(0, 7)

const buildTime = new Date()
const variables = {
__DEV__,
GIT_COMMIT_SHA,
Expand All @@ -36,6 +37,8 @@ const variables = {
APP_ENV,
APP_NAME,
PUBLIC_PATH,
CLI_VERSION: pkg.version,
BUILD_TIME: `${buildTime.toLocaleDateString()} ${buildTime.toLocaleTimeString()}`,
...customVariables
}

Expand Down

0 comments on commit 6821560

Please sign in to comment.