generated from nhcarrigan/template
feat: script to post technical breakdowns
I use this for sprint initiatives very helpful
This commit is contained in:
+10
-3
@@ -4,6 +4,7 @@
|
||||
* @author Naomi Carrigan
|
||||
*/
|
||||
import { readFile } from "node:fs/promises";
|
||||
import { join } from "node:path";
|
||||
import { S3Client, PutObjectCommand } from "@aws-sdk/client-s3";
|
||||
import { input } from "@inquirer/prompts";
|
||||
|
||||
@@ -15,16 +16,22 @@ if (accessKeyId === undefined || secretAccessKey === undefined) {
|
||||
}
|
||||
|
||||
const fileName = await input({
|
||||
message: "Enter the ABSOLUTE PATH of the file to upload, including leading slash:",
|
||||
message:
|
||||
// eslint-disable-next-line stylistic/max-len -- Big boi string.
|
||||
"Enter the name of the file to upload. Your file MUST be in the `data` directory in this repository. WITHOUT leading slash. Example: 'naomi.png' or 'img/naomi.png'",
|
||||
});
|
||||
if (fileName === "") {
|
||||
throw new Error("File name is not set");
|
||||
}
|
||||
|
||||
const file = await readFile(fileName);
|
||||
const file = await readFile(
|
||||
join(import.meta.dirname, "..", "..", "data", fileName),
|
||||
);
|
||||
|
||||
const uploadPath = await input({
|
||||
message: "Enter the PATH to upload the file to, WITHOUT leading slash:",
|
||||
message:
|
||||
// eslint-disable-next-line stylistic/max-len -- Big boi string.
|
||||
"Enter the PATH to upload the file to, WITHOUT leading slash. Example: 'img/naomi.png' or 'naomi.png':",
|
||||
});
|
||||
if (uploadPath === "") {
|
||||
throw new Error("Upload path is not set");
|
||||
|
||||
Reference in New Issue
Block a user