Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ui): localstorage compatibility issue #930

Merged
merged 9 commits into from
Jun 11, 2021
Prev Previous commit
Next Next commit
chore: set unknown as default env.RELEASE_VERSION
  • Loading branch information
shhdgit committed Jun 9, 2021
commit 857afcc08b351261d0f4555b883e4e9b6437a836
3 changes: 2 additions & 1 deletion ui/.env.development
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ REACT_APP_VERSION=$npm_package_version
REACT_APP_NAME=$npm_package_name
REACT_APP_SENTRY_DSN=https://[email protected]/5721090
REACT_APP_SENTRY_ENABLED=false
RELEASE_VERSION=DO_NOT_EDIT_its_set_in_config-overrides.js
# RELEASE_VERSION is set in config-overrides.js
RELEASE_VERSION=unknown
3 changes: 2 additions & 1 deletion ui/.env.production
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ REACT_APP_VERSION=$npm_package_version
REACT_APP_NAME=$npm_package_name
REACT_APP_SENTRY_DSN=https://[email protected]/5721090
REACT_APP_SENTRY_ENABLED=true
RELEASE_VERSION=DO_NOT_EDIT_its_set_in_config-overrides.js
# RELEASE_VERSION is set in config-overrides.js
RELEASE_VERSION=unknown
10 changes: 6 additions & 4 deletions ui/config-overrides.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,18 +125,20 @@ const getInternalVersion = () => {
// react-app-rewired does not support async override config method right now,
// subscribe: https://github.com/timarney/react-app-rewired/pull/543
const data = fs.readFileSync('../release-version').toString().split(os.EOL)
let version = ""
let version = ''
for (let i = 0; i < data.length; i++) {
const l = data[i].trim()
if (l.startsWith("#") || (l === "")) {
if (l.startsWith('#') || l === '') {
continue
}
version = l
break
}

if (version === "") {
throw new Error(`invalid release version`)
if (version === '') {
throw new Error(
`invalid release version, please check the release-version @tidb-dashboard/root`
)
}

return version
Expand Down