Defining vite env vars with git info
This commit is contained in:
parent
da76e30fc4
commit
7997138c5e
|
@ -157,6 +157,7 @@ const Map: Component = () => {
|
||||||
params: {
|
params: {
|
||||||
...params,
|
...params,
|
||||||
},
|
},
|
||||||
|
lastCommit: import.meta.env.VITE_GIT_COMMIT_HASH,
|
||||||
});
|
});
|
||||||
setState({
|
setState({
|
||||||
provider: params.provider,
|
provider: params.provider,
|
||||||
|
@ -290,7 +291,7 @@ const Map: Component = () => {
|
||||||
moveTolerance: 10,
|
moveTolerance: 10,
|
||||||
interactions: new Collection<Interaction>([
|
interactions: new Collection<Interaction>([
|
||||||
new DragRotate(),
|
new DragRotate(),
|
||||||
// new DoubleClickZoom(),
|
// new DoubleClickZoom(),
|
||||||
new DragPan(),
|
new DragPan(),
|
||||||
new PinchRotate(),
|
new PinchRotate(),
|
||||||
new PinchZoom(),
|
new PinchZoom(),
|
||||||
|
|
|
@ -5,6 +5,7 @@ import { defineConfig } from 'vite';
|
||||||
import solidPlugin from 'vite-plugin-solid';
|
import solidPlugin from 'vite-plugin-solid';
|
||||||
import suidPlugin from '@suid/vite-plugin';
|
import suidPlugin from '@suid/vite-plugin';
|
||||||
import solidSvg from 'vite-plugin-solid-svg';
|
import solidSvg from 'vite-plugin-solid-svg';
|
||||||
|
import { execSync } from 'child_process';
|
||||||
|
|
||||||
// yarn add --dev @esbuild-plugins/node-globals-polyfill
|
// yarn add --dev @esbuild-plugins/node-globals-polyfill
|
||||||
import { NodeGlobalsPolyfillPlugin } from '@esbuild-plugins/node-globals-polyfill';
|
import { NodeGlobalsPolyfillPlugin } from '@esbuild-plugins/node-globals-polyfill';
|
||||||
|
@ -13,7 +14,21 @@ import { NodeModulesPolyfillPlugin } from '@esbuild-plugins/node-modules-polyfil
|
||||||
// You don't need to add this to deps, it's included by @esbuild-plugins/node-modules-polyfill
|
// You don't need to add this to deps, it's included by @esbuild-plugins/node-modules-polyfill
|
||||||
import rollupNodePolyFill from 'rollup-plugin-node-polyfills';
|
import rollupNodePolyFill from 'rollup-plugin-node-polyfills';
|
||||||
|
|
||||||
export default defineConfig(({ command, mode, ssrBuild }) => ({
|
export default defineConfig(({ command, mode, ssrBuild }) => {
|
||||||
|
const commitDate = execSync('git log -1 --format=%cI').toString().trimEnd();
|
||||||
|
const branchName = execSync('git rev-parse --abbrev-ref HEAD')
|
||||||
|
.toString()
|
||||||
|
.trimEnd();
|
||||||
|
const commitHash = execSync('git rev-parse HEAD').toString().trimEnd();
|
||||||
|
const lastCommitMessage = execSync('git show -s --format=%s')
|
||||||
|
.toString()
|
||||||
|
.trimEnd();
|
||||||
|
|
||||||
|
process.env.VITE_GIT_COMMIT_DATE = commitDate;
|
||||||
|
process.env.VITE_GIT_BRANCH_NAME = branchName;
|
||||||
|
process.env.VITE_GIT_COMMIT_HASH = commitHash;
|
||||||
|
process.env.VITE_GIT_LAST_COMMIT_MESSAGE = lastCommitMessage;
|
||||||
|
return {
|
||||||
plugins: [
|
plugins: [
|
||||||
suidPlugin(),
|
suidPlugin(),
|
||||||
solidPlugin(),
|
solidPlugin(),
|
||||||
|
@ -94,4 +109,5 @@ export default defineConfig(({ command, mode, ssrBuild }) => ({
|
||||||
global: {},
|
global: {},
|
||||||
}
|
}
|
||||||
: {},
|
: {},
|
||||||
}));
|
};
|
||||||
|
});
|
||||||
|
|
Loading…
Reference in New Issue