add docs and a cli flag for testing adm-zip dependency updates (#4949)

* add docs and a cli flag for testing adm-zip dependency updates

Co-authored-by: Vincent <Vinnl@users.noreply.github.com>
This commit is contained in:
Robert Helmer 2024-08-19 06:45:33 -07:00 коммит произвёл GitHub
Родитель a4a5c5bdd0
Коммит c5512aaa93
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
2 изменённых файлов: 15 добавлений и 2 удалений

Просмотреть файл

@ -284,5 +284,13 @@ Monitor provides a tool for sending test email at the endpoint `/admin/emails`.
### `adm-zip`
This is used as part of downloading and unzipping location data for the auto-complete address feature.
Normally this is run by cron and uploads to an S3 bucket, the upload step can be skipped with:
```sh
npm run create-location-data -- --skip-upload
```
TODO: Describe how to verify that uploading auto-complete locations still works
as expected.

Просмотреть файл

@ -22,7 +22,6 @@ import {
rmSync,
writeFileSync,
} from "fs";
import { uploadToS3 } from "../../utils/s3.js";
import Sentry from "@sentry/nextjs";
import os from "os";
import path from "path";
@ -325,7 +324,13 @@ try {
writeFileSync(LOCATIONS_DATA_FILE, JSON.stringify(locationDataFinal));
let readStream = fs.createReadStream(LOCATIONS_DATA_FILE);
await uploadToS3(`autocomplete/${LOCATIONS_DATA_FILE}`, readStream);
if (process.argv.includes("--skip-upload")) {
console.debug("Skipping S3 upload");
} else {
const uploadToS3 = await import("../s3.js");
await uploadToS3(`autocomplete/${LOCATIONS_DATA_FILE}`, readStream);
}
if (CLEANUP_TMP_DATA_AFTER_FINISHED) {
console.info("Cleaning up data directory");