add version in login page

This commit is contained in:
MaysWind
2020-10-31 19:12:29 +08:00
parent 15b93ade02
commit 453e41b052
6 changed files with 40 additions and 1 deletions
+6
View File
@@ -5669,6 +5669,12 @@
"assert-plus": "^1.0.0" "assert-plus": "^1.0.0"
} }
}, },
"git-revision-webpack-plugin": {
"version": "3.0.6",
"resolved": "https://registry.npmjs.org/git-revision-webpack-plugin/-/git-revision-webpack-plugin-3.0.6.tgz",
"integrity": "sha512-vW/9dBahGbpKPcccy3xKkHgdWoH/cAPPc3lQw+3edl7b4j29JfNGVrja0a1d8ZoRe4nTN8GCPrF9aBErDnzx5Q==",
"dev": true
},
"glob": { "glob": {
"version": "7.1.6", "version": "7.1.6",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz",
+1
View File
@@ -28,6 +28,7 @@
"babel-plugin-component": "^1.1.1", "babel-plugin-component": "^1.1.1",
"eslint": "^6.7.2", "eslint": "^6.7.2",
"eslint-plugin-vue": "^6.2.2", "eslint-plugin-vue": "^6.2.2",
"git-revision-webpack-plugin": "^3.0.6",
"vue-template-compiler": "^2.6.11" "vue-template-compiler": "^2.6.11"
}, },
"eslintConfig": { "eslintConfig": {
+7
View File
@@ -0,0 +1,7 @@
export default {
getVersion: () => {
let version = process.env.VERSION || 'unknown';
let commitHash = process.env.COMMIT_HASH || 'unknown';
return `${version}-${commitHash.substr(0, Math.min(10, commitHash.length))}`;
}
};
+2
View File
@@ -12,6 +12,7 @@ import 'framework7/css/framework7.bundle.css';
import 'framework7-icons'; import 'framework7-icons';
import { getAllLanguages, getLanguage, getDefaultLanguage, getI18nOptions, getLocalizedError } from './lib/i18n.js'; import { getAllLanguages, getLanguage, getDefaultLanguage, getI18nOptions, getLocalizedError } from './lib/i18n.js';
import version from './lib/version.js';
import settings from './lib/settings.js'; import settings from './lib/settings.js';
import services from './lib/services.js'; import services from './lib/services.js';
import userstate from './lib/userstate.js'; import userstate from './lib/userstate.js';
@@ -24,6 +25,7 @@ Framework7.use(Framework7Vue);
const i18n = new VueI18n(getI18nOptions()); const i18n = new VueI18n(getI18nOptions());
Vue.prototype.$version = version.getVersion;
Vue.prototype.$settings = settings; Vue.prototype.$settings = settings;
Vue.prototype.$getDefaultLanguage = getDefaultLanguage; Vue.prototype.$getDefaultLanguage = getDefaultLanguage;
Vue.prototype.$getAllLanguages = getAllLanguages; Vue.prototype.$getAllLanguages = getAllLanguages;
+12
View File
@@ -31,6 +31,15 @@
</f7-block-footer> </f7-block-footer>
</f7-list> </f7-list>
<f7-button small popover-open=".popover-menu" :text="currentLanguageName"></f7-button> <f7-button small popover-open=".popover-menu" :text="currentLanguageName"></f7-button>
<f7-list>
<f7-block-footer>
<span>Powered by </span>
<f7-link external href="https://github.com/mayswind/lab" target="_blank">lab</f7-link>&nbsp;
<span>{{ version }}</span>
</f7-block-footer>
<f7-block-footer>
</f7-block-footer>
</f7-list>
<f7-popover class="popover-menu"> <f7-popover class="popover-menu">
<f7-list> <f7-list>
<f7-list-item <f7-list-item
@@ -98,6 +107,9 @@ export default {
}; };
}, },
computed: { computed: {
version() {
return this.$version();
},
isUserRegistrationEnabled() { isUserRegistrationEnabled() {
return this.$isUserRegistrationEnabled(); return this.$isUserRegistrationEnabled();
}, },
+12 -1
View File
@@ -1,3 +1,6 @@
const GitRevisionPlugin = require('git-revision-webpack-plugin');
const pkgFile = require('./package.json');
module.exports = { module.exports = {
pages: { pages: {
desktop: { desktop: {
@@ -42,7 +45,15 @@ module.exports = {
minChunks: 2 minChunks: 2
} }
} }
}) });
config.plugin('define').tap(definitions => {
const gitRevisionPlugin = new GitRevisionPlugin();
definitions[0]['process.env']['VERSION'] = JSON.stringify(pkgFile.version);
definitions[0]['process.env']['COMMIT_HASH'] = JSON.stringify(gitRevisionPlugin.commithash());
return definitions;
});
}, },
devServer: { devServer: {
host: '0.0.0.0', host: '0.0.0.0',