Use find's exec to handle paths with spaces

This commit is contained in:
Chandler Swift 2024-09-02 10:51:25 -05:00
parent 40ce1033e4
commit 5ade88be5e
Signed by: chandlerswift
GPG key ID: A851D929D52FB93F

View file

@ -4,7 +4,7 @@ export default () => {
// https://stackoverflow.com/a/71162041/3814663 // https://stackoverflow.com/a/71162041/3814663
const commitDate = childProcess.execSync('git log -1 --format=%cI').toString().trimEnd(); const commitDate = childProcess.execSync('git log -1 --format=%cI').toString().trimEnd();
const commitHash = childProcess.execSync('git rev-parse HEAD').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(); const fileDates = childProcess.execSync(`find . -iname '*.geojson' -not -path './dist/*' -exec ls -lh {} +`).toString().trimEnd();
process.env.VITE_GIT_COMMIT_DATE = commitDate; process.env.VITE_GIT_COMMIT_DATE = commitDate;
process.env.VITE_GIT_COMMIT_HASH = commitHash; process.env.VITE_GIT_COMMIT_HASH = commitHash;
process.env.VITE_FILE_DATES = fileDates; process.env.VITE_FILE_DATES = fileDates;