Add source code link with git hash, plus modification dates
This commit is contained in:
parent
acad9c5944
commit
fb667871b4
|
@ -13,6 +13,7 @@
|
||||||
<div class="ol-unselectable ol-control close" style="pointer-events: auto;">
|
<div class="ol-unselectable ol-control close" style="pointer-events: auto;">
|
||||||
<button onclick="document.body.classList.toggle('nav-open')">‹</button>
|
<button onclick="document.body.classList.toggle('nav-open')">‹</button>
|
||||||
</div>
|
</div>
|
||||||
|
<div id="source"></div>
|
||||||
</aside>
|
</aside>
|
||||||
<div id="map"></div>
|
<div id="map"></div>
|
||||||
<div id="popup" class="ol-popup">
|
<div id="popup" class="ol-popup">
|
||||||
|
|
5
main.js
5
main.js
|
@ -155,3 +155,8 @@ map.on('click', function (evt) {
|
||||||
new ResizeObserver(() => map.updateSize()).observe(document.getElementById("map"));
|
new ResizeObserver(() => map.updateSize()).observe(document.getElementById("map"));
|
||||||
|
|
||||||
window.map = map;
|
window.map = map;
|
||||||
|
|
||||||
|
document.getElementById('source').innerHTML = `<a href="https://git.chandlerswift.com/chandlerswift/maps.chandlerswift.com/commit/${import.meta.env.VITE_GIT_COMMIT_HASH}">Source code</a>
|
||||||
|
<!--
|
||||||
|
${import.meta.env.VITE_FILE_DATES}
|
||||||
|
-->`;
|
||||||
|
|
|
@ -25,12 +25,20 @@ aside {
|
||||||
transition: 0.25s;
|
transition: 0.25s;
|
||||||
max-height: 100vh;
|
max-height: 100vh;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
aside > div {
|
aside > div {
|
||||||
padding: 0 0.5em;
|
padding: 0 0.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#source {
|
||||||
|
order: 1;
|
||||||
|
margin: auto;
|
||||||
|
padding: 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
.nav-open aside {
|
.nav-open aside {
|
||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,18 @@
|
||||||
export default {
|
var childProcess = require('child_process');
|
||||||
build: {
|
|
||||||
sourcemap: true,
|
export default () => {
|
||||||
target: 'es2022',
|
// https://stackoverflow.com/a/71162041/3814663
|
||||||
|
const commitDate = childProcess.execSync('git log -1 --format=%cI').toString().trimEnd();
|
||||||
|
const commitHash = childProcess.execSync('git rev-parse HEAD').toString().trimEnd();
|
||||||
|
const fileDates = childProcess.execSync(`find . -iname '*.geojson' -not -path './dist/*' | xargs ls -lh`).toString().trimEnd();
|
||||||
|
process.env.VITE_GIT_COMMIT_DATE = commitDate;
|
||||||
|
process.env.VITE_GIT_COMMIT_HASH = commitHash;
|
||||||
|
process.env.VITE_FILE_DATES = fileDates;
|
||||||
|
|
||||||
|
return {
|
||||||
|
build: {
|
||||||
|
sourcemap: true,
|
||||||
|
target: 'es2022',
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue