refactor(projects): 注入全局常量:PROJECT_BUILD_TIME - 构建时间
This commit is contained in:
parent
3b3baf93ee
commit
ec907f061c
@ -7,7 +7,8 @@ module.exports = {
|
||||
defineProps: 'readonly',
|
||||
defineEmits: 'readonly',
|
||||
defineExpose: 'readonly',
|
||||
withDefaults: 'readonly'
|
||||
withDefaults: 'readonly',
|
||||
PROJECT_BUILD_TIME: 'readonly'
|
||||
},
|
||||
parser: 'vue-eslint-parser',
|
||||
parserOptions: {
|
||||
|
8
build/define/index.ts
Normal file
8
build/define/index.ts
Normal file
@ -0,0 +1,8 @@
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
/** 项目构建时间 */
|
||||
const PROJECT_BUILD_TIME = JSON.stringify(dayjs().format('YYYY-MM-DD HH:mm:ss'));
|
||||
|
||||
export default {
|
||||
PROJECT_BUILD_TIME
|
||||
};
|
@ -1,4 +1,5 @@
|
||||
import viteEnv from './env';
|
||||
import plugins from './plugins';
|
||||
import define from './define';
|
||||
|
||||
export { viteEnv, plugins };
|
||||
export { viteEnv, plugins, define };
|
||||
|
2
src/typings/global.d.ts
vendored
Normal file
2
src/typings/global.d.ts
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
/** 构建时间 */
|
||||
declare const PROJECT_BUILD_TIME: string;
|
5
src/typings/makeit-captcha.d.ts
vendored
5
src/typings/makeit-captcha.d.ts
vendored
@ -1,5 +0,0 @@
|
||||
declare module 'makeit-captcha' {
|
||||
import _default from 'makeit-captcha/es/src';
|
||||
|
||||
export default _default;
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
import type { VersionInfo } from '@/interface';
|
||||
import version from './version.json';
|
||||
import packageJson from '../../../package.json';
|
||||
|
||||
interface Version {
|
||||
dependencies: {
|
||||
@ -8,6 +8,7 @@ interface Version {
|
||||
devDependencies: {
|
||||
[key: string]: string;
|
||||
};
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
interface PackageVersion {
|
||||
@ -15,7 +16,7 @@ interface PackageVersion {
|
||||
devDependencies: VersionInfo[];
|
||||
}
|
||||
|
||||
const versionWithType = version as Version;
|
||||
const versionWithType = packageJson as Version;
|
||||
|
||||
function transformVersionData(tuple: [string, string]): VersionInfo {
|
||||
const [name, version] = tuple;
|
||||
|
@ -6,7 +6,7 @@
|
||||
<n-tag type="primary">1.0.0</n-tag>
|
||||
</n-descriptions-item>
|
||||
<n-descriptions-item label="最后编译时间">
|
||||
<n-tag type="primary">2021-11-05</n-tag>
|
||||
<n-tag type="primary">{{ lastestBuildTime }}</n-tag>
|
||||
</n-descriptions-item>
|
||||
<n-descriptions-item label="Github地址">
|
||||
<a class="g_text-primary" href="https://github.com/honghuangdc/soybean-admin" target="_blank">Github地址</a>
|
||||
@ -20,5 +20,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { NDescriptions, NDescriptionsItem, NTag } from 'naive-ui';
|
||||
|
||||
const lastestBuildTime = PROJECT_BUILD_TIME;
|
||||
</script>
|
||||
<style scoped></style>
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { defineConfig } from 'vite';
|
||||
import path from 'path';
|
||||
import { viteEnv, plugins } from './build';
|
||||
import { viteEnv, plugins, define } from './build';
|
||||
|
||||
export default defineConfig({
|
||||
base: viteEnv.VITE_BASE_URL,
|
||||
@ -9,6 +9,7 @@ export default defineConfig({
|
||||
'@': path.resolve(__dirname, './src')
|
||||
}
|
||||
},
|
||||
define,
|
||||
css: {
|
||||
preprocessorOptions: {
|
||||
scss: {
|
||||
|
Loading…
Reference in New Issue
Block a user