mirror of
https://github.com/cheeaun/phanpy.git
synced 2024-11-21 16:55:25 +03:00
Test add last build time and commit hash
This commit is contained in:
parent
45b7d42d38
commit
56cab34a9c
2 changed files with 25 additions and 0 deletions
|
@ -186,6 +186,24 @@ export default ({ onClose }) => {
|
|||
</a>
|
||||
.
|
||||
</p>
|
||||
{__BUILD_TIME__ && (
|
||||
<p>
|
||||
Last build:{' '}
|
||||
<relative-time datetime={new Date(__BUILD_TIME__).toISOString()} />{' '}
|
||||
{__COMMIT_HASH__ && (
|
||||
<>
|
||||
(
|
||||
<a
|
||||
href={`https://github.com/cheeaun/phanpy/commit/${__COMMIT_HASH__}`}
|
||||
target="_blank"
|
||||
>
|
||||
<code>{__COMMIT_HASH__}</code>
|
||||
</a>
|
||||
)
|
||||
</>
|
||||
)}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -1,9 +1,16 @@
|
|||
import preact from '@preact/preset-vite';
|
||||
import { execSync } from 'child_process';
|
||||
import { resolve } from 'path';
|
||||
import { defineConfig, splitVendorChunkPlugin } from 'vite';
|
||||
|
||||
const commitHash = execSync('git rev-parse --short HEAD').toString().trim();
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
define: {
|
||||
__BUILD_TIME__: JSON.stringify(Date.now()),
|
||||
__COMMIT_HASH__: JSON.stringify(commitHash),
|
||||
},
|
||||
plugins: [preact(), splitVendorChunkPlugin()],
|
||||
build: {
|
||||
sourcemap: true,
|
||||
|
|
Loading…
Reference in a new issue